mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Add icon translations to Flipr (#111540)
This commit is contained in:
parent
7b79c21835
commit
cc2ce4f4a6
12
homeassistant/components/flipr/icons.json
Normal file
12
homeassistant/components/flipr/icons.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"chlorine": {
|
||||
"default": "mdi:pool"
|
||||
},
|
||||
"red_ox": {
|
||||
"default": "mdi:pool"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -20,12 +20,10 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
key="chlorine",
|
||||
translation_key="chlorine",
|
||||
native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
|
||||
icon="mdi:pool",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="ph",
|
||||
icon="mdi:pool",
|
||||
device_class=SensorDeviceClass.PH,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
@ -45,7 +43,6 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
key="red_ox",
|
||||
translation_key="red_ox",
|
||||
native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
|
||||
icon="mdi:pool",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
|
@ -7,7 +7,6 @@ from flipr_api.exceptions import FliprError
|
||||
from homeassistant.components.flipr.const import CONF_FLIPR_ID, DOMAIN
|
||||
from homeassistant.components.sensor import ATTR_STATE_CLASS, SensorStateClass
|
||||
from homeassistant.const import (
|
||||
ATTR_ICON,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CONF_EMAIL,
|
||||
CONF_PASSWORD,
|
||||
@ -61,42 +60,36 @@ async def test_sensors(hass: HomeAssistant, entity_registry: er.EntityRegistry)
|
||||
|
||||
state = hass.states.get("sensor.flipr_myfliprid_ph")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:pool"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||
assert state.state == "7.03"
|
||||
|
||||
state = hass.states.get("sensor.flipr_myfliprid_water_temperature")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfTemperature.CELSIUS
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||
assert state.state == "10.5"
|
||||
|
||||
state = hass.states.get("sensor.flipr_myfliprid_last_measured")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
||||
assert state.state == "2021-02-15T09:10:32+00:00"
|
||||
|
||||
state = hass.states.get("sensor.flipr_myfliprid_red_ox")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:pool"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "mV"
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||
assert state.state == "657.58"
|
||||
|
||||
state = hass.states.get("sensor.flipr_myfliprid_chlorine")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:pool"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "mV"
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||
assert state.state == "0.23654886"
|
||||
|
||||
state = hass.states.get("sensor.flipr_myfliprid_battery")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||
assert state.state == "95.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user