Commit Graph

12 Commits (97426911a3bac20128f3558a3644b565b7024943)

Author SHA1 Message Date
Marc Mueller 0d29b7cbb3
Update coordinator typing (3) [g-n] (#68463) 2022-03-21 14:14:46 +01:00
Stefan Agner 320df10a26
Use _attr_last_reset to set last_reset (#65648) 2022-02-04 11:40:38 +01:00
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
Marc Mueller b168a8c7d0
Use imports from `helpers.typing` (#63459) 2022-01-05 14:56:34 +01:00
epenet a9901356c3
Add sensor setup type hints [i-l] (#63315)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 19:11:50 +01:00
epenet ffccc5bfa5
Use new enums in iotawatt (#61802)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-14 19:39:18 +01:00
Robert Hillis 05671557f0
Use DeviceInfo Class I-K (#58300) 2021-10-23 20:42:50 +02:00
Jean-Yves Avenard 9d84d41f81
Change energy state class to STATE_CLASS_TOTAL (#56974) 2021-10-06 13:24:17 +02:00
Marc Mueller 364767ff22
Import Callable from collections.abc (4) (#56778) 2021-09-29 16:15:36 +02:00
Jean-Yves Avenard 556dcf6abb
Add iotawatt high-accuracy energy readout sensors (#55512) 2021-09-09 15:32:43 +02:00
Paulus Schoutsen 9284f7b147
Tweaks for the iotawatt integration (#55510) 2021-09-01 13:18:50 +02:00
Greg 3bd9be2f6d
Add IoTaWatt integration (#55364)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-08-30 12:52:29 -07:00