I thought to share my automation for Deye since I couldn’t find alot of information online about it.
The way the way I have this setup is about the inverter’s programmes setup with time-of-use programming.
- Programme 1 starts at 12 a.m (when I start to charge the batteries) and ends at 2:30 a.m - set to charge the batteries
- Programme 2 starts at 2:30 a.m - set to charge the batteries
- Programme 3 (the end time for charging) is at 5:30a.m - which ends
- Programme 6 starts at 11:30 p.m and obviously ends at programme 1 which is at 12 a.m.
The logic of it is the automation configures programme 4 and programme 5 to charge the batteries when when a timed slot is issued and to dynamically move program 4 and 5 for each slot so we don’t charge anything beyond whats set.
- When programme 4 is used here, it’s standard set to disable the charge and by standards set the SOC to 10%.
- When we detect from Octopus Intelligent planned dispatching that we have a dispatch intelligence on, the automation goes and changes programme 4 time to now and change the SOC to 99% and set it charge to Grid.
- It also sets up programme 5 which is the end of programme 4 to the end of the off-peak rate end time which we also receive. (there is a condition to cover the case if the off peak rate end is beyond 23:30 - so we don’t mess the schedules.
The integrations that we have in the Home Assistant and after that we also have another automation that triggers that when the intelligent dispatch is set to off, that sets programme 4 to SOC 10% and also the programme for charging to disabled in that manner. We can set up programme 4 to immediately start charging once we know that there is an off-peak, and as a safeguard, it also sets the time for programme 5 to stop in case there is some problem with the Home Assistant it hasn’t triggered or anything like that. When it finishes and intelligent dispatching is off, programme 4 is then set back to sorry, 10% SOC and set up to disable charging, so next day it will pretty much just go ahead and just use the energy in the battery during the day. Might be a little bit of an overkill, but it’s an automation that works well and ensures we never charge beyond the allowed times (MAXIMUS EFFECIENCY!). I’ve also set up that the Zappi will also boost charge once we know that there is a dispatching on, and also it will turn off the boost charge. In my Zappi, I have it set up by default to charge according to the schedule 11:30 till 5:30 which is a lot simpler, but that automation allows me to control the die inverter without having to turn off the time of use and just leave everything nice and smooth, and it’s just basically dynamically works.
The reason this is better than turning off the TOU, is because when you do so - it takes a couple of minutes for the inverter to flick out of TOU to standard mode - which results in some bleed in battery discharge, or charge. But changing the TOU - I noticed its instant.
Repos used for tha atuomation:
for octopus intelligent
which gives us this off peak end, and intelligent planned dispatch when octopus plan to charge the car outside the normal hours.
And this for deye inverter
I just entered the IP of the solarman stick thats connected to my inverter - and its serial number and suddenly it pulled all the information - all while I can still control and see my inverter in the solarman or in the deye app.
and here are my automations:
alias: Cheap tarrif incoming
description: ""
mode: single
triggers:
- entity_id: binary_sensor.octopus_intelligent_planned_dispatch_slot
to: "on"
trigger: state
conditions:
- condition: time
after: "05:30:00"
before: "23:30:00"
actions:
- device_id: c2b04b1eee8e0fa2fcfbf98f2ebd268f
domain: select
entity_id: dfc5ee86a9c742bd2915b69150d173ac
type: select_option
option: Grid
- device_id: c2b04b1eee8e0fa2fcfbf98f2ebd268f
domain: number
entity_id: 97764a81d72cda8178d4a40d085c3748
type: set_value
value: 99
- target:
entity_id: time.inverter_program_4_time
data:
time: "{{ now().strftime('%H:%M:%S') }}"
action: time.set_value
- if:
- condition: template
value_template: >
{% set s = states('sensor.octopus_intelligent_offpeak_end') %} {% if s
in ['unknown','unavailable','none',''] %}
false
{% else %}
{% set end_time = strptime(s, '%Y-%m-%dT%H:%M:%S%z').astimezone(now().tzinfo) %}
{% set cutoff = end_time.replace(hour=23, minute=29, second=0, microsecond=0) %}
{{ end_time.date() == now().date() and end_time <= cutoff }}
{% endif %}
then:
- target:
entity_id: time.inverter_program_5_time
data:
time: >
{% set s = states('sensor.octopus_intelligent_offpeak_end') %} {%
set end_time = strptime(s,
'%Y-%m-%dT%H:%M:%S%z').astimezone(now().tzinfo) %} {{
end_time.strftime('%H:%M:%S') }}
action: time.set_value
else:
- target:
entity_id: time.inverter_program_5_time
data:
time: "23:29:00"
action: time.set_value
- data:
amount: 99
action: myenergi.myenergi_boost
and this one to turn off program 4
alias: Reset Program 4 and Disable Grid Charge When Dispatch Slot Off
description: ""
triggers:
- entity_id: binary_sensor.octopus_intelligent_planned_dispatch_slot
to: "off"
trigger: state
conditions:
- condition: or
conditions:
- condition: time
after: "05:30:00"
before: "23:30:00"
actions:
- device_id: c2b04b1eee8e0fa2fcfbf98f2ebd268f
domain: number
entity_id: 97764a81d72cda8178d4a40d085c3748
type: set_value
value: 10
- device_id: c2b04b1eee8e0fa2fcfbf98f2ebd268f
domain: select
entity_id: dfc5ee86a9c742bd2915b69150d173ac
type: select_option
option: Disabled
- action: myenergi.myenergi_stop_boost
metadata: {}
data: {}
mode: single
I also created another automation to sync the time of my deye inverter as I noticed it always drifts and doesn’t auto sync the time
alias: Inverter time synchronization
description: ""
triggers:
- at: sensor.sun_next_dawn
trigger: time
- event: start
trigger: homeassistant
actions:
- data:
datetime: "{{ now() }}"
target:
entity_id: datetime.inverter_date_time
action: datetime.set_value
mode: single