* Set last_reset for integrated entities
For entities which integrate over time (like energy in watt hours) the
iotawattpy library uses the beginning of the year as start date by
default (using relative time specification "y", see [1]). Since
PR #56974 state class has been changed from TOTAL_INCREASING to TOTAL.
However, the relative start date of "y" causes the value to reset to
zero at the beginning of the year.
This fixes it by setting last_reset properly, which takes such resets
into account.
While at it, let's set the cycle to one day. This lowers the load on
IoTaWatt (fetching with start date beginning of the day seems to
response faster than beginning of the year).
[1]: https://docs.iotawatt.com/en/master/query.html#relative-time
* Update homeassistant/components/iotawatt/sensor.py
* Update homeassistant/components/iotawatt/coordinator.py
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
* Cleanup sensor expire triggers after reload
* fix test binary_sensor
* Also trigger cleanup parent classes
* Restore an expiring state after a reload
* correct discovery_update
* restore expiring state with remaining time
* Update homeassistant/components/mqtt/binary_sensor.py
description
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Log remaining time
* Move check
* check and tests reload
* remove self.async_write_ha_state()
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Log error if public stations don't provide data
Signed-off-by: cgtobi <cgtobi@gmail.com>
* Only log once
Signed-off-by: cgtobi <cgtobi@gmail.com>
* Update homeassistant/components/netatmo/sensor.py
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
* Improve google calendar test coverage to 97%
* Remove commented out code.
* Remove unnecessary (flaky) checks for token file persistence
* Remove mock code assertions
* Add debug logging to google calendar integration
* Increase alarm time to polling code to reduce flakes
* Setup every test in their own configuration directory
* Mock out filesystem calls to avoid disk dependencies
Update scope checking code to use Storage object rather than text file matching
* Update tests to check entity states when integration is loaded
* Mock out google service in multiple locations
* Update homeassistant/components/google/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/google/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>