I have the ‘green’ mode working properly as well now. Connected a car last night, charging started this morning as soon as there was 1.5 kW excess for 5 min and the charge power increased nicely with increased solar power. Then I realized we need the car fully charge by noon and hit the ‘max’ button.
Surely there is always some finetuning to do, but here is the full implementation:
The automation controlling the charger current limit for the ‘green’ and ‘eco’ modes has a small update to only activate when the status is ‘Charging’, this prevents the current limit from creeping to 32A before charging even started.
- id: '1654960233260'
alias: WALLBOX - Charger current controller
description: Controls the Wallbox charger max current setting up and down (between
6 and 32 A), maintaining the grid power around zero, to use excess solar power
only.
trigger:
- platform: time_pattern
seconds: /12
condition:
- condition: state
entity_id: input_boolean.charger_max
state: 'off'
- condition: state
entity_id: sensor.wallbox_portal_status_description
state: Charging
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.actual_power
below: '-250'
sequence:
- service: number.set_value
data:
value: '{{ [((states(''number.wallbox_portal_max_charging_current'') | float(0)
+ 1.0) | round(0)), 32] | min }}'
target:
entity_id: number.wallbox_portal_max_charging_current
- conditions:
- condition: numeric_state
entity_id: sensor.actual_power
above: '250'
sequence:
- service: number.set_value
data:
value: '{{ [((states(''number.wallbox_portal_max_charging_current'') | float(0)
- 1.0) | round(0)), 6] | max }}'
target:
entity_id: number.wallbox_portal_max_charging_current
mode: single
To create the charge mode selection buttons on the HA dashboard I added the following to the configuration file:
input_boolean:
# Wallbox
charger_green:
name: "Wallbox green mode"
charger_eco:
name: "Wallbox eco mode"
charger_max:
name: "Wallbox max mode"
Each of these have a script associated to run the actions required to change charge mode:
# Charger control scripts
charger_green:
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.charger_green
- service: input_boolean.turn_off
entity_id: input_boolean.charger_eco
- service: input_boolean.turn_off
entity_id: input_boolean.charger_max
- service: number.set_value
data:
value: "6"
entity_id: number.wallbox_portal_max_charging_current
charger_eco:
sequence:
- service: input_boolean.turn_off
entity_id: input_boolean.charger_green
- service: input_boolean.turn_on
entity_id: input_boolean.charger_eco
- service: input_boolean.turn_off
entity_id: input_boolean.charger_max
- service: number.set_value
data:
value: "6"
entity_id: number.wallbox_portal_max_charging_current
charger_max:
sequence:
- service: input_boolean.turn_off
entity_id: input_boolean.charger_green
- service: input_boolean.turn_off
entity_id: input_boolean.charger_eco
- service: input_boolean.turn_on
entity_id: input_boolean.charger_max
- service: number.set_value
data:
value: "32"
entity_id: number.wallbox_portal_max_charging_current
And there are two additional automations to pause and resume the charger in ‘green’ mode:
- id: '1654977801663'
alias: WALLBOX - Charger pause controller - Resume
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.actual_power
for:
hours: 0
minutes: 5
seconds: 0
below: '-1500'
condition:
- condition: state
entity_id: input_boolean.charger_green
state: 'on'
- condition: state
entity_id: sensor.wallbox_portal_status_description
state: Paused
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.wallbox_portal_pause_resume
mode: single
- id: '1654978038793'
alias: WALLBOX - Charger pause controller - Pause
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.actual_power
for:
hours: 0
minutes: 5
seconds: 0
above: '250'
condition:
- condition: state
entity_id: input_boolean.charger_green
state: 'on'
- condition: state
entity_id: sensor.wallbox_portal_status_description
state: Charging
action:
- service: switch.turn_off
data: {}
target:
entity_id: switch.wallbox_portal_pause_resume
mode: single
And finally, to put it all together, this is what is in my dashboard:
type: vertical-stack
cards:
- show_name: true
show_icon: false
type: button
tap_action:
action: toggle
name: CHARGER CONTROLLER
- type: horizontal-stack
cards:
- show_name: true
show_icon: true
type: button
tap_action:
action: call-service
service: script.charger_green
data: {}
target: {}
entity: input_boolean.charger_green
name: Green
icon: mdi:leaf
icon_height: 80px
- show_name: true
show_icon: true
type: button
tap_action:
action: call-service
service: script.charger_eco
data: {}
target: {}
entity: input_boolean.charger_eco
name: Eco
icon: mdi:weather-sunny
icon_height: 80px
show_state: false
- show_name: true
show_icon: true
type: button
tap_action:
action: call-service
service: script.charger_max
data: {}
target: {}
entity: input_boolean.charger_max
name: Max
icon: mdi:flash
icon_height: 80px
- type: entities
entities:
- entity: number.wallbox_portal_max_charging_current
name: Current limit
- entity: switch.wallbox_portal_pause_resume
name: Enabled
- type: history-graph
entities:
- entity: sensor.wallbox_portal_max_charging_current
name: Charger Current Limit
hours_to_show: 24
- type: history-graph
entities:
- entity: sensor.actual_power
name: Mains Power
hours_to_show: 24
- type: history-graph
entities:
- entity: switch.wallbox_portal_pause_resume
name: Enabled
Which will give you something like this:
NOTES:
The automations can be realized/edited from the HA user interface. You can copy the code above into the automations.yaml file and then edit in the HA user interface.
Surely there is a way to simplify this. Let me know.
To be clear, this setup does NOT make use of the Wallbox eco-Smart functions because these cannot be managed through the API, or even the Wallbox app on WiFi. This setup creates similar functionality and is accessible from the HA dashboard using the official HA Wallbox integration (another shoutout @hesselonline for making this possible).
Copy with pride. Give me your opinion.