Skip to content

Commit

Permalink
- Added EnFluri USAGE data
Browse files Browse the repository at this point in the history
build 3.0.4
  • Loading branch information
marq24 committed Aug 27, 2023
1 parent 08956bd commit 37a9ca3
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 3 deletions.
100 changes: 99 additions & 1 deletion custom_components/senec/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,105 @@
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),

SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_freq",
name="Enfluri Usage Frequency",
native_unit_of_measurement=UnitOfFrequency.HERTZ,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.FREQUENCY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_power_total",
name="Enfluri Usage Total Power",
native_unit_of_measurement=POWER_WATT,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_potential_p1",
name="Enfluri Usage Potential Phase 1",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_potential_p2",
name="Enfluri Usage Potential Phase 2",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_potential_p3",
name="Enfluri Usage Potential Phase 3",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_current_p1",
name="Enfluri Usage Current Phase 1",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-ac",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_current_p2",
name="Enfluri Usage Current Phase 2",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-ac",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_current_p3",
name="Enfluri Usage Current Phase 3",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-ac",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_power_p1",
name="Enfluri Usage Power Phase 1",
native_unit_of_measurement=POWER_WATT,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_power_p2",
name="Enfluri Usage Power Phase 2",
native_unit_of_measurement=POWER_WATT,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="enfluri_usage_power_p3",
name="Enfluri Usage Power Phase 3",
native_unit_of_measurement=POWER_WATT,
icon="mdi:meter-electric",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
options=("disabled_by_default"),
key="bms_cell_temp_A1",
Expand Down
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 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/marq24/ha-senec-v3/issues",
"requirements": [],
"version": "3.0.3"
"version": "3.0.4"
}
46 changes: 45 additions & 1 deletion custom_components/senec/pysenec_ha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,50 @@ def enfluri_net_power_p3(self) -> float:
def enfluri_net_power_total(self) -> float:
return self._raw["PM1OBJ1"]["P_TOTAL"]

@property
def enfluri_usage_freq(self) -> float:
return self._raw["PM1OBJ2"]["FREQ"]

@property
def enfluri_usage_potential_p1(self) -> float:
return self._raw["PM1OBJ2"]["U_AC"][0]

@property
def enfluri_usage_potential_p2(self) -> float:
return self._raw["PM1OBJ2"]["U_AC"][1]

@property
def enfluri_usage_potential_p3(self) -> float:
return self._raw["PM1OBJ2"]["U_AC"][2]

@property
def enfluri_usage_current_p1(self) -> float:
return self._raw["PM1OBJ2"]["I_AC"][0]

@property
def enfluri_usage_current_p2(self) -> float:
return self._raw["PM1OBJ2"]["I_AC"][1]

@property
def enfluri_usage_current_p3(self) -> float:
return self._raw["PM1OBJ2"]["I_AC"][2]

@property
def enfluri_usage_power_p1(self) -> float:
return self._raw["PM1OBJ2"]["P_AC"][0]

@property
def enfluri_usage_power_p2(self) -> float:
return self._raw["PM1OBJ2"]["P_AC"][1]

@property
def enfluri_usage_power_p3(self) -> float:
return self._raw["PM1OBJ2"]["P_AC"][2]

@property
def enfluri_usage_power_total(self) -> float:
return self._raw["PM1OBJ2"]["P_TOTAL"]

def is_battery_empty(self) -> bool:
# 15: "BATTERY EMPTY",
bat_state_is_empty = self._raw["ENERGY"]["STAT_STATE"] == 15
Expand Down Expand Up @@ -994,7 +1038,7 @@ async def switch_safe_charge(self, value):
await self.write(postdata)

async def switch(self, switch_key, value):
return await getattr(self, 'switch_'+str(switch_key))(value)
return await getattr(self, 'switch_' + str(switch_key))(value)

async def write(self, data):
await self.write_senec_v31(data)
Expand Down

0 comments on commit 37a9ca3

Please sign in to comment.