Skip to content

Commit

Permalink
device type
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerza committed Jul 4, 2024
1 parent 3a882cd commit 2cec340
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
13 changes: 13 additions & 0 deletions src/sunsynk/definitions/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
"""Sensor definitions."""
from sunsynk.sensors import EnumSensor

DEVICE_TYPE = EnumSensor(
0,
"Device type",
options={
2: "Inverter",
3: "Single phase hybrid",
4: "Microinverter",
5: "Low voltage three phase hybrid",
6: "High voltage three phase hybrid",
},
)
4 changes: 3 additions & 1 deletion src/sunsynk/definitions/single_phase.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Sunsynk 5kW&8kW hybrid inverter sensor definitions."""
from sunsynk import AMPS, CELSIUS, KWH, VOLT, WATT
from sunsynk.definitions import DEVICE_TYPE
from sunsynk.rwsensors import (
NumberRWSensor,
SelectRWSensor,
Expand Down Expand Up @@ -138,10 +139,11 @@
# General
##########
RATED_POWER = Sensor((16, 17), "Rated power", WATT, 0.1)

SENSORS += (
DEVICE_TYPE,
RATED_POWER,
SerialSensor((3, 4, 5, 6, 7), "Serial"),
Sensor(0, "Device Type"),
FaultSensor((103, 104, 105, 106), "Fault"),
InverterStateSensor(59, "Overall state"),
SDStatusSensor(92, "SD Status", ""), # type: ignore
Expand Down
14 changes: 2 additions & 12 deletions src/sunsynk/definitions/three_phase_common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Sunsynk 5kW&8kW hybrid 3-phase inverter sensor definitions."""
from sunsynk import AMPS, CELSIUS, KWH, VOLT, WATT
from sunsynk.definitions import DEVICE_TYPE
from sunsynk.rwsensors import (
NumberRWSensor,
SelectRWSensor,
Expand All @@ -9,7 +10,6 @@
)
from sunsynk.sensors import (
BinarySensor,
EnumSensor,
FaultSensor,
InverterStateSensor,
MathSensor,
Expand Down Expand Up @@ -151,18 +151,8 @@
RATED_POWER = Sensor((20, 21), "Rated power", WATT, 0.1)

SENSORS += (
DEVICE_TYPE,
RATED_POWER,
EnumSensor(
0,
"Device type",
options={
2: "Inverter",
3: "Single phase hybrid",
4: "Microinverter",
5: "Low voltage three phase hybrid",
6: "High voltage three phase hybrid",
},
),
FaultSensor((555, 556, 557, 558), "Fault"),
InverterStateSensor(500, "Overall state"),
SDStatusSensor(0, "SD Status", ""), # type: ignore # 3 Phase does not have SD Card but crashes when removed
Expand Down

1 comment on commit 2cec340

@rixxxx
Copy link
Contributor

@rixxxx rixxxx commented on 2cec340 Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be used to automatically load right definition file... 🤔

Please sign in to comment.