mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Add refoss em16 device model (#126798)
This commit is contained in:
parent
dab5289177
commit
92d91a65bb
@ -20,6 +20,9 @@ COORDINATOR = "coordinator"
|
|||||||
|
|
||||||
MAX_ERRORS = 2
|
MAX_ERRORS = 2
|
||||||
|
|
||||||
|
# Energy monitoring
|
||||||
|
SENSOR_EM = "em"
|
||||||
|
|
||||||
CHANNEL_DISPLAY_NAME: dict[str, dict[int, str]] = {
|
CHANNEL_DISPLAY_NAME: dict[str, dict[int, str]] = {
|
||||||
"em06": {
|
"em06": {
|
||||||
1: "A1",
|
1: "A1",
|
||||||
@ -28,5 +31,25 @@ CHANNEL_DISPLAY_NAME: dict[str, dict[int, str]] = {
|
|||||||
4: "A2",
|
4: "A2",
|
||||||
5: "B2",
|
5: "B2",
|
||||||
6: "C2",
|
6: "C2",
|
||||||
}
|
},
|
||||||
|
"em16": {
|
||||||
|
1: "A1",
|
||||||
|
2: "A2",
|
||||||
|
3: "A3",
|
||||||
|
4: "A4",
|
||||||
|
5: "A5",
|
||||||
|
6: "A6",
|
||||||
|
7: "B1",
|
||||||
|
8: "B2",
|
||||||
|
9: "B3",
|
||||||
|
10: "B4",
|
||||||
|
11: "B5",
|
||||||
|
12: "B6",
|
||||||
|
13: "C1",
|
||||||
|
14: "C2",
|
||||||
|
15: "C3",
|
||||||
|
16: "C4",
|
||||||
|
17: "C5",
|
||||||
|
18: "C6",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ from .const import (
|
|||||||
COORDINATORS,
|
COORDINATORS,
|
||||||
DISPATCH_DEVICE_DISCOVERED,
|
DISPATCH_DEVICE_DISCOVERED,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
SENSOR_EM,
|
||||||
)
|
)
|
||||||
from .entity import RefossEntity
|
from .entity import RefossEntity
|
||||||
|
|
||||||
@ -43,8 +44,13 @@ class RefossSensorEntityDescription(SensorEntityDescription):
|
|||||||
fn: Callable[[float], float] = lambda x: x
|
fn: Callable[[float], float] = lambda x: x
|
||||||
|
|
||||||
|
|
||||||
|
DEVICETYPE_SENSOR: dict[str, str] = {
|
||||||
|
"em06": SENSOR_EM,
|
||||||
|
"em16": SENSOR_EM,
|
||||||
|
}
|
||||||
|
|
||||||
SENSORS: dict[str, tuple[RefossSensorEntityDescription, ...]] = {
|
SENSORS: dict[str, tuple[RefossSensorEntityDescription, ...]] = {
|
||||||
"em06": (
|
SENSOR_EM: (
|
||||||
RefossSensorEntityDescription(
|
RefossSensorEntityDescription(
|
||||||
key="power",
|
key="power",
|
||||||
translation_key="power",
|
translation_key="power",
|
||||||
@ -121,8 +127,11 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
if not isinstance(device, ElectricityXMix):
|
if not isinstance(device, ElectricityXMix):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
sensor_type = DEVICETYPE_SENSOR.get(device.device_type, "")
|
||||||
|
|
||||||
descriptions: tuple[RefossSensorEntityDescription, ...] = SENSORS.get(
|
descriptions: tuple[RefossSensorEntityDescription, ...] = SENSORS.get(
|
||||||
device.device_type, ()
|
sensor_type, ()
|
||||||
)
|
)
|
||||||
|
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user