Home Assistant: Saving money with EV charging suggestions using go-e chargers
Once again I bumped something problematic that I can possibly solve with an automation using Home Assistant. I’m using stock electric market and that means flexible energy prices, sometimes low, some times high. My wife in the other hand does not check daily prices that much, but yet she drives a fully electric car..
The problem
The first problem here is that my wife plugs the EV charging cord in after coming back from work regardless of electric price as she doesn’t follow it actively.
The second problem is with the usage of go-e chargers. Even though the charger does have an operating mode that follows the stock price to charge on the cheapest hours (mode called daily trip), it does not know if it should skip the whole day. Normally my wife only needs to charge the car about every three to four days, but of course I want the car to be charged as soon as the electric price is cheap enough to have some buffer for possible high price charging hours.
If my wife would just plug in every third day, then we could hit the high prices every time and skip the cheap days. If my wife would plug in every day, we could hit both cheap and expensive. But the thing here is that we should hit as much low prices as we possibly can.
The solution
The simplest and easiest solution here is to inform my wife when she should plug the cord and when to avoid plugging it. That’s where the Home Assistant, Nord Pool and go-e charger integration comes into play.
Go-e Gemini has a RGB led ring that can be programmed to change colour using API commands. So, we could just set the idle colour to green when the cord should be plugged, yellow when to think twice and red when think three times before connecting it 🙂 That way my wife knows when always to plug in and when to use her consideration. She can still decide to plug in if she really needs the extra battery the next day, even if the price will be high. After plugging in, the go-e charger will autonomously do the rest and charge during cheapest hours of that period.
Requirements
This automation requires:
- Home Assistant (obviously)
- Go-e Gemini charger
- Configured for MQTT use
- Daily trip mode in use
- Nord Pool integration
The automation and the code
First of all this automation isn’t perfect as there’s no information about the exact hours go-e charger will charge. The charger will autonomously charge whenever the price is cheapest, but there’s other factors as well like load management or exact amount of energy or time needed. Because of that we need to use some kind of average price to indicate if the price is ok.
In my use-case I’ve configured go-e charger daily trip to end at 07:00 so that’s one point we need to update the colour of the device to match average price of the next time frame (morning/afternoon charging). Second spot to update is whenever the Nord Pool receives the next day data (night charging).
When no Nord Pool next day data is available, we will use average price of current day value from 7:00 to 15:00. After Nord Pool data is available, we will use Nord Pool data from 21:00 to next morning 07:00. These time values are based on Nord Pool data receive (15:00), daily trip end time (07:00) and common sense when then price is about cheapest during night (21:00 – 07:00). This method is not ideal, but it’s ‘good enough’ to give us indication of the average price.
The price values I’m using are: average price below 10c/kWh is green, average price between 10c/kWh and 18c/kWh is yellow and everything above that is red.
In the automation there is a helper template that decides our colour depending on the average price on certain timeframes described above. Then the automation itself and finally a script that will change the led ring colour of the charger through MQTT.
Hopefully my explanation made even some sense 🙂 Here’s the Home Assistant package* content (the code) itself.
*If you don’t know what are Home Assistant packages, check it out from the Home Assistant package introduction page.
sensor:
- platform: template
sensors:
go_e_charger_color:
friendly_name: Go-e charger color
value_template: >
{%- set sensor = 'sensor.nordpool' -%}
{%- if state_attr(sensor, 'tomorrow_valid') == true -%}
{%- set arr = state_attr(sensor, 'today') + state_attr(sensor, 'tomorrow') -%}
{%- set avg = arr[21:31] | average -%}
{%- else -%}
{%- set avg = state_attr(sensor, 'today')[7:15] | average -%}
{%- endif -%}
{%- if avg < 10 -%}
#00FF00
{%- elif avg < 18 -%}
#FFFF00
{%- else -%}
#FF0000
{%- endif -%}
script:
set_charger_light_color:
alias: Set Charger Light Idle Color
fields:
charger_id:
description: Id of the charger
example: "123456"
color:
description: The desired color in RGB
example: "#FF0000"
sequence:
- service: mqtt.publish
data:
topic: "go-eCharger/{{charger_id}}/cid/set"
payload: '"{{color}}"'
automation:
alias: "Energy: Set go-e charger color"
id: set_go_e_charger_color
description: Sets charger color depending of the electric price
triggers:
- trigger: state
entity_id:
- sensor.nordpool
attribute: tomorrow_valid
to: "true"
- trigger: time
at: "07:00:00"
- trigger: time
at: "15:00:00"
conditions: []
actions:
- action: script.set_charger_light_color
metadata: {}
data:
color: |
{{ states.sensor.go_e_charger_color.state }}
charger_id: 400123
mode: single
Conclusion
This automation has been running at my smart home for few weeks now and results are starting to show. My wife clearly knows when to always plug the car in, but also has possibility to charge even if prices are high. Finally one more automation that has high wife approval factor 🙂
For further development I will need to adjust the timeframes to find more exact price ranges. For that I’m going to use AIO Energy Management once I’ve implemented some required features for it like providing average price.
I understand the value of doing things yourself, but I can highly recommend using the “EV Smart Charging” integration for the charger control. I have been using it for my two Go-E:s for a year and a half, and it seems to work very well as long as the pricing info is available.
Additionally I have two hardware buttons, which overrides the scheduling for immediate charging. Using the color of the RGB ring is something I have been planning to do, but the scheduling works so well, that the need really isn’t there anymore.
But just out of curiosity: How have you realized the load balancing with two chargers? I was struggling with this (with the additional twist that other of our cars loads only one-phased) and the best solution I found was to group two go-e:s under one load management group and control the max current value for the group. And when the one-phased car is charging, the other charger is set to one-phase mode so it’s also charged basically as fast as it’s possible at that time. There’s an automation which decreases the estimated charging speed of the 3-phased car based on the expected duration of the charging of the one-phased car.
Additionally, there are two load management scripts in home assistant, one which controls the three-phase -charging of the group and other which controls the two phases used phases of the two chargers independently from one another.
The only real problem, in addition to the unneeded complexity of the system, is that for a reason or another the charger which is set to charge the 3-phased car with one phase only sometimes ceases the charging completely and continues only when the 1-phased car is ready. Which, of course, ruins the idea of scheduling.
I really wish there would be a ready solution to schedule the charging of several vehicles.
My go-e chargers and a go-e controller are running load balancing stand-alone so no Home Assistant involved on that part at all.
Luckily both my EVs are 3-phased. I’ve noticed that if both are set to daily trip and charging at the same time the timeframe will obviously be more than estimated and if bad luck involved, some of the charging could be on more expensive hours.
Both chargers are in the same load balancing group.
EV Smart Charging integration could be good, but I’m considering EV Charging as a ‘critical’ system so I’ve left most of the controlling to be done by go-e stand alone and no Home Assistant involved. Just a personal preference here though 🙂
OK, understandeable. I have preferred low cost, so I wanted to cope without the official go-e controller and use Home Assistant instead. The system worked very well when I had two one phased vehicles and two single phase control scripts in home assistant, but using the home assistant load balancing group somehow involves in between and uses way more conservative current values even though there would be several amps of headroom left before the main fuse limit would be reached.
This is my first winter with this setup, and I guess I must do further investigations of Go-e:s behavior when two devices are used in one load balancing group.