landroid-bridge icon indicating copy to clipboard operation
landroid-bridge copied to clipboard

Function does not work: landroid/set/mow

Open sracing opened this issue 5 years ago • 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

sracing avatar Apr 19 '19 12:04 sracing

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.

spockster1985 avatar May 02 '19 08:05 spockster1985

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?

sracing avatar May 02 '19 18:05 sracing

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

sracing avatar May 03 '19 08:05 sracing

I will create a PR, please close the issue

lukicsl avatar May 11 '19 17:05 lukicsl

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?

sracing avatar May 12 '19 15:05 sracing

Type-sensitive comparison operations between payload and strings (payload === "start" and similar) should instead use the .toString() method, like 'payload.toString() === "start"', see https://github.com/weweave/landroid-bridge/pull/58#issuecomment-491776043

DBa2016 avatar May 13 '19 10:05 DBa2016

The fix from DBa2016 (see #58 and #61 for push request https://github.com/weweave/landroid-bridge/pull/61/commits/67be35a7738b4639c0be868dcb84b26f1af3aa55) solves the MQTT failure.

sracing avatar May 16 '19 11:05 sracing

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.

DBa2016 avatar Jul 18 '19 12:07 DBa2016