Skip to content

Commit 0f03f1c

Browse files
committed
added WebAPI: 'currentApparentChargingPowerInKw' (#215)
1 parent d846eee commit 0f03f1c

4 files changed

Lines changed: 94 additions & 10 deletions

File tree

custom_components/senec/const.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,42 @@ class ExtNumberEntityDescription(NumberEntityDescription):
983983
entity_category=EntityCategory.DIAGNOSTIC,
984984
),
985985

986+
ExtSensorEntityDescription(
987+
entity_registry_enabled_default=False,
988+
key="wallbox_1_current_apparent_charging_power",
989+
name="Wallbox I current apparent charging power",
990+
icon="mdi:lightning-bolt-outline",
991+
native_unit_of_measurement=UnitOfPower.KILO_WATT,
992+
state_class=SensorStateClass.MEASUREMENT,
993+
suggested_display_precision=2,
994+
),
995+
ExtSensorEntityDescription(
996+
entity_registry_enabled_default=False,
997+
key="wallbox_2_current_apparent_charging_power",
998+
name="Wallbox II current apparent charging power",
999+
icon="mdi:lightning-bolt-outline",
1000+
native_unit_of_measurement=UnitOfPower.KILO_WATT,
1001+
state_class=SensorStateClass.MEASUREMENT,
1002+
suggested_display_precision=2,
1003+
),
1004+
ExtSensorEntityDescription(
1005+
entity_registry_enabled_default=False,
1006+
key="wallbox_3_current_apparent_charging_power",
1007+
name="Wallbox III current apparent charging power",
1008+
icon="mdi:lightning-bolt-outline",
1009+
native_unit_of_measurement=UnitOfPower.KILO_WATT,
1010+
state_class=SensorStateClass.MEASUREMENT,
1011+
suggested_display_precision=2,
1012+
),
1013+
ExtSensorEntityDescription(
1014+
entity_registry_enabled_default=False,
1015+
key="wallbox_4_current_apparent_charging_power",
1016+
name="Wallbox IV current apparent charging power",
1017+
icon="mdi:lightning-bolt-outline",
1018+
native_unit_of_measurement=UnitOfPower.KILO_WATT,
1019+
state_class=SensorStateClass.MEASUREMENT,
1020+
suggested_display_precision=2,
1021+
),
9861022
]
9871023

