nibi79 / worxlandroid

openHAB Binding for Worx Landroid
60 stars 20 forks source link

AWS MQTT Exception: The connection was closed unexpectedly #82

Closed BobMiles closed 1 year ago

BobMiles commented 1 year ago

Hi,

first of all, thank you so much for this amazing binding. I got it up and running with OH3.4 and it worked quite well for some days . until today the thing stopped working and when I tried to reconnect the bridge (disable/enable) it now always hangs on INITIALIZING. THe log shows the following exception:

2023-05-19 12:06:50.122 [ERROR] [worxlandroid.internal.mqtt.AWSClient] - Exception: software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly.

I have not changed anything in the configuration. Any idea how to solve this?

Thank you so much and all the best,

Bob

BetaHydri commented 1 year ago

Same here, after ~24h of running, it seems that my account is somehow locked out to send MQTT to the worx AWS MQTT endpoint. Even though the Android App now has connection errors, I can't change any settings or control my Landroid via the App as well. My quick solution was to transfer my Landroid to another email account. But I ran into the same issue after approximately 24h.

Maybe too many requests to the MQTT AWS endpoint in comparison to the Worx App?

2023-05-19 14:27:08.653 [DEBUG] [d.internal.WorxLandroidBridgeHandler] - try to connect to API... 2023-05-19 14:27:08.656 [DEBUG] [nternal.webapi.request.WebApiRequest] - URI: https://id.eu.worx.com/oauth/token ==> /var/log/openhab/events.log <== 2023-05-19 14:27:08.641 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'worxlandroid:worxlandroidBridge:MyWorxsS300' changed from UNINITIALIZED (DISABLED) to INITIALIZING ==> /var/log/openhab/openhab.log <== 2023-05-19 14:27:09.373 [DEBUG] [nternal.webapi.request.WebApiRequest] - Worx Landroid WebApi Response: {"token_type":"Bearer","expires_in":3600,"access_token":"***hidden for debug log***","refresh_token":"***hidden for debug log***"} 2023-05-19 14:27:09.375 [DEBUG] [d.internal.WorxLandroidBridgeHandler] - API connected: true 2023-05-19 14:27:09.376 [DEBUG] [nternal.webapi.request.WebApiRequest] - URI: https://api.worxlandroid.com/api/v2/users/me 2023-05-19 14:27:09.563 [DEBUG] [nternal.webapi.request.WebApiRequest] - Worx Landroid WebApi Response: {"id":xxxxxx,"user_type":"customer","push_notifications":true,"location":null,"mqtt_endpoint":"a1optpg91s0ydf-ats.iot.eu-west-1.amazonaws.com","actions_on_google_pin_code":"xxxx","created_at":"2023-05-18 13:52:32","updated_at":"2023-05-18 18:11:59"} 2023-05-19 14:27:09.568 [DEBUG] [nternal.webapi.request.WebApiRequest] - URI: https://api.worxlandroid.com/api/v2/product-items?status=1 2023-05-19 14:27:09.654 [DEBUG] [nternal.webapi.request.WebApiRequest] - Worx Landroid WebApi Response: [{"id":778000,"uuid":"96c53323-1dff-4002-8b66-249b1a426c91","product_id":48,"user_id":xxxxxx,"serial_number":"MYSERIAL02492A5","mac_address":"MYMAC","name":"S300","locked":true,"firmware_version":3.28,"firmware_auto_upgrade":true,"push_notifications":true,"sim":null,"push_notifications_level":"warning","test":false,"iot_registered":true,"mqtt_registered":true,"pin_code":"XXXX","registered_at":"2023-05-17 00:00:00","online":true,"app_settings":null,"protocol":0,"pending_radio_link_validation":null,"capabilities":["auto_lock","bluetooth_pairing","digital_fence_settings","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"],"capabilities_available":[],"features":{"auto_lock":3.25,"bluetooth_pairing":true,"chassis":"s_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":{"ultrasonic":true},"mqtt_endpoint":"iot.eu-west-1.worxlandroid.com","mqtt_topics":{"command_in":"PRM100\/34865D79E748\/commandIn","command_out":"PRM100\/34865D79E748\/commandOut"},"warranty_registered":true,"purchased_at":"2023-05-17 00:00:00","warranty_expires_at":"2026-05-17 00:00:00","setup_location":{"latitude":xx.xxxxxxxx,"longitude":xx.xxxxxxxxxxx},"city":{"id":xxxxxxx,"country_id":0815,"name":"NEVERLAND","latitude":xx.xxxx,"longitude":xx.xxxxx,"created_at":"2018-02-15 22:06:52","updated_at":"2018-02-15 22:06:52"},"time_zone":"Europe\/Berlin","lawn_size":70,"lawn_perimeter":62,"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":null,"irrigation":null,"nutrition":null,"soil_type":null},"auto_schedule":false,"improvement":true,"diagnostic":true,"distance_covered":3752,"mower_work_time":249,"blade_work_time":237,"blade_work_time_reset":0,"blade_work_time_reset_at":null,"battery_charge_cycles":1,"battery_charge_cycles_reset":0,"battery_charge_cycles_reset_at":null,"created_at":"2022-05-25 10:50:56","updated_at":"2023-05-19 01:36:02","last_status":{"timestamp":"2023-05-19 12:24:04","payload":{"cfg":{"id":2,"sn":"MYSERIAL02492A5","dt":"19\/05\/2023","tm":"14:24:05","lg":"en","cmd":0,"sc":{"m":1,"d":[["09:30",30,0],["07:30",90,0],["07:30",90,1],["07:30",90,0],["07:30",90,0],["07:30",90,0],["09:45",60,1]],"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":[4,22,35,0],"mzv":[0,1,2,0,1,2,0,1,1,1],"rd":180,"al":{"lvl":1,"t":300},"tq":0,"modules":{"US":{"enabled":1}}},"dat":{"mac":"MYMAC","fw":3.28,"fwb":1,"ls":1,"le":0,"conn":"wifi","bt":{"t":15,"v":18.56,"p":65,"nr":1,"c":1,"m":0},"dmp":[-1.2,1.8,147.2],"st":{"b":404,"d":6295,"wt":418,"bl":62},"act":1,"rsi":-79,"lk":1,"tr":0,"lz":6,"rain":{"s":0,"cnt":0},"modules":{"US":{"stat":"ok"}}}}}}] 2023-05-19 14:27:09.704 [DEBUG] [d.internal.WorxLandroidBridgeHandler] - try to connect to AWS... 2023-05-19 14:27:10.063 [ERROR] [worxlandroid.internal.mqtt.AWSClient] - Exception: software.amazon.awssdk.crt.mqtt.MqttException: The connection was closed unexpectedly. 2023-05-19 14:27:10.064 [DEBUG] [d.internal.WorxLandroidBridgeHandler] - AWS connected: false

My Post @Roboter-forum

BobMiles commented 1 year ago

Now that you mention it, my ios app throws connection errors, too. I can't change or command anything. Maybe it really is locked up because of excessive usage through the binding? I'll wait a day or two and see what happens...

BetaHydri commented 1 year ago

Now that you mention it, my ios app throws connection errors, too. I can't change or command anything. Maybe it really is locked up because of excessive usage through the binding? I'll wait a day or two and see what happens...

Yes, I disabled the Binding (Bridge) on my rasberry (Openhab 3.4.4) for now and I will also wait 24h-48h and hope that at least the Worx App will be ok...

BetaHydri commented 1 year ago

After approx. 24h my account was unblocked, WorxLandroidBridgeHandler was able to connect again to AWS. I have now set the Landroid thing representing my S300 to:

In the Openhab logs I can see that reconnection to AWS happens now every 20min. The docs mentioned that 599 sec is the max? It seems to be 7200 sec as max. for the AWS reconnection interval.

BobMiles commented 1 year ago

After approx. 24h my account was unblocked, WorxLandroidBridgeHandler was able to connect again to AWS. I have now set the Landroid thing representing my S300 to:

  • Refresh status interval (300 sec)
  • Polling interval (300 sec)
  • Reconnect interval to AWS (1200 sec)

In the Openhab logs I can see that reconnection to AWS happens now every 30min. The docs mentioned that 599 sec is the max? It seems to be 7200 sec as max. for the AWS reconnection interval.

Thanks for the update, I did the account transfer to get it working again, but sadly I can tell you that I got blocked again with the following settings: Refresh: 600 Polling: 900 Reconnect 599

BetaHydri commented 1 year ago

Same here, today at ~10PM I was blocked also again.

sihui62 commented 1 year ago

Refresh: 600 Polling: 900 Reconnect 599

Please use these settings (Refreswh 1200, Polling 3600, Reconnect 0 or 300), runs since 5 weeks without any problems here:

https://github.com/nibi79/worxlandroid/issues/73#issuecomment-1507984587

BobMiles commented 1 year ago

Refresh: 600 Polling: 900 Reconnect 599

Please use these settings (Refreswh 1200, Polling 3600, Reconnect 0 or 300), runs since 5 weeks without any problems here:

#73 (comment)

Thank you so much! I dug through the original issue this morning and also saw that the setting are what makes or breaks this binding. Maybe it should state that in the instructions for new users. I might add that once I have it up and running again.

BetaHydri commented 1 year ago

Refresh: 600 Polling: 900 Reconnect 599

Please use these settings (Refreswh 1200, Polling 3600, Reconnect 0 or 300), runs since 5 weeks without any problems here: #73 (comment)

Thank you so much! I dug through the original issue this morning and also saw that the setting are what makes or breaks this binding. Maybe it should state that in the instructions for new users. I might add that once I have it up and running again.

Hi, I got the information from another German forum, that the worx account is limited to 150 MQTT request per day. So this limit will be reached quite fast with approx 150 x 9.6 requests/minute = 1440 min (24h).

nibi79 commented 1 year ago

information from another German forum

Can you give me the link, please?

150 MQTT request per day

per day or last 24h?

150 x 9.6 requests/minute = 1440 min (24h)

I don't understand your calculation!?

nibi79 commented 1 year ago

Does it work for everyone now? Can we close this issue?

BobMiles commented 1 year ago

Does it work for everyone now? Can we close this issue?

Yes, it's working for me. Thanks for merging the Docs!

sihui62 commented 1 year ago

Does it work for everyone now?

Thx again, works like a couple of weeks without any problems.

BetaHydri commented 1 year ago

information from another German forum

Can you give me the link, please?

150 MQTT request per day

per day or last 24h?

150 x 9.6 requests/minute = 1440 min (24h)

I don't understand your calculation!?

  • Regarding the calculation, I only pointed out how many requests/day it would theoretically possible until the 24h lockout of the worx account would happen. So, if there are no other requests e.g. from the android worx app, then maybe ~9 request/min may be possible? 1440min / 9.6request/min = 150 requests


how can you see these requests?
A ban lasts 24 hours - what do you mean by "hardly"?
Verbose 5 in the client.

Regarding the block, Worx claims that you don't notice this, but they see that I get blocked every now and then because I exceed the **150 requests/day and only third-party software** can do that. I had never installed IOBroker.
For me, however, the data was available throughout, only the mowed zone is asynchronous between Fhem and App and the boardercut is no longer reported.

I disabled the client on Sundays and on Mondays the bordercut message came back in the app. Currently the client is activated and the message does not come up again.

I don't understand that yet, but I don't get any more support from the "third-party software". Only when I switch them off, but then the problem no longer exists.```
RolandRosenfeld commented 1 year ago
  So, if there are no other requests e.g. from the android worx app, then maybe ~9 request/min may be possible?
  1440min / 9.6request/min = 150 requests

I think that is mathematically wrong. If you have 1440 min and 9.6 req/min than the result is 1440 min*9.6 req/min = 13824 req.

So if 150 requests are allowed we have 150 req/1440 min = 0.104 req/min. So you are allowed to send one request per 10 minutes.