normen / homebridge-landroid

Homebridge plugin to control Worx Landroid robo mowers through the Worx Cloud
24 stars 8 forks source link

PartyMode getter not working #53

Closed AndreasWuesten closed 1 year ago

AndreasWuesten commented 1 year ago

First of all, thanks for your work and fixing the plugin!!!

There is a problem with the PartyMode, it's possible to set the value but the switch changes to "false" afterwards. The problem seems to be the Property "partyModus" in objects.js, helper.js and/or CloudConnector.js instead of "partyMode". I could fix it locally via simple renaming and it works now. But I'm note sure if this is the perfect solution.

Have a nice day!

normen commented 1 year ago

Thanks for the report, should be fixed.

AndreasWuesten commented 1 year ago

I'm sorry, it's not working, but even my former "solution" doesn't do either. I did some additional logging to check if the value from worx is incorrect or the mapping. The value from worx is always correct (data.cfg.sc.m: 1 (off) or 2 (on)) and the setStateAsync-function uses the correct value (false/true) to update the partymode-property (helper.js 706). But in the dataset this property stays on "undefined" (when startet with deactivated PartyMode) or "true" (when started with activated PartyMode). There first transistion from undefined to true (activation of PM) seems to work, but it never changes from this time on.

Here is the Log with comments: ---Homeserver-Start with deactivated Party-Mode in Worx-App--- 7:24:53 PM: Restoring Landroid Landroid Shaun from HomeKit 7:24:53 PM: Fallback for On/Off switch 7:24:53 PM: DidFinishLaunching 7:24:53 PM: Use old session: worx 7:24:53 PM: Found 1 devices 7:24:53 PM: Found device Shaun with id 20***** 7:24:53 PM: Please wait a few minutes.... clean old version 7:24:53 PM: Done with cleaning 7:24:53 PM: Found Landroid in Worx Cloud with name: Shaun 7:24:53 PM: found DoubleShedule, create states... 7:24:53 PM: found OneTimeShedule, create states... 7:24:53 PM: found available firmware, create states... 7:24:53 PM: LandroidAccessory.prototype.landroidUpdate: this.dataset.partyModus: undefined 7:24:53 PM: found PartyModus, create states... 7:24:54 PM: Create folder activityLog and set states. 7:24:54 PM: Create product folder and states for WR141E 7:24:54 PM: LandroidAccessory.prototype.landroidUpdate: this.dataset.partyModus: undefined 7:24:54 PM: setStates(mower): data.cfg.sc.m: 1 7:24:54 PM: found torque control, create states... 7:24:54 PM: Autolock found! Create State : AutoLock 7:24:54 PM: Autolock found! Create State : AutoLockTimer 7:24:54 PM: LandroidAccessory.prototype.landroidUpdate: this.dataset.partyModus: undefined 7:24:54 PM: Start MQTT connection 7:24:55 PM: LandroidAccessory.prototype.landroidUpdate: this.dataset.partyModus: undefined

---Receives the correct value from Worx (1 = Partymode off) and calls setStateAsync with value false--- 7:24:55 PM: setStates(mower): data.cfg.sc.m: 1

---But dataset.partymode stays undefined (off in Homeserver, so no error for the eye)--- 7:24:55 PM: LandroidAccessory.prototype.landroidUpdate: this.dataset.partyModus: undefined

---Activation of Party-Mode in Worx-App happened--- 7:25:10 PM: LandroidAccessory.prototype.landroidUpdate: this.dataset.partyModus: undefined

---Value from Worx is correct (2 = Partymode on)--- 7:25:10 PM: setStates(mower): data.cfg.sc.m: 2

---Also correct change to true in dataset.partymode (on in Homeserver, everything looks fine)--- 7:25:10 PM: LandroidAccessory.prototype.landroidUpdate: this.dataset.partyModus: true

---DeActivation of Party-Mode in Worx-App--- ---Receives the correct value from Worx (1 = Partymode off) and calls setStateAsync with value false 7:25:18 PM: setStates(mower): data.cfg.sc.m: 1

