Commit Graph

81 Commits (f88b24f8a4a395e8b13cc18962fe49ab15af1ce8)

Author SHA1 Message Date
Diogo Gomes 8cf1890772
Moves diagnostic information from attributes to diagnostic in Utility Meter (#118637)
* move diag information from attributes to diagnostic

* remove constant attributes

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2024-06-15 12:50:19 +02:00
dougiteixeira cd80b9b318
Remove obsolete device links in Utility Meter helper (#119328)
* Make sure we update the links between the devices and config entries when the changes source device
2024-06-13 23:44:13 +02:00
epenet 3d1165519d
Fix broad-exception-raised in component tests (#119467) 2024-06-12 17:53:42 +02:00
epenet fb51163075
Move socket_enabled fixture to decorator (#118847) 2024-06-06 17:27:38 +02:00
epenet 2545b7d3bb
Use registry fixtures in tests (t-u) (#118297) 2024-05-28 14:23:01 +02:00
Marc Mueller dc47792ff2
Update codespell to 2.3.0 (#118001) 2024-05-24 08:22:29 +02:00
J. Nick Koston 5a609c34bb
Fix blocking I/O in the event loop when loading timezones (#117721) 2024-05-20 11:06:03 +02:00
Diogo Gomes 450c57969a
Add diagnostic platform to utility_meter (#114967)
* Add diagnostic to identify next_reset

* Add test

* add next_reset attr

* Trigger CI

* set as _unrecorded_attributes
2024-05-14 15:20:59 +02:00
gibwar e403b50ddc
Only reset requested utility meter with no tariff (#115170) 2024-04-08 10:05:46 +02:00
J. Nick Koston c4b5a7c027
Migrate start helper to use run_immediately (#115055) 2024-04-06 12:35:46 -10:00
Joost Lekkerkerker 2ef0521d3d
Use is in enum comparison in config flow tests U-Z (#114677)
* Use right enum expression U-Z

* Fix
2024-04-02 23:09:56 +02:00
Erik Montnemery 5b98a8458f
Improve device class of utility meter (#114368) 2024-03-28 13:24:44 +01:00
Erik Montnemery aa9d58df67
Improve utility meter restore state tests (#114356) 2024-03-28 10:42:52 +01:00
Sid 00ec7f11f0
Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
Marc Mueller 87165c0d6e
Add empty line after module docstring [tests t-z] (#112712) 2024-03-08 14:44:56 +01:00
gibwar 52fe0a5e96
Fix utility meter reset without tarrifs (#102884)
* Fix utility meter reset without tarrifs

When using a utility_meter helper set up with a "Meter reset cycle" of
"No cycle" it is impossible to properly reset the meter to 0 and utilize
the "last reset" and "last period" attributes on the helper.

With these changes the service call can now directly reset a meter in
such a configuration and the UI selector has been updated to include
utility meters in the selection list.

Fixes #96920

* Undo UI target selection modes

As requested to not cause confusion by being able to reset individual
meters when using multiple tariffs.

* Adjust logic to only reset standalone sensors

The original logic would allow resetting meters with multiple tariffs
which was an unintended side effect.
2024-03-01 16:44:24 +01:00
J. Nick Koston ab68a26000
Fix flakey utility meter test (#111400)
The test tooling would cancel setup at teardown because
it was still setting up

https://github.com/home-assistant/core/actions/runs/8039593463/job/21956908225?pr=111336
2024-02-25 20:21:09 +01:00
dougiteixeira 7713cf377d
Add utility meter option for the sensor to always be available (#103481)
* Adds option for the sensor to always be available

* Remove logger debug

* Add migration config entry version

* Update homeassistant/components/utility_meter/config_flow.py

Co-authored-by: Robert Resch <robert@resch.dev>

* Update homeassistant/components/utility_meter/sensor.py

Co-authored-by: Robert Resch <robert@resch.dev>

* Remove migration config entry version

* Change CONF_SENSOR_ALWAYS_AVAILABLE optional in CONFIG_SCHEMA

* Remove CONF_SENSOR_ALWAYS_AVAILABLE in tests

* Remove CONF_SENSOR_ALWAYS_AVAILABLE in tests

* Remove CONF_SENSOR_ALWAYS_AVAILABLE in tests

* Add option in yaml

* Update homeassistant/components/utility_meter/strings.json

Co-authored-by: Robert Resch <robert@resch.dev>

* Update homeassistant/components/utility_meter/strings.json

Co-authored-by: Robert Resch <robert@resch.dev>

* Changes tests

* Add test_always_available

* Use freezegun

* Update homeassistant/components/utility_meter/strings.json

---------

Co-authored-by: Robert Resch <robert@resch.dev>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-01-25 20:46:33 +01:00
J. Nick Koston c399cab427
Small speed up to checking core state (#107845) 2024-01-18 08:41:32 -10:00
Jan-Philipp Benecke a16819e0e5
Use freezegun in utility_meter tests (#105123) 2023-12-06 14:43:26 +01:00
Diogo Gomes 7c94293cb4
Fix utility_meter reset when DST change occurs (#103012) 2023-10-30 09:46:20 +01:00
Diogo Gomes 553cdfbf99
Always update unit of measurement of the utility_meter on state change (#99102) 2023-09-10 08:29:38 -05:00
Erik Montnemery c1b47b88f2
Adjust utility_meter tests which create devices (#98212) 2023-08-10 18:24:47 +02:00
Franck Nijhof 30058297cf
Migrate backported StrEnum to built-in StrEnum (#97101) 2023-07-23 23:19:24 +02:00
dougiteixeira 75bdb03363
Fix source device when source entity is changed for Utility Meter (#95636)
* Fix source device when source entity is changed

* Update loop

* Complement and add comments in the test_change_device_source test

* Only clean up dev reg when options change

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-07-02 22:46:21 -04:00
dougiteixeira f2f0c38fae
Fix device source for Utility Meter (#95585)
* Fix Device Source

* Remove debug
2023-06-29 21:52:48 -04:00
dougiteixeira 39229ce098
Add the device of the source entity in the helper entities for Utility Meter (#94734)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-06-26 18:08:13 +02:00
Diogo Gomes 86fe0c9683
Track availability of source sensor in utility meter (#91035)
* track availability of source sensor

* address review comments
2023-04-10 12:37:45 -04:00
Diogo Gomes fe393c84e2
Delay utility_meter until HA has started (#91017)
* increase information for end user

* only warn after home assistant has started

* delay utility_meter until HA has startED
2023-04-08 10:36:34 -04:00
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
epenet 9762b684c2
Adjust entity registry access in tests (3) (#88964) 2023-03-01 16:04:40 +01:00
epenet aa50096a31
Add type hints to integration tests (part 24) (#88307) 2023-02-17 16:34:53 +01:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Franck Nijhof 9030ca05b1
Enable Ruff SIM118 (#87772) 2023-02-15 12:39:12 +01:00
epenet 278050a73f
Add type hints to integration tests (t-z) (#87707) 2023-02-08 19:10:53 +01:00
Michael 9709391b52
Replace the usage of unit constants by enumerations in Tests [s-u] (#85937) 2023-01-16 09:00:27 +01:00
epenet 7bc2712142
Adjust root-import in tests (#78761)
* Adjust root-import in tests

* Adjust diagnostics

* Adjust button

* Adjust select

* Adjust device_tracker

* Adjust camera

* Adjust humidifier

* Adjust media_source

* Adjust update

* Adjust siren

* Adjust number

* Adjust alarm_control_panel

* Adjust notify

* Adjust sensor

* Adjust switch

* Revert anthemav

* Don't adjust demo humidifier
2022-09-19 15:22:23 +02:00
Diogo Gomes ef6b6e7850
Remove deprecated utility_meter entity (#76480)
* remove deprecated utility_meter domain

* remove select_tariff
2022-08-17 16:25:34 +02:00
Franck Nijhof a6244eea28
Search/replace RESULT_TYPE_* by FlowResultType enum (#74656) 2022-07-07 21:28:18 +02: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
J. Nick Koston fe6a4bfb1d
Remove EVENT_TIME_CHANGED and EVENT_TIMER_OUT_OF_SYNC (#69643)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-09 09:05:54 -10:00
Diogo Gomes a3cfb6d4ae
Fix utility_meter reset service (#69612) 2022-04-07 23:55:34 +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
Diogo Gomes 6389959fb7
Makes sure YAML defined tariffs are unique (#69151) 2022-04-02 20:41:03 -07: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