Commit Graph

82 Commits (c534d0a90e20798d1043d8c6d42f6677adfe17d3)

Author SHA1 Message Date
Erik Montnemery 9e213caefc
Tweak utility_meter service descriptions () 2022-04-20 22:07:16 +02:00
Diogo Gomes 03874d1b65
Correct state restoring for Utility Meter sensors ()
* 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 ()
* 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 ()
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
Raman Gupta b325c112b4
Add SelectorType enum and TypedDicts for each selector's data ()
* rebase off current

* rearrange

* Overload selector function

* Update/fix all selector references

* better typing?

* remove extra option

* move things around

* Switch to Sequence type to avoid ignoring mypy error

* Get rid of ...'s

* Improve typing to reduce number of ignores

* Remove all typing ignores

* Make config optional for selectors that don't need a config

* add missing unit prefixes

* Rename TypedDicts

* Update homeassistant/helpers/selector.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* review feedback

* remove peta from integration integration

* Fix min_max

* Revert change to selector function

* Fix logic

* Add typing for selector classes

* Update selector.py

* Fix indent

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-04-11 09:20:56 +02:00
Diogo Gomes a3cfb6d4ae
Fix utility_meter reset service () 2022-04-07 23:55:34 +02:00
epenet 2cf3057ff1
Add basic type hints to utility_meter ()
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 () 2022-04-04 20:02:40 +02:00
Erik Montnemery 82af314678
Improve utility_meter translation strings () 2022-04-04 14:24:56 +02:00
Erik Montnemery d7992c1e87
Unsubscribe listeners when entity meter sensor is removed () 2022-04-03 13:15:22 +02:00
Diogo Gomes 6389959fb7
Makes sure YAML defined tariffs are unique () 2022-04-02 20:41:03 -07:00
Erik Montnemery bda997efe9
Fix utility_meter startup () 2022-04-01 08:28:50 -07:00
Diogo Gomes 2963aea3ec
Ignore old_state when using delta_values ()
* 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 () 2022-03-31 13:57:26 +02:00
Erik Montnemery 4327d3aef9
Improve utility_meter services.yaml () 2022-03-31 11:32:11 +02:00
Erik Montnemery 3be689baf4
Improve utility_meter services.yaml () 2022-03-31 00:47:15 +02:00
Erik Montnemery f9f360c64e
Rename helper_config_entry_flow to schema_config_entry_flow () 2022-03-30 14:36:47 -07:00
epenet ecd43f391f
Prettify json (manifest.json) () 2022-03-30 10:56:37 +02:00
Erik Montnemery bdb61e0222
Add config flow for utility_meter () 2022-03-29 14:46:17 +02:00
Diogo Gomes ba814af701
Adopt SelectEntity in Utility Meter ()
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-03-21 08:21:26 +01:00
Diogo Gomes b211a1faa7
Fix utility meter restore state ()
* Address 

* 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
J. Nick Koston 5b755b74fb
Add loggers to integration manifest.json () 2022-01-28 13:37:53 -08:00
epenet 58a53046f2
Move list to dict in utility-meter discovery ()
* 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 ()
* 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 () 2021-12-16 12:50:41 +01:00
Marc Mueller a48ddcadd4
Use assignment expressions 31 () 2021-10-30 16:29:07 +02:00
Eddy G 4d5705c0fe
Add 'delta_values' option to utility_meter () 2021-10-28 19:00:31 -05:00
Diogo Gomes ad48d78315
Simplify utility_meter code base with croniter () 2021-10-27 06:41:44 -05:00
Marc Mueller 4513ee4ea5
Use assignment expressions 12 () 2021-10-20 14:34:08 -07:00
Diogo Gomes 79b10c43d8
Ignore utility_meter restore state if state is invalid ()
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 ()
* 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 () 2021-09-20 07:31:58 +02:00
Erik Montnemery 0d1412ea17
Set state class to total for net utility_meter sensors ()
* 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 ()
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 () 2021-08-25 15:24:51 +02:00
Daniel Hjelseth Høyer 7dd169b48e
Utility meter, add STATE_CLASS_TOTAL_INCREASING ()
* 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 ()
* 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) () 2021-08-11 18:57:50 +02:00
René Klomp da7b292855
Use Utility Meter configured name as friendly name () 2021-07-15 20:58:32 -07:00
Erik Montnemery ae8652217c
Change utility_meter last_reset timestamps to UTC () 2021-05-25 15:46:54 +02:00
Erik Montnemery 0c40f37336
Set device_class and state_class for utility_meter ()
* 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
Franck Nijhof eccefd154a
Extend targets for entity component services () 2021-05-17 14:06:50 +02:00
Erik Montnemery ee4e14e45e
Hoist ATTR_LAST_RESET from utility_meter to SensorEntity () 2021-05-17 13:51:09 +02:00
tkdrob 5d6f4068d3
Add targets and selectors for services (U-W) ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-05-15 10:49:10 +02:00
Franck Nijhof 2ed386f9e6
Migrate to async_get_current_platform everywhere () 2021-05-03 09:34:28 -07:00
Diogo Gomes 24b9d73392
Improves UX of Utility Meter services () 2021-05-02 10:53:35 +02:00
Franck Nijhof 055cdc64c0
Add support for IoT class in manifest () 2021-04-15 10:21:38 +02:00
Erik Montnemery 783b453bbe
Migrate integrations t-v to extend SensorEntity () 2021-03-22 19:47:44 +01:00
Erik Montnemery 346a724ac3
Mark base components' state_attribute @final, rename others to extra_state_attributes ()
* Mark base state_attributes @final, rename others to extra_state_attributes

* Fix calendar, update tests
2021-03-21 10:38:24 +01:00
Erik Montnemery 1fc8e32d86
Update integrations t-z to override extra_state_attributes() () 2021-03-11 20:16:26 +01:00