Add action attribute to Humidifier entity (#95131)

* Add HumidifierAction StrEnum

* Add action attribute to HumidifierEntity

* Update strings.json

* Add action to demo humidifier

* Add tests

* Fix imports

* Add 'off' humidifier action

* Set action to 'off' when state is 'off'

* Add 'off' action to strings.json

* Test that action sets to "off" when state is "off"

* Use is_on instead of state

* Fix typo

* black
This commit is contained in:
Denis Shulyaka 2023-06-28 14:21:17 +03:00 committed by GitHub
parent 8b6ed9c6b9
commit ae21ab2945
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 0 deletions

View file

@ -1,6 +1,8 @@
"""Provides the constants needed for component."""
from enum import IntFlag
from homeassistant.backports.enum import StrEnum
MODE_NORMAL = "normal"
MODE_ECO = "eco"
MODE_AWAY = "away"
@ -11,6 +13,17 @@ MODE_SLEEP = "sleep"
MODE_AUTO = "auto"
MODE_BABY = "baby"
class HumidifierAction(StrEnum):
"""Actions for humidifier devices."""
HUMIDIFYING = "humidifying"
DRYING = "drying"
IDLE = "idle"
OFF = "off"
ATTR_ACTION = "action"
ATTR_AVAILABLE_MODES = "available_modes"
ATTR_CURRENT_HUMIDITY = "current_humidity"
ATTR_HUMIDITY = "humidity"