Migrate WLED translations (#83296)

This commit is contained in:
Franck Nijhof 2022-12-05 13:45:14 +01:00 committed by GitHub
parent 32dfc59d9e
commit 42c6920a91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 15 deletions

View File

@ -1,7 +1,6 @@
"""Constants for the WLED integration.""" """Constants for the WLED integration."""
from datetime import timedelta from datetime import timedelta
import logging import logging
from typing import Final
# Integration domain # Integration domain
DOMAIN = "wled" DOMAIN = "wled"
@ -24,6 +23,3 @@ ATTR_SOFTWARE_VERSION = "sw_version"
ATTR_SPEED = "speed" ATTR_SPEED = "speed"
ATTR_TARGET_BRIGHTNESS = "target_brightness" ATTR_TARGET_BRIGHTNESS = "target_brightness"
ATTR_UDP_PORT = "udp_port" ATTR_UDP_PORT = "udp_port"
# Device classes
DEVICE_CLASS_WLED_LIVE_OVERRIDE: Final = "wled__live_override"

View File

@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DEVICE_CLASS_WLED_LIVE_OVERRIDE, DOMAIN from .const import DOMAIN
from .coordinator import WLEDDataUpdateCoordinator from .coordinator import WLEDDataUpdateCoordinator
from .helpers import wled_exception_handler from .helpers import wled_exception_handler
from .models import WLEDEntity from .models import WLEDEntity
@ -48,10 +48,10 @@ async def async_setup_entry(
class WLEDLiveOverrideSelect(WLEDEntity, SelectEntity): class WLEDLiveOverrideSelect(WLEDEntity, SelectEntity):
"""Defined a WLED Live Override select.""" """Defined a WLED Live Override select."""
_attr_device_class = DEVICE_CLASS_WLED_LIVE_OVERRIDE
_attr_entity_category = EntityCategory.CONFIG _attr_entity_category = EntityCategory.CONFIG
_attr_icon = "mdi:theater" _attr_icon = "mdi:theater"
_attr_name = "Live override" _attr_name = "Live override"
_attr_translation_key = "live_override"
def __init__(self, coordinator: WLEDDataUpdateCoordinator) -> None: def __init__(self, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED .""" """Initialize WLED ."""

View File

@ -30,5 +30,16 @@
} }
} }
} }
},
"entity": {
"select": {
"live_override": {
"state": {
"0": "[%key:common::state::off%]",
"1": "[%key:common::state::on%]",
"2": "Until device restarts"
}
}
}
} }
} }

View File

@ -1,9 +0,0 @@
{
"state": {
"wled__live_override": {
"0": "[%key:common::state::off%]",
"1": "[%key:common::state::on%]",
"2": "Until device restarts"
}
}
}

View File

@ -22,6 +22,17 @@
} }
} }
}, },
"entity": {
"select": {
"live_override": {
"state": {
"0": "Off",
"1": "On",
"2": "Until device restarts"
}
}
}
},
"options": { "options": {
"step": { "step": {
"init": { "init": {