Add entity name translations to Luftdaten (#90725)
This commit is contained in:
parent
7e543882fc
commit
682ebbd4d5
3 changed files with 38 additions and 12 deletions
|
@ -87,15 +87,18 @@ async def test_luftdaten_sensors(
|
|||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfPressure.PA
|
||||
assert ATTR_ICON not in state.attributes
|
||||
|
||||
entry = entity_registry.async_get("sensor.sensor_12345_pm10")
|
||||
entry = entity_registry.async_get("sensor.sensor_12345_particulate_matter_10_mm")
|
||||
assert entry
|
||||
assert entry.device_id
|
||||
assert entry.unique_id == "12345_P1"
|
||||
|
||||
state = hass.states.get("sensor.sensor_12345_pm10")
|
||||
state = hass.states.get("sensor.sensor_12345_particulate_matter_10_mm")
|
||||
assert state
|
||||
assert state.state == "8.5"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Sensor 12345 PM10"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Sensor 12345 Particulate matter 10 μm"
|
||||
)
|
||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.PM10
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||
assert (
|
||||
|
@ -104,15 +107,18 @@ async def test_luftdaten_sensors(
|
|||
)
|
||||
assert ATTR_ICON not in state.attributes
|
||||
|
||||
entry = entity_registry.async_get("sensor.sensor_12345_pm2_5")
|
||||
entry = entity_registry.async_get("sensor.sensor_12345_particulate_matter_2_5_mm")
|
||||
assert entry
|
||||
assert entry.device_id
|
||||
assert entry.unique_id == "12345_P2"
|
||||
|
||||
state = hass.states.get("sensor.sensor_12345_pm2_5")
|
||||
state = hass.states.get("sensor.sensor_12345_particulate_matter_2_5_mm")
|
||||
assert state
|
||||
assert state.state == "4.07"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Sensor 12345 PM2.5"
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== "Sensor 12345 Particulate matter 2.5 μm"
|
||||
)
|
||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.PM25
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||
assert (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue