Skip to content

Adding initial Wallbox implementation#81

Open
safinea wants to merge 3 commits into
dirkgroenen:mainfrom
safinea:AddWallbox
Open

Adding initial Wallbox implementation#81
safinea wants to merge 3 commits into
dirkgroenen:mainfrom
safinea:AddWallbox

Conversation

@safinea
Copy link
Copy Markdown

@safinea safinea commented Jan 24, 2026

Added Wallbox charger implementation, plus a simple test file.
Code is untested and is submitted as is.

Copy link
Copy Markdown
Owner

@dirkgroenen dirkgroenen left a comment

Choose a reason for hiding this comment

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

A few minor remarks, but I'll help you to fix those and have a look at the failing tests as well.

Comment thread custom_components/evse_load_balancer/chargers/wallbox_charger.py Outdated
Comment thread custom_components/evse_load_balancer/chargers/wallbox_charger.py Outdated
…ration, and lint

- MaxChargerLimit now uses `max_available_power` sensor (hardware max)
  instead of reusing the `maximum_charging_current` number entity
- has_synced_phase_limits returns True (single global current = synced)
- car_connected includes all connected statuses (Scheduled, Waiting,
  WaitingInQueue*, WaitingMid*)
- can_charge includes Discharging to fix hierarchy violation
- Register CHARGER_DOMAIN_WALLBOX in config_flow device filter
- Add # noqa: TID252, fix D213 docstrings, msg pattern for ValueError,
  remove unnecessary try/except in set_current_limit
- Rewrite tests: correct Phase import, dedicated is_charger_device
  tests, exhaustive status coverage, float parsing, has_synced test
@dirkgroenen
Copy link
Copy Markdown
Owner

@safinea are you in the ability to test the current branch with your wallbox to see if all is working correctly? Should be in a ready-to-merge state now.

@dirkgroenen dirkgroenen self-requested a review January 27, 2026 20:43
@safinea
Copy link
Copy Markdown
Author

safinea commented Jan 28, 2026

Testing is underway, although 'faking' a high current use may be difficult. Initial results are promising.

@AOskam
Copy link
Copy Markdown

AOskam commented Jan 29, 2026

@safinea are you in the ability to test the current branch with your wallbox to see if all is working correctly? Should be in a ready-to-merge state now.

Hi, also downloaded and replaced the branch files and get this: Config-flow kon niet geladen worden: {"message":"Invalid handler specified"}
with the new files. maybe my own fault?

@dirkgroenen
Copy link
Copy Markdown
Owner

dirkgroenen commented Feb 9, 2026

@AOskam if you have HACS you can install a specific version by running the following service action (Via HASS -> Developer Tools -> Actions)

action: update.install
data:
  version: 8eb3fb5a36cb5f29ffa499296d172a5a668997f0
target:
  entity_id: update.evse_load_balancer_update

That should install the latest commit from this branch. Would you mind giving that a try to see if it wasn't something in the copy-pasting of the files that went wrong?

Also please provide me with full logs (or your terminal output) such that I can see where the issue is happening.

@AOskam
Copy link
Copy Markdown

AOskam commented Feb 12, 2026

@AOskam if you have HACS you can install a specific version by running the following service action (Via HASS -> Developer Tools -> Actions)

action: update.install
data:
  version: 8eb3fb5a36cb5f29ffa499296d172a5a668997f0
target:
  entity_id: update.evse_load_balancer_update

That should install the latest commit from this branch. Would you mind giving that a try to see if it wasn't something in the copy-pasting of the files that went wrong?

Also please provide me with full logs (or your terminal output) such that I can see where the issue is happening.

Ah, didn't know that :).

Install went fine now. Wallbox was detected and configurable, will charge the car this evening and see if it responds properly.

Using DSMR and a Pulsar plus charger.

Thanks

@AOskam
Copy link
Copy Markdown

AOskam commented Feb 12, 2026

some issues, do not get the available current sensor at the moment.

Logger: homeassistant.components.sensor
Bron: helpers/entity_platform.py:680
integratie: Sensor (documentatie, problemen)
Eerst voorgekomen: 09:57:48 (9 gebeurtenissen)
Laatst gelogd: 20:45:25

