Skip to content

Commit

Permalink
added Enfluri (net) information
Browse files Browse the repository at this point in the history
  • Loading branch information
marq24 committed Apr 14, 2023
1 parent d801528 commit b1b79e4
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 2 deletions.
91 changes: 90 additions & 1 deletion custom_components/senec/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
POWER_WATT,
TEMP_CELSIUS,
UnitOfElectricPotential,
UnitOfElectricCurrent,
UnitOfElectricCurrent, UnitOfFrequency,
)

DOMAIN = "senec"
Expand Down Expand Up @@ -244,4 +244,93 @@
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),

SensorEntityDescription(
key="enfluri_net_freq",
name="Enfluri Net Frequency",
native_unit_of_measurement=UnitOfFrequency.HERTZ,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.FREQUENCY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_power_total",
name="Enfluri Net Total Power",
native_unit_of_measurement=POWER_WATT,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_potential_p1",
name="Enfluri Net Potential Phase 1",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_potential_p2",
name="Enfluri Net Potential Phase 2",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_potential_p3",
name="Enfluri Net Potential Phase 3",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_current_p1",
name="Enfluri Net Current Phase 1",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-dc",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_current_p2",
name="Enfluri Net Current Phase 2",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-dc",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_current_p3",
name="Enfluri Net Current Phase 3",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-dc",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_power_p1",
name="Enfluri Net Power Phase 1",
native_unit_of_measurement=POWER_WATT,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_power_p2",
name="Enfluri Net Power Phase 2",
native_unit_of_measurement=POWER_WATT,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="enfluri_net_power_p3",
name="Enfluri Net Power Phase 3",
native_unit_of_measurement=POWER_WATT,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
]
2 changes: 1 addition & 1 deletion custom_components/senec/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"@marq24"
],
"iot_class": "local_polling",
"version": "2.2.2"
"version": "2.2.3"
}
34 changes: 34 additions & 0 deletions custom_components/senec/pysenec_ha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,40 @@ def solar_mpp3_current(self) -> float:
def solar_mpp3_power(self) -> float:
return self._raw["PV1"]["MPP_POWER"][2]

@property
def enfluri_net_freq(self) -> float:
return self._raw["PM1OBJ1"]["FREQ"]
@property
def enfluri_net_potential_p1(self) -> float:
return self._raw["PM1OBJ1"]["U_AC"][0]
@property
def enfluri_net_potential_p2(self) -> float:
return self._raw["PM1OBJ1"]["U_AC"][1]
@property
def enfluri_net_potential_p3(self) -> float:
return self._raw["PM1OBJ1"]["U_AC"][2]
@property
def enfluri_net_current_p1(self) -> float:
return self._raw["PM1OBJ1"]["I_AC"][0]
@property
def enfluri_net_current_p2(self) -> float:
return self._raw["PM1OBJ1"]["I_AC"][1]
@property
def enfluri_net_current_p3(self) -> float:
return self._raw["PM1OBJ1"]["I_AC"][2]
@property
def enfluri_net_power_p1(self) -> float:
return self._raw["PM1OBJ1"]["P_AC"][0]
@property
def enfluri_net_power_p2(self) -> float:
return self._raw["PM1OBJ1"]["P_AC"][1]
@property
def enfluri_net_power_p3(self) -> float:
return self._raw["PM1OBJ1"]["P_AC"][2]
@property
def enfluri_net_power_total(self) -> float:
return self._raw["PM1OBJ1"]["P_TOTAL"]

def is_battery_empty(self) -> bool:
# 15: "BATTERY EMPTY",
bat_state_is_empty = self._raw["ENERGY"]["STAT_STATE"] == 15
Expand Down

0 comments on commit b1b79e4

Please sign in to comment.