virtualzone/landroid-bridge

Function does not work: landroid/set/mow

Opened this issue · 8 comments

Bridge is working fine for all functions, except for landroid/set/mow either documentation is wrong or function does not work (payload "start" starts the mower, "stop" stops the mower)
[INFO] Mqtt - Incoming MQTT message to topic landroid/set/mow: stop
[ERROR] LandroidS - Invalid MQTT payload for topic set/mow
this does not work.

Seems to be a common theme since its not only me:
https://knx-user-forum.de/forum/supportforen/smarthome-py/1089334-neues-mqtt-plugin/page6

Change file LandroidS.ts
line 175
From
if (payload === "start") {
To
if (String(payload) === "start") {

line 177
From
if (payload === "stop") {
To
if (String(payload) === "stop") {

Run command: npm run grunt

Restart the server

Now the start and stop works fine.

Doing so, I´m getting a error message:
[ERROR] App - Unhandled exception: SyntaxError: Unexpected token N in JSON at position 0

Any idea why this dis not work?

OK, got it. the error message seems not to be caused by the change in the LandroidS.ts file suggested by spockster1985, but probably is due to the change in the Landroid API towards v2

I will create a PR, please close the issue

I implemented the changes suggested by spockster1985, but that does not make the start/stop function work:

[INFO] Mqtt - Incoming MQTT message to topic landroid/set/mow: stop
[ERROR] LandroidS - Invalid MQTT payload for topic set/mow

Any other idea?

Type-sensitive comparison operations between payload and strings (payload === "start" and similar) should instead use the .toString() method, like 'payload.toString() === "start"', see #58 (comment)

The fix from DBa2016 (see #58 and #61 for push request 67be35a) solves the MQTT failure.

My PR #61 was never merged (no reason given) and a conflicting PR (#65) has been created and merged in the meantime. Not sure what that means - maybe contributions are not desired.