Error adding entity sensor.evse_load_balancer_available_current_l1 for domain sensor with platform evse_load_balancer
Error adding entity sensor.evse_load_balancer_available_current_l2 for domain sensor with platform evse_load_balancer
Error adding entity sensor.evse_load_balancer_available_current_l3 for domain sensor with platform evse_load_balancer
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 680, in _async_add_entities
await self._async_add_entity(
entity, False, entity_registry, config_subentry_id
)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 998, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1395, in add_to_platform_finish
self.async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1018, in async_write_ha_state
self._async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1163, in _async_write_ha_state
) = self.__async_calculate_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1069, in __async_calculate_state
available = self.available # only call self.available once per update cycle
^^^^^^^^^^^^^^
File "/config/custom_components/evse_load_balancer/load_balancer_sensor.py", line 54, in available
return self.state is not None
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 569, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/evse_load_balancer/load_balancer_phase_sensor.py", line 44, in native_value
return self._coordinator.get_available_current_for_phase(self._phase)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/config/custom_components/evse_load_balancer/coordinator.py", line 159, in get_available_current_for_phase
active_current = self._meter.get_active_phase_current(phase)
File "/config/custom_components/evse_load_balancer/meters/dsmr_meter.py", line 53, in get_active_phase_current
voltage_state = self._get_entity_state_for_phase_sensor(
phase, cf.CONF_PHASE_SENSOR_VOLTAGE
)
File "/config/custom_components/evse_load_balancer/meters/dsmr_meter.py", line 115, in _get_entity_state_for_phase_sensor
entity_id = self._get_entity_id_for_phase_sensor(phase, sensor_const)
File "/config/custom_components/evse_load_balancer/meters/dsmr_meter.py", line 107, in _get_entity_id_for_phase_sensor
return self._get_entity_id_by_translation_key(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self._get_entity_map_for_phase(phase)[sensor_const]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/config/custom_components/evse_load_balancer/ha_device.py", line 49, in _get_entity_id_by_translation_key
raise ValueError(msg)
ValueError: Entity not found for translation_key 'instantaneous_voltage_l1'

@AOskam
Copy link
Copy Markdown

AOskam commented Feb 12, 2026

and:

Logger: homeassistant
Bron: custom_components/evse_load_balancer/ha_device.py:49
integratie: EVSE Load Balancer (documentatie, problemen)
Eerst voorgekomen: 09:54:47 (39487 gebeurtenissen)
Laatst gelogd: 20:53:37

Error doing job: Exception in callback _TrackTimeInterval._interval_listener() (task: None)
Traceback (most recent call last):
File "/usr/local/lib/python3.13/asyncio/events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1667, in _interval_listener
self.hass.async_run_hass_job(self._run_job, dt_util.utcnow(), background=True)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 902, in async_run_hass_job
hassjob.target(*args)
~~~~~~~~~~~~~~^^^^^^^
File "/config/custom_components/evse_load_balancer/coordinator.py", line 204, in _execute_update_cycle
available_currents = self._get_available_currents()
File "/config/custom_components/evse_load_balancer/coordinator.py", line 170, in _get_available_currents
current = self.get_available_current_for_phase(phase_obj)
File "/config/custom_components/evse_load_balancer/coordinator.py", line 159, in get_available_current_for_phase
active_current = self._meter.get_active_phase_current(phase)
File "/config/custom_components/evse_load_balancer/meters/dsmr_meter.py", line 53, in get_active_phase_current
voltage_state = self._get_entity_state_for_phase_sensor(
phase, cf.CONF_PHASE_SENSOR_VOLTAGE
)
File "/config/custom_components/evse_load_balancer/meters/dsmr_meter.py", line 115, in _get_entity_state_for_phase_sensor
entity_id = self._get_entity_id_for_phase_sensor(phase, sensor_const)
File "/config/custom_components/evse_load_balancer/meters/dsmr_meter.py", line 107, in _get_entity_id_for_phase_sensor
return self._get_entity_id_by_translation_key(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self._get_entity_map_for_phase(phase)[sensor_const]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/config/custom_components/evse_load_balancer/ha_device.py", line 49, in _get_entity_id_by_translation_key
raise ValueError(msg)
ValueError: Entity not found for translation_key 'instantaneous_voltage_l1'

@AOskam
Copy link
Copy Markdown

AOskam commented Feb 12, 2026

Also the integration hang on "waiting for charger" when it started up. When the charger definition changed, it did not switch. Only after reloading the integration it changed to "monitoring loads", however because of the sensor config fault it is not functioning i guess. Not good at coding myself, so cannot help you with that ;).

@dirkgroenen
Copy link
Copy Markdown
Owner

@AOskam it seems like the DSMR meter has an issue finding the Voltage entity.

Which DSMR version are you using? It might be that there is a different entity name being used.

Also please check if your DSMR integration is indeed exposing Voltage entities for all three phases L1/L2/L3.

@safinea
Copy link
Copy Markdown
Author

safinea commented Apr 4, 2026

@dirkgroenen FWIW, I'm using "dsmr_version": "5" according to the diagnostics. The DSMR meter is showing the current per the 3 phases, but the EVSE load balancer was giving "Unavailable" for the available current sensors. DSMR sensors are electricity_meter_current_phase_l1 (and l2 and l3).
But I think I found the issue (for my situation, at least). I did not have the phase voltage sensors enabled (assuming only the current was needed). But enabling these sensors did cause the "Available current L1/2/3" to start showing data.
Unexpected success! Now I really can start testing the load balancing.

@dirkgroenen
Copy link
Copy Markdown
Owner

Good to hear @safinea 🙌 Looking forward hearing whether the wallbox implementation works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants