Commit Graph

42 Commits (fce869248cbb902aeece2ca7b469a2e90d7fdd3d)

Author SHA1 Message Date
Yuxin Wang 33c5d1855d
Rewrite APCUPSD sensors using DataUpdateCoordinator (#88467)
* Add test sensor.

* Fix sensor test file name.

* Add binary sensor test.

* Fix comments and styling.

* Remove apcupsd from omissions in coveragerc.

* Revert "Remove apcupsd from omissions in coveragerc."

This reverts commit 66b05fcb8829619a771a650a3d70174089e15d91.

* Implement the data coordinator for apcupsd.

* Add tests for sensor updates and throttles.

* Reorder the statement for better code clarity.

* Update docstring.

* Add more tests for checking if the coordinator works ok.

* Implement a custom debouncer with 5 second cooldown for the coordinator.

* Add more tests for checking if our integration is able to properly mark entity's availability.

* Make apcupsd a silver integration.

* Try to fix non-deterministic test behaviors

* Fix JSON format

* Use new `with` format in python 3.10 for better readability

* Update tests.

* Rebase and simplify code.

* Add an ups prefix to the property methods of the coordinator

* Replace init_integration with async_init_integration

* Lint fixes

* Fix imports

* Update BinarySensor implementation to add initial update of attributes

* Fix test failures due to rebases

* Reorder the statements for better code clarity

* Fix incorrect references to the ups_name property

* Simplify BinarySensor value getter code

* No need to update when adding coordinator-controlled sensors
2023-11-21 22:40:05 +01:00
Yuxin Wang 36ad24ce01
Add name and default name to device info of APCUPSD sensors (#94415) 2023-07-24 18:42:08 +02:00
Yuxin Wang b1bdd92383
Add unit inference for Amps and VA in APCUPSD integration (#94431)
* Add unit inference for Amps and VA

* Rename `init_integration` to `async_init_integration` for better consistency with HA naming style
2023-06-13 16:38:56 +02:00
Yuxin Wang 676b6ab706
Add support for "days" unit for STESTI sensor in APCUPSD integration (#93844)
Add a test case for self test interval
2023-05-31 14:25:46 +02:00
Yuxin Wang a547181984
Fix unit inference for ITEMP field for APCUPSD integration (#93724) 2023-05-29 20:40:36 +02:00
ondras12345 cef1809536
Fix apcupsd spamming logs when host is unavailable (#85920)
fixes undefined
2023-01-15 14:45:05 +01:00
Ville Skyttä ae302bbec0
Make use of str.removeprefix and .removesuffix (#85584) 2023-01-13 12:19:38 +01:00
Yuxin Wang 06095b1fec
Enable strict typing for apcupsd (#84861) 2022-12-30 21:48:29 +01:00
Yuxin Wang 7a7f986444
Add `state_class` to the sensor entity descriptions for apcupsd integration (#84829) 2022-12-30 17:53:54 +00:00
Yuxin Wang 677f0dc335
Remove deprecated apcupsd YAML config (#83801) 2022-12-13 08:52:05 +01:00
epenet 2b647bcd5b
Use device classes in apcupsd (#83807) 2022-12-12 11:44:37 +01:00
epenet 248d5ff541
Use ApparentPower unit and device class in integrations (#83577) 2022-12-08 20:55:18 +01:00
definitio 644b00ca2d
Add apcupsd laststest sensor (#80773) 2022-10-25 08:44:54 +02:00
Yuxin Wang 52307708c8
Refactor apcupsd to use config flow (#64809)
* Add Config Flow to APCUPSd integration and remove YAML support.

* Hide the binary sensor if user does not select STATFLAG resource.

* Add tests for config flows.

* Simplify config flow code.

* Spell fix.

* Fix pylint warnings.

* Simplify the code for config flow.

* First attempt to implement import flows to suppport legacy YAML configurations.

* Remove unnecessary log calls.

* Wrap synchronous update call with `hass.async_add_executor_job`.

* Import the YAML configurations when sensor platform is set up.

* Move the logger call since the variables are not properly set up.

* Add codeowner.

* Fix name field of manifest.json.

* Fix linting issue.

* Fix incorrect dependency due to incorrect rebase.

* Update codeowner and config flows via hassfest.

* Postpone the deprecation warning to 2022.7.

* Import future annotations for init file.

* Add an newline at the end to make prettier happy.

* Update github id.

* Add type hints for return types of steps in config flow.

* Move the deprecation date for YAML config to 2022.12.

* Update according to reviews.

* Use async_forward_entry_setups.

* Add helper properties to `APCUPSdData` class.

* Add device_info for binary sensor.

* Simplify config flow.

* Remove options flow strings.

* update the tests according to the changes.

* Add `entity_registry_enabled_default` to entities and use imported CONF_RESOURCES to disable entities instead of skipping them.

* Update according to reviews.

* Do not use model of the UPS as the title for the integration.

Instead, simply use "APCUPSd" as the integration title and let the device info serve as title for each device instead.

* Change schema to be a global variable.

* Add more comments.

* Rewrite the tests for config flows.

* Fix enabled_by_default.

* Show friendly titles in the integration.

* Add import check in `async_setup_platform` to avoid importing in sensor platform setup.

* Add import check in `async_setup_platform` to avoid importing in sensor platform setup.

* Update comments in test files.

* Use parametrize instead of manually iterating different test cases.

* Swap the order of the platform constants.

* Avoid using broad exceptions.

* Set up device info via `_attr_device_info`.

* Remove unrelated test in `test_config_flow`.

* Use `DeviceInfo` instead of dict to assign to `_attr_device_info`.

* Add english translation.

* Add `async_create_issue` for deprecated YAML configuration.

* Enable UPS status by default since it could show "online, charging, on battery etc" which is meaningful for all users.

* Apply suggestions from code review

* Apply suggestion

* Apply suggestion

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-09-28 09:14:04 +02:00
epenet 65eb1584f7
Improve entity type hints [a] (#76986) 2022-08-18 15:56:52 +02:00
Marc Mueller 911b159281
Cleanup after pylint update (#68657) 2022-03-26 00:34:12 +01:00
Franck Nijhof 276fd4f42c
Add Python 3.10 to CI (#59729) 2022-02-17 14:58:24 +01:00
epenet 4363852178
Add sensor setup type hints [a-b] (#63319)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 19:18:00 +01:00
epenet 880a2b69b6
Use new SensorDeviceClass in apcupsd (#61271)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-08 21:55:44 +01:00
Michael 0edb0c9bc9
Correct name of end apc sensor (#59200) 2021-11-08 16:08:07 +01:00
Marc Mueller a4e4ffef0a
Use EntityDescription - apcupsd (#55790) 2021-09-06 10:19:31 +02:00
Erik Montnemery 4e07ab1b32
Move temperature conversions to sensor base class (1/8) (#48261)
* Move temperature conversions to entity base class (1/8)

* Update integrations a-c

* Leave old temperature conversion until all integrations are migrated

* tweak

* Use contextlib.suppress

* Remove the MeasurableUnitEntity mixin

* Address comments, add tests

* Fix f-string

* Drop deprecation warning from base entity class

* Update with _attr-shorthand

* Fix rebase mistakes

* Fix additional rebase mistakes

* Only report temperature conversion once

* Fix additional rebase mistakes

* Format homeassistant/components/bbox/sensor.py

* Fix check for overidden _attr_state

* Remove test workarounds from implementation

* Remove useless None-check

* Tweaks

* Migrate new sensors a-c

* Update climacell

* Push deprecation of temperature conversion forward

* Override __repr__ in SensorEntity

* Include native_value in SensorEntity attributes

* Pylint

* Black

* Black

* Fix rebase mistakes

* black

* Fix rebase mistakes

* Revert changes in august/sensor.py

* Revert handling of unit converted restored state

* Apply code review suggestion

* Fix arlo test
2021-08-11 10:45:05 +02:00
Michael f7fb4ad782
Fix attr_unit_of_measurement in update of apcupsd entity (#53947) 2021-08-04 21:24:19 +02:00
Marc Mueller 074d762664
Rename and reorganize electric unit constants (#53243) 2021-07-20 20:06:23 +02:00
Erik Montnemery 9b8a776001
Set device_class on temperature sensors A-E (#49524)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-07-12 22:45:29 +02:00
Robert Hillis 1c11b247e4
Use entity class attributes for apcupsd (#52662) 2021-07-08 11:55:26 +02:00
Erik Montnemery e0cd7072d6
Migrate integrations a-c to extend SensorEntity (#48210) 2021-03-22 12:37:16 +01:00
springstan d2b1918e9c
Drop UNIT_ prefix for percentage constant (#39383) 2020-09-05 21:09:14 +02:00
Bram Kragten 9ecaa10e51
Adjust icons for MDI bump (#37730) 2020-07-14 22:17:14 +02:00
springstan b42a197293
Add and use ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_VOLTAGE_AMPERE constants (#33990)
* Add and use ELECTRICAL_CURRENT_AMPERE constant

* Add and use ELECTRICAL_VOLTAGE_AMPERE constant

* Rename ELECTRICAL_VOLTAGE_AMPERE to ELECTRICAL_VOLT_AMPERE

* Fix imports
2020-05-17 15:58:31 +02:00
springstan ef9d9b17bd
Drop UNIT_ prefix for constants (#34164)
* Drop UNIT_ prefix for VOLT

* Drop UNIT_ prefix for DEGREE

* Drop UNIT_ prefix for CONDUCTIVITY

* Drop UNIT_ prefix for UV_INDEX

* Run isort
2020-04-21 19:45:53 +02:00
springstan 19dd797dfe
Add and use frequency constants (#34113) 2020-04-12 22:44:31 +02:00
springstan 04c4501455
Add and use UNIT_VOLT constant (#33994)
* Add and use UNIT_VOLT constant

* Run isort
2020-04-11 02:04:58 +02:00
springstan 60dd2213cf
Remove global variable from apcupsd (#33717)
* Remove global variable from apcupsd

* Run isort

* Address review comments
2020-04-05 23:54:37 +02:00
springstan f1a0ca7cd3
Add and use percentage constant (#32094)
* Add and use percentage constant

* Fix pylint error and broken test
2020-02-28 11:46:48 -08: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
bouni 447d99a1ae Move imports in apcupsd component (#27803) 2019-10-17 17:10:28 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
cgtobi 2c07bfb9e0 Remove dependencies and requirements (#23024)
* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit fe7171b4cd.

* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit 391355ee2c.

* Remove dependencies and requirements

* Fix flake8 complaints

* Fix more flake8 complaints

* Revert non-component removals
2019-04-12 10:13:30 -07:00
Diogo Gomes ed2b9e5483 Centrally define Watt (#21570)
* centralize Watt definition

* lint
2019-03-02 11:29:59 +01:00
Fabian Affolter 127c55e0c1
Update file header (#21023)
* Update file header

* Update file header

* Update file header

* Update file header

* Update file header

* Fix lint issues
2019-02-13 21:21:14 +01:00
Paulus Schoutsen e2d3c27e85
Embed all platforms into components (#20677)
* Consolidate all components with platforms

* Organize tests

* Fix more tests

* Fix Verisure tests

* one final test fix

* Add change

* Fix coverage
2019-02-02 07:13:16 -08:00