home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.89k stars 30.96k forks source link

Shelly Gen1 H&T measurements are not updated #116865

Closed tush80 closed 2 months ago

tush80 commented 6 months ago

The problem

Shelly H&T devices (gen 1) measurements are not updated in HA; H&T Plus, Flood, TRVs all seem to be working fine. That was not observed with version 2024.4.x and and seems to be happening on 2024.5.x Debug log and diagnostic data from some H&T devices is attached. The device with IP 192.168.88.54 was removed and added again, this is why there are more recent temperature updates in the screenshot but it did stop updating again. Reloading integration/restarting HA does not help. All have static IP addresses, CoIoT is setup as IP:Port 192 168 88 51 192 168 88 52 192 168 88 54

What version of Home Assistant Core has the issue?

core-2024.5.1

What was the last working version of Home Assistant Core?

core-2024.4.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Shelly

Link to integration documentation on our website

No response

Diagnostics information

config_entry-shelly-e8d255aeead21a964c48f741cba495ba.json config_entry-shelly-ff3189ceab3ae5ffc7336434856ddb2a.json config_entry-shelly-7aa429689fbe0f3d2fd35827a86ad87a.json home-assistant_shelly_2024-05-05T14-52-02.252Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 6 months ago

Hey there @balloob, @bieniu, @thecode, @chemelli74, @bdraco, mind taking a look at this issue as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `shelly` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign shelly` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


shelly documentation shelly source (message by IssueLinks)

bieniu commented 6 months ago

Diagnostics files show that devices are not initialized. Please wake up the device before save a diagnostics file.

tush80 commented 6 months ago

Hi @bieniu Even after waking the device, the diagnostics file still says not initialized. Anything else I can do? Thank you!

config_entry-shelly-ff3189ceab3ae5ffc7336434856ddb2a (1).json

bieniu commented 6 months ago

This means that data from the device does not reach the HA server. Is HT on the same subnet as the HA server? Has the IP address of the HA server not changed? Is unicast properly configured on the device?

tush80 commented 6 months ago

HTs are on another subnet together with a working HT Plus; the IP of the HA server is static/verified correct, unicast is confgured according to the documentation - IP:port. image image image

Based on the following part of the debug log, I assumed the communication to the HA server works: image

Thanks for looking into this!

bieniu commented 6 months ago

Which firmware version do the devices use?

tush80 commented 6 months ago

1.14.0

thecode commented 6 months ago

@tush80 can you provide a longer debug log that starts from HA startup and has messages from this device? The log you provided in the first post doesn't contain any messages from this device. I would like to see the full init flow of the device. Thanks

tush80 commented 6 months ago

Hi @thecode After enabling debug logging, HA was restarted. The collected log for almost 12 hours is here, hopefully containing something useful: home-assistant_shelly_2024-05-06T08-43-31.828Z.log The devices that have the problem are with IPs 192.168.88.51 to 54; 192.168.88.50 (HT Plus) works fine. Thank you!

thecode commented 6 months ago

Hi @thecode After enabling debug logging, HA was restarted. The collected log for almost 12 hours is here, hopefully containing something useful: home-assistant_shelly_2024-05-06T08-43-31.828Z.log The devices that have the problem are with IPs 192.168.88.51 to 54; 192.168.88.50 (HT Plus) works fine. Thank you!

I checked two devices and they both timeout on fetching settings from the device (10 seconds timeout):

2024-05-06 02:43:02.124 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.88.54: http request: /settings (params=None)
2024-05-06 02:43:12.126 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.88.54: error: DeviceConnectionError(TimeoutError())

The only devices that succeeds are the ones on the 87 network:

2024-05-06 01:44:00.850 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.87.51: http request: /settings (params=None)
2024-05-06 01:44:00.877 DEBUG (MainThread) [aioshelly.block_device.device] aiohttp response: {'device': {'type': 'SHTRV-01',

I don't think we can do anything from here, you need to verify why the HTTP call fails to the other network, might be routing issue. Please also note that in general we do not support working with VLANs.

tush80 commented 6 months ago

@thecode thank you for the directions, I'll investigate further for possible network issues. In the mean time I downgraded to 2024.4.4 and downloaded the debug log for reference home-assistant_shelly_2024-05-07T05-05-01.221Z.log

muibeta commented 6 months ago

I also am experiencing unavailable messages with four recently purchased Shelly H&T Gen 2 devices under Home Assistant version 2024.5.3. On reading this post, I restored back 2024.4.4 and the four Shelly H&T Gen 2 have remained available consistently for the last 24 hours. The Firmware in the Shelly H&T Gen 2s is up to date and I have configured the websockets to point to the instance of Home Assistant. Under version 2024.5.3 each Shelly H&T would separately show as unavailable very 15-30 minutes for 15-30 minutes. The Shelly app displayed their readings consistently throughout. I am running Home Assistant in virtual machines on a Synology NAS and in Windows 11. The IP addresses of each Shelly H&Ts has been reserved in my home router. The LAN is a simple 192.168.1.2 - 192.168.1.255 range.

furansa commented 5 months ago

I hope everyone is doing good. Not sure if it's useful but I can confirm the issue also happening on HA core 2024.5.4 running on Docker.

NicolasGoeddel commented 5 months ago

I have the same issue after upgrading from 2024.4.4 to the the latest version. Nothing has changed outside HomeAssistant. I run HA in a docker compose stack and all the other Shelly Plugs work fine. Only the H&T Gen1 devices seem to retrieve no new data. Debug view shoes data coming from the devices though:

homeassistant       | 2024-06-09 14:23:20.794 DEBUG (MainThread) [aioshelly.block_device.coap] CoapMessage: ip=192.168.178.40, type=CoapType.PERIODIC(30), options={11: b's', 3332: b'SHHT-1#7076CF#2', 3412: b'\x96\x00', 3420: b'\x01\x00'}, payload={'G': [[0, 9103, 0], [0, 3101, 23.65], [0, 3102, 74.57], [0, 3103, 55.4], [0, 3115, 0], [0, 3111, 100], [0, 9102, ['sensor']]]}

192.168.178.40 is one of them. Here's a line from a Shelly Plug S device for comparison:

homeassistant       | 2024-06-09 14:23:21.928 DEBUG (MainThread) [aioshelly.block_device.coap] CoapMessage: ip=192.168.178.45, type=CoapType.PERIODIC(30), options={11: b's', 3332: b'SHPLG-S#7C87CEBA5148#2', 3412: b'\x96\x00', 3420: b'\xe6\x00'}, payload={'G': [[0, 9103, 0], [0, 1101, 1], [0, 4101, 1.52], [0, 4103, 154529], [0, 6102, 0], [0, 6109, 0.0], [0, 3104, 29.29], [0, 3105, 84.73], [0, 6101, 0]]}

Please fix this asap or show us a workaround because I really don't want to stay on 2024.4.4 too long.

bieniu commented 5 months ago

Today I performed a 12-hour Shelly HT test. I see absolutely no problems with updating the temperature and humidity values ​​in the HA. We suspect that the problem may be caused by blocking the event loop by another integration (probably custom one). The CoIoT packet with status reaches the HA server but cannot be processed correctly. To check this, please enable HA built-in debug mode, restart HA and attach the log file after few hours.

fhemberger commented 5 months ago

I'm running 2024.6.2 via Docker with only two integrations:

configuration.yaml

homeassistant:
  debug: true

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - "172.18.0.0/16"

assist_pipeline:
backup:
config:
energy:
history:
homeassistant_alerts:
image_upload:
logbook:
mobile_app:
my:
ssdp:
webhook:
zeroconf:

Shelly HT

Firmware: 20230913-112531/v1.14.0-gcb84623 (latest) CoIoT enabled (peer: mcast)

What I did

  1. I enabled the debug mode (as described in the previous post) and restarted the Docker container.
  2. Woke up the device, clicked "Reconfigure" without changing any values, just to make sure Home Assistant can connect to the device.
  3. I see the debug output showing up in the logs. I keep debug mode running, no further debug messages (not even connection attempts to the device) afterwards.
  4. I enabled the Pi-hole debug log as well and can see Home Assistant successfully polling updates every 5 minutes (not part of attached log).

Debug log output

2024-06-12 07:36:36.171 DEBUG (MainThread) [homeassistant.components.shelly] Deleting issue push_update_A4CF12F401D6
2024-06-12 07:36:36.173 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.178.15: block device shutdown
2024-06-12 07:36:36.174 DEBUG (MainThread) [aioshelly.block_device.coap] Sending request 'cit/s' to device 192.168.178.15
2024-06-12 07:36:36.176 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.178.15: block device create, MAC: A4CF12F401D6
2024-06-12 07:36:36.176 DEBUG (MainThread) [aioshelly.block_device.coap] Adding device F401D6 to CoAP message subscriptions
2024-06-12 07:36:36.176 DEBUG (MainThread) [homeassistant.components.shelly] Setting up offline block device shellyht-bedroom
2024-06-12 07:36:36.209 DEBUG (MainThread) [aioshelly.block_device.coap] CoapMessage: ip=192.168.178.15, type=CoapType.REPLY(69), options={11: b's', 3332: b'SHHT-1#F401D6#2', 3412: b'\x96\x00', 3420: b'\x01\x00'}, payload={'G': [[0, 9103, 0], [0, 3101, 22.0], [0, 3102, 71.6], [0, 3103, 60.0], [0, 3115, 0], [0, 3111, 100], [0, 9102, ['button']]]}
2024-06-12 07:36:36.209 DEBUG (MainThread) [aioshelly.block_device.coap] Calling CoAP message update for device id F401D6
2024-06-12 07:36:36.210 DEBUG (MainThread) [homeassistant.components.shelly] Shelly shellyht-bedroom handle update, type: BlockUpdateType.ONLINE
2024-06-12 07:36:36.210 DEBUG (MainThread) [homeassistant.components.shelly] Connecting to Shelly Device - shellyht-bedroom
2024-06-12 07:36:36.210 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.178.15: block device initialize
2024-06-12 07:36:36.213 DEBUG (MainThread) [homeassistant.components.shelly] Push update failures for shellyht-bedroom: 0
2024-06-12 07:36:36.214 DEBUG (MainThread) [homeassistant.components.shelly] Manually updated shellyht-bedroom data
2024-06-12 07:36:36.228 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.178.15: http request: /settings (params=None)
2024-06-12 07:36:36.258 DEBUG (MainThread) [aioshelly.block_device.device] aiohttp response: {'device': {'type': 'SHHT-1', 'mac': 'A4CF12F401D6', 'hostname': 'shellyht-F401D6', 'sleep_mode': True}, 'wifi_ap': {'enabled': False, 'ssid': 'shellyht-F401D6', 'key': ''}, 'wifi_sta': {'enabled': True, 'ssid': 'REDACTED', 'ipv4_method': 'static', 'ip': '192.168.178.15', 'gw': '192.168.178.1', 'mask': '255.255.255.0', 'dns': None}, 'wifi_sta1': {'enabled': False, 'ssid': None, 'ipv4_method': 'dhcp', 'ip': None, 'gw': None, 'mask': None, 'dns': None}, 'mqtt': {'enable': False, 'server': '192.168.33.3:1883', 'user': '', 'id': 'shellyht-F401D6', 'reconnect_timeout_max': 60.0, 'reconnect_timeout_min': 2.0, 'clean_session': True, 'keep_alive': 60, 'max_qos': 0, 'retain': False, 'update_period': 30}, 'coiot': {'enabled': True, 'update_period': 15, 'peer': ''}, 'sntp': {'server': 'time.google.com', 'enabled': True}, 'login': {'enabled': False, 'unprotected': False, 'username': 'admin'}, 'pin_code': '', 'name': 'shellyht-bedroom', 'fw': '20230913-112531/v1.14.0-gcb84623', 'pon_wifi_reset': False, 'discoverable': True, 'build_info': {'build_id': '20230913-112531/v1.14.0-gcb84623', 'build_timestamp': '2023-09-13T11:25:31Z', 'build_version': '1.0'}, 'cloud': {'enabled': False, 'connected': False}, 'timezone': 'Europe/Berlin', 'lat': 50.929798, 'lng': 6.9489, 'tzautodetect': True, 'tz_utc_offset': 7200, 'tz_dst': False, 'tz_dst_auto': True, 'time': '07:36', 'unixtime': 1718170596, 'debug_enable': False, 'allow_cross_origin': False, 'actions': {'active': False, 'names': ['report_url', 'temp_over_url', 'temp_under_url', 'hum_over_url', 'hum_under_url']}, 'sensors': {'temperature_threshold': 1.0, 'temperature_unit': 'C', 'humidity_threshold': 5.0}, 'sleep_mode': {'period': 12, 'unit': 'h'}, 'external_power': 0, 'temperature_offset': 0.0, 'humidity_offset': 0.0}
2024-06-12 07:36:36.259 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.178.15: http request: /status (params=None)
2024-06-12 07:36:36.283 DEBUG (MainThread) [aioshelly.block_device.device] aiohttp response: {'wifi_sta': {'connected': True, 'ssid': 'REDACTED', 'ip': '192.168.178.15', 'rssi': -38}, 'cloud': {'enabled': False, 'connected': False}, 'mqtt': {'connected': False}, 'time': '07:36', 'unixtime': 1718170596, 'serial': 1, 'has_update': False, 'mac': 'A4CF12F401D6', 'cfg_changed_cnt': 0, 'actions_stats': {'skipped': 0}, 'is_valid': True, 'tmp': {'value': 22.0, 'units': 'C', 'tC': 22.0, 'tF': 71.6, 'is_valid': True}, 'hum': {'value': 60.0, 'is_valid': True}, 'bat': {'value': 100, 'voltage': 2.96}, 'act_reasons': ['button'], 'connect_retries': 0, 'sensor_error': 0, 'update': {'status': 'idle', 'has_update': False, 'new_version': '20230913-112531/v1.14.0-gcb84623', 'old_version': '20230913-112531/v1.14.0-gcb84623', 'beta_version': '20231107-162243/v1.14.1-rc1-g0617c15'}, 'ram_total': 52384, 'ram_free': 41228, 'fs_size': 233681, 'fs_free': 153612, 'uptime': 55}
2024-06-12 07:36:36.284 DEBUG (MainThread) [aioshelly.block_device.coap] Sending request 'cit/d' to device 192.168.178.15
2024-06-12 07:36:36.294 DEBUG (MainThread) [aioshelly.block_device.coap] CoapMessage: ip=192.168.178.15, type=CoapType.REPLY(69), options={3332: b'SHHT-1#F401D6#2'}, payload={'blk': [{'I': 1, 'D': 'sensor_0'}, {'I': 2, 'D': 'device'}], 'sen': [{'I': 9103, 'T': 'EVC', 'D': 'cfgChanged', 'R': 'U16', 'L': 2}, {'I': 3101, 'T': 'T', 'D': 'extTemp', 'U': 'C', 'R': ['-55/125', '999'], 'L': 1}, {'I': 3102, 'T': 'T', 'D': 'extTemp', 'U': 'F', 'R': ['-67/257', '999'], 'L': 1}, {'I': 3103, 'T': 'H', 'D': 'humidity', 'R': ['0/100', '999'], 'L': 1}, {'I': 3115, 'T': 'S', 'D': 'sensorError', 'R': '0/1', 'L': 1}, {'I': 3111, 'T': 'B', 'D': 'battery', 'R': ['0/100', '-1'], 'L': 2}, {'I': 9102, 'T': 'EV', 'D': 'wakeupEvent', 'R': ['battery/button/periodic/poweron/sensor/alarm', 'unknown'], 'L': 2}]}
2024-06-12 07:36:36.294 DEBUG (MainThread) [aioshelly.block_device.coap] Calling CoAP message update for device id F401D6
2024-06-12 07:36:36.294 DEBUG (MainThread) [homeassistant.components.shelly] Shelly shellyht-bedroom handle update, type: BlockUpdateType.INITIALIZED
2024-06-12 07:36:36.295 DEBUG (MainThread) [homeassistant.components.shelly] Push update failures for shellyht-bedroom: 0
2024-06-12 07:36:36.295 DEBUG (MainThread) [homeassistant.components.shelly] Manually updated shellyht-bedroom data
2024-06-12 07:36:36.295 DEBUG (MainThread) [homeassistant.components.shelly] Skipping non-input event block sensor_0
2024-06-12 07:36:36.295 DEBUG (MainThread) [homeassistant.components.shelly] Skipping non-input event block device
2024-06-12 07:36:36.295 DEBUG (MainThread) [homeassistant.components.shelly] Entity shellyht-bedroom temperature attached to block
2024-06-12 07:36:36.296 DEBUG (MainThread) [homeassistant.components.shelly] Entity shellyht-bedroom humidity attached to block
2024-06-12 07:36:36.296 DEBUG (MainThread) [homeassistant.components.shelly] Entity shellyht-bedroom battery attached to block
2024-06-12 07:36:36.296 DEBUG (MainThread) [homeassistant.components.shelly] Updating device registry info for shellyht-bedroom

I'm new to Home Assistant, so maybe I'm just missing something. But the sensor worked flawlessly before using MQTT and visualizing the data with Prometheus/Grafana. Not getting sensor updates in Home Assistant is a bummer.

chemelli74 commented 5 months ago

Shelly HT

Firmware: 20230913-112531/v1.14.0-gcb84623 (latest) CoIoT enabled (peer: mcast)

Please read carefully the documentation; you are requested to configure CoIoT in unicast.

fhemberger commented 5 months ago

@chemelli74 Ah, sorry for that!

NicolasGoeddel commented 5 months ago

After changing the IP address of my Shelly HTs and changing the configuration of them in HA while the Shellys were not yet in sleep mode, I was able to enable them again. I still have no clue why this happened in the first place. I usually make my updates on time. Every time a new container image got released I update HA on the same day. Only the update after 2024.4.4 create the problem with my Shellys.

issue-triage-workflows[bot] commented 2 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.