Commit graph

52 commits

Author SHA1 Message Date
epenet
2cf3057ff1
Add basic type hints to utility_meter (#69325)
Co-authored-by: Diogo Gomes <diogogomes@gmail.com>
2022-04-05 15:43:10 +02:00
Erik Montnemery
e830032b33
Remove deprecated temperature conversion of non temperature sensors (#69069) 2022-04-04 20:02:40 +02:00
Erik Montnemery
d7992c1e87
Unsubscribe listeners when entity meter sensor is removed (#69172) 2022-04-03 13:15:22 +02:00
Erik Montnemery
bda997efe9
Fix utility_meter startup (#69064) 2022-04-01 08:28:50 -07:00
Diogo Gomes
2963aea3ec
Ignore old_state when using delta_values (#68402)
* delta value updates don't require old_state

* add test

* merge
2022-04-01 12:08:00 +03:00
Erik Montnemery
400943ce99
Make utility_meter tariffs a list (#68967) 2022-03-31 13:57:26 +02:00
Erik Montnemery
bdb61e0222
Add config flow for utility_meter (#68457) 2022-03-29 14:46:17 +02:00
Diogo Gomes
b211a1faa7
Fix utility meter restore state (#66490)
* Address #63874

* avoid setting _last_period to None

* name is always set in discovery

* ValueError never happens only DecimalException

* async_tariff_change tracks state change - state machine will not pass a None

* test we only reset one utility_meter

* test corrupted restored state

* pretty sure _current_tariff doesn't change from init until here

* missing assert

* Revert "async_tariff_change tracks state change - state machine will not pass a None"

This reverts commit 24fc04a964.

* address review comment

* always a Decimal
2022-02-15 02:16:30 +01:00
epenet
58a53046f2
Move list to dict in utility-meter discovery (#63808)
* Move list to dict in utility-meter discovery

* Reuse name variable

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-17 14:23:12 +01:00
Erik Montnemery
3083f059cc
Drop last_reset attribute for non 'total' sensors (#63880)
* Drop last_reset attribute for non 'total' sensors

* Adjust MQTT tests

* Add exception for utility_meter

* Rewrite exception for utility_meter

* Add comment in utility_meter

* Tweak comment
2022-01-11 13:58:35 +01:00
Robert Hillis
44f4656fe6
Use enums in utility_meter (#62033) 2021-12-16 12:50:41 +01:00
Marc Mueller
a48ddcadd4
Use assignment expressions 31 (#58715) 2021-10-30 16:29:07 +02:00
Eddy G
4d5705c0fe
Add 'delta_values' option to utility_meter (#54964) 2021-10-28 19:00:31 -05:00
Diogo Gomes
ad48d78315
Simplify utility_meter code base with croniter (#55625) 2021-10-27 06:41:44 -05:00
Marc Mueller
4513ee4ea5
Use assignment expressions 12 (#57937) 2021-10-20 14:34:08 -07:00
Diogo Gomes
79b10c43d8
Ignore utility_meter restore state if state is invalid (#57010)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-10-03 21:59:36 -07:00
Diogo Gomes
ec9fc0052d
Define unit_of_measurement of all utility_meter sensors on HA start (#56112)
* define unit_of_measurement on hass start

* delay utility_meter state

* check state

* store siblings

* don't check unit_of_measurement
2021-09-28 00:42:27 +02:00
Diogo Gomes
b05c1b516e
restore float and not string (#56406) 2021-09-20 07:31:58 +02:00
Erik Montnemery
0d1412ea17
Set state class to total for net utility_meter sensors (#55877)
* Set state class to total for net utility_meter sensors

* Update tests
2021-09-07 08:13:14 +02:00
Diogo Gomes
fb28665cfa
Add "cron patterns" to define utility_meter cycles (#46795)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-08-25 14:52:39 -05:00
Erik Montnemery
517fda1383
Fix last_reset in utility_meter (#55209) 2021-08-25 15:24:51 +02:00
Daniel Hjelseth Høyer
7dd169b48e
Utility meter, add STATE_CLASS_TOTAL_INCREASING (#54871)
* Utility meter, STATE_CLASS_TOTAL_INCREASING

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* update test

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* update test

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
2021-08-25 14:03:30 +02:00
Erik Montnemery
e1926caeb9
Remove STATE_CLASS_TOTAL and last_reset from sensor (#54755)
* Remove STATE_CLASS_TOTAL

* Update mill sensor

* Update tests

* Kill last_reset

* Return ATTR_LAST_RESET to utility_meter

* Update energy cost sensor

* Restore last_reset for backwards compatibility

* Re-add and update deprecation warning

* Update tests

* Fix utility_meter

* Update EnergyCostSensor

* Tweak

* Fix rebase mistake

* Fix test
2021-08-18 10:03:27 +02:00
Erik Montnemery
94a264afaf
Move temperature conversions to entity base class (7/8) (#54482) 2021-08-11 18:57:50 +02:00
Erik Montnemery
ae8652217c
Change utility_meter last_reset timestamps to UTC (#51067) 2021-05-25 15:46:54 +02:00
Erik Montnemery
0c40f37336
Set device_class and state_class for utility_meter (#50921)
* Set device_class and state_class for utility_meter

* Update test

* Tweak tests according to review comments
2021-05-21 13:23:20 +02:00
Erik Montnemery
ee4e14e45e
Hoist ATTR_LAST_RESET from utility_meter to SensorEntity (#50757) 2021-05-17 13:51:09 +02:00
Franck Nijhof
2ed386f9e6
Migrate to async_get_current_platform everywhere (#50034) 2021-05-03 09:34:28 -07:00
Erik Montnemery
783b453bbe
Migrate integrations t-v to extend SensorEntity (#48216) 2021-03-22 19:47:44 +01:00
Erik Montnemery
1fc8e32d86
Update integrations t-z to override extra_state_attributes() (#47760) 2021-03-11 20:16:26 +01:00
Diogo Gomes
81c77942eb
Update the Utility Meter sensor status on HA start (#44765)
* fix status on HA start

* better coverage and fix

* fix test

* address review
2021-01-13 16:42:28 +01:00
Diogo Gomes
b290a8b5a1
always sync unit_of_measurement (#44670) 2020-12-31 00:39:14 +01:00
Thomas Delaet
293f8eaaf3
Add quarter-hour period feature for utility_meter component (#41999)
* add support for quarter-hourly intervals to utility meter (15 minutes)

* add tests

* add test for every quarter

* Update homeassistant/components/utility_meter/sensor.py

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-11-14 11:53:59 +01:00
Diogo Gomes
12adde5349
On HA restart parse last_reset as a datetime object (#42939) 2020-11-09 08:35:50 +01:00
Hareesh M U
c8d5500441
Add bimonthly period feature for utility_meter component (#39931) 2020-09-15 17:52:19 +02:00
J. Nick Koston
aed98a830f
Switch async_track_state_change to the faster async_track_state_change_event part 5 (#37866)
Calling async_track_state_change_event directly is faster than async_track_state_change (see #37251) since async_track_state_change is a wrapper around async_track_state_change_event now
2020-07-14 22:25:12 -07:00
Diogo Gomes
53c1aba7df
Fix utility_meter calibration with float values (#35186) 2020-05-05 02:44:00 +02:00
Paulus Schoutsen
aef06a3544
Directly call write state 2 (#33513)
* Directly call async_write_ha_state pt2

* Directly call async_write_ha_state pt2

* Fix mock

* Address comments
2020-04-03 09:34:50 +02:00
Paulus Schoutsen
aaa1d06809
Directly call async_write_ha_state (#33508)
* Directly call async_write_ha_state

* Address comments

* Fix tests
2020-04-01 14:19:51 -07:00
Diogo Gomes
16336bf902
Add entity_service calibrate_meter to utility_meter (#32658)
* add calibrate service
2020-03-11 09:42:22 +01:00
Christian Clauss
df7d2b3aeb
Fix typos found by codespell (#31243)
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Bas Nijholt
e4e4f78eb0 Sort imports according to PEP8 for utility_meter (#29710) 2019-12-09 11:54:56 +01:00
Andrew McRae
de0db1601b Add quarterly cycle for utility_meter component (#29534)
* Add quarterly tariff period to utility_meter

Many tariff cycles in Australia are 3 monthly (quarterly).
Add quarterly tariff cycle handling to the utility_meter component.

* Add quarterly tariff period to utility_meter

Many tariff cycles in Australia are 3 monthly (quarterly).
Add quarterly tariff cycle handling to the utility_meter component.

* Change date for test for utility_meter

* Add quarterly tariff period to utility_meter

Many tariff cycles in Australia are 3 monthly (quarterly).
Add quarterly tariff cycle handling to the utility_meter component.
2019-12-08 09:49:18 +01:00
Franck Nijhof
decf13b948 Use literal string interpolation in core (f-strings) (#26166) 2019-08-23 09:53:33 -07:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Diogo Gomes
7c5846aed2 Fix #22648 - Utility_meter would try to cancel a non existing task (#22669)
* don't cancel tariff that are paused

* test tariffs
2019-04-03 08:49:53 +02:00
Diogo Gomes
8e9a496002 Utility Meter offset defined by a time_period (#20926)
* change offset from int to Time period dictionary

* track according to offset

* left overs... tks @fabaff

* typo
2019-03-06 07:55:24 -05:00
Justin Bassett
02745be44d Allows the utility_meter to net meter rather than only allow increases. (#21204)
* Allow the utility_meter to net meter rather than only allow increases.

* Fix PR issues around CI.

* Fix line length fallout.

* Change rollover to net_consumption.  Add unit tests.

* Fix test style issues.

* Fix style in tests.
2019-02-23 14:02:39 +00:00
Diogo Gomes
3b5ed7a20f Fix track_change error in utility_meter (#21134)
* split validation

* remove any()
2019-02-17 20:40:51 -08:00
Diogo Gomes
9cab597bc4 Don't expose services in Utility_Meter unless tariffs are available (#20878)
* only expose services when tariffs configured

* don't register services multiple times
2019-02-16 20:04:56 -08:00