Made this, think it works, it will only use price for tomorrow if valid:
{% if state_attr('nordpool_kwh_dk1_dkk_2_095_025', 'tomorrow') == none %}
{% set interval_end_tomorrow = 0 -%}
{% set interval_end_hour = 23 -%}
{% else %}
{% set interval_end_tomorrow = 1 -%}
{% set interval_end_hour = states('input_number.mini_charger_ready_tomorrow') | int -%}
And the use a helper to set the time when it must be ready to morrow (made in configuration.yaml)
input_number:
mini_charger_ready_tomorrow:
name: Mini klar kl
icon: mdi:clock-check
mode: slider
initial: 7
step: 1
min: 5
max: 23
unit_of_measurement: Kl
I also created a automation there starts the charger when power is under a certan cheap price, and sends a notify if the car is home and not plugedin. This automation waits 55 minutes if second car is low (under 70%). We have 2 EV car’s one with 33kWh and one with 89kWh battery and loadbalancing on the chargers. 1 car chargning = 11kW, 2 cars 5.5kW each
alias: EV MUSTANG - kWh < "input_number.ev_charge_start_always" kr start ladning.
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.nordpool_kwh_dk1_dkk_2_095_025
below: input_number.ev_charge_start_always
condition: []
action:
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.cooper_se_charging_level_hv
above: '70'
timeout: '00:55:00'
- choose:
- conditions:
- condition: state
entity_id: sensor.mustang_gt_easee_status
state: disconnected
- condition: device
device_id: 364f4a1d24de696091ae6d4f79a873d8
domain: device_tracker
entity_id: device_tracker.fordpass_tracker
type: is_home
sequence:
- device_id: 7ceb2dfb14ec52a79e1eef4d4540ce9c
domain: mobile_app
type: notify
message: >-
Sæt ladekabel i, der er billig strøm nu, du har {{
states('sensor.ford_hv_battery_percent') }}% batteri, kWh koster:
{{ states('sensor.nordpool_kwh_dk1_dkk_2_095_025') }} kr.
title: Kastanily - Mustang
- conditions:
- condition: state
entity_id: sensor.mustang_gt_easee_status
state: awaiting_start
sequence:
- device_id: 7ceb2dfb14ec52a79e1eef4d4540ce9c
domain: mobile_app
type: notify
message: >-
Lader nu: {{ states('sensor.ford_hv_battery_percent') }}% batteri
og kWh koster: {{ states('sensor.nordpool_kwh_dk1_dkk_2_095_025')
}} kr.
title: Kastaniely - Mustang
default: []
- service: easee.resume
data:
charger_id: XXXXXXX
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.mustang_charger_status_charge
mode: restart
And then the car is pluged in
alias: EV MUSTANG - Ladekabel sat i
description: ''
trigger:
- platform: state
entity_id: sensor.mustang_gt_easee_status
from: disconnected
for:
hours: 0
minutes: 0
seconds: 0
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.mustang_charger_status_charge
state: 'off'
sequence:
- service: easee.pause
data:
charger_id: XXXXXX
default:
- device_id: 7ceb2dfb14ec52a79e1eef4d4540ce9c
domain: mobile_app
type: notify
message: Ladekabel i
mode: restart
So when the car is plugedin the script puts the charger into pause if it has not been told to charge from the “EV MUSTANG - kWh < “input_number.ev_charge_start_always” kr start ladning” (by using a helper to keep track of charge on or off
and then eletricity prices gets above helper value it stops charge and sends notification:
alias: EV MUSTANG - KWh > "input_number.ev_charge_start_always" kr stop ladning
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.nordpool_kwh_dk1_dkk_2_095_025
above: input_number.ev_charge_start_always
condition:
- condition: state
entity_id: sensor.mustang_gt_easee_status
state: charging
action:
- device_id: 7ceb2dfb14ec52a79e1eef4d4540ce9c
domain: mobile_app
type: notify
message: >-
Stopper ladning, kWh kr: {{
states.sensor.nordpool_kwh_dk1_dkk_2_095_025.attributes.current_price
}}kr, ladet til: {{ states('sensor.ford_hv_battery_percent') }}%
title: Kastaniely - Mustang
- service: easee.pause
data:
charger_id: XXXXXX
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.mustang_charger_status_charge
mode: restart
The above makes sure that when electrity is cheap we charge, no matter what nedded
Now I have also made some template sensors that constant gives me these information:
Those are I planing to use from automation
in pseudocode:
if mustang < AA% and kWh awg price is < xx charge to BB%
if mustang < CC% and kWh awg price is < yy charge to DD%
if mustang < EE% and kWh awg price is < zz charge to EE%
Next look into my calender to morrow and se how far do I have to go and then make sure there is enough power for that (I work out from home)
So basicly I want to charge, under these conditions:
CAR 1:
!. Eletricity price cheap
2. If not enough charge for what I have to drive to morrow
CAR 2:
!. Eletricity price cheap
2. If not enough charge for what I have to drive to morrow
Also needs to think in load sharing in the Easee charger if both have to charge same day…
So I have a long way to go yet:-)