Add entity name translations to Plugwise (#90537)

* Add entity name translations to Plugwise

* Re-use extisting translation where possible
This commit is contained in:
Franck Nijhof 2023-04-03 15:25:02 +02:00 committed by GitHub
parent e72c2029cb
commit 186f47ba46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 24 deletions

View file

@ -31,26 +31,27 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription):
BINARY_SENSORS: tuple[PlugwiseBinarySensorEntityDescription, ...] = (
PlugwiseBinarySensorEntityDescription(
key="compressor_state",
name="Compressor state",
translation_key="compressor_state",
icon="mdi:hvac",
icon_off="mdi:hvac-off",
entity_category=EntityCategory.DIAGNOSTIC,
),
PlugwiseBinarySensorEntityDescription(
key="cooling_enabled",
name="Cooling enabled",
translation_key="cooling_enabled",
icon="mdi:snowflake-thermometer",
entity_category=EntityCategory.DIAGNOSTIC,
),
PlugwiseBinarySensorEntityDescription(
key="dhw_state",
name="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",
@ -58,28 +59,28 @@ BINARY_SENSORS: tuple[PlugwiseBinarySensorEntityDescription, ...] = (
),
PlugwiseBinarySensorEntityDescription(
key="heating_state",
name="Heating",
translation_key="heating_state",
icon="mdi:radiator",
icon_off="mdi:radiator-off",
entity_category=EntityCategory.DIAGNOSTIC,
),
PlugwiseBinarySensorEntityDescription(
key="cooling_state",
name="Cooling",
translation_key="cooling_state",
icon="mdi:snowflake",
icon_off="mdi:snowflake-off",
entity_category=EntityCategory.DIAGNOSTIC,
),
PlugwiseBinarySensorEntityDescription(
key="slave_boiler_state",
name="Secondary boiler state",
translation_key="slave_boiler_state",
icon="mdi:fire",
icon_off="mdi:circle-off-outline",
entity_category=EntityCategory.DIAGNOSTIC,
),
PlugwiseBinarySensorEntityDescription(
key="plugwise_notification",
name="Plugwise notification",
translation_key="plugwise_notification",
icon="mdi:mailbox-up-outline",
icon_off="mdi:mailbox-outline",
entity_category=EntityCategory.DIAGNOSTIC,

View file

@ -43,9 +43,9 @@ class PlugwiseNumberEntityDescription(
NUMBER_TYPES = (
PlugwiseNumberEntityDescription(
key="maximum_boiler_temperature",
translation_key="maximum_boiler_temperature",
command=lambda api, number, value: api.set_number_setpoint(number, value),
device_class=NumberDeviceClass.TEMPERATURE,
name="Maximum boiler temperature setpoint",
entity_category=EntityCategory.CONFIG,
native_max_value_key="upper_bound",
native_min_value_key="lower_bound",

View file

@ -37,7 +37,7 @@ class PlugwiseSelectEntityDescription(
SELECT_TYPES = (
PlugwiseSelectEntityDescription(
key="select_schedule",
name="Thermostat schedule",
translation_key="select_schedule",
icon="mdi:calendar-clock",
command=lambda api, loc, opt: api.set_schedule_state(loc, opt, STATE_ON),
current_option_key="selected_schedule",
@ -45,20 +45,18 @@ SELECT_TYPES = (
),
PlugwiseSelectEntityDescription(
key="select_regulation_mode",
name="Regulation mode",
translation_key="regulation_mode",
icon="mdi:hvac",
entity_category=EntityCategory.CONFIG,
translation_key="regulation_mode",
command=lambda api, loc, opt: api.set_regulation_mode(opt),
current_option_key="regulation_mode",
options_key="regulation_modes",
),
PlugwiseSelectEntityDescription(
key="select_dhw_mode",
name="DHW mode",
translation_key="dhw_mode",
icon="mdi:shower",
entity_category=EntityCategory.CONFIG,
translation_key="dhw_mode",
command=lambda api, loc, opt: api.set_dhw_mode(opt),
current_option_key="dhw_mode",
options_key="dhw_modes",

View file

@ -26,38 +26,94 @@
}
},
"entity": {
"binary_sensor": {
"compressor_state": {
"name": "Compressor state"
},
"cooling_enabled": {
"name": "Cooling enabled"
},
"dhw_state": {
"name": "DHW state"
},
"flame_state": {
"name": "Flame state"
},
"heating_state": {
"name": "[%key:component::climate::entity_component::_::state_attributes::hvac_action::state::heating%]"
},
"cooling_state": {
"name": "[%key:component::climate::entity_component::_::state_attributes::hvac_action::state::cooling%]"
},
"slave_boiler_state": {
"name": "Secondary boiler state"
},
"plugwise_notification": {
"name": "Plugwise notification"
}
},
"climate": {
"plugwise": {
"state_attributes": {
"available_schemas": {
"name": "Available schemas"
},
"preset_mode": {
"state": {
"asleep": "Night",
"away": "Away",
"home": "Home",
"away": "[%key:component::climate::entity_component::_::state_attributes::preset_mode::state::away%]",
"home": "[%key:component::climate::entity_component::_::state_attributes::preset_mode::state::home%]",
"no_frost": "Anti-frost",
"vacation": "Vacation"
}
},
"selected_schema": {
"name": "Selected schema"
}
}
}
},
"number": {
"maximum_boiler_temperature": {
"name": "Maximum boiler temperature setpoint"
}
},
"select": {
"dhw_mode": {
"name": "DHW mode",
"state": {
"off": "Off",
"off": "[%key:common::state::off%]",
"auto": "Auto",
"boost": "Boost",
"comfort": "Comfort"
"boost": "[%key:component::climate::entity_component::_::state_attributes::preset_mode::state::boost%]",
"comfort": "[%key:component::climate::entity_component::_::state_attributes::preset_mode::state::comfort%]"
}
},
"regulation_mode": {
"name": "Regulation mode",
"state": {
"bleeding_cold": "Bleeding cold",
"bleeding_hot": "Bleeding hot",
"cooling": "Cooling",
"heating": "Heating",
"off": "Off"
"cooling": "[%key:component::climate::entity_component::_::state_attributes::hvac_action::state::cooling%]",
"heating": "[%key:component::climate::entity_component::_::state_attributes::hvac_action::state::heating%]",
"off": "[%key:common::state::off%]"
}
},
"select_schedule": {
"name": "Thermostat schedule"
}
},
"switch": {
"cooling_ena_switch": {
"name": "[%key:component::climate::entity_component::_::state_attributes::hvac_action::state::cooling%]"
},
"dhw_cm_switch": {
"name": "DHW comfort mode"
},
"lock": {
"name": "[%key:component::lock::entity_component::_::name%]"
},
"relay": {
"name": "Relay"
}
}
}

View file

@ -21,19 +21,19 @@ from .util import plugwise_command
SWITCHES: tuple[SwitchEntityDescription, ...] = (
SwitchEntityDescription(
key="dhw_cm_switch",
name="DHW comfort mode",
translation_key="dhw_cm_switch",
icon="mdi:water-plus",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key="lock",
name="Lock",
translation_key="lock",
icon="mdi:lock",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key="relay",
name="Relay",
translation_key="relay",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(