diff --git a/homeassistant/components/sensibo/binary_sensor.py b/homeassistant/components/sensibo/binary_sensor.py index e57267a1658..08f45b94789 100644 --- a/homeassistant/components/sensibo/binary_sensor.py +++ b/homeassistant/components/sensibo/binary_sensor.py @@ -54,8 +54,8 @@ class SensiboDeviceBinarySensorEntityDescription( FILTER_CLEAN_REQUIRED_DESCRIPTION = SensiboDeviceBinarySensorEntityDescription( key="filter_clean", + translation_key="filter_clean", device_class=BinarySensorDeviceClass.PROBLEM, - name="Filter clean required", value_fn=lambda data: data.filter_clean, ) @@ -64,20 +64,18 @@ MOTION_SENSOR_TYPES: tuple[SensiboMotionBinarySensorEntityDescription, ...] = ( key="alive", device_class=BinarySensorDeviceClass.CONNECTIVITY, entity_category=EntityCategory.DIAGNOSTIC, - name="Alive", value_fn=lambda data: data.alive, ), SensiboMotionBinarySensorEntityDescription( key="is_main_sensor", + translation_key="is_main_sensor", entity_category=EntityCategory.DIAGNOSTIC, - name="Main sensor", icon="mdi:connection", value_fn=lambda data: data.is_main_sensor, ), SensiboMotionBinarySensorEntityDescription( key="motion", device_class=BinarySensorDeviceClass.MOTION, - name="Motion", icon="mdi:motion-sensor", value_fn=lambda data: data.motion, ), @@ -86,8 +84,8 @@ MOTION_SENSOR_TYPES: tuple[SensiboMotionBinarySensorEntityDescription, ...] = ( MOTION_DEVICE_SENSOR_TYPES: tuple[SensiboDeviceBinarySensorEntityDescription, ...] = ( SensiboDeviceBinarySensorEntityDescription( key="room_occupied", + translation_key="room_occupied", device_class=BinarySensorDeviceClass.MOTION, - name="Room occupied", icon="mdi:motion-sensor", value_fn=lambda data: data.room_occupied, ), @@ -100,30 +98,30 @@ DEVICE_SENSOR_TYPES: tuple[SensiboDeviceBinarySensorEntityDescription, ...] = ( PURE_SENSOR_TYPES: tuple[SensiboDeviceBinarySensorEntityDescription, ...] = ( SensiboDeviceBinarySensorEntityDescription( key="pure_ac_integration", + translation_key="pure_ac_integration", entity_category=EntityCategory.DIAGNOSTIC, device_class=BinarySensorDeviceClass.CONNECTIVITY, - name="Pure Boost linked with AC", value_fn=lambda data: data.pure_ac_integration, ), SensiboDeviceBinarySensorEntityDescription( key="pure_geo_integration", + translation_key="pure_geo_integration", entity_category=EntityCategory.DIAGNOSTIC, device_class=BinarySensorDeviceClass.CONNECTIVITY, - name="Pure Boost linked with presence", value_fn=lambda data: data.pure_geo_integration, ), SensiboDeviceBinarySensorEntityDescription( key="pure_measure_integration", + translation_key="pure_measure_integration", entity_category=EntityCategory.DIAGNOSTIC, device_class=BinarySensorDeviceClass.CONNECTIVITY, - name="Pure Boost linked with indoor air quality", value_fn=lambda data: data.pure_measure_integration, ), SensiboDeviceBinarySensorEntityDescription( key="pure_prime_integration", + translation_key="pure_prime_integration", entity_category=EntityCategory.DIAGNOSTIC, device_class=BinarySensorDeviceClass.CONNECTIVITY, - name="Pure Boost linked with outdoor air quality", value_fn=lambda data: data.pure_prime_integration, ), FILTER_CLEAN_REQUIRED_DESCRIPTION, diff --git a/homeassistant/components/sensibo/button.py b/homeassistant/components/sensibo/button.py index 1406d9d26c7..b47023f3ec4 100644 --- a/homeassistant/components/sensibo/button.py +++ b/homeassistant/components/sensibo/button.py @@ -33,7 +33,7 @@ class SensiboButtonEntityDescription( DEVICE_BUTTON_TYPES = SensiboButtonEntityDescription( key="reset_filter", - name="Reset filter", + translation_key="reset_filter", icon="mdi:air-filter", entity_category=EntityCategory.CONFIG, data_key="filter_clean", diff --git a/homeassistant/components/sensibo/entity.py b/homeassistant/components/sensibo/entity.py index 8b46e3e7941..3696f618fd7 100644 --- a/homeassistant/components/sensibo/entity.py +++ b/homeassistant/components/sensibo/entity.py @@ -49,6 +49,8 @@ def async_handle_api_call( class SensiboBaseEntity(CoordinatorEntity[SensiboDataUpdateCoordinator]): """Representation of a Sensibo Base Entity.""" + _attr_has_entity_name = True + def __init__( self, coordinator: SensiboDataUpdateCoordinator, @@ -68,8 +70,6 @@ class SensiboBaseEntity(CoordinatorEntity[SensiboDataUpdateCoordinator]): class SensiboDeviceBaseEntity(SensiboBaseEntity): """Representation of a Sensibo Device.""" - _attr_has_entity_name = True - def __init__( self, coordinator: SensiboDataUpdateCoordinator, @@ -93,8 +93,6 @@ class SensiboDeviceBaseEntity(SensiboBaseEntity): class SensiboMotionBaseEntity(SensiboBaseEntity): """Representation of a Sensibo Motion Entity.""" - _attr_has_entity_name = True - def __init__( self, coordinator: SensiboDataUpdateCoordinator, diff --git a/homeassistant/components/sensibo/number.py b/homeassistant/components/sensibo/number.py index c39026265c7..94765a17a4d 100644 --- a/homeassistant/components/sensibo/number.py +++ b/homeassistant/components/sensibo/number.py @@ -38,8 +38,8 @@ class SensiboNumberEntityDescription( DEVICE_NUMBER_TYPES = ( SensiboNumberEntityDescription( key="calibration_temp", + translation_key="calibration_temperature", remote_key="temperature", - name="Temperature calibration", icon="mdi:thermometer", entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, @@ -50,8 +50,8 @@ DEVICE_NUMBER_TYPES = ( ), SensiboNumberEntityDescription( key="calibration_hum", + translation_key="calibration_humidity", remote_key="humidity", - name="Humidity calibration", icon="mdi:water", entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, diff --git a/homeassistant/components/sensibo/select.py b/homeassistant/components/sensibo/select.py index 29ebdc89261..cda8a972ede 100644 --- a/homeassistant/components/sensibo/select.py +++ b/homeassistant/components/sensibo/select.py @@ -41,7 +41,6 @@ DEVICE_SELECT_TYPES = ( SensiboSelectEntityDescription( key="horizontalSwing", data_key="horizontal_swing_mode", - name="Horizontal swing", icon="mdi:air-conditioner", value_fn=lambda data: data.horizontal_swing_mode, options_fn=lambda data: data.horizontal_swing_modes, @@ -51,7 +50,6 @@ DEVICE_SELECT_TYPES = ( SensiboSelectEntityDescription( key="light", data_key="light_mode", - name="Light", icon="mdi:flashlight", value_fn=lambda data: data.light_mode, options_fn=lambda data: data.light_modes, diff --git a/homeassistant/components/sensibo/sensor.py b/homeassistant/components/sensibo/sensor.py index 69d6a8cb78b..7208902456e 100644 --- a/homeassistant/components/sensibo/sensor.py +++ b/homeassistant/components/sensibo/sensor.py @@ -67,8 +67,8 @@ class SensiboDeviceSensorEntityDescription( FILTER_LAST_RESET_DESCRIPTION = SensiboDeviceSensorEntityDescription( key="filter_last_reset", + translation_key="filter_last_reset", device_class=SensorDeviceClass.TIMESTAMP, - name="Filter last reset", icon="mdi:timer", value_fn=lambda data: data.filter_last_reset, extra_fn=None, @@ -77,22 +77,22 @@ FILTER_LAST_RESET_DESCRIPTION = SensiboDeviceSensorEntityDescription( MOTION_SENSOR_TYPES: tuple[SensiboMotionSensorEntityDescription, ...] = ( SensiboMotionSensorEntityDescription( key="rssi", + translation_key="rssi", device_class=SensorDeviceClass.SIGNAL_STRENGTH, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT, state_class=SensorStateClass.MEASUREMENT, - name="rssi", icon="mdi:wifi", value_fn=lambda data: data.rssi, entity_registry_enabled_default=False, ), SensiboMotionSensorEntityDescription( key="battery_voltage", + translation_key="battery_voltage", device_class=SensorDeviceClass.VOLTAGE, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfElectricPotential.VOLT, state_class=SensorStateClass.MEASUREMENT, - name="Battery voltage", icon="mdi:battery", value_fn=lambda data: data.battery_voltage, ), @@ -101,7 +101,6 @@ MOTION_SENSOR_TYPES: tuple[SensiboMotionSensorEntityDescription, ...] = ( device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, - name="Humidity", icon="mdi:water", value_fn=lambda data: data.humidity, ), @@ -109,7 +108,6 @@ MOTION_SENSOR_TYPES: tuple[SensiboMotionSensorEntityDescription, ...] = ( key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - name="Temperature", icon="mdi:thermometer", value_fn=lambda data: data.temperature, ), @@ -120,18 +118,16 @@ PURE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( device_class=SensorDeviceClass.PM25, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, state_class=SensorStateClass.MEASUREMENT, - name="PM2.5", icon="mdi:air-filter", value_fn=lambda data: data.pm25, extra_fn=None, ), SensiboDeviceSensorEntityDescription( key="pure_sensitivity", - name="Pure sensitivity", + translation_key="sensitivity", icon="mdi:air-filter", value_fn=lambda data: data.pure_sensitivity, extra_fn=None, - translation_key="sensitivity", ), FILTER_LAST_RESET_DESCRIPTION, ) @@ -139,35 +135,35 @@ PURE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( DEVICE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( SensiboDeviceSensorEntityDescription( key="timer_time", + translation_key="timer_time", device_class=SensorDeviceClass.TIMESTAMP, - name="Timer end time", icon="mdi:timer", value_fn=lambda data: data.timer_time, extra_fn=lambda data: {"id": data.timer_id, "turn_on": data.timer_state_on}, ), SensiboDeviceSensorEntityDescription( key="feels_like", + translation_key="feels_like", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - name="Temperature feels like", value_fn=lambda data: data.feelslike, extra_fn=None, entity_registry_enabled_default=False, ), SensiboDeviceSensorEntityDescription( key="climate_react_low", + translation_key="climate_react_low", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - name="Climate React low temperature threshold", value_fn=lambda data: data.smart_low_temp_threshold, extra_fn=lambda data: data.smart_low_state, entity_registry_enabled_default=False, ), SensiboDeviceSensorEntityDescription( key="climate_react_high", + translation_key="climate_react_high", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - name="Climate React high temperature threshold", value_fn=lambda data: data.smart_high_temp_threshold, extra_fn=lambda data: data.smart_high_state, entity_registry_enabled_default=False, @@ -175,7 +171,6 @@ DEVICE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( SensiboDeviceSensorEntityDescription( key="climate_react_type", translation_key="smart_type", - name="Climate React type", value_fn=lambda data: data.smart_type, extra_fn=None, entity_registry_enabled_default=False, @@ -186,19 +181,19 @@ DEVICE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( AIRQ_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( SensiboDeviceSensorEntityDescription( key="airq_tvoc", + translation_key="airq_tvoc", native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION, state_class=SensorStateClass.MEASUREMENT, icon="mdi:air-filter", - name="AirQ TVOC", value_fn=lambda data: data.tvoc, extra_fn=None, ), SensiboDeviceSensorEntityDescription( key="airq_co2", + translation_key="airq_co2", device_class=SensorDeviceClass.CO2, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, - name="AirQ CO2", value_fn=lambda data: data.co2, extra_fn=None, ), @@ -210,15 +205,14 @@ ELEMENT_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( device_class=SensorDeviceClass.PM25, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, state_class=SensorStateClass.MEASUREMENT, - name="PM 2.5", value_fn=lambda data: data.pm25, extra_fn=None, ), SensiboDeviceSensorEntityDescription( key="tvoc", + translation_key="tvoc", native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION, state_class=SensorStateClass.MEASUREMENT, - name="TVOC", value_fn=lambda data: data.tvoc, extra_fn=None, ), @@ -227,7 +221,6 @@ ELEMENT_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( device_class=SensorDeviceClass.CO2, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, - name="CO2", value_fn=lambda data: data.co2, extra_fn=None, ), @@ -243,7 +236,6 @@ ELEMENT_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = ( key="iaq", device_class=SensorDeviceClass.AQI, state_class=SensorStateClass.MEASUREMENT, - name="Air quality", value_fn=lambda data: data.iaq, extra_fn=None, ), diff --git a/homeassistant/components/sensibo/strings.json b/homeassistant/components/sensibo/strings.json index b00c4200836..2379e2c2b38 100644 --- a/homeassistant/components/sensibo/strings.json +++ b/homeassistant/components/sensibo/strings.json @@ -31,23 +31,45 @@ } }, "entity": { - "sensor": { - "sensitivity": { - "state": { - "n": "Normal", - "s": "Sensitive" - } + "binary_sensor": { + "filter_clean": { + "name": "Filter clean required" }, - "smart_type": { - "state": { - "temperature": "Temperature", - "feelslike": "Feels like", - "humidity": "Humidity" - } + "is_main_sensor": { + "name": "Main sensor" + }, + "room_occupied": { + "name": "Room occupied" + }, + "pure_ac_integration": { + "name": "Pure Boost linked with AC" + }, + "pure_geo_integration": { + "name": "Pure Boost linked with presence" + }, + "pure_measure_integration": { + "name": "Pure Boost linked with indoor air quality" + }, + "pure_prime_integration": { + "name": "Pure Boost linked with outdoor air quality" + } + }, + "button": { + "reset_filter": { + "name": "Reset filter" + } + }, + "number": { + "calibration_temperature": { + "name": "Temperature calibration" + }, + "calibration_humidity": { + "name": "Humidity calibration" } }, "select": { "horizontalswing": { + "name": "Horizontal swing", "state": { "stopped": "Stopped", "fixedleft": "Fixed left", @@ -61,12 +83,79 @@ } }, "light": { + "name": "Light", "state": { "on": "[%key:common::state::on%]", "dim": "Dim", "off": "[%key:common::state::off%]" } } + }, + "sensor": { + "filter_last_reset": { + "name": "Filter last reset" + }, + "rssi": { + "name": "RSSI" + }, + "battery_voltage": { + "name": "Battery voltage" + }, + "sensitivity": { + "name": "Pure sensitivity", + "state": { + "n": "Normal", + "s": "Sensitive" + } + }, + "timer_time": { + "name": "Timer end time" + }, + "feels_like": { + "name": "Temperature feels like" + }, + "climate_react_low": { + "name": "Climate React low temperature threshold" + }, + "climate_react_high": { + "name": "Climate React high temperature threshold" + }, + "smart_type": { + "name": "Climate React type", + "state": { + "temperature": "Temperature", + "feelslike": "Feels like", + "humidity": "Humidity" + } + }, + "airq_tvoc": { + "name": "AirQ TVOC" + }, + "airq_co2": { + "name": "AirQ CO2" + }, + "tvoc": { + "name": "TVOC" + }, + "ethanol": { + "name": "Ethanol" + } + }, + "switch": { + "timer_on_switch": { + "name": "Timer" + }, + "climate_react_switch": { + "name": "Climate React" + }, + "pure_boost_switch": { + "name": "Pure Boost" + } + }, + "update": { + "fw_ver_available": { + "name": "Update available" + } } } } diff --git a/homeassistant/components/sensibo/switch.py b/homeassistant/components/sensibo/switch.py index ee9c946268f..20167ddd184 100644 --- a/homeassistant/components/sensibo/switch.py +++ b/homeassistant/components/sensibo/switch.py @@ -45,8 +45,8 @@ class SensiboDeviceSwitchEntityDescription( DEVICE_SWITCH_TYPES: tuple[SensiboDeviceSwitchEntityDescription, ...] = ( SensiboDeviceSwitchEntityDescription( key="timer_on_switch", + translation_key="timer_on_switch", device_class=SwitchDeviceClass.SWITCH, - name="Timer", icon="mdi:timer", value_fn=lambda data: data.timer_on, extra_fn=lambda data: {"id": data.timer_id, "turn_on": data.timer_state_on}, @@ -56,8 +56,8 @@ DEVICE_SWITCH_TYPES: tuple[SensiboDeviceSwitchEntityDescription, ...] = ( ), SensiboDeviceSwitchEntityDescription( key="climate_react_switch", + translation_key="climate_react_switch", device_class=SwitchDeviceClass.SWITCH, - name="Climate React", icon="mdi:wizard-hat", value_fn=lambda data: data.smart_on, extra_fn=lambda data: {"type": data.smart_type}, @@ -70,8 +70,8 @@ DEVICE_SWITCH_TYPES: tuple[SensiboDeviceSwitchEntityDescription, ...] = ( PURE_SWITCH_TYPES: tuple[SensiboDeviceSwitchEntityDescription, ...] = ( SensiboDeviceSwitchEntityDescription( key="pure_boost_switch", + translation_key="pure_boost_switch", device_class=SwitchDeviceClass.SWITCH, - name="Pure Boost", value_fn=lambda data: data.pure_boost_enabled, extra_fn=None, command_on="async_turn_on_off_pure_boost", diff --git a/homeassistant/components/sensibo/update.py b/homeassistant/components/sensibo/update.py index 4cfb6058740..46b9b860ca6 100644 --- a/homeassistant/components/sensibo/update.py +++ b/homeassistant/components/sensibo/update.py @@ -41,9 +41,9 @@ class SensiboDeviceUpdateEntityDescription( DEVICE_SENSOR_TYPES: tuple[SensiboDeviceUpdateEntityDescription, ...] = ( SensiboDeviceUpdateEntityDescription( key="fw_ver_available", + translation_key="fw_ver_available", device_class=UpdateDeviceClass.FIRMWARE, entity_category=EntityCategory.DIAGNOSTIC, - name="Update available", icon="mdi:rocket-launch", value_version=lambda data: data.fw_ver, value_available=lambda data: data.fw_ver_available, diff --git a/tests/components/sensibo/test_binary_sensor.py b/tests/components/sensibo/test_binary_sensor.py index bb190908847..99bcfac8c9b 100644 --- a/tests/components/sensibo/test_binary_sensor.py +++ b/tests/components/sensibo/test_binary_sensor.py @@ -23,7 +23,7 @@ async def test_binary_sensor( ) -> None: """Test the Sensibo binary sensor.""" - state1 = hass.states.get("binary_sensor.hallway_motion_sensor_alive") + state1 = hass.states.get("binary_sensor.hallway_motion_sensor_connectivity") state2 = hass.states.get("binary_sensor.hallway_motion_sensor_main_sensor") state3 = hass.states.get("binary_sensor.hallway_motion_sensor_motion") state4 = hass.states.get("binary_sensor.hallway_room_occupied") @@ -57,7 +57,7 @@ async def test_binary_sensor( ) await hass.async_block_till_done() - state1 = hass.states.get("binary_sensor.hallway_motion_sensor_alive") + state1 = hass.states.get("binary_sensor.hallway_motion_sensor_connectivity") state3 = hass.states.get("binary_sensor.hallway_motion_sensor_motion") assert state1.state == "off" assert state3.state == "off"