I’m not using discovery. Manually configured entities instead.
Yeah… idea of removing availability check came across my mind. Thanks
Manual configuration uses the same code as discovery. The yaml is just passed to the objects instead of the discovery info. So it’s a 1 to 1 comp in that regards
Yes. I assume that. Thank you.
So, looks like I’m facing two different issues. Still waiting on asnwer from Shelly about AC powered device.
But I just encountered again issue with battery powered devices. All my battery Shelly H&T turned unavailable recently.
Main differences between them and mentioned above AC powerd devices are:
- those devices have no availability topic set
- those devices has expiration timeout to 24h
What happened yesterday is, I restarted HA at 12:51, then was reloading manually configured mqtt entities multiple times during a day.
Here is what found in logs:
cat ./home-assistant.log | grep -E "temp-kitchen|kitchen_temperature" | grep -v table
2021-11-20 16:30:16 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to shellies/temp-kitchen/sensor/temperature, mid: 5779
2021-11-20 16:30:16 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/temperature (retained): b'22.20'
2021-11-20 16:30:16 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=None, new_state=<state sensor.kitchen_temperature=22.20; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-20T16:30:16.100838+01:00>>
2021-11-20 16:30:16 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=22.20; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-20T16:30:16.100838+01:00>, new_state=<state sensor.kitchen_temperature=22.20; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-20T16:30:16.134957+01:00>>
2021-11-20 16:30:16 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to shellies/temp-kitchen/sensor/humidity, mid: 5780
2021-11-20 16:30:16 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/humidity (retained): b'54.0'
2021-11-21 02:28:08 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/temperature: b'22.20'
2021-11-21 02:28:08 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=22.20; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-20T16:30:16.134957+01:00>, new_state=<state sensor.kitchen_temperature=22.20; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T02:28:08.155853+01:00>>
2021-11-21 02:28:08 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/humidity: b'52.5'
2021-11-21 02:28:08 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/battery: b'100'
2021-11-21 11:04:13 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=22.20; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T02:28:08.155853+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T11:04:13.148924+01:00>>
2021-11-21 12:51:16 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T11:04:13.148924+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T12:51:16.969906+01:00>>
2021-11-21 12:54:34 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T12:51:16.969906+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T12:54:34.166672+01:00>>
2021-11-21 14:07:50 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T12:54:34.166672+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:07:50.729207+01:00>>
2021-11-21 14:19:19 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/temperature: b'22.45'
2021-11-21 14:19:19 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:07:50.729207+01:00>, new_state=<state sensor.kitchen_temperature=22.45; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:19:19.935248+01:00>>
2021-11-21 14:19:19 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/humidity: b'54.5'
2021-11-21 14:19:19 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/battery: b'100'
2021-11-21 14:21:20 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=22.45; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:19:19.935248+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:21:20.422972+01:00>>
2021-11-21 14:25:08 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/temperature: b'22.83'
2021-11-21 14:25:08 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:21:20.422972+01:00>, new_state=<state sensor.kitchen_temperature=22.83; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:25:08.503409+01:00>>
2021-11-21 14:25:08 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/humidity: b'54.0'
2021-11-21 14:25:08 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-kitchen/sensor/battery: b'100'
2021-11-21 14:27:31 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=22.83; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:25:08.503409+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:27:31.002663+01:00>>
2021-11-21 14:33:31 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:27:31.002663+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:33:31.424737+01:00>>
2021-11-21 14:36:52 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:33:31.424737+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:36:52.829243+01:00>>
2021-11-21 14:39:58 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:36:52.829243+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:39:58.600221+01:00>>
2021-11-21 14:41:59 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:39:58.600221+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:41:59.945812+01:00>>
2021-11-21 14:49:01 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.kitchen_temperature, old_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:41:59.945812+01:00>, new_state=<state sensor.kitchen_temperature=unavailable; unit_of_measurement=°C, friendly_name=Kitchen Temperature, device_class=temperature @ 2021-11-21T14:49:01.481926+01:00>>
In short,
at 2:28 most recent temperature value has been received from mqtt and set in entity
at 11:04 for some reason this sensor has been refreshed with the same values
at 12:51 temperature sensor went unavailable,
at 14:19 temperature is set to valid value because is refreshed from mqtt
at 14:21 it turns unavailable again without reason
at 14:25 temperature is set to valid value because is refreshed from mqtt
at 14:27 it turns unavailable again without reason
Reason of next sensor updates are not known for me but are executed roughly every 3 minutes not changing the state.
Because I make a grep for mqtt topic but for temperature sensor name, there are no log lines shown for humidity and battery sensor of this device. But both are unavailable too.
Here is similar log for other sensor. The behavior and timing are the same:
2021-11-20 16:30:15 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to shellies/temp-pcroom/sensor/humidity, mid: 5774
2021-11-20 16:30:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=25.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-20T16:30:15.919348+01:00>, new_state=<state sensor.pcroom_temperature=25.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-20T16:30:15.924397+01:00>>
2021-11-20 16:30:15 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/humidity (retained): b'50.0'
2021-11-20 18:53:15 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/temperature: b'24.50'
2021-11-20 18:53:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=25.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-20T16:30:15.924397+01:00>, new_state=<state sensor.pcroom_temperature=24.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-20T18:53:15.162819+01:00>>
2021-11-20 18:53:15 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/humidity: b'50.0'
2021-11-20 18:53:15 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/battery: b'100'
2021-11-21 03:57:42 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/temperature: b'23.50'
2021-11-21 03:57:42 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=24.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-20T18:53:15.162819+01:00>, new_state=<state sensor.pcroom_temperature=23.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T03:57:42.206813+01:00>>
2021-11-21 03:57:42 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/humidity: b'49.5'
2021-11-21 03:57:42 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/battery: b'100'
2021-11-21 11:20:29 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/temperature: b'24.50'
2021-11-21 11:20:29 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=23.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T03:57:42.206813+01:00>, new_state=<state sensor.pcroom_temperature=24.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T11:20:29.190627+01:00>>
2021-11-21 11:20:29 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/humidity: b'50.0'
2021-11-21 11:20:29 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/temp-pcroom/sensor/battery: b'100'
2021-11-21 11:41:07 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=24.50; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T11:20:29.190627+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T11:41:07.293522+01:00>>
2021-11-21 12:51:16 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T11:41:07.293522+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T12:51:16.779165+01:00>>
2021-11-21 13:47:07 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T12:51:16.779165+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T13:47:07.439301+01:00>>
2021-11-21 14:07:50 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T13:47:07.439301+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:07:50.398601+01:00>>
2021-11-21 14:21:20 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:07:50.398601+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:21:20.243528+01:00>>
2021-11-21 14:27:30 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:21:20.243528+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:27:30.825043+01:00>>
2021-11-21 14:33:31 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:27:30.825043+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:33:31.245656+01:00>>
2021-11-21 14:35:34 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:33:31.245656+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:35:34.314269+01:00>>
2021-11-21 14:39:58 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:35:34.314269+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:39:58.214383+01:00>>
2021-11-21 14:41:59 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:39:58.214383+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:41:59.662461+01:00>>
2021-11-21 14:49:01 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.pcroom_temperature, old_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:41:59.662461+01:00>, new_state=<state sensor.pcroom_temperature=unavailable; unit_of_measurement=°C, friendly_name=PCroom Temperature, device_class=temperature @ 2021-11-21T14:49:01.204123+01:00>>
And here are configuration of the sensor:
######
# KITCHEN SENSORS
# - temperature
# - humidity
# - battery
######
- platform: mqtt
name: "Kitchen Temperature"
state_topic: "shellies/temp-kitchen/sensor/temperature"
json_attributes_topic: "shellies/temp-kitchen/sensor/temperature"
unit_of_measurement: "°C"
force_update: true
device_class: temperature
expire_after: 86400
- platform: mqtt
name: "Kitchen Humidity"
state_topic: "shellies/temp-kitchen/sensor/humidity"
json_attributes_topic: "shellies/temp-kitchen/sensor/humidity"
unit_of_measurement: "%"
payload_available: "true"
payload_not_available: "false"
force_update: true
device_class: humidity
expire_after: 86400
- platform: mqtt
name: "Kitchen bttry"
state_topic: "shellies/temp-kitchen/sensor/battery"
unit_of_measurement: "%"
payload_available: "true"
payload_not_available: "false"
force_update: true
device_class: battery
expire_after: 86400
- platform: template
sensors:
kitchen_temp_battery:
friendly_name: "Kitchen Sensor Battery"
device_class: battery
unit_of_measurement: "%"
value_template: "{{ states('sensor.kitchen_bttry') }}"
(just noticed payload_available/payload_not_available set for 2 of those sensors. but it should make no difference since topic is not defined. Also temperature sensor has no those settings but fails too)
Just thinking if it has something to do with HA restart (see the same time, but one day later, one day = 24h) and possibly with subsequent mqtt entities reloading.
I have other battery powered shelly sensors (DW) but those have no expiration set. And they remain available.
Do you think it’s enough to raise issue on GitHub?
I reported expiration issue to github. Due to no any response, I decided to remove expiration from entities. Tbh not having this feature is less problematic than loosing sensors every few days.
Anyway what is more important I found that after removing expiration lines from entity configs and reloading manually configured mqtt entities, next day I lost those entities again.
It confirms that something is really screwed around this.
Then I restarted HA and since this time no more issues.
Maybe worth to say again that I’m talking about battery powered devices (see config in prev posts) so there is no way they turn unavailable. Also in order to make sure there are no invalid data causing this issue I created test sensors based on the same mqtt topics with use of NR. So I’m pretty sure there is an issue in HA core.
BTW, can you help somehow with pushing this git issue forward? 3 weeks without any reaction. Not sure if it’s expected in case of such a crucial component like mqtt.
Issues like this could take months to identify before a fix can be applied. The fact that you can’t identify it yourself and you have the issue shows that anyone else without the issue is going to have even more difficulty identifying the problem. Best advice I can give is to be patient and keep the issue alive by responding in it.
Yeah, I’d like to respond and help but nobody asking questions. Im afraid that after month or two bots will start closing this issue due to no development activity (which is extremely discouraging for reporters and imo doesn’t help anything, but this is subject for another discussion)
I think I narrowed the issue down to the feature of manual reloading entities. There should be no big problem to find what has been forgotten (fixing might be more complex depending on various things, though)
if you respond, the issue doesn’t get closed
the bot does not distinguish between members and non-members. It only cares about active conversations
here’s the code: as an FYI reloading reinits the entity. Both onboarding and reloading follow the same code. It could be related but I doubt it seeing as the config will be the same.
init
updating the state
the availability
To me, if this were a bug it would be in the availability, and I would start looking at the fget because the availability is based on the expiration and if it exists in that database. The reload may clear that accidentally or something
Hello. Seems the bug has been identified and the fix prepared.
But I’m not sure what next. Seems it didn’t get into any release yet. Label says it should be released withing 2022.2.x releases. (8 patches has been released since then)
Unfortunately more than 2 weeks there is no movement (while issue has been closed by a bot). I cannot find any information in github confirming it has been merged to official release branch.
Can you help describing current situation?
it’s merged, so it’s probably going into 2022.3
Yeah I saw merged to dev. But since emontnemery labeled it as 2022.2 milestone I though It will get to Feb.
Anyway thank you for instant answer.
I don’t know the process to 100%, but I’m fairly sure frenck just chooses the safest PR fixes for the xxxx.x.1+ fixes and all the volatile stuff goes into xxxx.x.0 & dev builds.
Could you please assist me finding confirmation if this fix either landed in 2022.3 or not?
It seems it’s not mentioned in changelog as well as I cannot see any references in GitHub
It was merged awhile ago, you can check the current releases history to see if it’s in there, which it is.
Yeah… indeed has been merged into dev branch to land later in v.3.0b0
Not sure what did you mean by ’ current releases history ’ but I found the merge commit by comparing releases by tags . A lot of clicks needed to load all those commits. Maybe there is a better way. For sure I would find it quicker using GIT directly.
However found no word in release changelogs etc.
Obviously there is too many items to expect all of them in changelog. Looks like this bug was not important enough to inform about fix either (or maybe was too critical to boast?)
Anyway thank you for your support.
with over 1k PRs merged a release, some might fall through the documentation cracks.
Still not updated to 2022.3. Waiting for patches. Looking forward to confirm it definitively fixes expire issue.
But I wonder if the fix is somehow related to second issue discussed in this thread. It is about AC powered devices which occasionally turn into unavailable. Recently I found it’s not affecting only one type of device (Shelly2.5) but also Shelly Dimmer.
Today I had opportunity to make some additional test.
The behavior is always the same: at some point entity turns unavailable and never recover while at the same time:
- the device is working
- the device is accessible in the network
- the device constantly reports to MQTT
- its online topic is set to true
Additionaly debug logs shows receiving all mqtt data changes. One of my posts above suggests that device reported online=false and this state was never changed later to true. But today I know that the topic in MQTT is set to true. So maybe HA somehow skips the first change?
As mentioned I had opportunity to make some tests on device which is reported as unavailable. I found I can recover entity either telling a device to announce itself or by manually set online topic to true (regardless the topic is already set to true before). This last thing somehow surprise me. I don’t know what to think about it. Cannot imagine the reason.
Note, that once entity is recovered, it properly react on changing online topic to false and true again.
So question is why sometimes it ignores the the online topic state.
I would like to collect some more information in order to properly report it.
BTW I wonder why I’m the only one who reports those particular two issues. Those are not device specific. Considering how many people uses mqtt it must affect many of them. Maybe they blame devices or wifi or so instead pointing at HA.
- platform: mqtt
schema: template
name: "Bedroom R"
state_topic: "shellies/light-sleep_r/light/0/status"
availability_topic: "shellies/light-sleep_r/online"
command_topic: "shellies/light-sleep_r/light/0/set"
state_template: "{% if value_json.ison %} on {% else %} off {% endif %}"
command_on_template: '{"turn": "on"{% if brightness is defined %}, "brightness": {{(brightness | float * 0.3882 + 1) | round(0)}}{% endif %}}'
command_off_template: '{"turn": "off"}'
brightness_template: "{{ (value_json.brightness | float * 2.55) | round(0) }}"
payload_available: "true"
payload_not_available: "false"
qos: 1
retain: false
optimistic: false