virtualzone / landroid-bridge

Bridge for connecting the Worx Landroid S Lawn Mower to home automation systems like OpenHAB or FHEM.
GNU General Public License v3.0
64 stars 48 forks source link

Function does not work: landroid/set/mow #51

Open sracing opened 5 years ago

sracing commented 5 years ago

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

spockster1985 commented 5 years ago

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.

sracing commented 5 years ago

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 commented 5 years ago

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

lukicsl commented 5 years ago

I will create a PR, please close the issue

sracing commented 5 years ago

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?

DBa2016 commented 5 years ago

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

sracing commented 5 years ago

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.

DBa2016 commented 5 years ago

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.