marq24 / ha-senec-v3

SENEC.Home V2.x/V3/V4 Integration for Home Assistant that will work with the recent changes introduced by SENEC (supporting https) - successfully tested with latest MCU Version: 0827 (Feb 2024).
Apache License 2.0
53 stars 4 forks source link

Store and check API value #45

Closed AndreWohnsland closed 12 months ago

AndreWohnsland commented 12 months ago

This PR extends the SenecSensor class with the HA RestoreEntity to get the latest known HA state. It uses the async_added_to_hass method at start combined with async_get_last_state. In addition, the value for the "_total" sensors is checked before updating, that the retrieved value is not lower than the current one.

marq24 commented 12 months ago

Thanks a lot - I will make very little adjustments and then prepare a next "beta" release