Wesley Vos
478a1d5e9a
Add periodically resetting meter option to utility meter ( #88446 )
...
* Use last valid state if meter is not periodically resetting
* Fix unload of entry, used during options flow submit
* Adjustments based on code review
* Move DecimalException handling to validation method
* Add test for invalid new state in calculate_adjustment method
2023-03-28 17:09:20 +02:00
Marc Mueller
ea4e2ab4aa
Add Self typing (4) [mypy 1.0] ( #87601 )
2023-02-06 22:30:22 -06:00
epenet
ebdf9a8658
Use UnitOfEnergy in integrations (o-z) ( #84221 )
2022-12-19 10:58:37 +01:00
epenet
d8b2563b3d
Use _attr_should_poll in components [u-z] ( #77371 )
2022-08-26 21:22:27 +02:00
Diogo Gomes
f6517884b1
Fix #72749 ( #72794 )
2022-05-31 20:40:42 -07:00
Diogo Gomes
03874d1b65
Correct state restoring for Utility Meter sensors ( #66851 )
...
* fix merge
* backward compatability
* add status
* increase coverage
* increase further the coverage
* adds support for Decimal in SensorExtraStoredData
* more precise
* review
* don't restore broken last_reset
* increase coverage
* address review comments
* stale
* coverage increase
* Update homeassistant/components/utility_meter/sensor.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* catch corrupt files and respective tests
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-04-19 09:01:52 +02:00
Diogo Gomes
9dfd37c60b
Use CONF_NAME consistently in utility meter sensors with and without tariffs ( #69152 )
...
* apply name to tariff based sensors too
* change name without breaking entity_id
* address comments
2022-04-19 09:00:36 +02:00
Diogo Gomes
8e64ae8478
Add unique_id to utility_meter sensors ( #68596 )
...
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-04-13 23:58:15 +02:00
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