Commit Graph
62 Commits
Author SHA1 Message Date
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 24fc04a964139e5cfecbfa20f91e2d30ab145d77.

* address review comment

* always a Decimal
2022-02-15 02:16:30 +01:00
J. Nick Koston 5b755b74fb Add loggers to integration manifest.json (#65083) 2022-01-28 13:37:53 -08:00
epenetandepenet 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 GomesandPaulus Schoutsen 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 GomesandJ. Nick Koston 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
René Klomp da7b292855 Use Utility Meter configured name as friendly name (#53051) 2021-07-15 20:58:32 -07: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
Franck Nijhof eccefd154a Extend targets for entity component services (#50760) 2021-05-17 14:06:50 +02:00
Erik Montnemery ee4e14e45e Hoist ATTR_LAST_RESET from utility_meter to SensorEntity (#50757) 2021-05-17 13:51:09 +02:00
tkdrobandFranck Nijhof 5d6f4068d3 Add targets and selectors for services (U-W) (#50630)
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 (#50034) 2021-05-03 09:34:28 -07:00
Diogo Gomes 24b9d73392 Improves UX of Utility Meter services (#48556) 2021-05-02 10:53:35 +02:00
Franck Nijhof 055cdc64c0 Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
Erik Montnemery 783b453bbe Migrate integrations t-v to extend SensorEntity (#48216) 2021-03-22 19:47:44 +01:00
Erik Montnemery 346a724ac3 Mark base components' state_attribute @final, rename others to extra_state_attributes (#48161)
* 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() (#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 Delaetandspringstan 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
Franck Nijhof 24840b54ac Add yamllint (in pre-commit and CI) (#33676)
* Add yamllint (in pre-commit and CI)

* Fix linting for all YAML files

* Bump and add it to requirements

* Fix gen_requirements for pre-commit, remove 'v' from version
2020-04-05 10:33:45 +02:00
Paulus Schoutsen f1d3c0d19b Remove unused manifest fields (#33595) 2020-04-03 12:58:19 -07: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
Franck Nijhof bfa0edaf92 Migrate Integration Quality Scale from docs to manifest: internal (#30551) 2020-01-07 20:58:49 +01:00
Franck Nijhof b4d6d238e5 Correct names in manifests (T-Z) (#30546) 2020-01-07 14:31:18 +01:00
Franck Nijhof a84741392b Format all manifests with prettier (#30521) 2020-01-06 21:28:23 +01: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
Paulus Schoutsen 02d9ed5e36 Do not select all entities when omitting entity ID in service call (#29178)
* Do not select all entities when omitting entity ID

* Address comments Matthew

* Require either area_id or entity_id

* Fix tests

* Fix test
2019-12-02 16:23:12 -08:00
Franck Nijhof c7da781efc Update documentation link URL for integrations in all manifests (#27114) 2019-10-02 09:25:44 -07:00