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.