mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Add icon translations to DSMR (#111411)
* Add icon translations to DSMR * Add icon translations to DSMR
This commit is contained in:
parent
913ee90e1a
commit
7ad1d3e891
24
homeassistant/components/dsmr/icons.json
Normal file
24
homeassistant/components/dsmr/icons.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"entity": {
|
||||||
|
"sensor": {
|
||||||
|
"electricity_active_tariff": {
|
||||||
|
"default": "mdi:flash"
|
||||||
|
},
|
||||||
|
"short_power_failure_count": {
|
||||||
|
"default": "mdi:flash-off"
|
||||||
|
},
|
||||||
|
"long_power_failure_count": {
|
||||||
|
"default": "mdi:flash-off"
|
||||||
|
},
|
||||||
|
"voltage_swell_l1_count": {
|
||||||
|
"default": "mdi:pulse"
|
||||||
|
},
|
||||||
|
"voltage_swell_l2_count": {
|
||||||
|
"default": "mdi:pulse"
|
||||||
|
},
|
||||||
|
"voltage_swell_l3_count": {
|
||||||
|
"default": "mdi:pulse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -106,7 +106,6 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
|
|||||||
dsmr_versions={"2.2", "4", "5", "5B", "5L"},
|
dsmr_versions={"2.2", "4", "5", "5B", "5L"},
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
options=["low", "normal"],
|
options=["low", "normal"],
|
||||||
icon="mdi:flash",
|
|
||||||
),
|
),
|
||||||
DSMRSensorEntityDescription(
|
DSMRSensorEntityDescription(
|
||||||
key="electricity_used_tariff_1",
|
key="electricity_used_tariff_1",
|
||||||
@ -194,7 +193,6 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
|
|||||||
obis_reference=obis_references.SHORT_POWER_FAILURE_COUNT,
|
obis_reference=obis_references.SHORT_POWER_FAILURE_COUNT,
|
||||||
dsmr_versions={"2.2", "4", "5", "5L"},
|
dsmr_versions={"2.2", "4", "5", "5L"},
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
icon="mdi:flash-off",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
DSMRSensorEntityDescription(
|
DSMRSensorEntityDescription(
|
||||||
@ -203,7 +201,6 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
|
|||||||
obis_reference=obis_references.LONG_POWER_FAILURE_COUNT,
|
obis_reference=obis_references.LONG_POWER_FAILURE_COUNT,
|
||||||
dsmr_versions={"2.2", "4", "5", "5L"},
|
dsmr_versions={"2.2", "4", "5", "5L"},
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
icon="mdi:flash-off",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
DSMRSensorEntityDescription(
|
DSMRSensorEntityDescription(
|
||||||
@ -236,7 +233,6 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
|
|||||||
obis_reference=obis_references.VOLTAGE_SWELL_L1_COUNT,
|
obis_reference=obis_references.VOLTAGE_SWELL_L1_COUNT,
|
||||||
dsmr_versions={"2.2", "4", "5", "5L"},
|
dsmr_versions={"2.2", "4", "5", "5L"},
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
icon="mdi:pulse",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
DSMRSensorEntityDescription(
|
DSMRSensorEntityDescription(
|
||||||
@ -245,7 +241,6 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
|
|||||||
obis_reference=obis_references.VOLTAGE_SWELL_L2_COUNT,
|
obis_reference=obis_references.VOLTAGE_SWELL_L2_COUNT,
|
||||||
dsmr_versions={"2.2", "4", "5", "5L"},
|
dsmr_versions={"2.2", "4", "5", "5L"},
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
icon="mdi:pulse",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
DSMRSensorEntityDescription(
|
DSMRSensorEntityDescription(
|
||||||
@ -254,7 +249,6 @@ SENSORS: tuple[DSMRSensorEntityDescription, ...] = (
|
|||||||
obis_reference=obis_references.VOLTAGE_SWELL_L3_COUNT,
|
obis_reference=obis_references.VOLTAGE_SWELL_L3_COUNT,
|
||||||
dsmr_versions={"2.2", "4", "5", "5L"},
|
dsmr_versions={"2.2", "4", "5", "5L"},
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
icon="mdi:pulse",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
DSMRSensorEntityDescription(
|
DSMRSensorEntityDescription(
|
||||||
|
@ -22,7 +22,6 @@ from homeassistant.components.sensor import (
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
ATTR_ICON,
|
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
UnitOfEnergy,
|
UnitOfEnergy,
|
||||||
@ -106,7 +105,6 @@ async def test_default_setup(
|
|||||||
assert (
|
assert (
|
||||||
power_consumption.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.POWER
|
power_consumption.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.POWER
|
||||||
)
|
)
|
||||||
assert power_consumption.attributes.get(ATTR_ICON) is None
|
|
||||||
assert (
|
assert (
|
||||||
power_consumption.attributes.get(ATTR_STATE_CLASS)
|
power_consumption.attributes.get(ATTR_STATE_CLASS)
|
||||||
== SensorStateClass.MEASUREMENT
|
== SensorStateClass.MEASUREMENT
|
||||||
@ -145,7 +143,6 @@ async def test_default_setup(
|
|||||||
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
||||||
assert active_tariff.state == "low"
|
assert active_tariff.state == "low"
|
||||||
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
||||||
assert active_tariff.attributes.get(ATTR_ICON) == "mdi:flash"
|
|
||||||
assert (
|
assert (
|
||||||
active_tariff.attributes.get(ATTR_FRIENDLY_NAME)
|
active_tariff.attributes.get(ATTR_FRIENDLY_NAME)
|
||||||
== "Electricity Meter Active tariff"
|
== "Electricity Meter Active tariff"
|
||||||
@ -282,7 +279,6 @@ async def test_v4_meter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
|||||||
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
||||||
assert active_tariff.state == "low"
|
assert active_tariff.state == "low"
|
||||||
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
||||||
assert active_tariff.attributes.get(ATTR_ICON) == "mdi:flash"
|
|
||||||
assert active_tariff.attributes.get(ATTR_OPTIONS) == ["low", "normal"]
|
assert active_tariff.attributes.get(ATTR_OPTIONS) == ["low", "normal"]
|
||||||
assert active_tariff.attributes.get(ATTR_STATE_CLASS) is None
|
assert active_tariff.attributes.get(ATTR_STATE_CLASS) is None
|
||||||
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||||
@ -369,7 +365,6 @@ async def test_v5_meter(
|
|||||||
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
||||||
assert active_tariff.state == "low"
|
assert active_tariff.state == "low"
|
||||||
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
||||||
assert active_tariff.attributes.get(ATTR_ICON) == "mdi:flash"
|
|
||||||
assert active_tariff.attributes.get(ATTR_OPTIONS) == ["low", "normal"]
|
assert active_tariff.attributes.get(ATTR_OPTIONS) == ["low", "normal"]
|
||||||
assert active_tariff.attributes.get(ATTR_STATE_CLASS) is None
|
assert active_tariff.attributes.get(ATTR_STATE_CLASS) is None
|
||||||
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||||
@ -447,7 +442,6 @@ async def test_luxembourg_meter(hass: HomeAssistant, dsmr_connection_fixture) ->
|
|||||||
active_tariff = hass.states.get("sensor.electricity_meter_energy_consumption_total")
|
active_tariff = hass.states.get("sensor.electricity_meter_energy_consumption_total")
|
||||||
assert active_tariff.state == "123.456"
|
assert active_tariff.state == "123.456"
|
||||||
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY
|
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY
|
||||||
assert active_tariff.attributes.get(ATTR_ICON) is None
|
|
||||||
assert (
|
assert (
|
||||||
active_tariff.attributes.get(ATTR_STATE_CLASS)
|
active_tariff.attributes.get(ATTR_STATE_CLASS)
|
||||||
== SensorStateClass.TOTAL_INCREASING
|
== SensorStateClass.TOTAL_INCREASING
|
||||||
@ -605,7 +599,6 @@ async def test_belgian_meter(hass: HomeAssistant, dsmr_connection_fixture) -> No
|
|||||||
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
||||||
assert active_tariff.state == "normal"
|
assert active_tariff.state == "normal"
|
||||||
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
||||||
assert active_tariff.attributes.get(ATTR_ICON) == "mdi:flash"
|
|
||||||
assert active_tariff.attributes.get(ATTR_OPTIONS) == ["low", "normal"]
|
assert active_tariff.attributes.get(ATTR_OPTIONS) == ["low", "normal"]
|
||||||
assert active_tariff.attributes.get(ATTR_STATE_CLASS) is None
|
assert active_tariff.attributes.get(ATTR_STATE_CLASS) is None
|
||||||
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||||
@ -1009,7 +1002,6 @@ async def test_belgian_meter_low(hass: HomeAssistant, dsmr_connection_fixture) -
|
|||||||
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
active_tariff = hass.states.get("sensor.electricity_meter_active_tariff")
|
||||||
assert active_tariff.state == "low"
|
assert active_tariff.state == "low"
|
||||||
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENUM
|
||||||
assert active_tariff.attributes.get(ATTR_ICON) == "mdi:flash"
|
|
||||||
assert active_tariff.attributes.get(ATTR_OPTIONS) == ["low", "normal"]
|
assert active_tariff.attributes.get(ATTR_OPTIONS) == ["low", "normal"]
|
||||||
assert active_tariff.attributes.get(ATTR_STATE_CLASS) is None
|
assert active_tariff.attributes.get(ATTR_STATE_CLASS) is None
|
||||||
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
assert active_tariff.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||||
@ -1066,7 +1058,6 @@ async def test_swedish_meter(hass: HomeAssistant, dsmr_connection_fixture) -> No
|
|||||||
active_tariff = hass.states.get("sensor.electricity_meter_energy_consumption_total")
|
active_tariff = hass.states.get("sensor.electricity_meter_energy_consumption_total")
|
||||||
assert active_tariff.state == "123.456"
|
assert active_tariff.state == "123.456"
|
||||||
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY
|
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY
|
||||||
assert active_tariff.attributes.get(ATTR_ICON) is None
|
|
||||||
assert (
|
assert (
|
||||||
active_tariff.attributes.get(ATTR_STATE_CLASS)
|
active_tariff.attributes.get(ATTR_STATE_CLASS)
|
||||||
== SensorStateClass.TOTAL_INCREASING
|
== SensorStateClass.TOTAL_INCREASING
|
||||||
@ -1142,7 +1133,6 @@ async def test_easymeter(hass: HomeAssistant, dsmr_connection_fixture) -> None:
|
|||||||
active_tariff = hass.states.get("sensor.electricity_meter_energy_consumption_total")
|
active_tariff = hass.states.get("sensor.electricity_meter_energy_consumption_total")
|
||||||
assert active_tariff.state == "54184.632"
|
assert active_tariff.state == "54184.632"
|
||||||
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY
|
assert active_tariff.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY
|
||||||
assert active_tariff.attributes.get(ATTR_ICON) is None
|
|
||||||
assert (
|
assert (
|
||||||
active_tariff.attributes.get(ATTR_STATE_CLASS)
|
active_tariff.attributes.get(ATTR_STATE_CLASS)
|
||||||
== SensorStateClass.TOTAL_INCREASING
|
== SensorStateClass.TOTAL_INCREASING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user