---But dataset.partymode stays true (on in Homeserver)--- 7:25:18 PM: LandroidAccessory.prototype.landroidUpdate: this.dataset.partyModus: true

Any ideas? I use the partymode for an automation. When there is chance of rain on the very same day, the partymode triggers to prevent the landroid from mowing wet grass (he does not know it was raining before because he's in a garage). So when it's dry weather the homebridge triggers partymode "off" (and worx accept). But because the switch stays on "true/on" he never triggers partymode "on" again, and the landroid always does his dirty work (literally).

Thanks in advance and have a relaxing weekend!

normen commented 1 year ago

Nah, then the issue is upstream, I'd have to look though the cloud adapter - or it gets fixed in iobroker.worx.

Febus123 commented 1 year ago

Also a big THANK YOU upfront for providing this module! I have the same issue here with a M500+. It worked fine to disable the mode in the cloud through HomeKit but the switch in HomeKit went back to enabled. Also the start/stop switch tends to switch without a reason. Can you maybe also give the switches more speaking names?

normen commented 1 year ago

Also a big THANK YOU upfront for providing this module! I have the same issue here with a M500+. It worked fine to disable the mode in the cloud through HomeKit but the switch in HomeKit went back to enabled.

As my mowers don't support this feature I have a hard time debugging this.

Also the start/stop switch tends to switch without a reason.

Without any additional info thats also hard to debug.

Can you maybe also give the switches more speaking names?

The switches are named the way you named your mowers in the worx cloud. Also, you can change the name of any HomeKit switch in the home app.

DennisJohnsen commented 1 year ago

Hello

So i am having the same issue with the PartyMode switch in Homekit via Homebridge as well.. The switch for the party mode in Homekit will always be on, no matter the status i set in the Worx app it self.

In homebridge i see the data is available in the Logs when i have debug enabled. And thus whatever the plugin gets from iot.eu-west-1.worxlandroid.com/mqtt is correct.

But when i hit the switch in Homekit (from off to on) i can get it to enable party mode, but when trying to disable it i get sone errors in the log: https://pastebin.com/Z24XGqpQ

I hope the following logs are enough for you to get an idea, and also my description.

normen commented 1 year ago

In homebridge i see the data is available in the Logs when i have debug enabled. And thus whatever the plugin gets from

Whats the data item name for the party mode? I can't seem to find it in your logs.

DennisJohnsen commented 1 year ago

https://pastebin.com/Z24XGqpQ

Thats because in the logs Party mode was disabled.

When i enable Party mode in the worx app i see this in the homebridge logs: [6/30/2023, 12:48:23 PM] [homebridge-landroid] [DEBUG] DATA: partyModus: true

So partyModus is completly missing when its false, not just set to false.

The logs i posted above was a snapshot of the logs when i tried to enable party mode through homekit. Starting from the message it tries to send. Then some errors starts to appear which i what i wanted to show.

DennisJohnsen commented 1 year ago

To try and summerize my experince better:

  1. Enabling Party mode in the app, sets partyModus: true 1.1. Homekit switch does not get updated with on (currently its just stuck on on actually)

  2. Disabling party mode in the app, removes partyModus: true 2.1. Homekit switch does not get updated with off

  3. PartyMode switch in Homekit is stuck on on, trying to flip it to off makes it appear its off, then after some seconds it goes back to on in Homekit 3.1 Opening the app i see it actually disabled PartyMode, but the switch behaviour above still happens (it goes back to on), but actually disables in 3.2 It is actually showing up as "no response" when i look more closely in the homekit app 3.3 This is the logs from the moment i try to disable party mode with the homekit switch until its flips back to on:

    [6/30/2023, 1:17:05 PM] [homebridge-landroid] Sending to Landroid Baghave: [{"sc":{ "m":1, "distm": 0}}] (20193019930200273149)
    [6/30/2023, 1:17:05 PM] [homebridge-landroid] Worxcloud MQTT sendMessage to 20193019930200273149 Message: {"sc":{ "m":1, "distm": 0}}
    [6/30/2023, 1:17:05 PM] [homebridge-landroid] Request Counter: 2
    [6/30/2023, 1:17:05 PM] [homebridge-landroid] length:  0
    [6/30/2023, 1:17:05 PM] [homebridge-landroid] Start MQTT ping: {"id":39037,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:05","dt":"30/06/2023","sc":{"m":1,"distm":0}}
    [6/30/2023, 1:17:05 PM] [homebridge-landroid] lastCommand_start:  {"39037":{"id":39037,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:05","dt":"30/06/2023","sc":{"m":1,"distm":0}}}
    [6/30/2023, 1:17:05 PM] [homebridge-landroid] this.mqtt_response_check:  {"39037":{"id":39037,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:05","dt":"30/06/2023","sc":{"m":1,"distm":0},"request":1688123825386,"response":0,"user":"homebridge"}}
    [6/30/2023, 1:17:05 PM] [homebridge-landroid] sendData:  {"id":39037,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:05","dt":"30/06/2023","sc":{"m":1,"distm":0}}
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] Worxcloud MQTT get Message for mower Baghave (20193019930200273149)
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] Request ID 39037 has been passed to the mower
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] lastCommand_start:  {"39037":{"id":39037,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:05","dt":"30/06/2023","sc":{"m":1,"distm":0},"request":1688123825386,"response":0,"user":"homebridge"}}
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] Set new timestamp
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] UNDEFINED:  {}
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] UNDEFINED_id:  39037
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] UNDEFINED_sent:  response
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] GET MQTT DATA from API: {"cfg":{"id":39037,"lg":"en","tm":"13:17:05","dt":"30/06/2023","sc":{"m":1,"distm":0,"ots":{"bc":0,"wtm":0},"p":30,"d":[["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0]],"dd":[["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0]]},"cmd":0,"mz":[0,0,0,0],"mzv":[0,0,0,0,0,0,0,0,0,0],"mzk":0,"rd":0,"sn":"20193019930200273149","al":{"lvl":0,"t":60},"tq":0,"modules":{"US":{"enabled":1},"DF":{"cut":1,"fh":0}}},"dat":{"mac":"98D863462AA8","fw":3.3,"fwb":1,"bt":{"t":24.3,"v":18.48,"p":37,"nr":1040,"c":1,"m":0},"dmp":[0.8,-0.8,13.8],"st":{"b":169574,"d":3080082,"wt":177927,"bl":164},"ls":1,"le":0,"lz":3,"rsi":-67,"lk":0,"act":1,"tr":0,"conn":"wifi","rain":{"s":0,"cnt":0},"time":{"r":0,"l":0},"modules":{"US":{"stat":"ok"},"DF":{"stat":"ok"}}}}
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: totalTime: 2965.45
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: totalDistance: 3080.08
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: totalBladeTime: 2826.23
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: gradient: 0.8
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: inclination: -0.8
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: direction: 13.8
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: batteryChargeCycle: 1040
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: batteryCharging: true
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: batteryVoltage: 18.48
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: batteryTemperature: 24.3
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] Test Status: 1
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: status: 1
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: wifiQuality: -67
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: mowerActive: true
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: mowTimeExtend: 30
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: oneTimeJson: "{\"bc\":0,\"wtm\":0}"
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: firmware: 3.3
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: batteryState: 37
    [6/30/2023, 1:17:07 PM] [homebridge-landroid] [DEBUG] DATA: AutoLockTimer: 60
    [6/30/2023, 1:17:14 PM] [homebridge-landroid] Sending to Landroid Baghave: [{"sc":{ "m":1, "distm": 0}}] (20193019930200273149)
    [6/30/2023, 1:17:14 PM] [homebridge-landroid] Worxcloud MQTT sendMessage to 20193019930200273149 Message: {"sc":{ "m":1, "distm": 0}}
    [6/30/2023, 1:17:14 PM] [homebridge-landroid] Request Counter: 3
    [6/30/2023, 1:17:14 PM] [homebridge-landroid] length:  0
    [6/30/2023, 1:17:14 PM] [homebridge-landroid] Start MQTT ping: {"id":60390,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:14","dt":"30/06/2023","sc":{"m":1,"distm":0}}
    [6/30/2023, 1:17:14 PM] [homebridge-landroid] lastCommand_start:  {"60390":{"id":60390,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:14","dt":"30/06/2023","sc":{"m":1,"distm":0}}}
    [6/30/2023, 1:17:14 PM] [homebridge-landroid] this.mqtt_response_check:  {"60390":{"id":60390,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:14","dt":"30/06/2023","sc":{"m":1,"distm":0},"request":1688123834734,"response":0,"user":"homebridge"}}
    [6/30/2023, 1:17:14 PM] [homebridge-landroid] sendData:  {"id":60390,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:14","dt":"30/06/2023","sc":{"m":1,"distm":0}}
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] Worxcloud MQTT get Message for mower Baghave (20193019930200273149)
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] Request ID 60390 has been passed to the mower
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] lastCommand_start:  {"60390":{"id":60390,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"13:17:14","dt":"30/06/2023","sc":{"m":1,"distm":0},"request":1688123834734,"response":0,"user":"homebridge"}}
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] Set new timestamp
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] UNDEFINED:  {}
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] UNDEFINED_id:  60390
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] UNDEFINED_sent:  response
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] GET MQTT DATA from API: {"cfg":{"id":60390,"lg":"en","tm":"13:17:14","dt":"30/06/2023","sc":{"m":1,"distm":0,"ots":{"bc":0,"wtm":0},"p":30,"d":[["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0]],"dd":[["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0]]},"cmd":0,"mz":[0,0,0,0],"mzv":[0,0,0,0,0,0,0,0,0,0],"mzk":0,"rd":0,"sn":"20193019930200273149","al":{"lvl":0,"t":60},"tq":0,"modules":{"US":{"enabled":1},"DF":{"cut":1,"fh":0}}},"dat":{"mac":"98D863462AA8","fw":3.3,"fwb":1,"bt":{"t":24.3,"v":18.48,"p":37,"nr":1040,"c":1,"m":0},"dmp":[0.8,-0.8,13.8],"st":{"b":169574,"d":3080082,"wt":177927,"bl":164},"ls":1,"le":0,"lz":3,"rsi":-64,"lk":0,"act":1,"tr":0,"conn":"wifi","rain":{"s":0,"cnt":0},"time":{"r":0,"l":0},"modules":{"US":{"stat":"ok"},"DF":{"stat":"ok"}}}}
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] [DEBUG] DATA: totalTime: 2965.45
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] [DEBUG] DATA: totalDistance: 3080.08
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] [DEBUG] DATA: totalBladeTime: 2826.23
    [6/30/2023, 1:17:16 PM] [homebridge-landroid] [DEBUG] DATA: gradient: 0.8
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: inclination: -0.8
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: direction: 13.8
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: batteryChargeCycle: 1040
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: batteryCharging: true
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: batteryVoltage: 18.48
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: batteryTemperature: 24.3
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] Test Status: 1
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: status: 1
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: wifiQuality: -64
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: mowerActive: true
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: mowTimeExtend: 30
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: oneTimeJson: "{\"bc\":0,\"wtm\":0}"
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: firmware: 3.3
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: batteryState: 37
    [6/30/2023, 1:17:17 PM] [homebridge-landroid] [DEBUG] DATA: AutoLockTimer: 60
  4. Worx says partyMode is not enabled. Homekit says it is. Flipping the switch from "On" to "Off" 4.1. Switch goes back to on automatically after some time, nothing updated in the Worx App.

  5. Worx says partyMode is not enabled. Home kit says it is. Flipping the switch From "On" to "Off" and bak to "On" again quickly 5.1 This actually eventually sets worx to be in PartyMode in the worx app. 5.2 Same odd behaviour as before, it goes into "no response" mode and eventually it caught up.

    So the above logs seems to indicate there is something odd going on when using the party switch. And most importantly, the switch state in homekit is not in sync/not the same state as in the worx app.


I hope the above helps.

normen commented 1 year ago

Hm, as said my mowers don't support this so this is stabbing in the dark. Maybe 0.11.8 fixes this.

DennisJohnsen commented 1 year ago

I just tried the new update, and initially it looked good. When homebridge loaded, the switch was off - and partymode was off in the worx app. Flip the switch, and partyMode was enabled in both Homekit and Worx app, even though i still see this immediately:

[6/30/2023, 7:38:28 PM] [homebridge-landroid] Sending to Landroid Baghave: [{"sc":{ "m":1, "distm": 0}}] (20193019930200273149)
[6/30/2023, 7:38:28 PM] [homebridge-landroid] Worxcloud MQTT sendMessage to 20193019930200273149 Message: {"sc":{ "m":1, "distm": 0}}
[6/30/2023, 7:38:28 PM] [homebridge-landroid] Request Counter: 6
[6/30/2023, 7:38:28 PM] [homebridge-landroid] length:  0
[6/30/2023, 7:38:28 PM] [homebridge-landroid] Start MQTT ping: {"id":48461,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"19:38:28","dt":"30/06/2023","sc":{"m":1,"distm":0}}
[6/30/2023, 7:38:28 PM] [homebridge-landroid] lastCommand_start:  {"48461":{"id":48461,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"19:38:28","dt":"30/06/2023","sc":{"m":1,"distm":0}}}
[6/30/2023, 7:38:28 PM] [homebridge-landroid] this.mqtt_response_check:  {"48461":{"id":48461,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"19:38:28","dt":"30/06/2023","sc":{"m":1,"distm":0},"request":1688146708449,"response":0,"user":"homebridge"}}
[6/30/2023, 7:38:28 PM] [homebridge-landroid] sendData:  {"id":48461,"cmd":0,"lg":"en","sn":"20193019930200273149","tm":"19:38:28","dt":"30/06/2023","sc":{"m":1,"distm":0}}

