claudegel / sinope-130

Neviweb130 custom component for Home Assistant to manage devices connected via a GT130 and wifi devices from Sinopé
GNU General Public License v3.0
73 stars 15 forks source link

Reconnect after disconnection #169

Open DanielRegert opened 1 year ago

DanielRegert commented 1 year ago

I'm not sure if it's just a coincidence or not, but after I updated my HA version, my thermostats (2 x TH1123WF) seem to be disconnecting from wi-fi like once a day at random hours. Once they disconnect, I get the following messages on HA:

Then you will have to re-activate device neviweb130 climate TH1123WF with service.neviweb130_set_activation.
9:30:34 AM – (WARNING) Sinope Neviweb130 (custom integration) - message first occurred at 9:30:34 AM and shows up 2 times
This device neviweb130 climate TH1123WF is de-activated and won't be polled until you put it back on HA and neviweb.
9:30:34 AM – (WARNING) Sinope Neviweb130 (custom integration) - message first occurred at 9:30:34 AM and shows up 2 times
Device neviweb130 climate TH1123WF is disconected from Neviweb: {'error': {'code': 'DVCUNVLB', 'data': {'identifier': 'ec6260fffea8cb98'}}}...(SKU: TH1123WF)
9:30:34 AM – (WARNING) Sinope Neviweb130 (custom integration) - message first occurred at 9:30:34 AM and shows up 2 times

After that happens, the only way to bring the thermostat back in seems to be a HA restart. So, I did try to create a routine that runs every 30min and if it detects that the thermostat is disconnected, it calls:

 - service: neviweb130.set_activation
    data:
      entity_id: climate.neviweb130_climate_th1123wf_2
      active: true

That call seems to work fine once the thermostat is back online, but it doesn't seem to bring the data back to HA. Is this the correct way to restart the "connection" with HA?

HA versions (downgraded from 2023.8.1 because some HACS extensions do not work with the new Python version):

Home Assistant 2023.7.2
Supervisor 2023.08.1
Operating System 10.4
claudegel commented 1 year ago

Hi, when neviweb130 poll Neviweb for device data update, if Neviweb is unable to connect with the device it will return an error message DVCUNVLB to neviweb130 and this is reported in the HA log. Normally when a device is disconected from Neviweb for any raison, wifi problem, router problem, defective device etc. HA will flood the log with a message like this {'error': {'code': 'DVCUNVLB', 'data': {'identifier': 'ec6260fffea8cb98'}}}...(SKU: TH1123WF) every scan_intervall time. To prevent this excess error messages I've added an activation/deactivation service and when I catch the error DVCUNVLB I just deactivate that device and write in the log the message you got. At each HA restart I test the device and if it is still absent I deactivate it again. If you find out what is the problem and the device is back in Neviweb you can use service: neviweb130.set_activation to reactivate the device polling without restarting HA. I don't think that the last HA update have something to do with your wifi device disconnection from Neviweb as Neviweb don't know anything about HA. Did you check in Neviweb if your device is still available when it get deactivated. Check your device history in the monthly section to see if there is missing data. You need to find why your two device are disconnecting from Neviweb

claudegel commented 1 year ago

Do you have only those two thermostats wifi or you have others that are working normally ? I've noticed that for my thermostats and all my zigbee device there are two holes in data history in neviweb. neviweb-data

sicarriere commented 1 year ago

I have the same two hole in my history for all of my WiFi and Zigbee devices connected to neviweb.

Because of that, I need to re-activated my devices to let sinope-130 to poll data from neviweb again.

DanielRegert commented 1 year ago

Do you have only those two thermostats wifi

Yeah, I only have those two.

What I noticed is that they don't necessarily lose the WiFi connection at the same time. But I agree it was probably just a coincidence that they started doing that after a HA update, most likely something with my network.

I did check neviweb and when the thermostats are offline, they do not show there. As soon I restore the connection (even if I manually do it on the thermostat) they are back on neviweb. But the part that doesn't seem to be working for me is that even after the devices are back in neviweb, I cannot bring them back to HA by just calling neviweb130.set_activation I need to restart HA then they get back to normal.

claudegel commented 1 year ago

Those two holes are probably because of major update of neviweb by Sinopé. I've asked Sinopé how the wifi connection work with neviweb. They wil probably send some support data next week but I'm away next week. Once I'm back I'll check if I can improve neviweb130 to better manage wifi devices. Sinopé is doing a lot of update because now it's the quiet period before next winter peak period. Probably it's a network problem on your side but if it as something to do with Neviweb I'll try to find a fix to improve stability.

claudegel commented 1 year ago

Wifi devices have some limitation because of the rooter you have. Some rooter like Bell hub 3000 do not support more then 15 connected devices. If you have more wifi devices, then some thermostat may loose there connection with Neviweb. If you have an Asus rooter then switch DTIM value to 1. This should prevent device disconnect from Neviweb. I'll try to find out a way to disconnect devices from HA when they are disconnected from Neviweb, This way we will know that something is wrong with wifi connection.

DanielRegert commented 1 year ago

Link comment here for reference: https://github.com/claudegel/sinope-130/issues/170#issuecomment-1686921389