9881024
WEB_BIN_SENSOR_TYPES =[

custom_components/senec/pysenec_ha/__init__.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3496,12 +3496,13 @@ async def get_all_systems(self, already_configured_lc_serials: list = None):
34963496
_LAST_UPDATE_TS = 0
34973497

34983498
async def update(self):
3499-
if self._LAST_UPDATE_TS + UPDATE_INTERVALS[self._UPDATE_INTERVAL] < time():
3499+
a_time = time()
3500+
if self._LAST_UPDATE_TS + UPDATE_INTERVALS[self._UPDATE_INTERVAL] < a_time:
35003501
success = await self.app_update()
35013502
if not success:
35023503
await self.web_update()
35033504

3504-
self._LAST_UPDATE_TS = time()
3505+
self._LAST_UPDATE_TS = a_time
35053506
else:
35063507
_LOGGER.debug(f"update(): SKIPP UPDATE REQUEST - last update was at {strftime('%Y-%m-%d %H:%M:%S', localtime(self._LAST_UPDATE_TS))} and we are still within the update interval of '{self._UPDATE_INTERVAL}' [{UPDATE_INTERVALS[self._UPDATE_INTERVAL]} seconds]")
35073508

@@ -7341,6 +7342,11 @@ def wallbox_1_comfort_set_icmax(self) -> float:
73417342
async def set_nv_wallbox_1_comfort_set_icmax(self, value: float) -> bool:
73427343
return await self.app_set_wallbox_icmax(value_to_set=value, wallbox_num=1, sync=True)
73437344

7345+
@property
7346+
def wallbox_1_current_apparent_charging_power(self) -> float:
7347+
a_wallbox_obj = self._app_get_wallbox_object_at_index(0)
7348+
return a_wallbox_obj.get("chargingCurrents", {}).get("currentApparentChargingPowerInKw", None)
7349+
73447350

73457351
## WALLBOX: 2
73467352
@property
@@ -7402,6 +7408,12 @@ def wallbox_2_comfort_set_icmax(self) -> float:
74027408
async def set_nv_wallbox_2_comfort_set_icmax(self, value: float) -> bool:
74037409
return await self.app_set_wallbox_icmax(value_to_set=value, wallbox_num=2, sync=True)
74047410

7411+
@property
7412+
def wallbox_2_current_apparent_charging_power(self) -> float:
7413+
a_wallbox_obj = self._app_get_wallbox_object_at_index(1)
7414+
return a_wallbox_obj.get("chargingCurrents", {}).get("currentApparentChargingPowerInKw", None)
7415+
7416+
74057417
## WALLBOX: 3
74067418
@property
74077419
def wallbox_3_temperature(self) -> str:
@@ -7462,6 +7474,12 @@ def wallbox_3_comfort_set_icmax(self) -> float:
74627474
async def set_nv_wallbox_3_comfort_set_icmax(self, value: float) -> bool:
74637475
return await self.app_set_wallbox_icmax(value_to_set=value, wallbox_num=3, sync=True)
74647476

7477+
@property
7478+
def wallbox_3_current_apparent_charging_power(self) -> float:
7479+
a_wallbox_obj = self._app_get_wallbox_object_at_index(2)
7480+
return a_wallbox_obj.get("chargingCurrents", {}).get("currentApparentChargingPowerInKw", None)
7481+
7482+
74657483
## WALLBOX: 4
74667484
@property
74677485
def wallbox_4_temperature(self) -> str:
@@ -7522,6 +7540,12 @@ def wallbox_4_comfort_set_icmax(self) -> float:
75227540
async def set_nv_wallbox_4_comfort_set_icmax(self, value: float) -> bool:
75237541
return await self.app_set_wallbox_icmax(value_to_set=value, wallbox_num=4, sync=True)
75247542

7543+
@property
7544+
def wallbox_4_current_apparent_charging_power(self) -> float:
7545+
a_wallbox_obj = self._app_get_wallbox_object_at_index(3)
7546+
return a_wallbox_obj.get("chargingCurrents", {}).get("currentApparentChargingPowerInKw", None)
7547+
7548+
75257549
###################################
75267550
# SWITCH-STUFF
75277551
###################################

custom_components/senec/translations/de.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@
10681068
"name": "Ladeleistung"
10691069
},
10701070
"wallbox_1_power_alt": {
1071-
"name": "Scheinladeleistung"
1071+
"name": "Scheinladeleistung [lokal]"
10721072
},
10731073
"wallbox_1_ev_connected": {
10741074
"name": "EV angeschlossen"
@@ -1088,14 +1088,17 @@
10881088
"wallbox_1_min_charging_current": {
10891089
"name": "MIN Ladestrom"
10901090
},
1091+
"wallbox_1_current_apparent_charging_power": {
1092+
"name": "Scheinladeleistung [web]"
1093+
},
10911094
"wallbox_2_state": {
10921095
"name": "Wallboxstatus"
10931096
},
10941097
"wallbox_2_power": {
10951098
"name": "Ladeleistung"
10961099
},
10971100
"wallbox_2_power_alt": {
1098-
"name": "Scheinladeleistung"
1101+
"name": "Scheinladeleistung [lokal]"
10991102
},
11001103
"wallbox_2_ev_connected": {
11011104
"name": "EV angeschlossen"
@@ -1115,14 +1118,17 @@
11151118
"wallbox_2_min_charging_current": {
11161119
"name": "MIN Ladestrom"
11171120
},
1121+
"wallbox_2_current_apparent_charging_power": {
1122+
"name": "Scheinladeleistung [web]"
1123+
},
11181124
"wallbox_3_state": {
11191125
"name": "Wallboxstatus"
11201126
},
11211127
"wallbox_3_power": {
11221128
"name": "Ladeleistung"
11231129
},
11241130
"wallbox_3_power_alt": {
1125-
"name": "Scheinladeleistung"
1131+
"name": "Scheinladeleistung [lokal]"
11261132
},
11271133
"wallbox_3_ev_connected": {
11281134
"name": "EV angeschlossen"
@@ -1142,14 +1148,17 @@
11421148
"wallbox_3_min_charging_current": {
11431149
"name": "MIN Ladestrom"
11441150
},
1151+
"wallbox_3_current_apparent_charging_power": {
1152+
"name": "Scheinladeleistung [web]"
1153+
},
11451154
"wallbox_4_state": {
11461155
"name": "Wallboxstatus"
11471156
},
11481157
"wallbox_4_power": {
11491158
"name": "Ladeleistung"
11501159
},
11511160
"wallbox_4_power_alt": {
1152-
"name": "Scheinladeleistung"
1161+
"name": "Scheinladeleistung [lokal]"
11531162
},
11541163
"wallbox_4_ev_connected": {
11551164
"name": "EV angeschlossen"
@@ -1169,6 +1178,9 @@
11691178
"wallbox_4_min_charging_current": {
11701179
"name": "MIN Ladestrom"
11711180
},
1181+
"wallbox_4_current_apparent_charging_power": {
1182+
"name": "Scheinladeleistung [web]"
1183+
},
11721184
"sockets_1_priority": {
11731185
"name": "Kontakt1 Priorität"
11741186
},

custom_components/senec/translations/en.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@
10551055
"name": "Charging Power"
10561056
},
10571057
"wallbox_1_power_alt": {
1058-
"name": "Apparent charging Power"
1058+
"name": "Apparent charging Power [local]"
10591059
},
10601060
"wallbox_1_ev_connected": {
10611061
"name": "EV Connected"
@@ -1075,14 +1075,17 @@
10751075
"wallbox_1_min_charging_current": {
10761076
"name": "MIN charging Current"
10771077
},
1078+
"wallbox_1_current_apparent_charging_power": {
1079+
"name": "Apparent charging Power [web]"
1080+
},
10781081
"wallbox_2_state": {
10791082
"name": "State"
10801083
},
10811084
"wallbox_2_power": {
10821085
"name": "Charging Power"
10831086
},
10841087
"wallbox_2_power_alt": {
1085-
"name": "Apparent charging Power"
1088+
"name": "Apparent charging Power [local]"
10861089
},
10871090
"wallbox_2_ev_connected": {
10881091
"name": "EV Connected"
@@ -1102,14 +1105,17 @@
11021105
"wallbox_2_min_charging_current": {
11031106
"name": "MIN charging Current"
11041107
},
1108+
"wallbox_2_current_apparent_charging_power": {
1109+
"name": "Apparent charging Power [web]"
1110+
},
11051111
"wallbox_3_state": {
11061112
"name": "State"
11071113
},
11081114
"wallbox_3_power": {
11091115
"name": "Charging Power"
11101116
},
11111117
"wallbox_3_power_alt": {
1112-
"name": "Apparent charging Power"
1118+
"name": "Apparent charging Power [local]"
11131119
},
11141120
"wallbox_3_ev_connected": {
11151121
"name": "EV Connected"
@@ -1129,14 +1135,17 @@
11291135
"wallbox_3_min_charging_current": {
11301136
"name": "MIN charging Current"
11311137
},
1138+
"wallbox_3_current_apparent_charging_power": {
1139+
"name": "Apparent charging Power [web]"
1140+
},
11321141
"wallbox_4_state": {
11331142
"name": "State"
11341143
},
11351144
"wallbox_4_power": {
11361145
"name": "charging Power"
11371146
},
11381147
"wallbox_4_power_alt": {
1139-
"name": "Apparent charging Power"
1148+
"name": "Apparent charging Power [local]"
11401149
},
11411150
"wallbox_4_ev_connected": {
11421151
"name": "EV Connected"
@@ -1156,6 +1165,9 @@
11561165
"wallbox_4_min_charging_current": {
11571166
"name": "MIN charging Current"
11581167
},
1168+
"wallbox_4_current_apparent_charging_power": {
1169+
"name": "Apparent charging Power [web]"
1170+
},
11591171
"sockets_1_priority": {
11601172
"name": "Socket1 priority"
11611173
},

0 commit comments

Comments
 (0)