2635 lines
91 KiB
YAML
2635 lines
91 KiB
YAML
- id: '5001'
|
||
alias: 5001 - Solax Zappi Octopus Control
|
||
description: "# 5001 - Solax Zappi Octopus Control\nSee documentation in repo.\n\
|
||
\n# Initial installation instructions\n1. This is 5001. You also need 5002 5003\
|
||
\ 5004 and 5005 to make this work successfully. \n\n**Change Log**\nv5.5.0 Added\
|
||
\ 4 triggers for finished discharge just in case EV is connected during daily\
|
||
\ discharge. Removed Option 4 as it was legacy\nv5.4.1 Added new daily export\
|
||
\ which works with pre-emptive\nv5.3.0 Introducing safe switching of octopus_intelligent_smart_charge\n\
|
||
v5.0 Refactor out account names\nv3.8 Estimated time EV needs to charge based\
|
||
\ on required % and registered EV size\nv3.7 Pre-emptive discharge of solax before\
|
||
\ EV charging option (when EV is connected)\n Pre-emptive discharge before\
|
||
\ 23:30 when EV is disconnected\nv3.6 Min soc calculation updated in variables\n\
|
||
v3.5 Variable for loops (to confirm solax commands have been applied should be\
|
||
\ set to min of 3)\nv3.4 Added condition to check if saving session is in progress\n\
|
||
v3.3 Changed the logic slightly for setting SoC limits. Sometimes depending on\
|
||
\ which mode is being set (self use or feed in) the inverter seems to randomly\
|
||
\ reject the second service call. so I now set the first soc limit to match the\
|
||
\ default return to mode.\nv3.2 Added an input boolean switch to enable possibility\
|
||
\ to check what kind of discharge is occurring when a manual discharge is occurring.\n\
|
||
v3.0.4 Added a condition to prevent inverter reverting back to default if vehicle\
|
||
\ was charging prior to a saving session starting.\nv3.0.3 Added When Condition\
|
||
\ to ensure inverter mode is reset to default mode when it's time to start charging\
|
||
\ the solax battery.\nv3.0.2 further fixes to 3.0.1\nv3.0.1 Fixed issue that if\
|
||
\ user plugs in during a saving session a charge could be initiated\nv3.0.0 Allow\
|
||
\ discharge battery before charging EV\nv2.1.4.1 Spotted a potential bug if user\
|
||
\ starts charge at 23:30 where it could clash with tail battery export\nv2.1.4\
|
||
\ Renamed automation\nv2.1.3.1 fixed missing scenario where min_SoC would not\
|
||
\ be set properly at 23:30 or if FAST charging was selected.\nv2.1.3 More readable\
|
||
\ notifications\nv2.1.1 Update dispatch trigger for octopus dispatch from on to\
|
||
\ off rather than just to off. false triggers when sensor is unavailable \nv2.1\
|
||
\ updated setting of modes and SoC's wrt rest sensor sensor.solax_rest_local_settings\n\
|
||
v2.0 Remove legacy dev work"
|
||
triggers:
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
from: null
|
||
to: Fault
|
||
id: Zappi Fault
|
||
trigger: state
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
from: Charging
|
||
to: EV Disconnected
|
||
id: Charging to Disconnected
|
||
trigger: state
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
from: EV Connected
|
||
to: EV Disconnected
|
||
id: Connected to Disconnected
|
||
trigger: state
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
from: Charging
|
||
to: EV Connected
|
||
id: Paused EV Charging
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 1
|
||
seconds: 0
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
from: Waiting for EV
|
||
to: EV Connected
|
||
id: Paused EV Charging
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 10
|
||
seconds: 0
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
from: EV Disconnected
|
||
to: EV Connected
|
||
id: Disconnected To Connected
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: '{{states(''input_number.delay_when_ev_connected'')}}
|
||
|
||
'
|
||
seconds: 0
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
from: Fault
|
||
to: Charging
|
||
id: Charging0
|
||
trigger: state
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
from: Waiting for EV
|
||
to: Charging
|
||
id: Charging1
|
||
trigger: state
|
||
- entity_id:
|
||
- sensor.zappi_plug_status
|
||
to: Charging
|
||
id: Charging2
|
||
from: EV Connected
|
||
trigger: state
|
||
- at: sensor.pre_export_battery_before_charging_ev_time
|
||
id: Time to Start Charging
|
||
trigger: time
|
||
- at: sensor.ev_start_time
|
||
id: Time to Start Charging
|
||
trigger: time
|
||
- at: sensor.pre_nightly_battery_export_time
|
||
id: Solax Discharge Prior to 2330 START
|
||
enabled: true
|
||
trigger: time
|
||
- trigger: time
|
||
at: sensor.daily_battery_export_time_ev_disconnected
|
||
id: Daily Export
|
||
- at: '23:30:00'
|
||
id: Discharge_battery_at_2330
|
||
enabled: true
|
||
trigger: time
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.solax_discharge_before_2330
|
||
from: 'on'
|
||
to: 'off'
|
||
id: Solax Discharge Prior to 2330 END
|
||
enabled: false
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.solax_discharge_before_2330
|
||
to: 'off'
|
||
from: 'on'
|
||
id: finish discharge
|
||
for:
|
||
hours: 0
|
||
minutes: 2
|
||
seconds: 0
|
||
- entity_id:
|
||
- binary_sensor.octopus_intelligent_dispatching
|
||
to: 'off'
|
||
id: Peak Rate
|
||
trigger: state
|
||
from: 'on'
|
||
- entity_id:
|
||
- select.zappi_charge_mode
|
||
to: Fast
|
||
id: Fast_unknown
|
||
trigger: state
|
||
- entity_id:
|
||
- select.zappi_charge_mode
|
||
for:
|
||
hours: 0
|
||
minutes: '{{(state_attr(''input_datetime.solax_stop_charge_2'', ''timestamp'')/60-state_attr(''input_datetime.solax_start_charge_2'',
|
||
''timestamp'')/60)|int (default = 60)}}'
|
||
seconds: 0
|
||
to: Fast
|
||
id: Fast
|
||
trigger: state
|
||
- entity_id:
|
||
- input_button.solax_force_discharge
|
||
id: ForceDischarge
|
||
trigger: state
|
||
- entity_id:
|
||
- input_button.solax_stop_discharge
|
||
id: StopForceDischarge
|
||
trigger: state
|
||
- trigger: state
|
||
entity_id:
|
||
- input_boolean.octopus_schedule_anytime
|
||
to: 'on'
|
||
id: Allow Octopus to Determine Schedule
|
||
- trigger: state
|
||
entity_id:
|
||
- input_boolean.solar_export_priority
|
||
to: 'on'
|
||
id: Only allow EV charging after sunset
|
||
- trigger: state
|
||
entity_id:
|
||
- input_boolean.use_clever_time
|
||
to: 'on'
|
||
id: use clever time
|
||
- trigger: state
|
||
entity_id:
|
||
- input_boolean.use_fixed_time
|
||
to: 'on'
|
||
id: use fixed time
|
||
- trigger: state
|
||
entity_id:
|
||
- input_boolean.ev_solax_battery_drain
|
||
- input_boolean.use_grid_during_octopus_dispatch
|
||
id: Battery usage options
|
||
- entity_id:
|
||
- sensor.solax_local_battery_soc
|
||
below: input_number.solax_default_discharge_limit_soc
|
||
for:
|
||
hours: 0
|
||
minutes: 1
|
||
seconds: 1
|
||
id: Battery at min SoC
|
||
trigger: numeric_state
|
||
value_template: '{{ state.state | float(0) - 1 }}'
|
||
- trigger: time
|
||
at:
|
||
entity_id: sensor.octopus_intelligent_target_time
|
||
offset: '120'
|
||
id: Dispatch Finished
|
||
- trigger: state
|
||
entity_id:
|
||
- input_boolean.zappi_eco_always
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 30
|
||
id: Zappi eco mode
|
||
- trigger: state
|
||
entity_id:
|
||
- sensor.solax_local_manual_mode_behaviour
|
||
to: Do Nothing
|
||
for:
|
||
hours: 0
|
||
minutes: 3
|
||
seconds: 0
|
||
id: Check Discharge Mode
|
||
from: Force Discharge
|
||
enabled: true
|
||
- trigger: time
|
||
at:
|
||
entity_id: input_datetime.solax_battery_start_charge_time
|
||
offset: '-300'
|
||
id: Charge Solax
|
||
- trigger: time
|
||
at: sensor.solax_local_battery_setting_stop_charge_2
|
||
id: Charge Period 2 End
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.solax_discharge_before_ev_charge
|
||
from: 'on'
|
||
to: 'off'
|
||
id: Solax Discharge Prior to EV
|
||
- trigger: state
|
||
entity_id:
|
||
- number.octopus_intelligent_charge_target
|
||
id: charge target
|
||
for:
|
||
hours: 0
|
||
minutes: 1
|
||
seconds: 0
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.solax_local_battery_charging_period
|
||
id: Solax charging from grid
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 59
|
||
from: 'on'
|
||
to: 'off'
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.solax_local_battery_charging_period
|
||
id: Solax charging from grid
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 59
|
||
from: 'off'
|
||
to: 'on'
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.solax_discharge_daily
|
||
to: 'off'
|
||
from: 'on'
|
||
id: finish discharge
|
||
for:
|
||
hours: 0
|
||
minutes: 2
|
||
seconds: 0
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.solax_discharge_daily_prior
|
||
to: 'off'
|
||
from: 'on'
|
||
id: finish discharge
|
||
for:
|
||
hours: 0
|
||
minutes: 2
|
||
seconds: 0
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.solax_discharge_nightly
|
||
to: 'off'
|
||
from: 'on'
|
||
id: finish discharge
|
||
for:
|
||
hours: 0
|
||
minutes: 2
|
||
seconds: 0
|
||
conditions: []
|
||
actions:
|
||
- choose:
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Allow Octopus to Determine Schedule
|
||
sequence:
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id:
|
||
- input_boolean.solar_export_priority
|
||
- input_boolean.use_clever_time
|
||
- input_boolean.use_fixed_time
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Only allow EV charging after sunset
|
||
sequence:
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id:
|
||
- input_boolean.octopus_schedule_anytime
|
||
- input_boolean.use_clever_time
|
||
- input_boolean.use_fixed_time
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- use clever time
|
||
sequence:
|
||
- if:
|
||
- condition: state
|
||
entity_id: input_boolean.use_clever_time
|
||
state: 'on'
|
||
then:
|
||
- action: input_datetime.set_datetime
|
||
data_template:
|
||
entity_id: input_datetime.don_t_charge_ev_before_time
|
||
time: '{{ states(''sensor.calculated_ev_charge_start_time'')}}
|
||
|
||
'
|
||
enabled: false
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id:
|
||
- input_boolean.solar_export_priority
|
||
- input_boolean.octopus_schedule_anytime
|
||
- input_boolean.use_fixed_time
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- use fixed time
|
||
sequence:
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id:
|
||
- input_boolean.solar_export_priority
|
||
- input_boolean.octopus_schedule_anytime
|
||
- input_boolean.use_clever_time
|
||
enabled: true
|
||
- condition: not
|
||
conditions:
|
||
- condition: or
|
||
conditions:
|
||
- condition: and
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Discharge_battery_at_2330
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: Charging
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: Waiting for EV
|
||
- condition: state
|
||
entity_id: sensor.solax_local_manual_mode_behaviour
|
||
state: Force Discharge
|
||
- condition: and
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax Discharge Prior to 2330 START
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: Charging
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: Waiting for EV
|
||
- condition: state
|
||
entity_id: sensor.solax_local_manual_mode_behaviour
|
||
state: Force Discharge
|
||
- condition: and
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Time to Start Charging
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: EV Disconnected
|
||
- condition: trigger
|
||
id:
|
||
- Only allow EV charging after sunset
|
||
- use clever time
|
||
- use fixed time
|
||
- condition: and
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Allow Octopus to Determine Schedule
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: Charging
|
||
- condition: and
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Battery usage options
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: Charging
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'on'
|
||
- condition: and
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Time to Start Charging
|
||
- condition: state
|
||
entity_id: switch.octopus_intelligent_smart_charge
|
||
state: 'on'
|
||
- condition: and
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax Discharge Prior to EV
|
||
- condition: state
|
||
entity_id: switch.octopus_intelligent_smart_charge
|
||
state: 'on'
|
||
- condition: and
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Check Discharge Mode
|
||
- condition: template
|
||
value_template: '{{states(''sensor.solax_local_inverter_mode'')!= "Manual"}}'
|
||
- condition: template
|
||
value_template: '{{now()|as_timestamp-states(''sensor.uptime'')|as_timestamp>80}}
|
||
|
||
'
|
||
- variables:
|
||
default_mode: '{{states(''sensor.solax_default_operation_mode'')|int}}
|
||
|
||
'
|
||
min_soc: "{% set ev_charging = is_state('sensor.zappi_plug_status','Charging')\
|
||
\ %} {% set dispatch_on = is_state('binary_sensor.octopus_intelligent_dispatching','on')\
|
||
\ %} {% set use_grid = is_state('input_boolean.use_grid_during_octopus_dispatch','on')\
|
||
\ %} {% set prevent_ev_drain = is_state('input_boolean.ev_solax_battery_drain','on')\
|
||
\ %} {% set default_soc = states('input_number.solax_default_discharge_limit_soc')|int\
|
||
\ %} {% set current_soc = states('sensor.solax_local_battery_soc')|int %}\
|
||
\ {% set smart_charge = is_state('switch.octopus_intelligent_smart_charge','on')\
|
||
\ %}\n{# ===============================================================\n\
|
||
\ min_soc decision rules\n\n Special triggers:\n - Discharge_battery_at_2330,\
|
||
\ Fast_unknown:\n → If prevent_ev_drain and (not charging OR use_grid):\
|
||
\ hold current SoC\n → Else: default_soc\n\n Charging period (binary_sensor.solax_local_battery_charging_period\
|
||
\ = on):\n → Always default_soc\n\n Charging→Disconnected transition\
|
||
\ (05:30–23:30):\n → Always default_soc\n\n NEW: Daytime dispatch exception\
|
||
\ (05:30–23:30):\n - If dispatch_on = true AND smart_charge = off:\n \
|
||
\ → Force default_soc\n\n Normal conditions:\n EV charging:\n\
|
||
\ - If prevent_ev_drain OR use_grid: hold current SoC\n - Else:\
|
||
\ default_soc\n\n EV not charging:\n - If dispatch_on AND prevent_ev_drain\
|
||
\ AND use_grid: hold current SoC\n - Else: default_soc\n\n Summary:\n\
|
||
\ → Two possible outputs: current_soc (discharge blocked) OR default_soc\
|
||
\ (discharge allowed)\n ===============================================================\
|
||
\ #}\n\n{# --- Special triggers override everything --- #} {% if trigger.id\
|
||
\ in ['Discharge_battery_at_2330', 'Fast_unknown'] %}\n {% if prevent_ev_drain\
|
||
\ and (not ev_charging or use_grid) %}\n {{ current_soc }}\n {% else %}\n\
|
||
\ {{ default_soc }}\n {% endif %}\n\n{# --- Local battery charging period\
|
||
\ → always allow discharge --- #} {% elif is_state('binary_sensor.solax_local_battery_charging_period','on')\
|
||
\ %}\n {{ default_soc }}\n\n{# --- Daytime Charging→Disconnected transition\
|
||
\ → allow discharge --- #} {% elif trigger.id == 'Charging to Disconnected'\n\
|
||
\ and now() > today_at(\"05:30\") and now() < today_at(\"23:30\") %}\n\
|
||
\ {{ default_soc }}\n\n{# --- NEW: Daytime dispatch, Smart Charge OFF → force\
|
||
\ default discharge --- #} {% elif dispatch_on and not smart_charge\n \
|
||
\ and now() > today_at(\"05:30\") and now() < today_at(\"23:30\") %}\n {{\
|
||
\ default_soc }}\n\n{# --- Normal conditions --- #} {% else %}\n {% if ev_charging\
|
||
\ %}\n {% if prevent_ev_drain or use_grid %}\n {{ current_soc }}\n\
|
||
\ {% else %}\n {{ default_soc }}\n {% endif %}\n {% else %}\n\
|
||
\ {% if dispatch_on and prevent_ev_drain and use_grid %}\n {{ current_soc\
|
||
\ }}\n {% else %}\n {{ default_soc }}\n {% endif %}\n {% endif\
|
||
\ %}\n{% endif %}\n"
|
||
- action: input_boolean.turn_on
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.solax_automation_running
|
||
enabled: true
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
selfuse_battery_min_soc: '{{min_soc}}'
|
||
feedin_battery_min_soc: '{{min_soc}}'
|
||
- choose:
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: Charging
|
||
- condition: state
|
||
entity_id: select.zappi_charge_mode
|
||
state: Eco+
|
||
- condition: trigger
|
||
id:
|
||
- Charging0
|
||
- Charging1
|
||
- Charging2
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: EV started charging @ {{now().strftime('%H:%M')}}.
|
||
title: EV Charging Started
|
||
class: normal
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Paused EV Charging
|
||
sequence:
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: EV paused charging @ {{now().strftime('%H:%M')}}. Zappi charge
|
||
session {{states('sensor.zappi_charge_added_session')}}kWh.
|
||
title: Octopus Paused Charging.
|
||
class: normal
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Disconnected To Connected
|
||
- Time to Start Charging
|
||
- Allow Octopus to Determine Schedule
|
||
- Solax Discharge Prior to EV
|
||
- finish discharge
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: EV Connected
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'off'
|
||
enabled: false
|
||
- condition: template
|
||
value_template: '{{ states(''sensor.solax_local_inverter_mode'') != ''Manual''
|
||
}}'
|
||
sequence:
|
||
- if:
|
||
- condition: state
|
||
entity_id: input_boolean.zappi_eco_always
|
||
state: 'on'
|
||
then:
|
||
- action: select.select_option
|
||
data:
|
||
option: Eco+
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
else:
|
||
- action: select.select_option
|
||
data:
|
||
option: Stopped
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
- choose:
|
||
- conditions:
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: binary_sensor.solax_battery_export_before_ev_charge_allowed
|
||
state: 'off'
|
||
- condition: template
|
||
value_template: '{{ trigger.id == "Solax Discharge Prior to EV" and
|
||
now()|as_timestamp >= states(''sensor.ev_start_time'')|as_timestamp
|
||
}}
|
||
|
||
'
|
||
sequence:
|
||
- if:
|
||
- condition: or
|
||
conditions:
|
||
- condition: time
|
||
after: sensor.ev_start_time
|
||
before: sensor.octopus_intelligent_target_time
|
||
then:
|
||
- metadata: {}
|
||
data:
|
||
option: Eco+
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
action: select.select_option
|
||
- action: script.safe_switch_toggle
|
||
metadata: {}
|
||
data:
|
||
target_switch: switch.octopus_intelligent_smart_charge
|
||
desired_state: 'on'
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- if:
|
||
- condition: not
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Time to Start Charging
|
||
then:
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: EV Connected @ {{(states('sensor.zappi_last_connected')|as_datetime|as_local).strftime("%H:%M")}}.Getting
|
||
shedule at {%if now()|as_timestamp > states('sensor.ev_start_time')|as_timestamp%}
|
||
{{now().strftime('%H:%M')}} {% else %} {{(states('sensor.ev_start_time')|as_datetime).strftime('%H:%M')}}.
|
||
{% endif %}
|
||
title: EV Connected - Waiting for Octopus schedule
|
||
class: normal
|
||
enabled: true
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: binary_sensor.solax_battery_export_before_ev_charge_allowed
|
||
state: 'on'
|
||
sequence:
|
||
- if:
|
||
- condition: or
|
||
conditions:
|
||
- condition: template
|
||
value_template: '{{now()|as_timestamp>=([states(''sensor.ev_start_time''),states(''sensor.pre_export_battery_before_charging_ev_time'')]|min)|as_timestamp
|
||
and now()|as_timestamp <=states(''sensor.octopus_intelligent_target_time'')|as_timestamp}}'
|
||
then:
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: discharge before EV charge
|
||
enabled: true
|
||
- if:
|
||
- condition: numeric_state
|
||
entity_id: sensor.solax_local_battery_soc
|
||
above: input_number.solax_discharge_limit_soc_before_ev
|
||
value_template: '{{ state.state | float(0) - 9 }}'
|
||
then:
|
||
- action: select.select_option
|
||
metadata: {}
|
||
data:
|
||
option: Stopped
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: 3
|
||
manual_mode: 2
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Solax discharging to {{states(''input_number.solax_discharge_limit_soc_before_ev'')|int}}%
|
||
before charging EV. EV Connected @ {{(states(''sensor.zappi_last_connected'')|as_datetime|as_local).strftime("%H:%M")}}. '
|
||
title: Pre Discharge
|
||
class: normal
|
||
enabled: true
|
||
else:
|
||
- if:
|
||
- condition: template
|
||
value_template: ' {{now()|as_timestamp >= states(''sensor.ev_start_time'')|as_timestamp}}'
|
||
then:
|
||
- wait_template: '{{states(''binary_sensor.solax_discharge_before_ev_charge'')==true}}'
|
||
continue_on_timeout: true
|
||
timeout: '5'
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: do nothing
|
||
enabled: true
|
||
- wait_template: '{{states(''binary_sensor.solax_discharge_before_ev_charge'')==false}}'
|
||
continue_on_timeout: true
|
||
timeout: '5'
|
||
- if:
|
||
- condition: state
|
||
entity_id: binary_sensor.solax_discharge_before_ev_charge
|
||
state: 'off'
|
||
for:
|
||
hours: 0
|
||
minutes: 5
|
||
seconds: 0
|
||
then:
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'EV Connected @ {{(states(''sensor.zappi_last_connected'')|as_datetime|as_local).strftime("%H:%M")}}.
|
||
Solax Battery will attempt to discharge at {%if now()|as_timestamp<=([states(''sensor.ev_start_time''),states(''sensor.pre_export_battery_before_charging_ev_time'')]|min)|as_timestamp
|
||
-%}{{(([states(''sensor.ev_start_time''),states(''sensor.pre_export_battery_before_charging_ev_time'')]|min)|as_datetime|as_local).strftime("%H:%M")}}{%-else
|
||
%} {{now().strftime(''%H:%M'')}}{%-endif %} prior to getting a schedule
|
||
from octopus. '
|
||
title: EV Connected - Waiting for Solax to Discharge Before Getting
|
||
Octopus Schedule
|
||
class: normal
|
||
enabled: true
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Connected to Disconnected
|
||
- Charging to Disconnected
|
||
sequence:
|
||
- if:
|
||
- condition: state
|
||
entity_id: input_boolean.zappi_eco_always
|
||
state: 'on'
|
||
then:
|
||
- action: select.select_option
|
||
metadata: {}
|
||
data:
|
||
option: Eco+
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
else:
|
||
- action: select.select_option
|
||
metadata: {}
|
||
data:
|
||
option: Stopped
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
- metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: switch.octopus_intelligent_smart_charge
|
||
action: switch.turn_off
|
||
enabled: false
|
||
- action: script.safe_switch_toggle
|
||
metadata: {}
|
||
data:
|
||
target_switch: switch.octopus_intelligent_smart_charge
|
||
desired_state: 'off'
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: EV disconnected @ {{now().strftime('%H:%M')}}
|
||
title: EV Disconnected
|
||
class: normal
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Zappi Fault
|
||
sequence:
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: ZAPPI FAULT @ {{now().strftime('%H:%M')}}. Go outside and follow
|
||
instructions on charger
|
||
title: ZAPPI FAULT
|
||
class: high
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Fast
|
||
sequence:
|
||
- metadata: {}
|
||
data:
|
||
option: Stopped
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
action: select.select_option
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: EV started BOOST charging @ {{now().strftime('%H:%M')}}. Rate =
|
||
{{states('select.daily_grid_import')}}
|
||
title: EV FAST Charging Started
|
||
class: normal
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- ForceDischarge
|
||
- condition: template
|
||
value_template: '{{(state_attr(''sensor.solax_local_settings'', ''Data'')[10]
|
||
!= 3)}}'
|
||
sequence:
|
||
- if:
|
||
- condition: numeric_state
|
||
entity_id: sensor.solax_local_battery_soc
|
||
above: input_number.solax_manual_forced_discharge_limit_soc
|
||
value_template: '{{ state.state | float(0) - 9 }}'
|
||
then:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: 3
|
||
manual_mode: 2
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: Manual Discharge @ {{now().strftime('%H:%M')}}
|
||
title: Manual Discharge Started
|
||
class: normal
|
||
enabled: true
|
||
- action: input_boolean.turn_on
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.export_battery_manual
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- StopForceDischarge
|
||
- condition: template
|
||
value_template: '{{(state_attr(''sensor.solax_local_settings'', ''Data'')[10]
|
||
== 3)}}'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: Manual Discharge Stopped @ {{now().strftime('%H:%M')}}
|
||
title: Manual Discharge Stopped
|
||
class: normal
|
||
enabled: true
|
||
- if:
|
||
- condition: state
|
||
entity_id: binary_sensor.solax_discharge_before_ev_charge
|
||
state: 'on'
|
||
then:
|
||
- delay:
|
||
hours: 0
|
||
minutes: 1
|
||
seconds: 0
|
||
milliseconds: 0
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: do nothing
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.export_battery_manual
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Discharge_battery_at_2330
|
||
- Solax Discharge Prior to 2330 START
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: EV Disconnected
|
||
- condition: and
|
||
conditions:
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: EV Connected
|
||
for:
|
||
hours: 0
|
||
minutes: 10
|
||
seconds: 0
|
||
- condition: template
|
||
value_template: '{%if states(''input_boolean.octopus_schedule_anytime'')
|
||
== on %}
|
||
|
||
{{(now()|as_timestamp-states(''sensor.zappi_last_connected'')|as_timestamp)|abs
|
||
> 15*60 and states(''select.zappi_charge_mode'') not in [''Eco'',''Eco+'',''Fast'']}}
|
||
|
||
{%else%}
|
||
|
||
{{(now()|as_timestamp-states(''sensor.pre_export_battery_before_charging_ev_time'')|as_timestamp)|abs
|
||
> 15*60}}
|
||
|
||
{%endif%}'
|
||
sequence:
|
||
- if:
|
||
- condition: state
|
||
entity_id: input_boolean.export_battery
|
||
state: 'on'
|
||
- condition: numeric_state
|
||
entity_id: sensor.solax_local_battery_soc
|
||
value_template: '{{ state.state | float(0) - 9 }}'
|
||
above: input_number.solax_nightly_discharge_limit_soc
|
||
- condition: template
|
||
value_template: '{{(state_attr(''sensor.solax_local_settings'', ''Data'')[10]
|
||
!= 3)}}'
|
||
then:
|
||
- choose:
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.pre_emptive_export_battery
|
||
state: 'off'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: 3
|
||
manual_mode: 2
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: discharge nightly
|
||
enabled: true
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Attempting Discharge @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Battery Export Started
|
||
class: normal
|
||
enabled: true
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.pre_emptive_export_battery
|
||
state: 'on'
|
||
sequence:
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: discharge before 2330
|
||
enabled: true
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: 3
|
||
manual_mode: 2
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Attempting Discharge @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Battery Export Started
|
||
class: normal
|
||
enabled: true
|
||
else:
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Cheap Rate @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Cheap Rate
|
||
class: normal
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Peak Rate
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'off'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: Peak Rate @ {{now().strftime('%H:%M')}}
|
||
title: Peak Rate
|
||
class: normal
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Battery at min SoC
|
||
- condition: state
|
||
entity_id: binary_sensor.octopus_intelligent_dispatching
|
||
state: 'off'
|
||
sequence:
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: Battery close to min SoC {{now().strftime('%H:%M')}}. {{states('sensor.solax_local_battery_soc')}}%
|
||
title: Battery Flat
|
||
class: high
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Dispatch Finished
|
||
- condition: numeric_state
|
||
entity_id: sensor.octopus_total_planned_dispatch
|
||
below: 1
|
||
enabled: false
|
||
sequence:
|
||
- action: switch.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: switch.octopus_intelligent_smart_charge
|
||
enabled: false
|
||
- action: script.safe_switch_toggle
|
||
metadata: {}
|
||
data:
|
||
target_switch: switch.octopus_intelligent_smart_charge
|
||
desired_state: 'off'
|
||
- if:
|
||
- condition: state
|
||
entity_id: input_boolean.zappi_eco_always
|
||
state: 'on'
|
||
then:
|
||
- action: select.select_option
|
||
metadata: {}
|
||
data:
|
||
option: Eco+
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
else:
|
||
- action: select.select_option
|
||
metadata: {}
|
||
data:
|
||
option: Stopped
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Zappi eco mode
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: EV Connected
|
||
sequence:
|
||
- if:
|
||
- condition: state
|
||
entity_id: input_boolean.zappi_eco_always
|
||
state: 'on'
|
||
then:
|
||
- action: select.select_option
|
||
metadata: {}
|
||
data:
|
||
option: Eco+
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
else:
|
||
- action: select.select_option
|
||
metadata: {}
|
||
data:
|
||
option: Stopped
|
||
target:
|
||
entity_id: select.zappi_charge_mode
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: sensor.solax_local_inverter_mode
|
||
state: Manual
|
||
for:
|
||
hours: 0
|
||
minutes: 2
|
||
seconds: 0
|
||
- condition: time
|
||
after: '23:30:00'
|
||
before: input_datetime.solax_battery_start_charge_time
|
||
enabled: false
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.export_battery
|
||
state: 'on'
|
||
- condition: state
|
||
entity_id: binary_sensor.solax_discharge_before_ev_charge
|
||
state: 'on'
|
||
- condition: template
|
||
value_template: '{{(states(''sensor.solax_local_manual_mode_behaviour'')
|
||
== "Do Nothing")}}'
|
||
- condition: trigger
|
||
id:
|
||
- Check Discharge Mode
|
||
sequence:
|
||
- if:
|
||
- condition: numeric_state
|
||
entity_id: sensor.solax_local_battery_soc
|
||
value_template: '{{ state.state | float(0) - 9 }}'
|
||
above: input_number.solax_manual_forced_discharge_limit_soc
|
||
then:
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: Manual discharge failure @ {{now().strftime('%H:%M')}}. Setting
|
||
modes issue. Attempting to recover.
|
||
title: Manual Discharge Failure
|
||
class: high
|
||
enabled: true
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: 3
|
||
manual_mode: 2
|
||
else:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Charge Solax
|
||
- condition: template
|
||
value_template: '{{ (state_attr(''sensor.solax_local_settings'', ''Data'')[10]|int
|
||
!= states(''sensor.solax_default_operation_mode'')|int) }}'
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'off'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Charge Period 2 End
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'off'
|
||
- condition: template
|
||
value_template: '{{states(''sensor.solax_local_battery_chd2_enabled'')|bool==true}}'
|
||
sequence:
|
||
- data:
|
||
enabled: '{{ 0 }}
|
||
|
||
'
|
||
action: rest_command.solax_local_set_period2_enable
|
||
- delay:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: '{{refresh_settings_delay}}'
|
||
milliseconds: 0
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Daily Export
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: EV Disconnected
|
||
- condition: and
|
||
conditions:
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: EV Connected
|
||
for:
|
||
hours: 0
|
||
minutes: 10
|
||
seconds: 0
|
||
- condition: state
|
||
entity_id: input_boolean.export_battery_daily
|
||
state: 'on'
|
||
- condition: state
|
||
entity_id: binary_sensor.free_electricity_today
|
||
state: 'off'
|
||
sequence:
|
||
- if:
|
||
- condition: numeric_state
|
||
entity_id: sensor.solax_local_battery_soc
|
||
value_template: '{{ state.state | float(0) - 5 }}'
|
||
above: input_number.solax_manual_forced_discharge_limit_soc
|
||
- condition: template
|
||
value_template: '{{(state_attr(''sensor.solax_local_settings'', ''Data'')[10]
|
||
!= 3)}}'
|
||
then:
|
||
- choose:
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.export_battery_daily
|
||
state: 'on'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: 3
|
||
manual_mode: 2
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: discharge daily
|
||
enabled: true
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Attempting Discharge @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Battery Export Started
|
||
class: normal
|
||
enabled: true
|
||
enabled: true
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.solax_automation_running
|
||
enabled: true
|
||
trace:
|
||
stored_traces: 20
|
||
mode: queued
|
||
max: 4
|
||
- id: '5002'
|
||
alias: 5002 - Solax Reset Mode After Manual Discharge
|
||
description: "# 5002 - Solax Reset Mode After Manual Discharge\nAfter a force/regular\
|
||
\ discharge set the mode back to default mode when the SoC threshold is met. In\
|
||
\ a free Electric discharge, feed in priority is used to prevent the battery filling\
|
||
\ if it's sunny. After free electric session is done default mode is returned.\
|
||
\ \n\n# Initial installation instructions\n1. This is 5002 only. You also need\
|
||
\ 5001 5003 5004 and 5005. \n2. Copy and Paste into your automations.yaml\n\n\
|
||
# Change log\nv5.4.1 Added missing catch for manual discharge\nv5.4.0 Added daily\
|
||
\ discharge and consistent trigger behaviours\nv3.6 variable for loops\nv3.6 Stop\
|
||
\ discharge at time required for car to charge\nv3.3 Added condition to check\
|
||
\ if saving session is in progress\nv3.3 Added a validity check on which SoC\
|
||
\ is highest for the discharge before ev charge as it is critical that an event\
|
||
\ is triggered in this option to initialise EV charging.\nv3.2 Add a condition\
|
||
\ to check if export prior and manual export button press.\nv3.0.0 Set an event\
|
||
\ to trigger EV charging if binary_sensor.\nSolax Discharge Before EV Charge is\
|
||
\ on to off\nv2.1.4 Renamed automation\nv2.1.0 - Changes to limits to catch the\
|
||
\ battery closer to the required threshold set by user\nv2.0.0 -productionisation\n"
|
||
triggers:
|
||
- trigger: template
|
||
value_template: "{%set highestSoC = states('sensor.solax_local_feed_in_battery_min_soc')|int\
|
||
\ (default=15),\n states('sensor.solax_local_selfuse_battery_min_soc')|int\
|
||
\ (default=15),\n states('input_number.solax_discharge_limit_soc_before_ev')|int\
|
||
\ (default =20)\n%}\n{{ states('sensor.solax_local_battery_soc')|int (default=100)\
|
||
\ < highestSoC|max|int+1 and states('binary_sensor.solax_discharge_before_ev_charge')\
|
||
\ == 'on'}}\n"
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 0
|
||
id: EV Stop Discharge Prior
|
||
- trigger: time
|
||
at: sensor.ev_start_time
|
||
id: EV Stop Discharge Prior time trigger
|
||
enabled: true
|
||
- trigger: template
|
||
value_template: "{%set highestSoC = states('sensor.solax_local_feed_in_battery_min_soc')|int\
|
||
\ (default=15),\n states('sensor.solax_local_selfuse_battery_min_soc')|int\
|
||
\ (default=15),\n states('input_number.solax_daily_discharge_limit_soc')|int\
|
||
\ (default =20)\n%}\n{{ states('sensor.solax_local_battery_soc')|int (default=100)\
|
||
\ < highestSoC|max|int+1 and states('binary_sensor.solax_discharge_daily') ==\
|
||
\ 'on'}}\n"
|
||
id: Daily Stop Discharge
|
||
- trigger: template
|
||
value_template: "{%set highestSoC = states('sensor.solax_local_feed_in_battery_min_soc')|int\
|
||
\ (default=15),\n states('sensor.solax_local_selfuse_battery_min_soc')|int\
|
||
\ (default=15),\n states('input_number.solax_nightly_discharge_limit_soc')|int\
|
||
\ (default =20)\n%}\n{{ states('sensor.solax_local_battery_soc')|int (default=100)\
|
||
\ < highestSoC|max|int+1 and states('binary_sensor.solax_discharge_nightly')\
|
||
\ == 'on'}}\n"
|
||
id: Nightly Stop Discharge
|
||
- trigger: template
|
||
value_template: "{%set highestSoC = states('sensor.solax_local_feed_in_battery_min_soc')|int\
|
||
\ (default=15),\n states('sensor.solax_local_selfuse_battery_min_soc')|int\
|
||
\ (default=15),\n states('input_number.solax_nightly_discharge_limit_soc')|int\
|
||
\ (default =20)\n%}\n{{ states('sensor.solax_local_battery_soc')|int (default=100)\
|
||
\ < highestSoC|max|int+1 and states('binary_sensor.solax_discharge_before_2330')\
|
||
\ == 'on'}}\n"
|
||
id: Nightly Stop Discharge
|
||
- trigger: template
|
||
value_template: "{%set highestSoC = states('sensor.solax_local_feed_in_battery_min_soc')|int\
|
||
\ (default=15),\n states('sensor.solax_local_selfuse_battery_min_soc')|int\
|
||
\ (default=15),\n states('input_number.solax_manual_forced_discharge_limit_soc')|int\
|
||
\ (default =20)\n%}\n{{ states('sensor.solax_local_battery_soc')|int (default=100)\
|
||
\ < highestSoC|max|int+1 and states('binary_sensor.solax_discharge_manual')\
|
||
\ == 'on'}}\n"
|
||
id: Manual Stop Discharge
|
||
- trigger: template
|
||
value_template: "{%set highestSoC = states('sensor.solax_local_feed_in_battery_min_soc')|int\
|
||
\ (default=15),\n states('sensor.solax_local_selfuse_battery_min_soc')|int\
|
||
\ (default=15),\n states('input_number.octopus_free_session_battery_prep_soc')|int\
|
||
\ (default =20)\n%}\n{{ states('sensor.solax_local_battery_soc')|int (default=100)\
|
||
\ < highestSoC|max|int+1 }}\n"
|
||
id: FreeElectric
|
||
- entity_id:
|
||
- sensor.solax_local_battery_soc
|
||
below: input_number.octopus_saving_session_target_battery_soc
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 0
|
||
id: Saving Session Stop Discharge
|
||
trigger: numeric_state
|
||
value_template: '{{ state.state | float(0) - 1 }}'
|
||
conditions:
|
||
- condition: template
|
||
value_template: '{{ (states(''sensor.solax_local_inverter_mode'') == ''Manual'')|bool==true}}'
|
||
actions:
|
||
- action: input_boolean.turn_on
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.solax_automation_running
|
||
- variables:
|
||
default_mode: '{{states(''sensor.solax_default_operation_mode'')|int(default=0)}}'
|
||
mode_delay: 30
|
||
settings_delay: 5
|
||
refresh_settings_delay: 5
|
||
loops: 5
|
||
- choose:
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- EV Stop Discharge Prior
|
||
- EV Stop Discharge Prior time trigger
|
||
- condition: state
|
||
entity_id: input_boolean.export_battery_prior
|
||
state: 'on'
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'off'
|
||
enabled: false
|
||
- condition: state
|
||
entity_id: sensor.zappi_plug_status
|
||
state: EV Connected
|
||
sequence:
|
||
- condition: not
|
||
conditions:
|
||
- condition: template
|
||
value_template: '{{(trigger.id == ''EV Stop Discharge Prior time trigger''
|
||
and states(''sensor.ev_start_time'')|as_timestamp == today_at(''23:30'')|as_timestamp)
|
||
or
|
||
|
||
(trigger.id == ''EV Stop Discharge Prior time trigger'' and states(''input_boolean.priorise_export_over_ev'')==''on'')
|
||
|
||
}}'
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Discharge finished @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Battery Export Finished
|
||
class: normal
|
||
enabled: true
|
||
- delay:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 30
|
||
milliseconds: 0
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: do nothing
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Daily Stop Discharge
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'off'
|
||
enabled: false
|
||
- condition: or
|
||
conditions:
|
||
- condition: time
|
||
before: input_datetime.solax_battery_start_charge_time
|
||
enabled: true
|
||
- condition: state
|
||
entity_id: input_boolean.export_battery_daily
|
||
state: 'on'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Daily Discharge finished @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Battery Export Finished
|
||
class: normal
|
||
enabled: true
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: do nothing
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Nightly Stop Discharge
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'off'
|
||
enabled: false
|
||
- condition: or
|
||
conditions:
|
||
- condition: time
|
||
after: '23:30:00'
|
||
before: input_datetime.solax_battery_start_charge_time
|
||
enabled: true
|
||
- condition: state
|
||
entity_id: binary_sensor.solax_discharge_before_ev_charge
|
||
state: 'off'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Nightly Discharge finished @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Battery Export Finished
|
||
class: normal
|
||
enabled: true
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: do nothing
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Manual Stop Discharge
|
||
- condition: state
|
||
entity_id: input_boolean.saving_session_active
|
||
state: 'off'
|
||
enabled: false
|
||
- condition: or
|
||
conditions:
|
||
- condition: time
|
||
before: input_datetime.solax_battery_start_charge_time
|
||
enabled: true
|
||
- condition: state
|
||
entity_id: input_boolean.export_battery_manual
|
||
state: 'on'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Manual Discharge finished @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Battery Export Finished
|
||
class: normal
|
||
enabled: true
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.export_battery_manual
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: do nothing
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- FreeElectric
|
||
- condition: state
|
||
entity_id: binary_sensor.octopus_intelligent_dispatching
|
||
state: 'off'
|
||
- condition: state
|
||
entity_id: binary_sensor.free_electricity_today
|
||
state: 'on'
|
||
- condition: time
|
||
after: input_datetime.octopus_free_electricity_prep
|
||
before: '23:00:00'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{1}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Discharge finished @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Free Electric Battery Export Prep
|
||
class: normal
|
||
enabled: true
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: do nothing
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Saving Session Stop Discharge
|
||
- condition: time
|
||
after: 05:30:00
|
||
before: '23:30:00'
|
||
- condition: time
|
||
after: input_datetime.saving_session_start
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.octopus_saving_session_manual
|
||
state: 'on'
|
||
- condition: state
|
||
entity_id: input_select.saving_session_today
|
||
state: 'yes'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{default_mode}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Discharge finished @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Saving Session Battery Exported
|
||
class: normal
|
||
enabled: true
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: do nothing
|
||
enabled: true
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.solax_automation_running
|
||
mode: queued
|
||
trace:
|
||
stored_traces: 20
|
||
max: 4
|
||
- id: '5003'
|
||
alias: 5003 - Solax Set UI Options
|
||
description: "Populate UI with Solax Settings\n\n# AUTOMATION 5003 \n1. This is\
|
||
\ 5003 only. You need 5001 5002 5004 and 5005.\n2. Copy and Paste into your automations.yaml\n\
|
||
\n# Change log\nv3.2 Added Battery Heat Level - 0 to heat only when below freezing,\
|
||
\ 1 to heat when below 10 degrees, 2 to heat when below 20 degrees. see https://solaxpowerservice.zendesk.com/hc/en-001/articles/12334533938191-What-is-the-meaning-of-heating-level-in-my-inverter-settings\n\
|
||
v3.1 Added system on/off\nv2.1.4 Renamed automation\nv2.1.0 \n*Allow queued runs\
|
||
\ so UI looks a bit more seemless when updating the inverter settings\n*Added\
|
||
\ battery warmer controls\nV2.0 Revamp\nv1.0 Initial"
|
||
triggers:
|
||
- entity_id:
|
||
- input_number.solax_feed_in_battery_min_soc
|
||
id: Set Feed in Min SoC
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- entity_id:
|
||
- input_number.solax_selfuse_battery_min_soc
|
||
id: Solax Self Use Min SoC
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- entity_id:
|
||
- input_number.solax_feed_in_charge_to_soc
|
||
id: Set Feed in Charge to SoC
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- entity_id:
|
||
- input_number.solax_selfuse_charge_to_soc
|
||
id: Solax Self Use Charge to SoC
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- entity_id:
|
||
- input_boolean.self_use_enable_charge_from_grid
|
||
id: Set Self Use Charge From Grid
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- entity_id:
|
||
- input_select.solax_manual_modes
|
||
id: Set Manual Mode
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- entity_id:
|
||
- input_select.solax_work_mode
|
||
id: Set Work Mode
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- entity_id:
|
||
- input_boolean.solaxchargeperiod2
|
||
id: Chargeperiod2
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_start_charge_2
|
||
id: Charge Period 2 Start
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_stop_charge_2
|
||
id: Charge Period 2 Stop
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_battery_start_charge_time
|
||
id: Solax Battery Start Charge Time
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_battery_stop_charge_time
|
||
id: Solax Battery Stop Charge Time
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_battery_start_discharge_time
|
||
id: Solax Battery Start Discharge Time
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_battery_stop_discharge_time
|
||
id: Solax Battery Stop Discharge Time
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- entity_id:
|
||
- input_boolean.battery_heat_enable
|
||
id: heat enable
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_battery_start_heat_time
|
||
id: Heat Period Start
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_battery_stop_heat_time
|
||
id: Heat Period Stop
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_start_heat_2
|
||
id: Heat Period Start 2
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_datetime.solax_stop_heat_2
|
||
id: Heat Period Stop 2
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_boolean.solax_system_enable
|
||
id: Solax On Off
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
- trigger: state
|
||
entity_id:
|
||
- input_select.solax_battery_heat_level
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 10
|
||
id: Battery Heat Level
|
||
conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.solax_automation_running
|
||
state: 'off'
|
||
actions:
|
||
- action: input_boolean.turn_on
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.solax_automation_running
|
||
- choose:
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Set Feed in Min SoC
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
feedin_battery_min_soc: '{{states(''input_number.solax_feed_in_battery_min_soc'')}}'
|
||
selfuse_battery_min_soc: '{{states(''input_number.solax_feed_in_battery_min_soc'')}}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax Self Use Min SoC
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
feedin_battery_min_soc: '{{states(''input_number.solax_selfuse_battery_min_soc'')}}'
|
||
selfuse_battery_min_soc: '{{states(''input_number.solax_selfuse_battery_min_soc'')}}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Set Feed in Charge to SoC
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
feedin_charge_battery_from_grid: '{{states(''input_number.solax_feed_in_charge_to_soc'')}}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax Self Use Charge to SoC
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
selfuse_charge_battery_from_grid: '{{states(''input_number.solax_selfuse_charge_to_soc'')}}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Set Self Use Charge From Grid
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
selfuse_charge_from_grid_enable: '{% if states(''input_boolean.self_use_enable_charge_from_grid'')
|
||
== ''on''%}{{1}}{% else%}{{0}}{% endif%}'
|
||
allowed_discharge_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_charge_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
allowed_discharge_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_charge_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Set Manual Mode
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: 3
|
||
manual_mode: '{{state_attr(trigger.entity_id,''options'').index(states(trigger.entity_id))}}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Set Work Mode
|
||
sequence:
|
||
- if:
|
||
- condition: template
|
||
value_template: '{{state_attr(trigger.entity_id,''options'').index(states(trigger.entity_id))==0
|
||
|
||
or
|
||
|
||
state_attr(trigger.entity_id,''options'').index(states(trigger.entity_id))==1
|
||
|
||
or
|
||
|
||
state_attr(trigger.entity_id,''options'').index(states(trigger.entity_id))==3
|
||
|
||
}}'
|
||
then:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{state_attr(trigger.entity_id,''options'').index(states(trigger.entity_id))}}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Chargeperiod2
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
period2_enabled: '{% if states(''input_boolean.solaxchargeperiod2'') ==
|
||
''on''%}{{1}}{% else%}{{0}}{% endif%}'
|
||
forced_charge_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_start_charge_2'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
forced_charge_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_stop_charge_2'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Charge Period 2 Start
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
forced_charge_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_start_charge_2'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Charge Period 2 Stop
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
forced_charge_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_stop_charge_2'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax Battery Start Charge Time
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
forced_charge_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_charge_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax Battery Stop Charge Time
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
forced_charge_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_charge_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax Battery Start Discharge Time
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
allowed_discharge_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_discharge_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax Battery Stop Discharge Time
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
set_allowed_discharge_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_discharge_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- heat enable
|
||
sequence:
|
||
- if:
|
||
- condition: state
|
||
entity_id: input_boolean.battery_heat_enable
|
||
state: 'off'
|
||
then:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
heat_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_heat_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256
|
||
}}'
|
||
heat_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_heat_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
heat_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_start_heat_2'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256
|
||
}}'
|
||
heat_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_stop_heat_2'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }}'
|
||
battery_heat_enable: '{% if states(''input_boolean.battery_heat_enable'')
|
||
== ''on''%}{{1}}{% else%}{{0}}{% endif%}'
|
||
enabled: true
|
||
else:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
heat_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_heat_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256
|
||
}}'
|
||
heat_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_heat_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
heat_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_start_heat_2'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256
|
||
}}'
|
||
heat_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_stop_heat_2'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }}'
|
||
battery_heat_enable: '{% if states(''input_boolean.battery_heat_enable'')
|
||
== ''on''%}{{1}}{% else%}{{0}}{% endif%}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Heat Period Start
|
||
sequence:
|
||
- action: rest_command.solax_local_set_heat_start
|
||
data:
|
||
value: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_start_heat_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }}'
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
heat_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_heat_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
heat_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_heat_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
heat_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_start_heat_2'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
heat_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_stop_heat_2'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }}'
|
||
battery_heat_enable: '{% if states(''input_boolean.battery_heat_enable'')
|
||
== ''on''%}{{1}}{% else%}{{0}}{% endif%}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Heat Period Stop
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
heat_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_heat_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
heat_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_heat_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
heat_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_start_heat_2'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
heat_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_stop_heat_2'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }}'
|
||
battery_heat_enable: '{% if states(''input_boolean.battery_heat_enable'')
|
||
== ''on''%}{{1}}{% else%}{{0}}{% endif%}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Heat Period Start 2
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
heat_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_heat_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
heat_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_heat_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
heat_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_start_heat_2'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
heat_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_stop_heat_2'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }}'
|
||
battery_heat_enable: '{% if states(''input_boolean.battery_heat_enable'')
|
||
== ''on''%}{{1}}{% else%}{{0}}{% endif%}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Heat Period Stop 2
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
heat_start: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_battery_start_heat_time'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
heat_end: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_battery_stop_heat_time'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }} '
|
||
heat_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.solax_start_heat_2'',
|
||
''timestamp'') - 0) %}{{ start_time.hour + start_time.minute * 256 }}'
|
||
heat_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.solax_stop_heat_2'',
|
||
''timestamp'') - 0) %}{{ end_time.hour + end_time.minute * 256 }}'
|
||
battery_heat_enable: '{% if states(''input_boolean.battery_heat_enable'')
|
||
== ''on''%}{{1}}{% else%}{{0}}{% endif%}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Solax On Off
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
system_state: '{% if states(''input_boolean.solax_system_enable'') ==
|
||
''on'' %}{{1}}{% else%}{{0}}{% endif%}'
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Battery Heat Level
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
battery_heat_level: '{{states(''input_select.solax_battery_heat_level'')}}'
|
||
enabled: true
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.solax_automation_running
|
||
trace:
|
||
stored_traces: 20
|
||
mode: queued
|
||
max: 9
|
||
- id: '5004'
|
||
alias: 5004 - Solax Reload Settings
|
||
description: "Populate UI with Solax Settings \n\n# AUTOMATION 5004\n 1. This is\
|
||
\ 5004 only. You also need 5001 5002 5003 and 5005. \n 2. Paste into your automations.yaml\n\
|
||
\n# Change log\nv3.1 Added system on/off\n v2.1.4 Renamed automation\n v2.1 Battery\
|
||
\ Warmer\n v2.0 Revamp\n"
|
||
triggers:
|
||
- trigger: time_pattern
|
||
minutes: /12
|
||
- trigger: state
|
||
entity_id:
|
||
- input_boolean.solax_automation_running
|
||
from: 'on'
|
||
to: 'off'
|
||
enabled: true
|
||
for:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 13
|
||
- entity_id:
|
||
- input_button.refresh
|
||
trigger: state
|
||
conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.solax_automation_running
|
||
state: 'off'
|
||
actions:
|
||
- variables:
|
||
mode_delay: 15
|
||
settings_delay: 10
|
||
refresh_settings_delay: 10
|
||
- action: automation.turn_off
|
||
metadata: {}
|
||
data:
|
||
stop_actions: true
|
||
target:
|
||
entity_id: automation.solax_set_ui_options
|
||
- delay:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 1
|
||
milliseconds: 0
|
||
- action: homeassistant.update_entity
|
||
data:
|
||
entity_id:
|
||
- sensor.solax_rest_local_settings
|
||
- delay:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: '{{refresh_settings_delay}}'
|
||
- metadata: {}
|
||
data:
|
||
option: '{{states(''sensor.solax_local_inverter_mode'')}}'
|
||
target:
|
||
entity_id: input_select.solax_work_mode
|
||
action: input_select.select_option
|
||
- metadata: {}
|
||
data:
|
||
option: '{{states(''sensor.solax_local_manual_mode_behaviour'')}}'
|
||
target:
|
||
entity_id: input_select.solax_manual_modes
|
||
action: input_select.select_option
|
||
- metadata: {}
|
||
data:
|
||
value: '{{states(''sensor.solax_local_feed_in_battery_min_soc'')|int}}'
|
||
target:
|
||
entity_id: input_number.solax_feed_in_battery_min_soc
|
||
action: input_number.set_value
|
||
- metadata: {}
|
||
data:
|
||
value: '{{states(''sensor.solax_local_feed_in_battery_charge_from_grid_to'')|int}}'
|
||
target:
|
||
entity_id: input_number.solax_feed_in_charge_to_soc
|
||
action: input_number.set_value
|
||
- metadata: {}
|
||
data:
|
||
value: '{{states(''sensor.solax_local_selfuse_battery_chrg_frm_grd_to'')|int}}'
|
||
target:
|
||
entity_id: input_number.solax_selfuse_charge_to_soc
|
||
action: input_number.set_value
|
||
enabled: true
|
||
- metadata: {}
|
||
data:
|
||
value: '{{states(''sensor.solax_local_selfuse_battery_min_soc'')|int}}'
|
||
target:
|
||
entity_id: input_number.solax_selfuse_battery_min_soc
|
||
action: input_number.set_value
|
||
enabled: true
|
||
- if:
|
||
- condition: template
|
||
value_template: '{{states(''sensor.solax_local_battery_chd2_enabled'')|bool==true}}'
|
||
then:
|
||
- action: input_boolean.turn_on
|
||
target:
|
||
entity_id: input_boolean.solaxchargeperiod2
|
||
data: {}
|
||
- if:
|
||
- condition: template
|
||
value_template: '{{states(''sensor.solax_local_battery_chd2_enabled'')|bool==false}}'
|
||
then:
|
||
- action: input_boolean.turn_off
|
||
target:
|
||
entity_id:
|
||
- input_boolean.solaxchargeperiod2
|
||
data: {}
|
||
- if:
|
||
- condition: state
|
||
entity_id: sensor.solax_local_self_use_battery_charge_from_grid
|
||
state: '1'
|
||
then:
|
||
- action: input_boolean.turn_on
|
||
target:
|
||
entity_id: input_boolean.self_use_enable_charge_from_grid
|
||
data: {}
|
||
- if:
|
||
- condition: state
|
||
entity_id: sensor.solax_local_self_use_battery_charge_from_grid
|
||
state: '0'
|
||
then:
|
||
- action: input_boolean.turn_off
|
||
target:
|
||
entity_id:
|
||
- input_boolean.self_use_enable_charge_from_grid
|
||
data: {}
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_setting_start_charge'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_battery_start_charge_time
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_setting_stop_charge'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_battery_stop_charge_time
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_setting_start_discharge'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_battery_start_discharge_time
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_setting_stop_discharge'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_battery_stop_discharge_time
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_setting_start_charge_2'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_start_charge_2
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_setting_stop_charge_2'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_stop_charge_2
|
||
- if:
|
||
- condition: state
|
||
entity_id: sensor.solax_local_battery_heat_enabled
|
||
state: 'True'
|
||
then:
|
||
- action: input_boolean.turn_on
|
||
target:
|
||
entity_id: input_boolean.battery_heat_enable
|
||
data: {}
|
||
else:
|
||
- action: input_boolean.turn_off
|
||
target:
|
||
entity_id:
|
||
- input_boolean.battery_heat_enable
|
||
data: {}
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_heat_start'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_battery_start_heat_time
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_heat_stop'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_battery_stop_heat_time
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_heat_start_2'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_start_heat_2
|
||
- action: input_datetime.set_datetime
|
||
metadata: {}
|
||
data:
|
||
time: '{{states(''sensor.solax_local_battery_heat_stop_2'')}}'
|
||
target:
|
||
entity_id: input_datetime.solax_stop_heat_2
|
||
- if:
|
||
- condition: state
|
||
entity_id: sensor.solax_local_system_state
|
||
state: 'True'
|
||
then:
|
||
- action: input_boolean.turn_on
|
||
target:
|
||
entity_id:
|
||
- input_boolean.solax_system_enable
|
||
data: {}
|
||
- if:
|
||
- condition: state
|
||
entity_id: sensor.solax_local_system_state
|
||
state: 'False'
|
||
then:
|
||
- action: input_boolean.turn_off
|
||
target:
|
||
entity_id:
|
||
- input_boolean.solax_system_enable
|
||
data: {}
|
||
- metadata: {}
|
||
data:
|
||
option: '{{states(''sensor.solax_local_battery_heat_level'')}}'
|
||
target:
|
||
entity_id: input_select.solax_battery_heat_level
|
||
action: input_select.select_option
|
||
- delay:
|
||
hours: 0
|
||
minutes: 0
|
||
seconds: 1
|
||
milliseconds: 0
|
||
- action: automation.turn_on
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: automation.solax_set_ui_options
|
||
trace:
|
||
stored_traces: 20
|
||
mode: single
|
||
- id: '5005'
|
||
alias: 5005 - Solax Zappi Octopus Control - Notifier
|
||
description: '# 5005 - Solax Zappi Octopus Control - Notifier
|
||
|
||
Allows for notification of activity such as EV Connected, EV charging started,
|
||
amount Octopus will dispatch, Solax battery forced discharge events etc
|
||
|
||
|
||
# Initial installation instructions
|
||
|
||
1. Copy to your automations.yaml and reload yaml from developer tools
|
||
|
||
|
||
# Change Log
|
||
|
||
v4.0 Added logging
|
||
|
||
v3.1 Better notification management
|
||
|
||
v2.2 Added Alert Exclusions
|
||
|
||
v2.1.4 Renamed automation
|
||
|
||
v2.1.3 Simplications
|
||
|
||
v2.0 Initial production release
|
||
|
||
v1.0 Initial'
|
||
triggers:
|
||
- trigger: event
|
||
event_type: Solax Zappi Octopus Control
|
||
event_data:
|
||
class: normal
|
||
id: Normal
|
||
- trigger: event
|
||
event_type: Solax Zappi Octopus Control
|
||
event_data:
|
||
class: high
|
||
id: High
|
||
- trigger: event
|
||
event_type: Solax Control
|
||
event_data:
|
||
class: normal
|
||
id: Normal
|
||
- trigger: event
|
||
event_type: Solax Control
|
||
event_data:
|
||
class: high
|
||
id: High
|
||
conditions: []
|
||
actions:
|
||
- action: logbook.log
|
||
data:
|
||
name: Solax Zappi Octopus
|
||
message: 'Event ({{ trigger.event.data.class }}): {{ trigger.event.data.title
|
||
}}
|
||
|
||
'
|
||
- choose:
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- High
|
||
- condition: or
|
||
conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.solax_zappi_octopus_control_notifications
|
||
state: 'off'
|
||
- condition: state
|
||
entity_id: input_boolean.nofify_mobile
|
||
state: 'off'
|
||
sequence:
|
||
- action: persistent_notification.create
|
||
data:
|
||
title: '{{trigger.event.data.title}}'
|
||
message: '{{trigger.event.data.message}}'
|
||
- if:
|
||
- condition: template
|
||
value_template: '{{states(''input_text.mobile_device_selected'') != ''None
|
||
Selected''}}'
|
||
then:
|
||
- repeat:
|
||
for_each: '{{state_attr(''sensor.solax_zappi_octopus_devices_to_notify'',
|
||
''mobile_devices'') | map(attribute=''device'') | reject(''match'',"
|
||
")|list}}
|
||
|
||
'
|
||
sequence:
|
||
- action: notify.{{repeat.item}}
|
||
metadata: {}
|
||
data:
|
||
title: '{{trigger.event.data.title}}'
|
||
message: '{{trigger.event.data.message}}'
|
||
- conditions:
|
||
- condition: or
|
||
conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Normal
|
||
- condition: trigger
|
||
id:
|
||
- High
|
||
- condition: state
|
||
entity_id: input_boolean.solax_zappi_octopus_control_notifications
|
||
state: 'on'
|
||
sequence:
|
||
- if:
|
||
- condition: template
|
||
value_template: '{{trigger.event.data.title not in state_attr(''sensor.solax_zappi_octopus_notification_to_exclude'',''notification_list'')
|
||
| map(attribute=''notification'') | list}}'
|
||
then:
|
||
- action: persistent_notification.create
|
||
data:
|
||
title: '{{trigger.event.data.title}}'
|
||
message: '{{trigger.event.data.message}}'
|
||
- if:
|
||
- condition: template
|
||
value_template: '{{states(''input_text.mobile_device_selected'') != ''None
|
||
Selected''}}'
|
||
then:
|
||
- repeat:
|
||
for_each: '{{state_attr(''sensor.solax_zappi_octopus_devices_to_notify'',
|
||
''mobile_devices'') | map(attribute=''device'') | reject(''match'',"
|
||
")|list}}
|
||
|
||
'
|
||
sequence:
|
||
- action: notify.{{repeat.item}}
|
||
metadata: {}
|
||
data:
|
||
title: '{{trigger.event.data.title}}'
|
||
message: '{{trigger.event.data.message}}'
|
||
mode: queued
|
||
max: 10
|
||
- id: '6001'
|
||
alias: 6001 - Octopus - Free Electric Automation
|
||
description: "# 6001 - Automation to get the most from Octopus Free Electric Sessions\n\
|
||
\n# Initial config instructions\n1. Paste into your automations.yaml\n\n# Change\
|
||
\ log\nv5.4.0 Tidy\nv5.3.0 Introducing safe switching of octopus_intelligent_smart_charge\n\
|
||
v5.1.1 Fixed bug in Free Electric notification where end time was announced as\
|
||
\ start time\nv2.1.4 Renamed automation\nv2.1 - Removed legacy dev work and fix\
|
||
\ bug with charge period 2\nv2.0 - Productionise\nv1.1 - Initial\n\n\n# Overview\n\
|
||
Octopus offer free electric sessions in the summer.\nThis automation allows you\
|
||
\ to automatically charge the solax battery and also sets the zappi to fast mode.\
|
||
\ \nTo prepare for the free electricity, options are provided to export the house\
|
||
\ battery to benefit from export rates and to give headroom to charge from the\
|
||
\ grid for free in the session. You can set a time and export threshold. However\
|
||
\ beware that on a sunny day you may already be at the inverters limit so won't\
|
||
\ be able to discharge the battery so you have to balance the time at which you\
|
||
\ discharge and the battery SoC level for which you need to last the day before\
|
||
\ the free session. To prevent the battery filling the inverter mode is set to\
|
||
\ feed in priority and will return to your default mode after the free electric\
|
||
\ session. If export rates become unfavourable you can use the target battery\
|
||
\ SoC as the charge to if you allow charging from grid overnight."
|
||
triggers:
|
||
- at: sensor.octopus_free_electricity_start
|
||
id: start
|
||
trigger: time
|
||
enabled: true
|
||
- at: sensor.octopus_free_electricity_stop
|
||
id: stop
|
||
trigger: time
|
||
enabled: true
|
||
- entity_id:
|
||
- binary_sensor.free_electricity_today
|
||
to: 'on'
|
||
id: Prepare
|
||
trigger: state
|
||
for:
|
||
hours: 0
|
||
minutes: 2
|
||
seconds: 0
|
||
enabled: true
|
||
- at: input_datetime.octopus_free_electricity_prep
|
||
id: ExportBatteryPrep
|
||
trigger: time
|
||
- trigger: state
|
||
entity_id:
|
||
- binary_sensor.upcoming_free_electricity
|
||
to: 'on'
|
||
for:
|
||
hours: 0
|
||
minutes: 2
|
||
seconds: 0
|
||
id: Octopus New Free Electric
|
||
conditions:
|
||
- condition: state
|
||
entity_id: input_boolean.solax_automation_running
|
||
state: 'off'
|
||
enabled: false
|
||
actions:
|
||
- action: input_boolean.turn_on
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.solax_automation_running
|
||
- variables:
|
||
default_mode: '{{states(''sensor.solax_default_operation_mode'')|int}}'
|
||
default_charge_to: '{{states(''input_number.solax_default_charge_to_limit_soc'')|int}}'
|
||
free_electric_event_entity: event.octopus_energy_z_ZZZZZZZZ_octoplus_free_electricity_session_events
|
||
enabled: true
|
||
- choose:
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Prepare
|
||
- condition: state
|
||
entity_id: binary_sensor.free_electricity_today
|
||
state: 'on'
|
||
sequence:
|
||
- if:
|
||
- condition: state
|
||
entity_id: input_boolean.octopus_free_electric_soc_use
|
||
state: 'on'
|
||
then:
|
||
- condition: not
|
||
conditions:
|
||
- condition: template
|
||
value_template: "{{states('input_number.octopus_free_session_battery_prep_soc')|int==states('sensor.solax_local_feed_in_battery_charge_from_grid_to')|int\
|
||
\ \nand states('input_number.octopus_free_session_battery_prep_soc')|int==states('sensor.solax_local_selfuse_battery_chrg_frm_grd_to')}}"
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
feedin_charge_battery_from_grid: '{{states(''input_number.octopus_free_session_battery_prep_soc'')}}'
|
||
selfuse_charge_battery_from_grid: '{{states(''input_number.octopus_free_session_battery_prep_soc'')}}'
|
||
else:
|
||
- condition: not
|
||
conditions:
|
||
- condition: template
|
||
value_template: '{{default_charge_to == states(''sensor.solax_local_feed_in_battery_charge_from_grid_to'')|int
|
||
and default_charge_to == states(''sensor.solax_local_selfuse_battery_chrg_frm_grd_to'')|int}}'
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
settings:
|
||
feedin_charge_battery_from_grid: '{{default_charge_to}}'
|
||
selfuse_charge_battery_from_grid: '{{default_charge_to}}'
|
||
- condition: not
|
||
conditions:
|
||
- condition: template
|
||
value_template: "{% set start_time =\n as_datetime(state_attr('input_datetime.octopus_free_electricity_start',\n\
|
||
\ 'timestamp') - 60) \n%}\n\n{% set end_time =\n as_datetime(state_attr('input_datetime.octopus_free_electricity_stop',\n\
|
||
\ 'timestamp') - 0) \n%}\n\n\n{{ (state_attr('sensor.solax_local_settings',\
|
||
\ 'Data')[10] == 1\nand state_attr('sensor.solax_local_settings', 'Data')[7]\
|
||
\ == 1 \nand state_attr('sensor.solax_local_settings', 'Data')[8] == start_time.hour\
|
||
\ + start_time.minute * 256 \nand state_attr('sensor.solax_local_settings',\
|
||
\ 'Data')[9] == end_time.hour + end_time.minute * 256) \n}}"
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{1}}'
|
||
settings:
|
||
period2_enabled: '{{1}}'
|
||
forced_charge_start2: '{% set start_time = as_datetime(state_attr(''input_datetime.octopus_free_electricity_start'',
|
||
''timestamp'') - 0)|as_local %}{{ start_time.hour + start_time.minute
|
||
* 256 }}'
|
||
forced_charge_end2: '{% set end_time = as_datetime(state_attr(''input_datetime.octopus_free_electricity_stop'',
|
||
''timestamp'') - 0)|as_local %}{{ end_time.hour + end_time.minute *
|
||
256 }}'
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- start
|
||
- condition: state
|
||
entity_id: binary_sensor.free_electricity_today
|
||
state: 'on'
|
||
sequence:
|
||
- action: automation.turn_off
|
||
metadata: {}
|
||
data:
|
||
stop_actions: true
|
||
target:
|
||
entity_id: automation.solax_zappi_octopus_control
|
||
- metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id:
|
||
- switch.octopus_intelligent_smart_charge
|
||
action: switch.turn_on
|
||
enabled: false
|
||
- action: script.safe_switch_toggle
|
||
metadata: {}
|
||
data:
|
||
target_switch: switch.octopus_intelligent_smart_charge
|
||
desired_state: 'on'
|
||
- metadata: {}
|
||
data:
|
||
option: Eco+
|
||
target:
|
||
entity_id: select.myenergi_zappi_XXXXXXXX_charge_mode
|
||
action: select.select_option
|
||
enabled: true
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Free electric session started @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Free Electric Started
|
||
class: high
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- stop
|
||
- condition: state
|
||
entity_id: binary_sensor.free_electricity_today
|
||
state: 'on'
|
||
sequence:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{states(''sensor.solax_default_operation_mode'')|int}}'
|
||
settings:
|
||
period2_enabled: '{{0}}'
|
||
selfuse_charge_battery_from_grid: '{{states(''input_number.solax_default_charge_to_limit_soc'')|int}}'
|
||
feedin_charge_battery_from_grid: '{{states(''input_number.solax_default_charge_to_limit_soc'')|int}}'
|
||
feedin_battery_min_soc: '{{states(''input_number.solax_default_discharge_limit_soc'')|int}}'
|
||
selfuse_battery_min_soc: '{{states(''input_number.solax_default_discharge_limit_soc'')|int}}'
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: 'Free electric session finished @ {{now().strftime(''%H:%M'')}}. '
|
||
title: Free Electric Finished
|
||
class: high
|
||
enabled: true
|
||
- action: script.safe_switch_toggle
|
||
metadata: {}
|
||
data:
|
||
target_switch: switch.octopus_intelligent_smart_charge
|
||
desired_state: 'off'
|
||
- metadata: {}
|
||
data:
|
||
option: Stopped
|
||
target:
|
||
entity_id: select.myenergi_zappi_XXXXXXXX_charge_mode
|
||
action: select.select_option
|
||
enabled: true
|
||
- action: automation.turn_on
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: automation.solax_zappi_octopus_control
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- ExportBatteryPrep
|
||
- condition: numeric_state
|
||
entity_id: sensor.solax_local_battery_soc
|
||
above: input_number.octopus_free_session_battery_prep_soc
|
||
value_template: '{{ state.state | float(0) - 14 }}'
|
||
- condition: template
|
||
value_template: '{{(state_attr(''sensor.solax_local_settings'', ''Data'')[10]!=
|
||
3)}}'
|
||
- condition: state
|
||
entity_id: binary_sensor.free_electricity_today
|
||
state: 'on'
|
||
sequence:
|
||
- if:
|
||
- condition: numeric_state
|
||
entity_id: sensor.solax_local_battery_soc
|
||
above: input_number.octopus_free_session_battery_prep_soc
|
||
value_template: '{{ state.state | float(0) - 14 }}'
|
||
then:
|
||
- action: script.solax_set_mode_and_settings
|
||
data:
|
||
mode: '{{3}}'
|
||
manual_mode: '{{2}}'
|
||
- event: solax_discharge
|
||
event_data:
|
||
battery_discharge: Free Electric Prep
|
||
enabled: true
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: Free electric session prep export started @ {{now().strftime('%H:%M')}}.
|
||
Discharging to {{states('input_number.octopus_free_session_battery_prep_soc')}}%
|
||
title: Free Electric Prep
|
||
class: high
|
||
enabled: true
|
||
- conditions:
|
||
- condition: trigger
|
||
id:
|
||
- Octopus New Free Electric
|
||
sequence:
|
||
- if:
|
||
- condition: template
|
||
value_template: '{% set event_start = state_attr(''binary_sensor.upcoming_free_electricity'',''next_session_start'')
|
||
%}
|
||
|
||
{{event_start|as_timestamp>now()|as_timestamp}}'
|
||
then:
|
||
- event: Solax Zappi Octopus Control
|
||
event_data:
|
||
message: '{% set event_start = state_attr(''binary_sensor.upcoming_free_electricity'',''next_session_start'')|as_datetime
|
||
%}It starts at {{event_start.strftime(''%H:%M'') }} on {{ event_start.day
|
||
}}/{{event_start.month }} for {{ state_attr(''binary_sensor.upcoming_free_electricity'',''next_session_duration'') }}
|
||
minutes.
|
||
|
||
'
|
||
title: Octopus Free Electric Session
|
||
class: high
|
||
- action: input_boolean.turn_off
|
||
metadata: {}
|
||
data: {}
|
||
target:
|
||
entity_id: input_boolean.solax_automation_running
|
||
mode: single
|