Skip to content

Commit 66dcd70

Browse files
authored
56 bug verzoegerung bei bedienung der wallbox via integration (#57)
* Added a 2 second wait after new mode selection. * Changed comment language * Housekeeping
1 parent 5b4014f commit 66dcd70

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

custom_components/enpal_webparser/button.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# See README.md for setup and usage instructions.
1818
#
1919

20+
import asyncio
2021
from functools import cached_property
2122
import logging
2223

@@ -91,6 +92,9 @@ async def async_press(self):
9192
except Exception as e:
9293
_LOGGER.exception("[Enpal] Wallbox request failed: %s", e)
9394

95+
# Wait a moment to allow the wallbox to process the change
96+
await asyncio.sleep(2)
97+
9498
await self._hass.services.async_call(
9599
"homeassistant",
96100
"update_entity",

custom_components/enpal_webparser/const.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# --- Default Connection Settings ---
2323
DEFAULT_URL = "http://192.168.178.178/deviceMessages"
2424
DEFAULT_INTERVAL = 60
25+
2526
DEFAULT_GROUPS = [
2627
"Wallbox",
2728
"Battery",
@@ -30,6 +31,7 @@
3031
"IoTEdgeDevice",
3132
"PowerSensor",
3233
]
34+
3335
DEFAULT_USE_WALLBOX_ADDON = False
3436
DEFAULT_WALLBOX_API_ENDPOINT = "http://localhost:36725/wallbox"
3537

@@ -62,6 +64,13 @@
6264
"energy_battery_charge_level_absolute": "battery",
6365
}
6466

67+
STATE_CLASS_OVERRIDES = {
68+
"energy_battery_charge_level": "measurement",
69+
"energy_battery_charge_level_unit_1": "measurement",
70+
"energy_battery_charge_level_unit_2": "measurement",
71+
"energy_battery_charge_level_absolute": "measurement",
72+
}
73+
6574
# --- Wallbox Mode Mapping ---
6675
WALLBOX_MODE_MAP = {
6776
"eco": "Eco",
@@ -72,7 +81,6 @@
7281
# --- Date/Time Formats ---
7382
ENPAL_TIMESTAMP_FORMAT = "%m/%d/%Y %H:%M:%S"
7483

75-
7684
ICON_MAP = {
7785
# IoT Edge Device
7886
"iotedgedevice_cpu_load": "mdi:cpu-64-bit",
@@ -216,9 +224,3 @@
216224
"voltage_wallbox_connector_1_phase_c": "mdi:transmission-tower",
217225
}
218226

219-
STATE_CLASS_OVERRIDES = {
220-
"energy_battery_charge_level": "measurement",
221-
"energy_battery_charge_level_unit_1": "measurement",
222-
"energy_battery_charge_level_unit_2": "measurement",
223-
"energy_battery_charge_level_absolute": "measurement",
224-
}

custom_components/enpal_webparser/select.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# See README.md for setup and usage instructions.
1818
#
1919

20+
import asyncio
2021
import logging
2122
from functools import cached_property
2223

@@ -99,6 +100,9 @@ async def async_select_option(self, option: str):
99100

100101
await self._call_wallbox_api(f"/set_{key}")
101102

103+
# Wait a moment to allow the wallbox to process the change
104+
await asyncio.sleep(2)
105+
102106
await self._hass.services.async_call(
103107
"homeassistant",
104108
"update_entity",

custom_components/enpal_webparser/switch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ async def _call_wallbox_api(self, endpoint):
118118
else:
119119
_LOGGER.debug("Wallbox API call success: %s", url)
120120

121-
# Kurze Verzögerung für Übernahme des Status
121+
# Short wait to allow wallbox to process the change
122122
await asyncio.sleep(2)
123123

124-
# Sensoren aktiv aktualisieren
124+
# Get new status after command
125125
await self._hass.services.async_call(
126126
"homeassistant", "update_entity",
127127
{

0 commit comments

Comments
 (0)