Commit Graph

25 Commits (1a68784852472c85a5fbb3ae7001283bd7a43b23)

Author SHA1 Message Date
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
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
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 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 5ee362bc34
Store sensor last_reset attribute as a string, not a datetime (#50851)
* Store last_reset attribute as a string, not a datetime

* Update tests
2021-05-19 12:28:00 -07:00
Erik Montnemery ee4e14e45e
Hoist ATTR_LAST_RESET from utility_meter to SensorEntity (#50757) 2021-05-17 13:51:09 +02: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
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +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
Philip Allgaier dde6305549
Cleanup unused loggers (components N-Z + tests) (#41982) 2020-10-16 21:24:08 -05:00
Ville Skyttä 5e90a4d000
Use more state attribute name constants (#40428) 2020-09-21 23:03:39 +02: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 60009ec2f9
Use event loop scheduling for tracking time patterns (#38021)
* Use event loop scheduling for tracking time patterns

* make patching of time targetable

* patch time tests since time can tick to match during the test

* fix more tests

* time can only move forward

* time can only move forward

* back to 100% coverage

* simplify since the event loop time cannot move backwards

* simplify some more

* revert simplify

* Revert "revert simplify"

This reverts commit bd42f232f6.

* Revert "simplify some more"

This reverts commit 2a6c57d514.

* Revert "simplify since the event loop time cannot move backwards"

This reverts commit 3b13714ef4.

* Attempt another simplify

* time does not move backwards in the last two

* remove next_time <= now check

* fix previous merge error
2020-07-20 20:18:31 -10:00
Diogo Gomes 53c1aba7df
Fix utility_meter calibration with float values (#35186) 2020-05-05 02:44:00 +02:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
springstan 02c9e47db8
Use ENERGY_KILO_WATT_HOUR constant (#33962) 2020-04-10 20:21:29 +02:00
Diogo Gomes 16336bf902
Add entity_service calibrate_meter to utility_meter (#32658)
* add calibrate service
2020-03-11 09:42:22 +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 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 1d5ffe9ad5 Utility meter (#19718)
* initial commit

* test service calls

* lint

* float -> Decimal

* extra tests

* lint

* lint

* lint

* lint

* fix self reset

* clean

* add services

* improve service example description

* add optional paused initialization

* fix

* travis fix

* fix YEARLY

* add tests for previous bug

* address comments and suggestions from @ottowinter

* lint

* remove debug

* add discoverability capabilities

* no need for _hass

* Update homeassistant/components/sensor/utility_meter.py

Co-Authored-By: dgomes <diogogomes@gmail.com>

* Update homeassistant/components/sensor/utility_meter.py

Co-Authored-By: dgomes <diogogomes@gmail.com>

* correct comment

* improve error handling

* address @MartinHjelmare comments

* address @MartinHjelmare comments

* one patch is enought

* follow @ballob suggestion in https://github.com/home-assistant/architecture/issues/131

* fix tests

* review fixes

* major refactor

* lint

* lint

* address comments by @MartinHjelmare

* rename variable
2019-01-26 16:33:11 +01:00