Add icon translations to Bond (#111349)
This commit is contained in:
parent
20647af5ae
commit
688395a3e3
3 changed files with 136 additions and 29 deletions
|
@ -36,7 +36,7 @@ class BondButtonEntityDescription(ButtonEntityDescription):
|
|||
STOP_BUTTON = BondButtonEntityDescription(
|
||||
key=Action.STOP,
|
||||
name="Stop Actions",
|
||||
icon="mdi:stop-circle-outline",
|
||||
translation_key="stop_actions",
|
||||
mutually_exclusive=None,
|
||||
argument=None,
|
||||
)
|
||||
|
@ -46,175 +46,175 @@ BUTTONS: tuple[BondButtonEntityDescription, ...] = (
|
|||
BondButtonEntityDescription(
|
||||
key=Action.TOGGLE_POWER,
|
||||
name="Toggle Power",
|
||||
icon="mdi:power-cycle",
|
||||
translation_key="toggle_power",
|
||||
mutually_exclusive=Action.TURN_ON,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.TOGGLE_LIGHT,
|
||||
name="Toggle Light",
|
||||
icon="mdi:lightbulb",
|
||||
translation_key="toggle_light",
|
||||
mutually_exclusive=Action.TURN_LIGHT_ON,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.INCREASE_BRIGHTNESS,
|
||||
name="Increase Brightness",
|
||||
icon="mdi:brightness-7",
|
||||
translation_key="increase_brightness",
|
||||
mutually_exclusive=Action.SET_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.DECREASE_BRIGHTNESS,
|
||||
name="Decrease Brightness",
|
||||
icon="mdi:brightness-1",
|
||||
translation_key="decrease_brightness",
|
||||
mutually_exclusive=Action.SET_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.TOGGLE_UP_LIGHT,
|
||||
name="Toggle Up Light",
|
||||
icon="mdi:lightbulb",
|
||||
translation_key="toggle_up_light",
|
||||
mutually_exclusive=Action.TURN_UP_LIGHT_ON,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.TOGGLE_DOWN_LIGHT,
|
||||
name="Toggle Down Light",
|
||||
icon="mdi:lightbulb",
|
||||
translation_key="toggle_down_light",
|
||||
mutually_exclusive=Action.TURN_DOWN_LIGHT_ON,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.START_DIMMER,
|
||||
name="Start Dimmer",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="start_dimmer",
|
||||
mutually_exclusive=Action.SET_BRIGHTNESS,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.START_UP_LIGHT_DIMMER,
|
||||
name="Start Up Light Dimmer",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="start_up_light_dimmer",
|
||||
mutually_exclusive=Action.SET_UP_LIGHT_BRIGHTNESS,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.START_DOWN_LIGHT_DIMMER,
|
||||
name="Start Down Light Dimmer",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="start_down_light_dimmer",
|
||||
mutually_exclusive=Action.SET_DOWN_LIGHT_BRIGHTNESS,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.START_INCREASING_BRIGHTNESS,
|
||||
name="Start Increasing Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="start_increasing_brightness",
|
||||
mutually_exclusive=Action.SET_BRIGHTNESS,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.START_DECREASING_BRIGHTNESS,
|
||||
name="Start Decreasing Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="start_decreasing_brightness",
|
||||
mutually_exclusive=Action.SET_BRIGHTNESS,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.INCREASE_UP_LIGHT_BRIGHTNESS,
|
||||
name="Increase Up Light Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="increase_up_light_brightness",
|
||||
mutually_exclusive=Action.SET_UP_LIGHT_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.DECREASE_UP_LIGHT_BRIGHTNESS,
|
||||
name="Decrease Up Light Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="decrease_up_light_brightness",
|
||||
mutually_exclusive=Action.SET_UP_LIGHT_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.INCREASE_DOWN_LIGHT_BRIGHTNESS,
|
||||
name="Increase Down Light Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="increase_down_light_brightness",
|
||||
mutually_exclusive=Action.SET_DOWN_LIGHT_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.DECREASE_DOWN_LIGHT_BRIGHTNESS,
|
||||
name="Decrease Down Light Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="decrease_down_light_brightness",
|
||||
mutually_exclusive=Action.SET_DOWN_LIGHT_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.CYCLE_UP_LIGHT_BRIGHTNESS,
|
||||
name="Cycle Up Light Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="cycle_up_light_brightness",
|
||||
mutually_exclusive=Action.SET_UP_LIGHT_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.CYCLE_DOWN_LIGHT_BRIGHTNESS,
|
||||
name="Cycle Down Light Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="cycle_down_light_brightness",
|
||||
mutually_exclusive=Action.SET_DOWN_LIGHT_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.CYCLE_BRIGHTNESS,
|
||||
name="Cycle Brightness",
|
||||
icon="mdi:brightness-percent",
|
||||
translation_key="cycle_brightness",
|
||||
mutually_exclusive=Action.SET_BRIGHTNESS,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.INCREASE_SPEED,
|
||||
name="Increase Speed",
|
||||
icon="mdi:skew-more",
|
||||
translation_key="increase_speed",
|
||||
mutually_exclusive=Action.SET_SPEED,
|
||||
argument=1,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.DECREASE_SPEED,
|
||||
name="Decrease Speed",
|
||||
icon="mdi:skew-less",
|
||||
translation_key="decrease_speed",
|
||||
mutually_exclusive=Action.SET_SPEED,
|
||||
argument=1,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.TOGGLE_DIRECTION,
|
||||
name="Toggle Direction",
|
||||
icon="mdi:directions-fork",
|
||||
translation_key="toggle_direction",
|
||||
mutually_exclusive=Action.SET_DIRECTION,
|
||||
argument=None,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.INCREASE_TEMPERATURE,
|
||||
name="Increase Temperature",
|
||||
icon="mdi:thermometer-plus",
|
||||
translation_key="increase_temperature",
|
||||
mutually_exclusive=None,
|
||||
argument=1,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.DECREASE_TEMPERATURE,
|
||||
name="Decrease Temperature",
|
||||
icon="mdi:thermometer-minus",
|
||||
translation_key="decrease_temperature",
|
||||
mutually_exclusive=None,
|
||||
argument=1,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.INCREASE_FLAME,
|
||||
name="Increase Flame",
|
||||
icon="mdi:fire",
|
||||
translation_key="increase_flame",
|
||||
mutually_exclusive=None,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.DECREASE_FLAME,
|
||||
name="Decrease Flame",
|
||||
icon="mdi:fire-off",
|
||||
translation_key="decrease_flame",
|
||||
mutually_exclusive=None,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
|
@ -227,14 +227,14 @@ BUTTONS: tuple[BondButtonEntityDescription, ...] = (
|
|||
BondButtonEntityDescription(
|
||||
key=Action.INCREASE_POSITION,
|
||||
name="Increase Position",
|
||||
icon="mdi:plus-box",
|
||||
translation_key="increase_position",
|
||||
mutually_exclusive=Action.SET_POSITION,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
BondButtonEntityDescription(
|
||||
key=Action.DECREASE_POSITION,
|
||||
name="Decrease Position",
|
||||
icon="mdi:minus-box",
|
||||
translation_key="decrease_position",
|
||||
mutually_exclusive=Action.SET_POSITION,
|
||||
argument=STEP_SIZE,
|
||||
),
|
||||
|
|
107
homeassistant/components/bond/icons.json
Normal file
107
homeassistant/components/bond/icons.json
Normal file
|
@ -0,0 +1,107 @@
|
|||
{
|
||||
"entity": {
|
||||
"button": {
|
||||
"stop_actions": {
|
||||
"default": "mdi:stop-circle-outline"
|
||||
},
|
||||
"toggle_power": {
|
||||
"default": "mdi:power-cycle"
|
||||
},
|
||||
"toggle_light": {
|
||||
"default": "mdi:lightbulb"
|
||||
},
|
||||
"increase_brightness": {
|
||||
"default": "mdi:brightness-7"
|
||||
},
|
||||
"decrease_brightness": {
|
||||
"default": "mdi:brightness-1"
|
||||
},
|
||||
"toggle_up_light": {
|
||||
"default": "mdi:lightbulb"
|
||||
},
|
||||
"toggle_down_light": {
|
||||
"default": "mdi:lightbulb"
|
||||
},
|
||||
"start_dimmer": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"start_up_light_dimmer": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"start_down_light_dimmer": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"start_increasing_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"start_decreasing_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"increase_up_light_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"decrease_up_light_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"increase_down_light_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"decrease_down_light_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"cycle_up_light_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"cycle_down_light_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"cycle_brightness": {
|
||||
"default": "mdi:brightness-percent"
|
||||
},
|
||||
"increase_speed": {
|
||||
"default": "mdi:skew-more"
|
||||
},
|
||||
"decrease_speed": {
|
||||
"default": "mdi:skew-less"
|
||||
},
|
||||
"toggle_direction": {
|
||||
"default": "mdi:directions-fork"
|
||||
},
|
||||
"increase_temperature": {
|
||||
"default": "mdi:thermometer-plus"
|
||||
},
|
||||
"decrease_temperature": {
|
||||
"default": "mdi:thermometer-minus"
|
||||
},
|
||||
"increase_flame": {
|
||||
"default": "mdi:fire"
|
||||
},
|
||||
"decrease_flame": {
|
||||
"default": "mdi:fire-off"
|
||||
},
|
||||
"increase_position": {
|
||||
"default": "mdi:plus-box"
|
||||
},
|
||||
"decrease_position": {
|
||||
"default": "mdi:minus-box"
|
||||
}
|
||||
},
|
||||
"light": {
|
||||
"fireplace": {
|
||||
"default": "mdi:fireplace-off",
|
||||
"state": {
|
||||
"on": "mdi:fireplace"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"set_fan_speed_tracked_state": "mdi:fan",
|
||||
"set_switch_power_tracked_state": "mdi:toggle-switch-variant",
|
||||
"set_light_power_tracked_state": "mdi:lightbulb",
|
||||
"set_light_brightness_tracked_state": "mdi:lightbulb-on",
|
||||
"start_increasing_brightness": "mdi:brightness-7",
|
||||
"start_decreasing_brightness": "mdi:brightness-1",
|
||||
"stop": "mdi:stop"
|
||||
}
|
||||
}
|
|
@ -274,6 +274,7 @@ class BondFireplace(BondEntity, LightEntity):
|
|||
|
||||
_attr_color_mode = ColorMode.BRIGHTNESS
|
||||
_attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||
_attr_translation_key = "fireplace"
|
||||
|
||||
def _apply_state(self) -> None:
|
||||
state = self._device.state
|
||||
|
@ -281,7 +282,6 @@ class BondFireplace(BondEntity, LightEntity):
|
|||
flame = state.get("flame")
|
||||
self._attr_is_on = power == 1
|
||||
self._attr_brightness = round(flame * 255 / 100) if flame else None
|
||||
self._attr_icon = "mdi:fireplace" if power == 1 else "mdi:fireplace-off"
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the fireplace on."""
|
||||
|
|
Loading…
Add table
Reference in a new issue