Add state attribute translations to Switchbot (#90861)
parent
22f29e8c84
commit
58f8f9c82a
|
@ -51,6 +51,7 @@ class SwitchBotCurtainEntity(SwitchbotEntity, CoverEntity, RestoreEntity):
|
|||
| CoverEntityFeature.STOP
|
||||
| CoverEntityFeature.SET_POSITION
|
||||
)
|
||||
_attr_translation_key = "cover"
|
||||
|
||||
def __init__(self, coordinator: SwitchbotDataUpdateCoordinator) -> None:
|
||||
"""Initialize the Switchbot."""
|
||||
|
@ -120,6 +121,7 @@ class SwitchBotBlindTiltEntity(SwitchbotEntity, CoverEntity, RestoreEntity):
|
|||
| CoverEntityFeature.STOP_TILT
|
||||
| CoverEntityFeature.SET_TILT_POSITION
|
||||
)
|
||||
_attr_translation_key = "cover"
|
||||
CLOSED_UP_THRESHOLD = 80
|
||||
CLOSED_DOWN_THRESHOLD = 20
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ class SwitchBotHumidifier(SwitchbotSwitchedEntity, HumidifierEntity):
|
|||
_attr_available_modes = [MODE_NORMAL, MODE_AUTO]
|
||||
_device: switchbot.SwitchbotHumidifier
|
||||
_attr_min_humidity = 1
|
||||
_attr_translation_key = "humidifier"
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
|
|
|
@ -26,6 +26,7 @@ async def async_setup_entry(
|
|||
class SwitchBotLock(SwitchbotEntity, LockEntity):
|
||||
"""Representation of a Switchbot lock."""
|
||||
|
||||
_attr_translation_key = "lock"
|
||||
_device: switchbot.SwitchbotLock
|
||||
|
||||
def __init__(self, coordinator: SwitchbotDataUpdateCoordinator) -> None:
|
||||
|
|
|
@ -108,6 +108,60 @@
|
|||
"power": {
|
||||
"name": "[%key:component::sensor::entity_component::power::name%]"
|
||||
}
|
||||
},
|
||||
"cover": {
|
||||
"cover": {
|
||||
"state_attributes": {
|
||||
"last_run_success": {
|
||||
"state": {
|
||||
"true": "[%key:component::binary_sensor::entity_component::problem::state::off%]",
|
||||
"false": "[%key:component::binary_sensor::entity_component::problem::state::on%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"humidifier": {
|
||||
"humidifier": {
|
||||
"state_attributes": {
|
||||
"last_run_success": {
|
||||
"state": {
|
||||
"true": "[%key:component::binary_sensor::entity_component::problem::state::off%]",
|
||||
"false": "[%key:component::binary_sensor::entity_component::problem::state::on%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"lock": {
|
||||
"lock": {
|
||||
"state_attributes": {
|
||||
"last_run_success": {
|
||||
"state": {
|
||||
"true": "[%key:component::binary_sensor::entity_component::problem::state::off%]",
|
||||
"false": "[%key:component::binary_sensor::entity_component::problem::state::on%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"bot": {
|
||||
"state_attributes": {
|
||||
"last_run_success": {
|
||||
"state": {
|
||||
"true": "[%key:component::binary_sensor::entity_component::problem::state::off%]",
|
||||
"false": "[%key:component::binary_sensor::entity_component::problem::state::on%]"
|
||||
}
|
||||
},
|
||||
"switch_mode": {
|
||||
"state": {
|
||||
"true": "Pull/Retract",
|
||||
"false": "Momentary"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class SwitchBotSwitch(SwitchbotSwitchedEntity, SwitchEntity, RestoreEntity):
|
|||
"""Representation of a Switchbot switch."""
|
||||
|
||||
_attr_device_class = SwitchDeviceClass.SWITCH
|
||||
_attr_translation_key = "bot"
|
||||
_device: switchbot.Switchbot
|
||||
|
||||
def __init__(self, coordinator: SwitchbotDataUpdateCoordinator) -> None:
|
||||
|
|
Loading…
Reference in New Issue