rtl_433-hass-addons icon indicating copy to clipboard operation
rtl_433-hass-addons copied to clipboard

Support last-updated for unchanging sensor values

Open Gonioul opened this issue 2 years ago • 8 comments

Hi,

Looks like the last-updated value of the entity isn't updated if the sensor value doesn't change (temperature for example).

The only way to know the entity is not dead is to look for the utc value of the device.

Regards,

Gonioul avatar May 19 '22 20:05 Gonioul

Good thought! My sensors all update fairly frequently with different values. Can you check to see if rtl_433 is sending the value to mqtt?

My first guess is we may want to set force_update, which defaults to false. If that's the case, we should change this upstream first at https://github.com/merbanan/rtl_433/blob/master/examples/rtl_433_mqtt_hass.py.

deviantintegral avatar May 25 '22 01:05 deviantintegral

I just ran into this same situation with a humidity sensor. It was raining outside and relative humidity was at 100% for an extended period (several hours). I confirmed that the MQTT messages were being published but the last_updated and last_changed dates for the entity weren't being updated as each new message arrived.

I confirmed on the Home Assistant Discord that setting force_update: true would fix this, but it's unclear to me if / how this is supported using this Add On with the Auto Discovery Add On too.

My plan at the moment is to manually configure those MQTT sensors in Home Assistant.

It's worth noting this is reproducible with lots of different sensors whose value doesn't change for several hours - e.g. UV index sensor overnight, fridge / freezer temperature sensor, rainfall sensor, etc.

abstractvector avatar Jun 08 '22 14:06 abstractvector

I confirmed on the Home Assistant Discord that setting force_update: true would fix this, but it's unclear to me if / how this is supported using this Add On with the Auto Discovery Add On too.

It is! There is a force_update setting in the autodiscovery configuration: Screen Shot 2022-06-12 at 3 00 16 PM

Does that work for you? If so, I think we need to mention it in the readme as it's not there currently.

deviantintegral avatar Jun 12 '22 19:06 deviantintegral

There's open discussions about this at https://github.com/merbanan/rtl_433/pull/2102 and https://github.com/home-assistant/home-assistant.io/pull/23900.

deviantintegral avatar Aug 26 '22 19:08 deviantintegral

Looking into this, I still need to get a better understanding of updated, changed, availability…

first comment, it seems like force update for all 433 auto discovered devices is a pretty blunt control. Does this wind up generating state updates in hass / recorder every time a message is received?

rct avatar Aug 28 '22 13:08 rct

first comment, it seems like force update for all 433 auto discovered devices is a pretty blunt control. Does this wind up generating state updates in hass / recorder every time a message is received?

Yes, that's exactly the issue. It's suggested here that removing force_update entirely may be a better solution.

@Gonioul , it turns out that "Last updated" doesn't actually mean what it looks like in the UI. I've filed a discussion in the Home Assistant front-end repository at https://github.com/home-assistant/frontend/discussions/13687.

To solve the original case of "The only way to know the entity is not dead is to look for the utc value of the device.", I think we'd need to write something that marks an entity as unavailable if a given period of time has passed.

deviantintegral avatar Sep 19 '22 21:09 deviantintegral

Ah! We can expose expire-after perhaps: https://github.com/merbanan/rtl_433/blob/master/examples/rtl_433_mqtt_hass.py#L747

deviantintegral avatar Sep 19 '22 21:09 deviantintegral

Registering my interest in this!

kohkohwastaken avatar Jan 15 '23 01:01 kohkohwastaken