But when trying to turn it off again, the same behaviour starts again as described previously.

So even though there is some undefined being sent back and forth, the partyMode flag is set to true, and partyMode seems to be omitted from the object if its false, and for some reason the switch is not being properly updated.

DennisJohnsen commented 1 year ago

I just tried to make sure that Homebridge was updated. It was slightly behind, but still no dice. It seems like it accepts the first initial value from Worx just fine (on load)

I flip it to partyMode in worx:

[6/30/2023, 8:05:25 PM] [homebridge-landroid] Worxcloud MQTT get Message for mower Baghave (20193019930200273149)
[6/30/2023, 8:05:25 PM] [homebridge-landroid] Response ID 17594 from mower
[6/30/2023, 8:05:25 PM] [homebridge-landroid] lastCommand_start:  {"cfg":{"id":17594,"lg":"en","tm":"20:05:22","dt":"30/06/2023","sc":{"m":2,"distm":0,"ots":{"bc":0,"wtm":0},"p":30,"d":[["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0]],"dd":[["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0]]},"cmd":0,"mz":[0,0,0,0],"mzv":[0,0,0,0,0,0,0,0,0,0],"mzk":0,"rd":0,"sn":"20193019930200273149","al":{"lvl":0,"t":60},"tq":0,"modules":{"US":{"enabled":1},"DF":{"cut":1,"fh":0}}},"dat":{"mac":"98D863462AA8","fw":3.3,"fwb":1,"bt":{"t":20.4,"v":18.26,"p":47,"nr":1041,"c":1,"m":0},"dmp":[-1.8,-2.1,263.6],"st":{"b":169667,"d":3081813,"wt":178020,"bl":164},"ls":1,"le":0,"lz":3,"rsi":-59,"lk":0,"act":1,"tr":0,"conn":"wifi","rain":{"s":0,"cnt":0},"time":{"r":0,"l":0},"modules":{"US":{"stat":"ok"},"DF":{"stat":"ok"}}}}
[6/30/2023, 8:05:25 PM] [homebridge-landroid] Set new timestamp
[6/30/2023, 8:05:25 PM] [homebridge-landroid] GET MQTT DATA from API: {"cfg":{"id":17594,"lg":"en","tm":"20:05:22","dt":"30/06/2023","sc":{"m":2,"distm":0,"ots":{"bc":0,"wtm":0},"p":30,"d":[["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0]],"dd":[["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0]]},"cmd":0,"mz":[0,0,0,0],"mzv":[0,0,0,0,0,0,0,0,0,0],"mzk":0,"rd":0,"sn":"20193019930200273149","al":{"lvl":0,"t":60},"tq":0,"modules":{"US":{"enabled":1},"DF":{"cut":1,"fh":0}},"request":0,"response":1688148325748,"action":"APP","user":"APP"},"dat":{"mac":"98D863462AA8","fw":3.3,"fwb":1,"bt":{"t":20.4,"v":18.26,"p":47,"nr":1041,"c":1,"m":0},"dmp":[-1.8,-2.1,263.6],"st":{"b":169667,"d":3081813,"wt":178020,"bl":164},"ls":1,"le":0,"lz":3,"rsi":-59,"lk":0,"act":1,"tr":0,"conn":"wifi","rain":{"s":0,"cnt":0},"time":{"r":0,"l":0},"modules":{"US":{"stat":"ok"},"DF":{"stat":"ok"}}}}
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: totalTime: 2967
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: totalDistance: 3081.81
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: totalBladeTime: 2827.78
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: gradient: -1.8
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: inclination: -2.1
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: direction: 263.6
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: batteryChargeCycle: 1041
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: batteryCharging: true
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: batteryVoltage: 18.26
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: batteryTemperature: 20.4
[6/30/2023, 8:05:25 PM] [homebridge-landroid] Test Status: 1
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: status: 1
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: wifiQuality: -59
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: mowerActive: true
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: mowTimeExtend: 30
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: oneTimeJson: "{\"bc\":0,\"wtm\":0}"
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: partyModus: true
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: firmware: 3.3
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: batteryState: 47
[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: AutoLockTimer: 60

[6/30/2023, 8:05:25 PM] [homebridge-landroid] [DEBUG] DATA: partyModus: true is the important part here. The data IS sent from Worx to the plugin just fine.

Then 10 seconds later i try and turn off PartyMode in Worx App, and the data is correct from Worx (partyModus is missing), but the plugin dosn't update the switch anymore.

[6/30/2023, 8:05:35 PM] [homebridge-landroid] Worxcloud MQTT get Message for mower Baghave (20193019930200273149)
[6/30/2023, 8:05:35 PM] [homebridge-landroid] Response ID 16578 from mower
[6/30/2023, 8:05:35 PM] [homebridge-landroid] lastCommand_start:  {"cfg":{"id":16578,"lg":"en","tm":"20:05:32","dt":"30/06/2023","sc":{"m":1,"distm":0,"ots":{"bc":0,"wtm":0},"p":30,"d":[["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0]],"dd":[["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0]]},"cmd":0,"mz":[0,0,0,0],"mzv":[0,0,0,0,0,0,0,0,0,0],"mzk":0,"rd":0,"sn":"20193019930200273149","al":{"lvl":0,"t":60},"tq":0,"modules":{"US":{"enabled":1},"DF":{"cut":1,"fh":0}}},"dat":{"mac":"98D863462AA8","fw":3.3,"fwb":1,"bt":{"t":20.4,"v":18.27,"p":47,"nr":1041,"c":1,"m":0},"dmp":[-1.8,-2.1,263.6],"st":{"b":169667,"d":3081813,"wt":178020,"bl":164},"ls":1,"le":0,"lz":3,"rsi":-59,"lk":0,"act":1,"tr":0,"conn":"wifi","rain":{"s":0,"cnt":0},"time":{"r":0,"l":0},"modules":{"US":{"stat":"ok"},"DF":{"stat":"ok"}}}}
[6/30/2023, 8:05:35 PM] [homebridge-landroid] Set new timestamp
[6/30/2023, 8:05:35 PM] [homebridge-landroid] GET MQTT DATA from API: {"cfg":{"id":16578,"lg":"en","tm":"20:05:32","dt":"30/06/2023","sc":{"m":1,"distm":0,"ots":{"bc":0,"wtm":0},"p":30,"d":[["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0],["10:00",600,0],["10:00",600,1],["10:00",600,0]],"dd":[["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0],["09:00",0,0]]},"cmd":0,"mz":[0,0,0,0],"mzv":[0,0,0,0,0,0,0,0,0,0],"mzk":0,"rd":0,"sn":"20193019930200273149","al":{"lvl":0,"t":60},"tq":0,"modules":{"US":{"enabled":1},"DF":{"cut":1,"fh":0}},"request":0,"response":1688148335061,"action":"APP","user":"APP"},"dat":{"mac":"98D863462AA8","fw":3.3,"fwb":1,"bt":{"t":20.4,"v":18.27,"p":47,"nr":1041,"c":1,"m":0},"dmp":[-1.8,-2.1,263.6],"st":{"b":169667,"d":3081813,"wt":178020,"bl":164},"ls":1,"le":0,"lz":3,"rsi":-59,"lk":0,"act":1,"tr":0,"conn":"wifi","rain":{"s":0,"cnt":0},"time":{"r":0,"l":0},"modules":{"US":{"stat":"ok"},"DF":{"stat":"ok"}}}}
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: totalTime: 2967
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: totalDistance: 3081.81
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: totalBladeTime: 2827.78
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: gradient: -1.8
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: inclination: -2.1
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: direction: 263.6
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: batteryChargeCycle: 1041
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: batteryCharging: true
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: batteryVoltage: 18.27
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: batteryTemperature: 20.4
[6/30/2023, 8:05:35 PM] [homebridge-landroid] Test Status: 1
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: status: 1
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: wifiQuality: -59
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: mowerActive: true
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: mowTimeExtend: 30
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: oneTimeJson: "{\"bc\":0,\"wtm\":0}"
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: firmware: 3.3
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: batteryState: 47
[6/30/2023, 8:05:35 PM] [homebridge-landroid] [DEBUG] DATA: AutoLockTimer: 60

It can only be turned on once in Homekit, then it gets out of "sync" and its stuck in a on positon - no matter the data it gets from Worx.

DennisJohnsen commented 1 year ago

Even though i have no idea how to write Homebridge plugins, i do see that the lib/helpers.js is looking for cfg.sc.m where 1 would be partyMode is false, and if 2 it would be true. The data object from and too Worx appears to be fine. But it seems like the state in the homebridge app is not being updated for the switch.

Considering that the data is correct, i tried to look into index.js

https://github.com/normen/homebridge-landroid/blob/c7cf47d057cd3c2e2e51b69210301d1e17b45a65/index.js#L262

Could it be this if statement? this.dataset.partyModus != oldDataset.partyModus that this is always truthy and thus ending it constantly being set to true.

DennisJohnsen commented 1 year ago

Alright, i have never looked this much into a Homebridge plugin before, but this seems like as good a time as any. Forked the project, and see if i can find a solution having access to more debug data.

Still if my above info made you see a quick fix, i wouldn't mind you still looking at it - as i feel i'm on pretty deep water :P I'm more a webdeveloper with UI development (css, html, react) is more my thing.

normen commented 1 year ago

Then 10 seconds later i try and turn off PartyMode in Worx App, and the data is correct from Worx (partyModus is missing), but the plugin dosn't update the switch anymore.

if partyModus is never appearing in that list (the one with [DEBUG]) then thats the issue. Thats the way the data gets from the iobroker part (CloudConnector) to the homebridge part (index.js)

DennisJohnsen commented 1 year ago

if partyModus is never appearing in that list (the one with [DEBUG]) then thats the issue. Thats the way the data gets from the iobroker part (CloudConnector) to the homebridge part (index.js)

Yeah thats what i figured. I have a developement homebridge running with a test home now, and wanted to try and change it so that if you have the switch enabled, then i will set this.dataset.partyModus to false, so at least the false would be there.

Just as a test. But viable solution, doubt it as it would only work if you know you have a model with Party mode.

normen commented 1 year ago

Right, though the code should in theory work imo, if the partyMode was transferred.. Thing is that the CloudConnector code should be left mostly untouched as thats maintained externally so if you'd manage to find a good way to extract the actual partyMode status from there that'd be nice.

DennisJohnsen commented 1 year ago

It appears it was transferred all a long. Just a simple check for object.val that filtered out the data.

There is still one thing described in the PR, but at least now it properly updates the switch eventually.