Commit graph

52 commits

Author SHA1 Message Date
dougiteixeira
c6210b68bd
Fix device source for Riemann sum integral (#95622)
Fix Device Source
2023-06-30 14:49:00 -04:00
dougiteixeira
e5afff7f98
Add the device of the source entity in the helper entities for Riemann sum integral (#94727) 2023-06-23 00:04:51 +02:00
Diogo Gomes
b5f582eecc
Make Riemann sum sensors restore last valid state (#93674)
* keep last valid state

* keep last valid state

* typo

* increase coverage

* better error handling

* debug messages

* increase coverage

* remove random log

* don't expose last_valid_state as an attribute
2023-06-02 08:44:36 -04:00
epenet
c475273145
Prevent SensorEntity and RestoreEntity inheritance (#88971) 2023-05-24 12:49:35 +02:00
Diogo Gomes
e100bcfaea
Better handling of source sensor unavailability in Riemman Integration (#93137)
* refactor and increase coverage

* fix log order
2023-05-23 11:19:29 +02:00
Diogo Gomes
23e24d75dc
Don't try to restore unavailable nor unknown states (#92825) 2023-05-09 22:22:06 +02:00
Diogo Gomes
48546c77b5
Follow the unavailability of the source sensor (#91975) 2023-04-25 09:49:58 +02:00
epenet
55a5e17cf2
Use UnitOfTime in integrations (h-s) (#84289) 2022-12-20 13:21:14 +01:00
epenet
4f963cfc64
Improve type hints in integration (#78345) 2022-09-13 22:45:25 +02:00
epenet
23090cb8a2
Improve entity type hints [i] (#77529) 2022-08-30 19:21:08 +02:00
Diogo Gomes
8ca5b5d4a4
Remove icon attribute if device class is set (#76161) 2022-08-04 19:36:37 +02:00
Erik Montnemery
78cb0e24bc
Improve integration sensor's time unit handling (#72759) 2022-05-31 15:51:38 +02:00
RoboMagus
c1ddde3764
Check if attributes are present in new_state before accessing them (#71967)
* Check if attributes are present in new_state before accessing them.

* Early return if new state is None|Unknown|Unavailable

* Removed whitespace at line endings. +black run

* Update test for coverage
2022-05-25 08:44:08 +02:00
Diogo Gomes
852eaa062c
update unit_of_measurement even if unit_of_measurement is known (#69699) 2022-04-30 02:16:05 +03:00
Diogo Gomes
fa28ee1f14
Remove deprecated unit configuration option from integration integration (#69157) 2022-04-13 19:19:34 +02:00
Diogo Gomes
8fe9e364e1
Update integration Riemann sum to use _attr* (#69769)
* move to _attr

* improve debug

* review comment

Co-authored-by: Shay Levy <levyshay1@gmail.com>

Co-authored-by: Shay Levy <levyshay1@gmail.com>
2022-04-10 20:09:33 +03:00
Erik Montnemery
c79b361927
Unsubscribe from listeners when removing integration sensor (#69235) 2022-04-04 11:09:38 +02:00
Diogo Gomes
0cbc29caca
Add unique_id through YAML to the integration component (#68435) 2022-03-20 22:48:11 +01:00
Erik Montnemery
0655ebbd84
Add config flow for integration sensor (#68288) 2022-03-18 09:52:17 +01:00
Franck Nijhof
fa09cf663e
Update black to 22.1.0 (#65788) 2022-02-05 14:19:37 +01:00
Ryan Steckler
b541e91885
Fix units not being pulled from source sensor (#63639) 2022-01-24 15:15:34 +01:00
epenet
178d2848f3
Add setup type hints [i-k] (#63444)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-05 12:14:13 +01:00
epenet
1692fab664
Use new enums in integration (#61803)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-14 18:32:33 +01:00
Diogo Gomes
ec9b5df7b3
Ignore None state in state_change_event (#59485) 2021-11-10 22:31:56 -08:00
Marc Mueller
a48ddcadd4
Use assignment expressions 31 (#58715) 2021-10-30 16:29:07 +02:00
Diogo Gomes
84140a547b
deprecated unit_of_measurement (#55876) 2021-09-08 16:33:53 +02:00
Diogo Gomes
d705b35ea1
Address comment in integration Riemann sum PR #55875 (#55895)
* https://github.com/home-assistant/core/pull/55875\#discussion_r703334504

* missing test update
2021-09-07 19:40:20 +02:00
Diogo Gomes
1ca9deb520
Integration Sensor Initial State (#55875)
* initial state is UNAVAILABLE

* update tests
2021-09-07 08:12:54 +02:00
Erik Montnemery
b1dbdec2ea
Set state class to total for Integration sensors (#55872) 2021-09-07 00:27:31 +02:00
Diogo Gomes
34d54511e8
Integration Sensor unit of measurement overwrite (#55869) 2021-09-06 13:41:01 -07:00
Thomas Lovén
8d37fd08c7
Fix integration sensors sometimes not getting device_class or unit_of_measurement (#54802) 2021-08-18 08:59:31 -07:00
Daniel Hjelseth Høyer
27849426fe
Remove last_reset attribute and set state class to total_increasing for Integration sensors (#54815) 2021-08-18 15:54:11 +02:00
Erik Montnemery
2720ba2753
Move temperature conversions to sensor base class (4/8) (#54472)
* Move temperature conversions to entity base class (4/8)

* Fix litterrobot sensor

* Fix tests
2021-08-11 21:17:47 +02:00
Diogo Gomes
b88f0adbe9
Restores unit_of_measurement (#54335) 2021-08-09 19:48:01 +02:00
Marc Mueller
0815eede4b
Replace lists with tuples (2) (#53685) 2021-07-30 01:20:03 +02:00
Daniel Hjelseth Høyer
6590e464af
Integration. Add device class, last_reset, state_class (#53698)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-07-29 20:05:53 +02:00
Erik Montnemery
fdf97eaca3
Migrate integrations i-m to extend SensorEntity (#48213) 2021-03-22 19:59:03 +01:00
Erik Montnemery
af4d06b12e
Update integrations f-i to override extra_state_attributes() (#47757) 2021-03-11 16:57:47 +01:00
tkdrob
ad400d91bc
Use core constants for sensor integration (#46290) 2021-02-10 08:36:05 -05:00
springstan
513f03eb1f
Return attribute dict directly without temporary variable v2 (#41271) 2020-10-06 16:55:16 +02:00
J. Nick Koston
b430496b13
Switch async_track_state_change to the faster async_track_state_change_event part 4 (#37863)
* Switch async_track_state_change to the faster async_track_state_change_event part 4

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

* pylint
2020-07-14 22:25:48 -07: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
bangom
1f9f5bfaa8
Fix wrong SI unit_prefix in Integration component (#33227) (#33228)
* wrong SI metric prefixes
2020-03-29 11:17:53 +01:00
springstan
157f972d72
Use f-strings in integrations starting with "H" - "L" (#32265)
* Use f-strings in integrations starting with "H"

* Use f-strings in integrations starting with "I"

* Use f-strings in integrations starting with "J"

* Use f-strings in integrations starting with "K"

* Use f-strings in integrations starting with "L"

* Fix lint error

* Use join instead of f-string in homekit_controller

* Use local variables with f-strings

* Fix lint error

* Escape the characters in f-string

* Sort imports with isort in homeworks light

* Fix pylint error

* Fix broken tests

* Fix broken tests v2
2020-02-28 12:39:29 +01:00
springstan
a85808e325
Add and use time related constants (#32065)
* Add and use time related constants

* Sort time constants and reuse them in data rate constants

* Fix greeneyemonitor import

* Fix greeneyemonitor import V2

* Fix failing here_travel_time test

* Add TIME_MONTHS and TIME_YEARS

* Use TIME_MINUTES in opentherm_gw and isy994

* Add and use TIME_MILLISECONDS

* Change inconsistent ones

* Add TIME_MICROSECONDS and TIME_WEEKS

* Use constants in apcupsd and travisci

* Fix import error in upnp sensor.py

* Fix isy994 sensor.py using TIME_YEARS

* Fix dyson tests

* Use TIME_SECONDS in more places

* Use TIME_DAYS in google wifi
2020-02-23 22:09:24 +02:00
Bas Nijholt
14779ce3d0 Sort imports according to PEP8 for components starting with "I" (#29769) 2019-12-09 14:21:24 +01:00
Franck Nijhof
decf13b948 Use literal string interpolation in core (f-strings) (#26166) 2019-08-23 09:53:33 -07:00
Ville Skyttä
b738082dad Type check various base components (#25878)
* Type check various component base classes, disabling bunch of checks for now

* Type hint fixes

* Help mypy out some

* Add more type hints
2019-08-11 20:38:18 -07:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Emilv2
c486f794f9 Fix typo in integration component (#24250) 2019-06-02 01:07:17 -07:00