Commit graph

75 commits

Author SHA1 Message Date
Erik Montnemery
cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
epenet
4c8e3aa7c4
Remove lumen from Illuminance units (#84386) 2022-12-27 14:25:47 +01:00
epenet
3970da0ad3
Adjust device class in xiaomi_miio (#83647) 2022-12-10 11:10:13 +01:00
an0nfunc
a5890b2374
Support xiaomi_miio Smartmi Air Purifier (zhimi.airpurifier.za1) (#80387) 2022-11-29 10:29:34 +01:00
Alejandro Del Rincón López
b51c434b9d
Add support for Xiaomi Purifier 4 Lite (#79758)
* Added support for Xiaomi Purifier 4 Lite

* Remove favorite level from Xiaomi purifier 4 lite.

* Fix linting

Co-authored-by: borky-git <borky-git@protonmail.com>
2022-10-07 13:48:05 +02:00
starkillerOG
e6f567a751
Use device class duration for relevant Xiaomi Miio sensors (#78974) 2022-09-23 18:44:52 +02:00
epenet
7cfc28e915
Add unit constant for revolutions per minute (#78752) 2022-09-19 15:46:47 +02:00
epenet
856318b137
Improve entity type hints [x] (#77887) 2022-09-06 14:00:09 +02:00
McYars
7f4c5c04d3
Add Xiaomi Smartmi Fresh Air System XFXTDFR02ZM (#76637) 2022-08-24 15:09:01 +02:00
borky
25d943d272
Add xiaomi air purifier 4 and 4 pro support (#75745)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-07-28 12:38:04 +02:00
Maciej Bieniek
503b31fb15
Migrate Xiaomi Miio to new entity naming style - part 1 (#75350) 2022-07-17 15:15:24 +02:00
epenet
5360e56d09
Remove xiaomi_miio from mypy ignore list (#74669) 2022-07-09 19:59:11 +02:00
starkillerOG
cfe9ea033a
Split miio gateway coordinator (#69755) 2022-05-19 11:14:07 +02:00
epenet
014aadb299
Use new CONF_MODEL core constant (2/3) (#68831)
* Use CONF_MODEL in xiaomi_miio

* Use CONF_MODEL in xiaomi

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-29 11:12:43 +02:00
Igor Pakhomov
a4ba511276
Add aditional sensors for dmaker.airfresh.a1/t2017 to xiaomi_miio (#66370) 2022-02-21 17:56:34 +01:00
Teemu R
88b7a9fccc
Enable consumable sensors per default for xiaomi_miio vacuums (#66843)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-02-19 20:22:49 +01:00
Igor Pakhomov
2ffb46dc93
Initial xiaomi_miio support for dmaker.airfresh.a1/t2017 (#66331)
* Initial support for dmaker.airfresh.a1/t2017

* fix typo
2022-02-11 23:28:22 +01:00
Kevin Hellemun
6d162929a6
Add xiaomi_miio vacuum current cleaning cycle statistics sensor (#61098) 2022-01-10 22:49:59 +01:00
epenet
cb135bc889
Add basic type hints to xiaomi_miio (#62889)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-28 00:15:40 +01:00
Robert Hillis
83cb2d11d5
Use enums in xiaomi_miio (#61979) 2021-12-16 22:31:51 +01:00
Franck Nijhof
ed6352a22b
Fix Xiaomi Miio providing strings as timestamps (#60979) 2021-12-04 12:33:34 +01:00
Kevin Hellemun
20b93132dd
Support generic xiaomi_miio vacuums (#59317)
* Support generic xiaomi_miio vacuums

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Fix lint

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Remove warning log

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
2021-11-08 23:13:00 +01:00
Maciej Bieniek
c85db9a39d
Remove illuminance sensor (#59305) 2021-11-07 23:17:15 +01:00
Teemu R
f578eee81d
Remove use_time sensor from mjjsq humidifers (#59066) 2021-11-04 14:25:07 +01:00
Maciej Bieniek
43ccf1d967
Handle None values in Xiaomi Miio integration (#58880)
* Initial commit

* Improve _handle_coordinator_update()

* Fix entity_description define

* Improve sensor & binary_sensor platforms

* Log None value

* Use coordinator variable

* Improve log strings

* Filter attributes with None values

* Add hasattr condition

* Update homeassistant/components/xiaomi_miio/sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-11-01 17:40:15 +01:00
Maciej Bieniek
6fb0609f0c
Add use time sensor for air purifiers (#57775) 2021-10-17 07:39:25 +02:00
Maciej Bieniek
b0ff28ceb4
Add entity category to Xiaomi Miio (#57719) 2021-10-14 17:31:25 -07:00
Jan Bouwhuis
c470a03a4e
Add a use_time sensor for Xiaomi_miio humidifiers (#57560)
Co-authored-by: Maciej Bieniek <bieniu@users.noreply.github.com>
2021-10-13 13:36:02 +02:00
Kevin Hellemun
dc5e4392ae
Refactor Xiaomi vacuum to sensors (#54990)
* Refactor Xiaomi vacuum with sensors.

This is the first step into refactoring xiaomi vacuum attributes into sensors.
What is missing are some switches and binary sensors etc.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Use generic sensor for Xiaomi vacuum sensors.

By using HA coordinator, the generic Xiaomi sensor class can be used with these
coordinators to get the status sensors from vacuum. This also means now that
sensors are available as soon as HA starts, which is a nice plus.

Now the only reason to create a subclass of the generic sensors is when custom
value parsing needs to be done.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Working vacuum sensors via 1 coordinator.

Vacuum needs a custom coordinator to ensure that it fetches all the needed data
and puts it in a dict. From this dict the sensors will then get their data
accordingly.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Remove vacuum setup method in sensor

Sensor is generic enough that vacuum does not require its own setup method.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Don't auto register generic sensors.

Let the user decide which sensor is useful for them and enable them.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Remove converted attributes from xiaomi vacuum.

The attributes that have been converted so far should be removed from the vacuum
attributes list.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Fetch data from vacuum sequentially.

It seems some vacuums do not like parallel requests. The requests that came
before are ignored.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Refactor vacuum sensors to its own container.

By moving vacuum sensors to its own container, there is no more key collisions.
This in turns means that there is need for the split hack to ensure key names
are correct.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* fixup! fix bad rebase.

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Fix sensor naming and default registration.

Use proper names for sensors, no need to include from which device status it
came.

Registration of the sensor by default has been parameterised. If the param is
not set, the sensor is not registered.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Make vacuum platform also use coordinator for its data.

By using the coordinator for data in vacuum platfrom, removes the cases where
request gets ignored during the case where the requests are done concurrently by
separate platforms.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Add binary sensor for vacuum

Add binary sensor for waterbox, mop, and water shortage.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Added proper icons to sensors.

https://github.com/home-assistant/core/issues/51361

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Refactor sensors to use dataclass.

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Make vacuum use coordinator for its data.

This commit also insures that the binary sensors are only registered for devices
that include a mop.

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Minor refactoring

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Update data from coordinator after running command.

This is is to have a faster status change when executing a command like changing
fan speeds. If a manual refresh is not triggered. Worst case scenario it will
take 10s for the new fan speed to be reported in HA.

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Refresh within coroutine is ok.

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Move logging to _handle_coordinator_update

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Use internal state attribute.

Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>

* Fix vacuum typing

* Fix tests constants

* Fix vacuum inconsistent return values

* Fix vacuum state update

* Fix vacuum tests

* Remove impossible cases

* Parametrize custom services test

* Move goto test

* Move clean segment test

* Move clean single segment test

* Test service pause

* Include vacuum in coverage

* Delint

* Fix vacuum sensor dict collision.

This also prevents collision for unique id. As the key is used to construct
unique ids.

* Use f strings as dict keys

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-10-07 18:30:17 +02:00
Maciej Bieniek
0044fa9fb9
Add support for pedestal MIOT fans to Xiaomi Miio integration (#56555)
* Add initial support for Xiaomi Fan ZA5

* Add sensor, number and switch platform

* Addionizer switch

* Improve ionizer icon

* Fix parent of XiaomiFanMiot class

* Add another MIOT models

* Fix consts

* Add powersupply attached binary sensor

* Simplify async_create_miio_device_and_coordinator

* Simplify XiaomiGenericFan

* Fix XiaomiFanZA5 parent

* Remove pass

* Remove unused _available variable

* 1C doesn't support direction

* Suggested change

* Use elif

* Clean up oscillation angle

* Fix typo
2021-09-28 10:21:14 +02:00
Maciej Bieniek
9ee0d8fefe
Fix xiaomi miio Air Quality Monitor initialization (#55773) 2021-09-06 15:30:03 +02:00
Maciej Bieniek
08a0377dcb
Add support for Xiaomi Miio Air Purifier 3C (#55484) 2021-08-31 16:44:13 +02:00
Maciej Bieniek
b97d131fb3
Add support for Xiaomi Miio pedestal fans (#55114)
Co-authored-by: Teemu R. <tpr@iki.fi>
2021-08-25 12:09:01 -05:00
Teemu R
3048923dc2
Remove deprecated async_setup_platforms() for xiaomi_miio (#54930) 2021-08-20 11:13:58 -07:00
Maciej Bieniek
8c4a2dc6d2
Add water level and water tank detached sensors for Xiaomi Miio humidifiers (#54625)
* Add water level and water tank detached sensors

* Use elif

* Use DEVICE_CLASS_CONNECTIVITY for water tank sensor

* Improve docstring

* Change the water tank sensor icon

* Fix typo
2021-08-16 09:13:45 +02:00
Maciej Bieniek
ebaae8d2bf
Add sensor platform for Xiaomi Miio fans (#54564) 2021-08-15 13:49:29 +02:00
Erik Montnemery
87e7a8fb5f
Move temperature conversions to sensor base class - new integrations (#54623)
* Move temperature conversions to sensor base class

* Tweaks

* Update pvpc_hourly_pricing

* Fix flipr sensor

* Fix ezviz and youless sensor
2021-08-15 08:51:43 +02:00
Erik Montnemery
ae507aeed1
Move temperature conversions to sensor base class (8/8) (#54483)
* Move temperature conversions to entity base class (8/8)

* Fix wallbox sensor

* Fix tests
2021-08-11 21:17:16 +02:00
Maciej Bieniek
aaddeb0bcd
Add missing motor_speed sensor for Xiaomi Miio humidifier CA1 and CB1 (#54264)
* Add motor_speed sensor for CA1 and CB1

* Remove value limits
2021-08-08 15:21:55 +02:00
starkillerOG
af38ff1ec1
Add xiaomi miio lumi.gateway.aqhm01 support (#53929) 2021-08-04 11:23:21 +02:00
Maciej Bieniek
1286734ce9
Use SensorEntityDescription class for Xiaomi Miio (#53890) 2021-08-03 13:56:56 +02:00
Maciej Bieniek
938ec27a86
Add support for MJJSQ humidifiers for Xiaomi MIIO integration (#53807) 2021-08-02 22:08:37 +02:00
Jan Bouwhuis
1e33017db8
Fix Xiaomi humidifier name migration (#53738) 2021-07-29 22:10:16 -07:00
Jan Bouwhuis
781015fb19
Xiaomi_Miio Humidifier rework (#52366)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Maciej Bieniek <bieniu@users.noreply.github.com>
Co-authored-by: Teemu R. <tpr@iki.fi>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2021-07-28 10:52:43 +02:00
Franck Nijhof
258b388f41
Collection of changing entity properties to class attributes (#51248)
* Collection of changing entity properties to class attributes

* Apply suggestions from code review

Co-authored-by: Erik Montnemery <erik@montnemery.com>

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-05-31 10:50:11 +02:00
Erik Montnemery
b169a8dbda
Mark battery, humidity and pressure sensors as STATE_CLASS_MEASUREMENT (#50924)
* Mark battery, humidity and pressure sensors as STATE_CLASS_MEASUREMENT

* Fix deconz battery sensor
2021-05-24 11:36:42 +02:00
Erik Montnemery
73d7a754e8
Mark temperature sensors as STATE_CLASS_MEASUREMENT (#50889)
* Mark temperature sensors as STATE_CLASS_MEASUREMENT

* Fix broadlink tests

* Tweak Hue changes
2021-05-21 11:44:34 +02:00
Erik Montnemery
0c086b5067
Migrate integrations w-z to extend SensorEntity (#48217) 2021-03-22 19:50:29 +01:00
starkillerOG
b2efcb3c22
Support all Xiaomi Miio gateway switches (#46657)
* Support all gateway switches

* fix checks

* process revieuw

* Update homeassistant/components/xiaomi_miio/switch.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* generilize variable matching

* fix styling

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-15 12:15:34 +01:00
starkillerOG
50b5fc4860
Add Xiaomi Miio subdevice lightbulb support (#46660)
* Xiaomi Miio: add subdevice lightbulb support

* fix tests

* process revieuw comments

* bump python-miio to 0.5.5

* bump python-miio to 0.5.5

* fix imports
2021-03-14 12:32:19 +01:00