Page 1 of 1

Savings Session Automation

Posted: Sun Mar 03, 2024 12:44 am
by RyanMorgan
This is a fairly basic automation that operates on a "set and forget" basis.
Hopefully this will help you guys out there who - like me - sometimes forget to turn off the force discharge cycle the next day!

How does it work?

Savings Session Automation 2.jpg

1) Enable the automation (if not on already - you can keep it on permanently if you want - my OCD leads me to turn it off...)
2) Turn on the main On/Off toggle
3) If required, turn on the pre-charge toggle
4) Set the pre-charge start time - this bit is fairly common sense - if you want to pre-charge for 30 mins, set it to 30 mins before the start of the savings session and if you don't want a pre-charge, simply set it for a few mins before the savings session start time
5) Set the savings session start and end time.
6) and relax... the automation will trigger at the pre-charge start time and turn itself off at the savings session end time.

Savings Session Automation 2.jpg

____

Step 1

To begin, you need the Foxess Modbus integration and have at least version v1.10.1 installed.
This version includes the new Force Charge and Force Discharge work modes that I will be using with this automation.

____

Step 2

Next, you'll need 5 basic helpers to support the automation.
1) Main on/off toggle - toggle helper named "Savings Session On/Off"
2) Pre-charge on/off toggle - toggle helper named "Savings Session Pre-charge On/Off"
3) Pre-charge start time - datetime helper (set to time) named "Savings Session Pre-Charge Start"
4) Session start time - datetime helper (set to time) named "Savings Session Start"
5) Session end time - datetime helper (set to time) named "Savings Session End"

Savings Session Automation 2.jpg
____

Step 3

Next, you'll need to create a new automation.

Open a new blank automation, switch to YAML view and then copy and paste the code in the link below into the automation.

After you've copied the code - switch back to visual editor mode - then make sure work mode steps are pointing at your own Foxeess Modbus integration.

Code: Select all

alias: Savings Session Automation
description: ""
trigger:
  - platform: time
    at: input_datetime.savings_session_pre_charge_start
condition:
  - condition: state
    entity_id: input_boolean.savings_session_on_off
    state: "on"
action:
  - if:
      - condition: state
        entity_id: input_boolean.savings_session_pre_charge_on_off
        state: "on"
    then:
      - device_id: 6be5bb4feedac189c5bf85cac8ea83f0
        domain: select
        entity_id: 42f2d324789f519b902c3aa15cbb5e32
        type: select_option
        option: Force Charge
      - service: input_boolean.turn_off
        data: {}
        target:
          entity_id: input_boolean.savings_session_pre_charge_on_off
  - wait_for_trigger:
      - platform: time
        at: input_datetime.savings_session_start
  - device_id: 6be5bb4feedac189c5bf85cac8ea83f0
    domain: select
    entity_id: 42f2d324789f519b902c3aa15cbb5e32
    type: select_option
    option: Force Discharge
  - wait_for_trigger:
      - platform: time
        at: input_datetime.savings_session_end
  - device_id: 6be5bb4feedac189c5bf85cac8ea83f0
    domain: select
    entity_id: 42f2d324789f519b902c3aa15cbb5e32
    type: select_option
    option: Self Use
  - service: input_boolean.turn_off
    target:
      entity_id:
        - input_boolean.savings_session_on_off
    data: {}
mode: single
Savings Session Automation 2.jpg
_____

Step 4

Once you've created and saved the automation - you can now create the card for your dashboard using the yaml code below.

Code: Select all

type: entities
entities:
  - entity: automation.savings_session_automation
  - entity: input_boolean.savings_session_on_off
  - entity: input_boolean.savings_session_pre_charge_on_off
  - entity: input_datetime.savings_session_pre_charge_start
  - entity: input_datetime.savings_session_start
  - entity: input_datetime.savings_session_end
title: Savings Sessions Settings
show_header_toggle: false
state_color: true
Savings Session Automation 2.jpg
____

As mentioned, this automation is fairly basic but very easy to customise to your taste.
It switches back to Self Use at the end but you could easily edit the automation to have it switch to any other modes which suits you, for example.
There may be cleverer ways to automate this process - I am experimenting with the Octopus integration to try and use the information there to further automate the process - but for most, this automation will strike a reasonable balance between automation and control.

Any feedback, errors, questions - please feel free to contact me on Facebook DM or here.

Re: Savings Session Automation

Posted: Sun Mar 03, 2024 9:47 am
by Dave Foster
Nice one, that's going to come in very handy, great idea for the pre-charge - thanks Ryan :)