theneweinstein / somneo

Home Assistant custom component for Philips Someo
32 stars 18 forks source link

Somneo integration stops working #57

Closed Nezz closed 2 months ago

Nezz commented 5 months ago

About two weeks ago I started having an issue where the integration stops working. The entities become unavailable and the integration is stuck in this state: image

The device has a fixed IP and I have IPv6 disabled in Home Assistant. I don't know where the error that's shown on mouseover comes from and why it has IPv6, but it's not in the logs.

Logs with DEBUG log level when restarting the integration:

2024-02-26 00:08:53.370 ERROR (SyncWorker_10) [pysomneo] Error connecting to somneo after 3 attempts.
2024-02-26 00:08:53.381 DEBUG (MainThread) [custom_components.somneo] Finished fetching somneo data in 0.018 seconds (success: False)
2024-02-26 00:08:58.360 ERROR (SyncWorker_30) [pysomneo] Error connecting to somneo after 3 attempts.
2024-02-26 00:08:58.368 DEBUG (MainThread) [custom_components.somneo] Finished fetching somneo data in 0.028 seconds (success: False)
2024-02-26 00:09:00.501 ERROR (SyncWorker_36) [pysomneo] Error connecting to somneo after 3 attempts.
2024-02-26 00:09:00.506 DEBUG (MainThread) [custom_components.somneo] Finished fetching somneo data in 0.011 seconds (success: False)

The data returned by https://192.168.0.55/di/v1/products/1/wusts

{"wusts":1,"rpair":false,"prvmd":false,"sdemo":false,"pwrsz":false,"nrcur":4,"snztm":9,"wizrd":99,"brght":1,"dspon":false,"canup":false,"fmrna":false,"wutim":65535,"dutim":65535,"sntim":65535,"updtm":65280,"updln":65310}

The device works fine and can be accessed using the SleepMapper app. Restarting it or HA does not help. Removing the existing device and re-adding it resolves the issue for a day or two:

2024-02-21 01:21:55.442 ERROR (SyncWorker_31) [pysomneo] Error connecting to somneo after 3 attempts.
2024-02-21 01:22:55.403 DEBUG (MainThread) [custom_components.somneo.config_flow] None
2024-02-21 01:23:02.646 DEBUG (MainThread) [custom_components.somneo.config_flow] {'name': 'Somneo', 'host': '192.168.0.55'}
2024-02-21 01:23:04.312 DEBUG (MainThread) [custom_components.somneo] Finished fetching somneo data in 1.099 seconds (success: True)
2024-02-21 01:23:06.012 DEBUG (MainThread) [custom_components.somneo] Finished fetching somneo data in 0.414 seconds (success: True)
2024-02-21 01:23:06.014 DEBUG (MainThread) [custom_components.somneo.select] custom
2024-02-21 01:23:06.014 DEBUG (MainThread) [custom_components.somneo.select] custom
2024-02-21 01:23:06.014 DEBUG (MainThread) [custom_components.somneo.select] workdays
2024-02-21 01:23:06.014 DEBUG (MainThread) [custom_components.somneo.select] tomorrow
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] workdays
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.015 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.016 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.016 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.016 DEBUG (MainThread) [custom_components.somneo.select] daily
2024-02-21 01:23:06.016 DEBUG (MainThread) [custom_components.somneo.select] soft rain
2024-02-21 01:23:06.016 DEBUG (MainThread) [custom_components.somneo.select] sunny day
Nezz commented 5 months ago

When the integration breaks, the IP in .storage/core.config_entries is changed to IPv6: image That's why re-adding the device (with IPv4) fixes the integration.

theneweinstein commented 2 months ago

Sorry for the late reply, I changed to code so it ignores IPv6 addresses, if you can test the beta release v2024.6.0b1 it should work.

Nezz commented 2 months ago

Thank you, it's working nicely.