Skip to content

Shelly gas sensor doesn't update last_reported for gas concentration #146740

Open
@avandorp

Description

@avandorp

The problem

The shelly integration doesn't set the states last_reported value when the shelly gas sensor is reporting in. It doesn't matter whether it is via Coap or REST (see debug output below). A look into the HA-DB shows that the last_reported_ts mirrors the last_updated_ts and is usually as old as the last connection failure. For a gas sensor it's vital to know when the state has been reported the last time, even if its value did not change.

2025-06-13 15:09:29.325 DEBUG (MainThread) [homeassistant.components.shelly] REST update for shellygas-083A8DXXXXX 2025-06-13 15:09:29.325 DEBUG (MainThread) [aioshelly.block_device.device] host 192.168.0.XXX: http request: /status (params=None) 2025-06-13 15:09:30.391 DEBUG (MainThread) [aioshelly.block_device.device] aiohttp response: {'wifi_sta': {'connected': True, 'ssid': 'XXXXXXXX', 'ip': '192.168.0.XXX', 'rssi': -81}, 'cloud': {'enabled': False, 'connected': False}, 'mqtt': {'connected': False}, 'time': '15:09', 'unixtime': 1749820171, 'serial': 5, 'has_update': False, 'mac': '083A8DXXXXX, 'cfg_changed_cnt': 3, 'actions_stats': {'skipped': 0}, 'gas_sensor': {'sensor_state': 'normal', 'self_test_state': 'not_completed', 'alarm_state': 'none'}, 'concentration': {'ppm': 0, 'is_valid': True}, 'valves': [{'state': 'not_connected'}], 'update': {'status': 'idle', 'has_update': False, 'new_version': '20230913-114427/v1.14.0-gcb84623', 'old_version': '20230913-114427/v1.14.0-gcb84623', 'beta_version': '20231107-165146/v1.14.1-rc1-g0617c15'}, 'ram_total': 52528, 'ram_free': 40548, 'fs_size': 233681, 'fs_free': 93121, 'uptime': 7410999} 2025-06-13 15:09:30.391 DEBUG (MainThread) [homeassistant.components.shelly] Finished fetching shellygas-083A8DXXXXX data in 1.066 seconds (success: True)

2025-06-13 15:09:54.630 DEBUG (MainThread) [aioshelly.block_device.coap] CoapMessage: ip=192.168.0.XXX, type=CoapType.PERIODIC(30), options={11: b's', 3332: b'SHGS-1#083A8DXXXXX#2', 3412: b'\x96\x00', 3420: b'\x05\x00'}, payload={'G': [[0, 9103, 3], [0, 3113, 'normal'], [0, 3114, 'not_completed'], [0, 6108, 'none'], [0, 3107, 0], [0, 1105, 'not_connected']]} 2025-06-13 15:09:54.630 DEBUG (MainThread) [aioshelly.block_device.coap] Calling CoAP message update for device id XXXXX 2025-06-13 15:09:54.630 DEBUG (MainThread) [homeassistant.components.shelly] Shelly shellygas-083A8DXXXXX handle update, type: BlockUpdateType.COAP_PERIODIC 2025-06-13 15:09:54.630 DEBUG (MainThread) [homeassistant.components.shelly] Manually updated shellygas-083A8DXXXXX data

last_reported on state still shows a timestamp from 19 hours ago.

What version of Home Assistant Core has the issue?

2025.5.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Shelly

Link to integration documentation on our website

https://www.home-assistant.io/integrations/shelly

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions