Add entity translations to IntelliFire (#95466)
parent
11fd43b1fc
commit
9ca288858b
|
@ -38,45 +38,45 @@ class IntellifireBinarySensorEntityDescription(
|
|||
INTELLIFIRE_BINARY_SENSORS: tuple[IntellifireBinarySensorEntityDescription, ...] = (
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="on_off", # This is the sensor name
|
||||
name="Flame", # This is the human readable name
|
||||
translation_key="flame", # This is the translation key
|
||||
icon="mdi:fire",
|
||||
value_fn=lambda data: data.is_on,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="timer_on",
|
||||
name="Timer on",
|
||||
translation_key="timer_on",
|
||||
icon="mdi:camera-timer",
|
||||
value_fn=lambda data: data.timer_on,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="pilot_light_on",
|
||||
name="Pilot light on",
|
||||
translation_key="pilot_light_on",
|
||||
icon="mdi:fire-alert",
|
||||
value_fn=lambda data: data.pilot_on,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="thermostat_on",
|
||||
name="Thermostat on",
|
||||
translation_key="thermostat_on",
|
||||
icon="mdi:home-thermometer-outline",
|
||||
value_fn=lambda data: data.thermostat_on,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_pilot_flame",
|
||||
name="Pilot flame error",
|
||||
translation_key="pilot_flame_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_pilot_flame,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_flame",
|
||||
name="Flame Error",
|
||||
translation_key="flame_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_flame,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_fan_delay",
|
||||
name="Fan delay error",
|
||||
translation_key="fan_delay_error",
|
||||
icon="mdi:fan-alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_fan_delay,
|
||||
|
@ -84,21 +84,21 @@ INTELLIFIRE_BINARY_SENSORS: tuple[IntellifireBinarySensorEntityDescription, ...]
|
|||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_maintenance",
|
||||
name="Maintenance error",
|
||||
translation_key="maintenance_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_maintenance,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_disabled",
|
||||
name="Disabled error",
|
||||
translation_key="disabled_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_disabled,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_fan",
|
||||
name="Fan error",
|
||||
translation_key="fan_error",
|
||||
icon="mdi:fan-alert",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_fan,
|
||||
|
@ -106,35 +106,35 @@ INTELLIFIRE_BINARY_SENSORS: tuple[IntellifireBinarySensorEntityDescription, ...]
|
|||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_lights",
|
||||
name="Lights error",
|
||||
translation_key="lights_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_lights,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_accessory",
|
||||
name="Accessory error",
|
||||
translation_key="accessory_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_accessory,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_soft_lock_out",
|
||||
name="Soft lock out error",
|
||||
translation_key="soft_lock_out_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_soft_lock_out,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_ecm_offline",
|
||||
name="ECM offline error",
|
||||
translation_key="ecm_offline_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_ecm_offline,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
),
|
||||
IntellifireBinarySensorEntityDescription(
|
||||
key="error_offline",
|
||||
name="Offline error",
|
||||
translation_key="offline_error",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.error_offline,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
|
|
|
@ -45,7 +45,7 @@ class IntellifireFanEntityDescription(
|
|||
INTELLIFIRE_FANS: tuple[IntellifireFanEntityDescription, ...] = (
|
||||
IntellifireFanEntityDescription(
|
||||
key="fan",
|
||||
name="Fan",
|
||||
translation_key="fan",
|
||||
set_fn=lambda control_api, speed: control_api.set_fan_speed(speed=speed),
|
||||
value_fn=lambda data: data.fanspeed,
|
||||
speed_range=(1, 4),
|
||||
|
|
|
@ -40,7 +40,7 @@ class IntellifireLightEntityDescription(
|
|||
INTELLIFIRE_LIGHTS: tuple[IntellifireLightEntityDescription, ...] = (
|
||||
IntellifireLightEntityDescription(
|
||||
key="lights",
|
||||
name="Lights",
|
||||
translation_key="lights",
|
||||
set_fn=lambda control_api, level: control_api.set_lights(level=level),
|
||||
value_fn=lambda data: data.light_level,
|
||||
),
|
||||
|
|
|
@ -27,7 +27,7 @@ async def async_setup_entry(
|
|||
|
||||
description = NumberEntityDescription(
|
||||
key="flame_control",
|
||||
name="Flame control",
|
||||
translation_key="flame_control",
|
||||
icon="mdi:arrow-expand-vertical",
|
||||
)
|
||||
|
||||
|
@ -54,7 +54,7 @@ class IntellifireFlameControlEntity(IntellifireEntity, NumberEntity):
|
|||
coordinator: IntellifireDataUpdateCoordinator,
|
||||
description: NumberEntityDescription,
|
||||
) -> None:
|
||||
"""Initilaize Flame height Sensor."""
|
||||
"""Initialize Flame height Sensor."""
|
||||
super().__init__(coordinator, description)
|
||||
|
||||
@property
|
||||
|
|
|
@ -56,15 +56,14 @@ def _downtime_to_timestamp(data: IntellifirePollData) -> datetime | None:
|
|||
INTELLIFIRE_SENSORS: tuple[IntellifireSensorEntityDescription, ...] = (
|
||||
IntellifireSensorEntityDescription(
|
||||
key="flame_height",
|
||||
translation_key="flame_height",
|
||||
icon="mdi:fire-circle",
|
||||
name="Flame height",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
# UI uses 1-5 for flame height, backing lib uses 0-4
|
||||
value_fn=lambda data: (data.flameheight + 1),
|
||||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="temperature",
|
||||
name="Temperature",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
|
@ -72,7 +71,7 @@ INTELLIFIRE_SENSORS: tuple[IntellifireSensorEntityDescription, ...] = (
|
|||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="target_temp",
|
||||
name="Target temperature",
|
||||
translation_key="target_temp",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
|
@ -80,50 +79,50 @@ INTELLIFIRE_SENSORS: tuple[IntellifireSensorEntityDescription, ...] = (
|
|||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="fan_speed",
|
||||
translation_key="fan_speed",
|
||||
icon="mdi:fan",
|
||||
name="Fan Speed",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
value_fn=lambda data: data.fanspeed,
|
||||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="timer_end_timestamp",
|
||||
translation_key="timer_end_timestamp",
|
||||
icon="mdi:timer-sand",
|
||||
name="Timer End",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=_time_remaining_to_timestamp,
|
||||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="downtime",
|
||||
name="Downtime",
|
||||
translation_key="downtime",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=_downtime_to_timestamp,
|
||||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="uptime",
|
||||
name="Uptime",
|
||||
translation_key="uptime",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda data: utcnow() - timedelta(seconds=data.uptime),
|
||||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="connection_quality",
|
||||
name="Connection Quality",
|
||||
translation_key="connection_quality",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.connection_quality,
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="ecm_latency",
|
||||
name="ECM latency",
|
||||
translation_key="ecm_latency",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.ecm_latency,
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
IntellifireSensorEntityDescription(
|
||||
key="ipv4_address",
|
||||
name="IP",
|
||||
translation_key="ipv4_address",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.ipv4_address,
|
||||
),
|
||||
|
|
|
@ -35,5 +35,106 @@
|
|||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
|
||||
"not_intellifire_device": "Not an IntelliFire Device."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"flame": {
|
||||
"name": "Flame"
|
||||
},
|
||||
"timer_on": {
|
||||
"name": "Timer on"
|
||||
},
|
||||
"pilot_light_on": {
|
||||
"name": "Pilot light on"
|
||||
},
|
||||
"thermostat_on": {
|
||||
"name": "Thermostat on"
|
||||
},
|
||||
"pilot_flame_error": {
|
||||
"name": "Pilot flame error"
|
||||
},
|
||||
"flame_error": {
|
||||
"name": "Flame Error"
|
||||
},
|
||||
"fan_delay_error": {
|
||||
"name": "Fan delay error"
|
||||
},
|
||||
"maintenance_error": {
|
||||
"name": "Maintenance error"
|
||||
},
|
||||
"disabled_error": {
|
||||
"name": "Disabled error"
|
||||
},
|
||||
"fan_error": {
|
||||
"name": "Fan error"
|
||||
},
|
||||
"lights_error": {
|
||||
"name": "Lights error"
|
||||
},
|
||||
"accessory_error": {
|
||||
"name": "Accessory error"
|
||||
},
|
||||
"soft_lock_out_error": {
|
||||
"name": "Soft lock out error"
|
||||
},
|
||||
"ecm_offline_error": {
|
||||
"name": "ECM offline error"
|
||||
},
|
||||
"offline_error": {
|
||||
"name": "Offline error"
|
||||
}
|
||||
},
|
||||
"fan": {
|
||||
"fan": {
|
||||
"name": "[%key:component::fan::title%]"
|
||||
}
|
||||
},
|
||||
"light": {
|
||||
"lights": {
|
||||
"name": "Lights"
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"flame_control": {
|
||||
"name": "Flame control"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"flame_height": {
|
||||
"name": "Flame height"
|
||||
},
|
||||
"target_temp": {
|
||||
"name": "Target temperature"
|
||||
},
|
||||
"fan_speed": {
|
||||
"name": "Fan Speed"
|
||||
},
|
||||
"timer_end_timestamp": {
|
||||
"name": "Timer end"
|
||||
},
|
||||
"downtime": {
|
||||
"name": "Downtime"
|
||||
},
|
||||
"uptime": {
|
||||
"name": "Uptime"
|
||||
},
|
||||
"connection_quality": {
|
||||
"name": "Connection quality"
|
||||
},
|
||||
"ecm_latency": {
|
||||
"name": "ECM latency"
|
||||
},
|
||||
"ipv4_address": {
|
||||
"name": "IP address"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"flame": {
|
||||
"name": "Flame"
|
||||
},
|
||||
"pilot_light": {
|
||||
"name": "Pilot light"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,14 +37,14 @@ class IntellifireSwitchEntityDescription(
|
|||
INTELLIFIRE_SWITCHES: tuple[IntellifireSwitchEntityDescription, ...] = (
|
||||
IntellifireSwitchEntityDescription(
|
||||
key="on_off",
|
||||
name="Flame",
|
||||
translation_key="flame",
|
||||
on_fn=lambda control_api: control_api.flame_on(),
|
||||
off_fn=lambda control_api: control_api.flame_off(),
|
||||
value_fn=lambda data: data.is_on,
|
||||
),
|
||||
IntellifireSwitchEntityDescription(
|
||||
key="pilot",
|
||||
name="Pilot light",
|
||||
translation_key="pilot_light",
|
||||
icon="mdi:fire-alert",
|
||||
on_fn=lambda control_api: control_api.pilot_on(),
|
||||
off_fn=lambda control_api: control_api.pilot_off(),
|
||||
|
|
Loading…
Reference in New Issue