Commit Graph

3 Commits (1f4ee3c265753e76b628b8a3358edc86c344fc4f)

Author SHA1 Message Date
Stefan Agner c8e64358b1
Set last_reset for integrated entities in IoTaWatt (#65143)
* 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>
2022-02-02 17:39:33 +01:00
Jean-Yves Avenard 556dcf6abb
Add iotawatt high-accuracy energy readout sensors (#55512) 2021-09-09 15:32:43 +02:00
Greg 3bd9be2f6d
Add IoTaWatt integration (#55364)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-08-30 12:52:29 -07:00