I have just started to use HA having set it up last week on a mini PC, and for my first project I decided to automate the charging routines for my EV, including pausing my Givenergy home battery using the GivTCP integration. At this point I have an (I’m sure slightly clunky) set of automations that ask me to make the following decisions with a series of actionable notifications befoe seting the charger and invertor to the correct modes:
Charge now/later
Solar (Eco+)/Grid (Fast) charge
Pause home battery discharge (Y/N) (I only ask this Q if the user has selected to charge now from the grid)
All of that works fine in test, but I want to trigger the first of these notifications by plugging in the EV. This should be simple to do using the plug status, and whislt I can clearly see the state of this in HA at any given time and it appears to switch state as expected, I can’t seem to trigger from it. Here is my automation (with the Zappi ID obfuscated) - any ideas what I am doing wrong?
alias: "EV - Daytime charge 1: Now or later?"
description: Routine to choose charge time (now or later)
trigger:
- platform: state
entity_id:
- sensor.myenergi_zappi_xxxxxxxx_plug_status
to: EV Connected
for:
hours: 0
minutes: 0
seconds: 0
condition:
- condition: not
conditions:
- condition: time
after: "02:00:00"
before: "05:00:00"
enabled: true
action:
- service: notify.notify
data:
message: Charge immediately or off-peak?
title: Charge type
data:
actions:
- action: CHARGE_NOW
title: Charge now
- action: CHARGE_LATER
title: Charge off-peak
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: CHARGE_NOW
timeout:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
continue_on_timeout: false
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: CHARGE_LATER
timeout:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
continue_on_timeout: true
mode: single
I’m wondering whether the syntax of the state trigger to: field is wrong - maybe “EV Connected” needs to be in single or double inverted commas? I think I tried that once early on and it didn’t make any difference, but I could be wrong…
Hmmmm… Interestingly I just tested this automation (to trigger an off-peak charge at 0200 during my off-peak electricity hours) which uses the plug status as a condition rather than a trigger. It works fine with identical syntax, so I’m stumped as to why the other one doesn’t trigger successfully off the change in plug status…
Update - Tonight when I plugged in it did work, but only after quite a long pause (~30 seconds). Why that is I’m not sure, but it is probably a delay on the EV’s side in telling the charger of the plug status change. Waht’s clear is that if you take out the charge plug, wait a few seconds, then plug it back in (as I was doing when intially testing the automation), it doesn’t like it. So I think this was more an EV/charger foible than it was an API or HA one.
I am sure the delay you mentioned is lag between the charger communicating with myenergi servers and lag from their servers to your HA via the API.
I am completely new to HA and having the same issues of your original post. I see ‘EV Connected’ in the card but cannot get to set up an automation to detect with Unknown or Unavailable as the options while setting up a trigger and condition in Automations. I’ve not tried YAML and unsure where to even start.
WORKED IT OUT - Here is some helpers for those cominv behind me. I’ve a lot to catch up but if you are also looking to Automate your Zappi.
I’m using the UI Automation, not the YAML code method.
I want to switch off load dumping when the Zappi is plugging in and set to Eco+ or Eco.
Trigger:
First, you need to generate a ‘trigger’ - this i achieved by setting 3 Triggers on the Automation card, HA is only looking for one of these Entities changing State.
Conditions
Then using the Conditions section, set up what to look for after a State change triggered, such as"EV Connected" or “Charging” as required.
Ive also used AND arguments to detect Mode set or has been set to either Eco or Eco+. On the cards, select the required Entity such as Mode, Statis for either Charger or Plug. Leave Attribute field blank and enter the matching State as free text.
Then
Once a trigger has been detected and the Zappi matches the State(s) you are looking for. Add an Entry to perform your required task or event.
Hope this is helpful to others.
Just need to puzzle how to use the an Automation to change the Mode.
SUSSED IT
In Actions - select Call Service and start typing myenergi and the Modes will pop up.
To change Mode Fast-Eco-Eco±Stop select Device then Zappi, choose action and select your choice.
Starting to get more brave with this and getting to a stage YAML is unavoidable.
Your post Andy is useful in that it gives me chance to compare coded to UI, much appreciated.
Up to now using ‘helpers’ to create toggles and dashboard buttons - i can plug in and set a pre-set button such as ‘Boost 12kwh’, '‘Boost 16kwh’ and 'Night Charge. As 12am arrives, if a button is selected Automations trigger and then set up charging to the Zappi to begin. Automations as they run, unset the toggle that triggered it.
As i get my head around YAML i want to bring it into the hard coding than UI.
One question if anyone can help. I want to be able to read whether or not the Zappi is ‘Locked’. To then use an Automation or an indication on a dashboard.
I’ve found so far EV Connected, EV Disconnected, Paused, Charging but cant see Locked and Unlocked.
So far though - I really appreciate this plug in being created.