Closed clinique closed 2 weeks ago
@nibi79 : do you prefer I push to your repo or should I go directly to openhab/addons ?
@clinique thanks for your work, but please push it only to my repo. I hope I can check it next week.
Does this version work for you? Because I have connection problems.
use the mqtt transport provided by openhab core
If I'm right, openhab uses HiveMQ version 1.2.2, but this version doesn't support custom headers for MQTT. The newer version 1.3.1 does.
Does this version work for you? Because I have connection problems.
Not fully tested, consider it as of now as an ongoing work. I will setup my landroid this week-end, so I will be able to move on.
I’m at bridge initialization right now. I’m stuck in my tests line 121 of bridge handler because my mower is not setup and the api call answers with an empty array.
If I'm right, openhab uses HiveMQ version 1.2.2, but this version doesn't support custom headers for MQTT. The newer version 1.3.1 does.
Ok, so keep as it is for now and in a second time see if there is no show-stopper on upgrading core version of HiveMQ
@nibi79 : I think I nearly finished reviewing your code. It now needs testing. We could publish it on the Marketplace, this would let people give feedback while we refine it. Your thoughts ?
The README.md still needs a complete review.
@clinique , @nibi79 I could help you testing if you could provide me a *.jar file
if you could provide me a *.jar file
https://community.openhab.org/t/worx-landroid-binding/95246/289?u=sihui
I get the following error during initialization of the bridge thing:
COMMUNICATION_ERROR Unexpected error deserializing '[{"id":669878,"uuid":"96c53178-25db-4002-83e2-ba004ec7a4b7","product_id":70,"user_id":621168,"serial_number":"XXX","mac_address":"XXX","name":"M","locked":false,"firmware_version":3.3,"firmware_auto_upgrade":true,"push_notifications":true,"sim":null,"push_notifications_level":"warning","test":false,"iot_registered":true,"mqtt_registered":true,"pin_code":null,"registered_at":"2022-07-08 00:00:00","online":true,"app_settings":null,"protocol":0,"pending_radio_link_validation":null,"capabilities":["auto_lock","bluetooth_control","bluetooth_pairing","border_cut","digital_fence_settings","follow_border","lock","mqtt","multi_zone","multi_zone_percentage","one_time_scheduler","pairing_smartconfig","pause_over_wire","rain_delay","rain_delay_start","safe_go_home","scheduler_two_slots","unrestricted_mowing_time","zone_keeper"],"capabilities_available":[],"features":{"auto_lock":3.25,"bluetooth_control":3.2,"bluetooth_pairing":true,"chassis":"m_2021","digital_fence_settings":3.25,"display_type":"lcd","input_type":"keyboard_push_knob","lock":true,"mqtt":true,"multi_zone":true,"multi_zone_percentage":true,"multi_zone_zones":4,"one_time_scheduler":3.15,"pause_over_wire":3.26,"rain_delay":true,"rain_delay_start":3.08,"safe_go_home":3.25,"scheduler_two_slots":3.15,"unrestricted_mowing_time":true,"wifi_pairing":"smartconfig"},"accessories":{"ultrasonic":true},"mqtt_endpoint":"iot.eu-west-1.worxlandroid.com","mqtt_topics":{"command_in":"PRM100\/1C9DC2DCE064\/commandIn","command_out":"PRM100\/1C9DC2DCE064\/commandOut"},"warranty_registered":true,"purchased_at":"2022-05-31 00:00:00","warranty_expires_at":"2024-05-31 00:00:00","setup_location":{"latitude":49.20071752,"longitude":8.29588249},"city":{"id":2951206,"country_id":276,"name":"XXX","latitude":XXX,"longitude":XXX",created_at":"2018-02-15 22:21:32","updated_at":"2018-02-15 22:21:32"},"time_zone":"Europe\/Berlin","lawn_size":120,"lawn_perimeter":60,"auto_schedule_settings":{"boost":2,"exclusion_scheduler":{"days":[{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false}],"exclude_nights":false},"grass_type":"mixed_species","irrigation":true,"nutrition":{"k":8,"n":17,"p":23},"soil_type":"sand"},"auto_schedule":false,"improvement":true,"diagnostic":true,"distance_covered":335830,"mower_work_time":22507,"blade_work_time":21405,"blade_work_time_reset":18282,"blade_work_time_reset_at":"2023-06-19 16:59:53","battery_charge_cycles":318,"battery_charge_cycles_reset":0,"battery_charge_cycles_reset_at":null,"created_at":"2021-12-16 12:16:15","updated_at":"2023-07-24 02:01:17","last_status":{"timestamp":"2023-07-24 13:59:15","payload":{"cfg":{"id":2,"sn":"2021302672090085435A","dt":"24\/07\/2023","tm":"15:59:16","lg":"de","cmd":0,"sc":{"m":2,"d":[["17:00",180,1],["17:00",180,0],["17:00",180,0],["17:00",180,1],["17:00",180,0],["17:00",180,0],["17:00",180,0]],"dd":[["00:00",0,0],["00:00",0,0],["00:00",0,0],["00:00",0,0],["00:00",0,0],["00:00",0,0],["00:00",0,0]],"distm":0,"p":0,"ots":{"wtm":0,"bc":0}},"mz":[0,0,0,0],"mzv":[0,0,0,0,0,0,0,0,0,0],"mzk":0,"rd":0,"al":{"lvl":1,"t":300},"tq":0,"modules":{"US":{"enabled":1}}},"dat":{"mac":"1C9DC2DCE064","fw":3.3,"fwb":1,"ls":1,"le":0,"conn":"wifi","bt":{"t":26.2,"v":20.08,"p":100,"nr":318,"c":0,"m":1},"dmp":[-0.8,1.8,337.3],"st":{"b":21405,"d":335830,"wt":22507,"bl":60},"act":1,"rsi":-58,"lk":0,"tr":0,"lz":0,"rain":{"s":0,"cnt":0},"modules":{"US":{"stat":"ok"}}}}}}]'
[{"id":669878,"uuid":"96c53178-25db-4002-83e2-ba004ec7a4b7","product_id":70,"user_id":621168,"serial_number":"XXX","mac_address":"XXX","name":"M","locked":false,"firmware_version":3.3,"firmware_auto_upgrade":true,"push_notifications":true,"sim":null,"push_notifications_level":"warning","test":false,"iot_registered":true,"mqtt_registered":true,"pin_code":null,"registered_at":"2022-07-08 00:00:00","online":true,"app_settings":null,"protocol":0,"pending_radio_link_validation":null,"capabilities":["auto_lock","bluetooth_control","bluetooth_pairing","border_cut","digital_fence_settings","follow_border","lock","mqtt","multi_zone","multi_zone_percentage","one_time_scheduler","pairing_smartconfig","pause_over_wire","rain_delay","rain_delay_start","safe_go_home","scheduler_two_slots","unrestricted_mowing_time","zone_keeper"],"capabilities_available":[],"features":{"auto_lock":3.25,"bluetooth_control":3.2,"bluetooth_pairing":true,"chassis":"m_2021","digital_fence_settings":3.25,"display_type":"lcd","input_type":"keyboard_push_knob","lock":true,"mqtt":true,"multi_zone":true,"multi_zone_percentage":true,"multi_zone_zones":4,"one_time_scheduler":3.15,"pause_over_wire":3.26,"rain_delay":true,"rain_delay_start":3.08,"safe_go_home":3.25,"scheduler_two_slots":3.15,"unrestricted_mowing_time":true,"wifi_pairing":"smartconfig"},"accessories":{"ultrasonic":true},"mqtt_endpoint":"iot.eu-west-1.worxlandroid.com","mqtt_topics":{"command_in":"PRM100\/1C9DC2DCE064\/commandIn","command_out":"PRM100\/1C9DC2DCE064\/commandOut"},"warranty_registered":true,"purchased_at":"2022-05-31 00:00:00","warranty_expires_at":"2024-05-31 00:00:00","setup_location":{"latitude":49.20071752,"longitude":8.29588249},"city":{"id":2951206,"country_id":276,"name":"XXX","latitude":XXX,"longitude":XXX"created_at":"2018-02-15 22:21:32","updated_at":"2018-02-15 22:21:32"},"time_zone":"Europe\/Berlin","lawn_size":120,"lawn_perimeter":60,"auto_schedule_settings":{"boost":2,"exclusion_scheduler":{"days":[{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false},{"slots":[{"reason":"generic","duration":780,"start_time":540}],"exclude_day":false}],"exclude_nights":false},"grass_type":"mixed_species","irrigation":true,"nutrition":{"k":8,"n":17,"p":23},"soil_type":"sand"},"auto_schedule":false,"improvement":true,"diagnostic":true,"distance_covered":335830,"mower_work_time":22507,"blade_work_time":21405,"blade_work_time_reset":18282,"blade_work_time_reset_at":"2023-06-19 16:59:53","battery_charge_cycles":318,"battery_charge_cycles_reset":0,"battery_charge_cycles_reset_at":null,"created_at":"2021-12-16 12:16:15","updated_at":"2023-07-24 02:01:17","last_status":{"timestamp":"2023-07-24 13:59:15","payload":{"cfg":{"id":2,"sn":"2021302672090085435A","dt":"24\/07\/2023","tm":"15:59:16","lg":"de","cmd":0,"sc":{"m":2,"d":[["17:00",180,1],["17:00",180,0],["17:00",180,0],["17:00",180,1],["17:00",180,0],["17:00",180,0],["17:00",180,0]],"dd":[["00:00",0,0],["00:00",0,0],["00:00",0,0],["00:00",0,0],["00:00",0,0],["00:00",0,0],["00:00",0,0]],"distm":0,"p":0,"ots":{"wtm":0,"bc":0}},"mz":[0,0,0,0],"mzv":[0,0,0,0,0,0,0,0,0,0],"mzk":0,"rd":0,"al":{"lvl":1,"t":300},"tq":0,"modules":{"US":{"enabled":1}}},"dat":{"mac":"1C9DC2DCE064","fw":3.3,"fwb":1,"ls":1,"le":0,"conn":"wifi","bt":{"t":26.2,"v":20.08,"p":100,"nr":318,"c":0,"m":1},"dmp":[-0.8,1.8,337.3],"st":{"b":21405,"d":335830,"wt":22507,"bl":60},"act":1,"rsi":-58,"lk":0,"tr":0,"lz":0,"rain":{"s":0,"cnt":0},"modules":{"US":{"stat":"ok"}}}}}}]
Yes, there's obviously something wrong with this json response. I'll have to find where is the error in it.
Ok, I think the error does not lie in the json. It is wrong because you anonimized your location. Correct ? Would you have another error line point the erroneous data in the json ?
Ok, I think the error does not lie in the json. It is wrong because you anonimized your location. Correct ? Would you have another error line point the erroneous data in the json ?
I exchanged the exact location as well as the serial number and mac with the XXX. Yes, there was an error in the json due to my manual edit. I fixed that. The json seems to be at least in a correct format.
The app is telling me also that there is a connection issue. Maybe I am blocked at the moment and need to check it again tomorrow.
In the logs I also see the same error message as well as:
2023-07-24 18:18:20.409 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'worxlandroid:mower:MyWorxBridge:mymower' changed from OFFLINE (BRIDGE_OFFLINE) to UNINITIALIZED 2023-07-24 18:18:20.414 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'worxlandroid:mower:MyWorxBridge:mymower' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
But this is mainly due to the problem with the bridge as I would understand this.
Hi @clinique! I have the same issue like @ilumie802. I have validated the JSON that I've got back from the binding and it is valid. I have my Android App working correctly and connected. Also the JSON response from the AWS servers do seem correct and filled with actual data. My modified JSON can be found in the forum.
Thank you.
I'm going to take a look and try to find the origin of the deserialization error. Ok. Got it. I need to expand the deserialization model. You're using auto schedule setting that are currently not present.
I got it up and running with this new version. There are still some errors in the readme regarding the channel names, but I did not have time to come up with a full correct version to share at the moment.
Current status: `` Switch LandroidEnable "Mowing enabled" {channel="worxlandroid:mower:MyWorxBridge:mymower:common#enable"}
String LandroidAction "Action []"
String LandroidMacAdress "MAC [%s]"
String LandroidLastUpdateOnlineStatus "Last Update Online Status [%1$td.%1$tm.%1$ty / %1$tH:%1$tM:%1$tS]"
// Multizone
Switch LandroidMultizoneEnable "Multizone enable []" {channel="worxlandroid:mower:MyWorxBridge:mymower:cfgMultiZones#enable"}
Number LandroidLastZone "Start Zone []"
// Zone Meters
Number LandroidMeterZone1 "Meters Zone 1 [%d]"
// Allocation Zones
Number LandroidAllocation0 "Allocation 0 []"
// Status
Number LandroidWifiQuality "Wifi Quality [%d]"
// Rain
Switch LandroidRainState "Rain State []"
// Move
Number LandroidPitch "Pitch [%s]"
// Battery
Number LandroidBatteryLevel "Battery Level [%d %%]"
// Settings
Number LandroidRainDelay "Rain Delay [%d min]"
// Statistics Number LandroidTotalTime "Total Time [JS(minstohours.js):%s]"
//Schedule
// OneTime Schedule
Switch LandroidOneTimeScheduleEdgecut "OneTime Edgecut"
// Monday
Switch LandroidScheduleMondayEnable "Monday: [MAP(landroid_schedule_enable.map):%s]"
// Tuesday
Switch LandroidScheduleTuesdayEnable "Tuesday: [MAP(landroid_schedule_enable.map):%s]"
// Wednesday
Switch LandroidScheduleWednesdayEnable "Wednesday: [MAP(landroid_schedule_enable.map):%s]"
// Thursday
Switch LandroidScheduleThursdayEnable "Thursday: [MAP(landroid_schedule_enable.map):%s]"
// Friday
Switch LandroidScheduleFridayEnable "Friday: [MAP(landroid_schedule_enable.map):%s]"
// Saturday
Switch LandroidScheduleSaturdayEnable "Saturday: [MAP(landroid_schedule_enable.map):%s]"
// Sunday
Switch LandroidScheduleSundayEnable "Sunday: [MAP(landroid_schedule_enable.map):%s]"
With org.openhab.binding.worxlandroid-4.1.0-SNAPSHOT.jar
from Jul 25, 2023, 12:45 PM GMT+2 I unfortunately still get a deserializing error. Maybe it's because I have a "Find My Landroid" installed.
Unexpected error deserializing '[ <<see anonymized json below>> ]' : java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 273 path $[0].sim
The json appears to be valid json:
[{
"id": 521194,
"uuid": "96c52fe2-b305-4002-a016-cfe629b82643",
"product_id": 49,
"user_id": 0,
"serial_number": "00000000000000000000",
"mac_address": "XXXXXXXXXXXX",
"name": "M",
"locked": true,
"firmware_version": 3.28,
"firmware_auto_upgrade": true,
"push_notifications": true,
"sim": {
"id": 12345,
"iccid": "0000000000000000000",
"sim_status": "provisioned",
"pending_activation": false,
"contract_starts_at": "2023-04-10 00:00:00",
"contract_ends_at": "2026-04-10 00:00:00",
"created_at": "2023-04-10 08:09:21",
"updated_at": "2023-07-26 08:31:33"
},
"push_notifications_level": "warning",
"test": false,
"iot_registered": true,
"mqtt_registered": true,
"pin_code": "1803",
"registered_at": "2021-08-19 00:00:00",
"online": false,
"app_settings": {
"cellular_setup_completed": true
},
"protocol": 0,
"pending_radio_link_validation": null,
"capabilities": ["auto_lock", "bluetooth_pairing", "border_cut", "digital_fence_settings", "follow_border", "lock", "mqtt", "multi_zone", "multi_zone_percentage", "one_time_scheduler", "ota_upgrade", "pairing_smartconfig", "pause_over_wire", "rain_delay", "rain_delay_start", "safe_go_home", "scheduler_two_slots", "unrestricted_mowing_time"],
"capabilities_available": ["zone_keeper"],
"features": {
"auto_lock": 3.25,
"bluetooth_pairing": true,
"chassis": "m_2019",
"digital_fence_settings": 3.25,
"display_type": "tube",
"input_type": "keyboard_tube",
"lock": true,
"mqtt": true,
"multi_zone": true,
"multi_zone_percentage": true,
"multi_zone_zones": 4,
"one_time_scheduler": 3.15,
"pause_over_wire": 3.26,
"rain_delay": true,
"rain_delay_start": 3.08,
"safe_go_home": 3.25,
"scheduler_two_slots": 3.15,
"unrestricted_mowing_time": true,
"wifi_pairing": "smartconfig"
},
"accessories": {
"cellular": true
},
"mqtt_endpoint": "iot.eu-west-1.worxlandroid.com",
"mqtt_topics": {
"command_in": "PRM100\/F4CFA2A090C8\/commandIn",
"command_out": "PRM100\/F4CFA2A090C8\/commandOut"
},
"warranty_registered": true,
"purchased_at": "2021-08-08 00:00:00",
"warranty_expires_at": "2024-08-08 00:00:00",
"setup_location": {
"latitude": 0.00000000,
"longitude": 0.00000000
},
"city": {
"id": 0,
"country_id": 0,
"name": "XXXXXXXXXXXX",
"latitude": 0.000000,
"longitude": 0.00000,
"created_at": "2018-02-15 22:35:20",
"updated_at": "2018-02-15 22:35:20"
},
"time_zone": "Europe\/Amsterdam",
"lawn_size": 36,
"lawn_perimeter": null,
"auto_schedule_settings": {
"boost": 0,
"exclusion_scheduler": {
"days": [{
"slots": [],
"exclude_day": false
}, {
"slots": [],
"exclude_day": false
}, {
"slots": [],
"exclude_day": false
}, {
"slots": [],
"exclude_day": false
}, {
"slots": [],
"exclude_day": false
}, {
"slots": [],
"exclude_day": false
}, {
"slots": [],
"exclude_day": false
}],
"exclude_nights": true
},
"grass_type": "lolium_perenne",
"irrigation": false,
"nutrition": null,
"soil_type": null
},
"auto_schedule": false,
"improvement": true,
"diagnostic": true,
"distance_covered": 46682,
"mower_work_time": 4378,
"blade_work_time": 4153,
"blade_work_time_reset": 0,
"blade_work_time_reset_at": null,
"battery_charge_cycles": 58,
"battery_charge_cycles_reset": 0,
"battery_charge_cycles_reset_at": null,
"created_at": "2020-11-22 05:19:53",
"updated_at": "2023-04-10 09:24:43",
"last_status": {
"timestamp": "2023-07-23 16:25:25",
"payload": {
"cfg": {
"id": 0,
"sn": "00000000000000000000",
"dt": "23\/07\/2023",
"tm": "18:25:25",
"lg": "en",
"cmd": 0,
"sc": {
"m": 1,
"d": [
["09:00", 0, 0],
["00:00", 0, 0],
["00:00", 0, 0],
["00:00", 0, 0],
["00:00", 0, 0],
["00:00", 0, 0],
["09:00", 0, 0]
],
"dd": [
["09:00", 0, 0],
["00:00", 0, 0],
["00:00", 0, 0],
["00:00", 0, 0],
["00:00", 0, 0],
["00:00", 0, 0],
["09:00", 0, 0]
],
"distm": 0,
"p": 0,
"ots": {
"wtm": 0,
"bc": 0
}
},
"mz": [0, 0, 0, 0],
"mzv": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"rd": 180,
"al": {
"lvl": 1,
"t": 30
},
"tq": 0,
"modules": {
"4G": {
"enabled": 1,
"geo": {
"coo": [0.00000, 0.00000],
"rad": 21
}
}
}
},
"dat": {
"mac": "XXXXXXXXXXXX",
"fw": 3.28,
"fwb": 1,
"ls": 1,
"le": 0,
"conn": "wifi",
"bt": {
"t": 21.6,
"v": 19.36,
"p": 100,
"nr": 58,
"c": 0,
"m": 0
},
"dmp": [1.3, 0.5, 0],
"st": {
"b": 4153,
"d": 46682,
"wt": 4378,
"bl": 0
},
"act": 1,
"rsi": 0,
"lk": 1,
"tr": 0,
"lz": 0,
"rain": {
"s": 0,
"cnt": 0
},
"modules": {
"4G": {
"stat": "ok",
"vers": 2.51,
"batt": {
"t": 23,
"v": 4.11,
"l": 96
},
"mode": 0,
"geo": {
"stat": "unk"
},
"network": {
"status": "disconnected",
"ICCID": "0000000000000000000",
"IMSI": "000000000000000",
"rssi": -125
}
}
}
}
}
}
}]
Hello,
may I help with implementation for OH4 please?
Thanks
Updated jar. This only address some missing status codes (issue #91) and missing Sim data when you've got "Find My Landroid" option.
use the mqtt transport provided by openhab core
If I'm right, openhab uses HiveMQ version 1.2.2, but this version doesn't support custom headers for MQTT. The newer version 1.3.1 does.
This is now apparently done : https://github.com/openhab/openhab-core/pull/3824 I will investigate this.
@nibi79 : when do you plan to push it to OH repo ?
@nibi79 : sorry to push you on this but coping with a binding outside of the repo is a burden. Should I make the PR ?
hi @clinique, to be honest, I didn't really want to push into the OH repo, but let's talk about it again next week
hey guys, thanks @clinique for all the refactoring. @nibi79 why is there no interest to migrate to official oh repo? if not, I think best solution to be independet from oh repo would be, to redesign it as a seperate peace of daemon and working as a worx2mqtt bridge. that there is no dependency. otherwise every oh update/upgrade could lead to a dysfunction of the binding.
BR mitch
Checklist :
- [ ] use the mqtt transport provided by openhab core