Skip to content
This repository has been archived by the owner on Dec 19, 2021. It is now read-only.

Update LandroidS.ts #58

Merged
merged 1 commit into from
May 21, 2019
Merged

Update LandroidS.ts #58

merged 1 commit into from
May 21, 2019

Conversation

lukicsl
Copy link
Contributor

@lukicsl lukicsl commented May 11, 2019

mosquitto_pub -h vevedock -t 'landroid/set/mow' -m "stop"
is generation and error:
landroid_landroid.1.88y4dpx7iq8p@vevedock-01 | [2019-05-11T17:43:29.081] [INFO] Mqtt - Incoming MQTT message to topic landroid/set/mow: stop landroid_landroid.1.88y4dpx7iq8p@vevedock-01 | [2019-05-11T17:43:29.082] [ERROR] LandroidS - Invalid MQTT payload for topic set/mow payload stop
This at least shows the payload but does not help any further, will open an issue

@DBa2016
Copy link

DBa2016 commented May 13, 2019

In the comparison statements, replace 'payload === "start"' by 'payload.toString("") === "start"' (same for stop, of course).

In my tests, payload was a "Buffer" object. The reason why your modified log.error statement shows a string is that it seems to do an implicit conversion, by calling payload's ".toString()" method - however, "===" specifically compares data types, so it compares a string to a Buffer, which results in "False".

I don't want to interfer with your PR, so will let you implement this.

@DBa2016
Copy link

DBa2016 commented May 13, 2019

I actually realized this is needed for HA integration improvement, so I resolved it in PR #61

@virtualzone virtualzone merged commit fe3e95f into virtualzone:master May 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants