Add icon translations to Plugwise (#108498)
parent
e71efa0e2b
commit
19bf8970d2
|
@ -28,64 +28,48 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription):
|
|||
"""Describes a Plugwise binary sensor entity."""
|
||||
|
||||
key: BinarySensorType
|
||||
icon_off: str | None = None
|
||||
|
||||
|
||||
BINARY_SENSORS: tuple[PlugwiseBinarySensorEntityDescription, ...] = (
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="compressor_state",
|
||||
translation_key="compressor_state",
|
||||
icon="mdi:hvac",
|
||||
icon_off="mdi:hvac-off",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="cooling_enabled",
|
||||
translation_key="cooling_enabled",
|
||||
icon="mdi:snowflake-thermometer",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="dhw_state",
|
||||
translation_key="dhw_state",
|
||||
icon="mdi:water-pump",
|
||||
icon_off="mdi:water-pump-off",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="flame_state",
|
||||
translation_key="flame_state",
|
||||
name="Flame state",
|
||||
icon="mdi:fire",
|
||||
icon_off="mdi:fire-off",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="heating_state",
|
||||
translation_key="heating_state",
|
||||
icon="mdi:radiator",
|
||||
icon_off="mdi:radiator-off",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="cooling_state",
|
||||
translation_key="cooling_state",
|
||||
icon="mdi:snowflake",
|
||||
icon_off="mdi:snowflake-off",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="slave_boiler_state",
|
||||
translation_key="slave_boiler_state",
|
||||
icon="mdi:fire",
|
||||
icon_off="mdi:circle-off-outline",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="plugwise_notification",
|
||||
translation_key="plugwise_notification",
|
||||
icon="mdi:mailbox-up-outline",
|
||||
icon_off="mdi:mailbox-outline",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
)
|
||||
|
@ -140,13 +124,6 @@ class PlugwiseBinarySensorEntity(PlugwiseEntity, BinarySensorEntity):
|
|||
"""Return true if the binary sensor is on."""
|
||||
return self.device["binary_sensors"][self.entity_description.key]
|
||||
|
||||
@property
|
||||
def icon(self) -> str | None:
|
||||
"""Return the icon to use in the frontend, if any."""
|
||||
if (icon_off := self.entity_description.icon_off) and self.is_on is False:
|
||||
return icon_off
|
||||
return self.entity_description.icon
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self) -> Mapping[str, Any] | None:
|
||||
"""Return entity specific state attributes."""
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"compressor_state": {
|
||||
"default": "mdi:hvac",
|
||||
"state": {
|
||||
"off": "mdi:hvac-off"
|
||||
}
|
||||
},
|
||||
"cooling_enabled": {
|
||||
"default": "mdi:snowflake-thermometer"
|
||||
},
|
||||
"cooling_state": {
|
||||
"default": "mdi:snowflake",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
}
|
||||
},
|
||||
"dhw_state": {
|
||||
"default": "mdi:water-pump",
|
||||
"state": {
|
||||
"off": "mdi:water-pump-off"
|
||||
}
|
||||
},
|
||||
"flame_state": {
|
||||
"default": "mdi:fire",
|
||||
"state": {
|
||||
"off": "mdi:fire-off"
|
||||
}
|
||||
},
|
||||
"heating_state": {
|
||||
"default": "mdi:radiator",
|
||||
"state": {
|
||||
"off": "mdi:radiator-off"
|
||||
}
|
||||
},
|
||||
"plugwise_notification": {
|
||||
"default": "mdi:mailbox-up-outline",
|
||||
"state": {
|
||||
"off": "mdi:mailbox-outline"
|
||||
}
|
||||
},
|
||||
"slave_boiler_state": {
|
||||
"default": "mdi:fire",
|
||||
"state": {
|
||||
"off": "mdi:circle-off-outline"
|
||||
}
|
||||
}
|
||||
},
|
||||
"climate": {
|
||||
"plugwise": {
|
||||
"state_attributes": {
|
||||
"preset_mode": {
|
||||
"state": {
|
||||
"asleep": "mdi:weather-night",
|
||||
"away": "mdi:account-arrow-right",
|
||||
"home": "mdi:home",
|
||||
"no_frost": "mdi:snowflake-melt",
|
||||
"vacation": "mdi:beach"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"dhw_mode": {
|
||||
"default": "mdi:shower"
|
||||
},
|
||||
"gateway_mode": {
|
||||
"default": "mdi:cog-outline"
|
||||
},
|
||||
"regulation_mode": {
|
||||
"default": "mdi:hvac"
|
||||
},
|
||||
"select_schedule": {
|
||||
"default": "mdi:calendar-clock"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"gas_consumed_interval": {
|
||||
"default": "mdi:meter-gas"
|
||||
},
|
||||
"modulation_level": {
|
||||
"default": "mdi:percent"
|
||||
},
|
||||
"valve_position": {
|
||||
"default": "mdi:valve"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"cooling_ena_switch": {
|
||||
"default": "mdi:snowflake-thermometer"
|
||||
},
|
||||
"dhw_cm_switch": {
|
||||
"default": "mdi:water-plus"
|
||||
},
|
||||
"lock": {
|
||||
"default": "mdi:lock"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,14 +30,12 @@ SELECT_TYPES = (
|
|||
PlugwiseSelectEntityDescription(
|
||||
key="select_schedule",
|
||||
translation_key="select_schedule",
|
||||
icon="mdi:calendar-clock",
|
||||
command=lambda api, loc, opt: api.set_schedule_state(loc, STATE_ON, opt),
|
||||
options_key="available_schedules",
|
||||
),
|
||||
PlugwiseSelectEntityDescription(
|
||||
key="select_regulation_mode",
|
||||
translation_key="regulation_mode",
|
||||
icon="mdi:hvac",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
command=lambda api, loc, opt: api.set_regulation_mode(opt),
|
||||
options_key="regulation_modes",
|
||||
|
@ -45,7 +43,6 @@ SELECT_TYPES = (
|
|||
PlugwiseSelectEntityDescription(
|
||||
key="select_dhw_mode",
|
||||
translation_key="dhw_mode",
|
||||
icon="mdi:shower",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
command=lambda api, loc, opt: api.set_dhw_mode(opt),
|
||||
options_key="dhw_modes",
|
||||
|
@ -53,7 +50,6 @@ SELECT_TYPES = (
|
|||
PlugwiseSelectEntityDescription(
|
||||
key="select_gateway_mode",
|
||||
translation_key="gateway_mode",
|
||||
icon="mdi:cog-outline",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
command=lambda api, loc, opt: api.set_gateway_mode(opt),
|
||||
options_key="gateway_modes",
|
||||
|
|
|
@ -315,7 +315,6 @@ SENSORS: tuple[PlugwiseSensorEntityDescription, ...] = (
|
|||
PlugwiseSensorEntityDescription(
|
||||
key="gas_consumed_interval",
|
||||
translation_key="gas_consumed_interval",
|
||||
icon="mdi:meter-gas",
|
||||
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
|
@ -357,7 +356,6 @@ SENSORS: tuple[PlugwiseSensorEntityDescription, ...] = (
|
|||
PlugwiseSensorEntityDescription(
|
||||
key="modulation_level",
|
||||
translation_key="modulation_level",
|
||||
icon="mdi:percent",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -365,7 +363,6 @@ SENSORS: tuple[PlugwiseSensorEntityDescription, ...] = (
|
|||
PlugwiseSensorEntityDescription(
|
||||
key="valve_position",
|
||||
translation_key="valve_position",
|
||||
icon="mdi:valve",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
|
|
@ -33,13 +33,11 @@ SWITCHES: tuple[PlugwiseSwitchEntityDescription, ...] = (
|
|||
PlugwiseSwitchEntityDescription(
|
||||
key="dhw_cm_switch",
|
||||
translation_key="dhw_cm_switch",
|
||||
icon="mdi:water-plus",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
PlugwiseSwitchEntityDescription(
|
||||
key="lock",
|
||||
translation_key="lock",
|
||||
icon="mdi:lock",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
PlugwiseSwitchEntityDescription(
|
||||
|
@ -51,7 +49,6 @@ SWITCHES: tuple[PlugwiseSwitchEntityDescription, ...] = (
|
|||
key="cooling_ena_switch",
|
||||
translation_key="cooling_ena_switch",
|
||||
name="Cooling",
|
||||
icon="mdi:snowflake-thermometer",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue