Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmason/2f87edec85ce2fcfe07e18d164b9c340 to your computer and use it in GitHub Desktop.
Save jmason/2f87edec85ce2fcfe07e18d164b9c340 to your computer and use it in GitHub Desktop.
alias: Control Zappi charging based on solar PV
description: >-
Switch the Zappi EV charger on (in Eco mode), or off, depending on the
availabilty of power from the solar panels. If the charger is already on in
"Fast" mode, let that run without any interruption (drawing from the grid
or battery if required).
sequence:
- alias: Only run during the daytime
condition: time
after: "09:00:00"
before: "21:00:00"
- alias: Only run if Zappi state is readable, and charger is not in Fast mode
condition: state
entity_id: select.myenergi_zappi_20278784_charge_mode
state:
- Stopped
- Eco
- Eco+
- alias: Compute available solar PV energy in watts
variables:
solar_production_watts: "{{ states('sensor.solis_ac_output_total_power') }}"
house_usage_watts: "{{ states('sensor.solis_total_consumption_power') }}"
available_energy_watts: "{{ solar_production_watts|float - house_usage_watts|float }}"
- alias: Turn on or off the charger based on energy available
if:
- condition: template
value_template: "{{ available_energy_watts > 1500 }}"
then:
- alias: If charge_mode is not already Eco, set it to Eco
if:
- condition: not
conditions:
- condition: state
entity_id: select.myenergi_zappi_20278784_charge_mode
state: Eco
then:
- device_id: 611b73c52c6236a9d522748e24885061
domain: select
entity_id: select.myenergi_zappi_20278784_charge_mode
type: select_option
option: Eco
- service: notify.jmason_org
data:
message: >-
Zappi set to Eco mode, as spare power is {{ available_energy_watts }}W
else:
- alias: If charge_mode is not already Stopped, set it to Stopped
if:
- condition: not
conditions:
- condition: state
entity_id: select.myenergi_zappi_20278784_charge_mode
state: Stopped
then:
- device_id: 611b73c52c6236a9d522748e24885061
domain: select
entity_id: select.myenergi_zappi_20278784_charge_mode
type: select_option
option: Stopped
- service: notify.jmason_org
data:
message: >-
Zappi charging stopped, as spare power is {{ available_energy_watts }}W
mode: queued
icon: mdi:battery-80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment