Skip to content

Octopus Energy

alienatedsec edited this page Nov 4, 2024 · 11 revisions

A Simple Octopus Saving Session Dashboard

I may create a separate HA integration if popular.

The below example will create a simple dashboard to charge your battery between set hours and discharge whenever the Octopus Saving Session starts. It's worth highlighting that when you export, you need to disable your iBoost and Eddi devices. The below automation does not account for that.

  • Add the following time sensors onto your configuration.yaml.
input_datetime:
  octopus_saving_session_start:
    name: Octopus Saving Session Start
    has_date: false
    has_time: true
  octopus_saving_session_stop:
    name: Octopus Saving Session Stop
    has_date: false
    has_time: true
  battery_charging_start:
    name: Battery Charging Start
    has_date: false
    has_time: true
  battery_charging_stop:
    name: Battery Charging Stop
    has_date: false
    has_time: true

Reboot your Home Assistant

The inverter settings are switched to Backup/Reserve when charging and Timed Charge/Discharge when discharging. It uses several helpers, and a few automations to function independently.

Items needed for CHARGING:

  • Create Toggle Helpers

image

  • Automations'

Battery Charge Automation - it turns input_boolean.battery_charge ON at specific time defined in input_datetime.battery_charging_start

alias: Battery Charge Automation
description: "
trigger:
  - platform: template
    value_template: >-
      {{ states('sensor.time') ==
      (states.input_datetime.battery_charging_start.attributes.timestamp | int |
      timestamp_custom('%H:%M', False)) }}
condition: []
action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.battery_charge
mode: single

Charge Automation ON - it changes the mode on the inverter to Backup/Reserve where the Backup SoC is set at 100.

alias: Charge Automation ON
description: Sets the Battery to charge from the grid.
trigger:
  - platform: state
    entity_id:
      - input_boolean.battery_charge
    from: "off"
    to: "on"
condition: []
action:
  - if:
      - condition: device
        device_id: [your inverter device id]
        domain: select
        entity_id: [your inverter entity id]
        type: selected_option
        option: Backup/Reserve
    then: []
    else:
      - device_id: [your inverter device id]
        domain: select
        entity_id: [your inverter entity id]
        type: select_option
        option: Backup/Reserve
mode: single

Charge Automation OFF - it changes the mode on the inverter to Timed Charge/Discharge and disables the automation Battery Charge Automation

alias: Charge Automation OFF
description: >-
  Sets the Battery to Not Discharge to the grid. 
trigger:
  - platform: state
    entity_id:
      - input_boolean.battery_charge
    from: "on"
    to: "off"
condition: []
action:
  - if:
      - condition: device
        device_id: [your inverter device id]
        domain: select
        entity_id: [your inverter entity id]
        type: selected_option
        option: Backup/Reserve
    then:
      - device_id: [your inverter device id]
        domain: select
        entity_id: [your inverter entity id]
        type: select_option
        option: Timed Charge/Discharge
  - if:
      - condition: state
        entity_id: automation.battery_charge_automation
        state: "on"
    then:
      - service: automation.turn_off
        data:
          stop_actions: false
        target:
          entity_id: automation.battery_charge_automation
mode: single

Battery Charge Cut off - it stops charging at the specific time defined in input_datetime.battery_charging_stop

alias: Battery Charge Cut off
description: Stops battery charging at 16:00 with battery charging enabled
trigger:
  - platform: template
    value_template: >-
      {{ states('sensor.time') ==
      (states.input_datetime.battery_charging_stop.attributes.timestamp | int |
      timestamp_custom('%H:%M', False)) }}
condition:
  - condition: state
    entity_id: input_boolean.battery_charge
    state: "on"
action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.battery_charge
mode: single

Items needed for DISCHARGING:

  • Create Toggle Helpers

image

  • Automations'

Octopus Saving Session - it turns input_boolean.battery_discharge ON at specific time defined in input_datetime.octopus_saving_session_start

alias: Octopus Saving Session
description: ""
trigger:
  - platform: template
    value_template: >-
      {{ states('sensor.time') ==
      (states.input_datetime.octopus_saving_session_start.attributes.timestamp |
      int | timestamp_custom('%H:%M', False)) }}
action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.battery_discharge

Discharge Automation ON - it sets the inverter's mode to Timed Charge/Discharge - Times Specified By the Octopus Saving Session Start/Stop - It also disables Eddi and Zappi - solislan is my inverter's sensor entity id (name) in the SolaX integration.

alias: Discharge Automation ON
description: >-
  Sets the Battery to Discharge to the grid at full power at times specified in
  Octopus Saving Session Stop
triggers:
  - entity_id:
      - input_boolean.battery_discharge
    to: "on"
    trigger: state
    from: "off"
conditions: []
actions:
  - alias: Turn Off Zappi
    if:
      - condition: device
        device_id: [your zappi device id]
        domain: select
        entity_id: [your zappi entity id]
        type: selected_option
        option: Stopped
    then: []
    else:
      - device_id: [your zappi device id]
        domain: select
        entity_id: [your zappi entity id]
        type: select_option
        option: Stopped
      - device_id: [your mobile device id]
        domain: mobile_app
        type: notify
        message: "{{states('sensor.myenergi_zappi_[ID]_status')}}"
        title: Zappi Status OFF - Discharging Started
  - alias: Turn Off Eddi
    if:
      - condition: device
        device_id: [your eddi device id]
        domain: select
        device_id: [your eddi setting id]
        type: selected_option
        option: Stopped
    then: []
    else:
      - device_id: [your eddi device id]
        domain: select
        device_id: [your eddi setting id]
        type: select_option
        option: Stopped
      - device_id: [your mobile device id]
        domain: mobile_app
        type: notify
        message: "{{states('sensor.myenergi_eddi_[ID]_status')}}"
        title: Eddi Status OFF - Discharging Started
  - parallel:
      - data:
          value: >-
            {{
            (states.input_datetime.octopus_saving_session_start.attributes.timestamp
            | int | timestamp_custom('%H', False)) }}
        target:
          entity_id: number.solislan_timed_discharge_start_hours
        action: number.set_value
      - data:
          value: >-
            {{
            (states.input_datetime.octopus_saving_session_start.attributes.timestamp
            | int | timestamp_custom('%M', False)) }}
        target:
          entity_id: number.solislan_timed_discharge_start_minutes
        action: number.set_value
      - data:
          value: >-
            {{
            (states.input_datetime.octopus_saving_session_stop.attributes.timestamp
            | int | timestamp_custom('%H', False)) }}
        target:
          entity_id: number.solislan_timed_discharge_end_hours
        action: number.set_value
      - data:
          value: >-
            {{
            (states.input_datetime.octopus_saving_session_stop.attributes.timestamp
            | int | timestamp_custom('%M', False)) }}
        target:
          entity_id: number.solislan_timed_discharge_end_minutes
        action: number.set_value
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - data: {}
    action: button.press
    target:
      entity_id: button.solislan_update_charge_discharge_times
  - if:
      - condition: device
        device_id: [your inverter id]
        domain: select
        device_id: [your inverter setting entity id]
        type: selected_option
        option: Self-Use
    then: []
    else:
      - device_id: [your inverter id]
        domain: select
        device_id: [your inverter setting entity id]
        type: select_option
        option: Self-Use
    alias: Ensure the inverter has right settings
mode: single

Discharge Automation OFF - Removes discharge schedule

alias: Discharge Automation OFF
description: >-
  Sets the Battery to Not Discharge to the grid.  Both Solax discharge values
  set to 15:59
triggers:
  - entity_id:
      - input_boolean.battery_discharge
    to: "off"
    trigger: state
conditions: []
actions:
  - parallel:
      - data:
          value: "15"
        target:
          entity_id: number.solislan_timed_discharge_start_hours
        action: number.set_value
      - data:
          value: "59"
        target:
          entity_id: number.solislan_timed_discharge_start_minutes
        action: number.set_value
      - data:
          value: "15"
        target:
          entity_id: number.solislan_timed_discharge_end_hours
        action: number.set_value
      - data:
          value: "59"
        target:
          entity_id: number.solislan_timed_discharge_end_minutes
        action: number.set_value
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - data: {}
    target:
      entity_id:
        - button.solislan_update_charge_discharge_times
    action: button.press
  - device_id: [your inverter device id]
    domain: select
    entity_id: [your inverter entity id]
    type: select_option
    option: Stopped
    enabled: true
    alias: Stop Eddi Boosting
  - device_id: [your eddi device id]
    domain: select
    entity_id: [your eddi entity id]
    type: select_option
    option: Eco+
    alias: Change Zappi to Eco+
  - if:
      - condition: state
        entity_id: automation.octopus_saving_session
        state: "on"
    then:
      - data:
          stop_actions: false
        target:
          entity_id: automation.octopus_saving_session
        action: automation.turn_off
    alias: Turn Off Octopus Saving Session
  - device_id: [your mobile device id]
    domain: mobile_app
    type: notify
    message: Inverter Discharging Stopped
    title: Inverter Discharging Stopped
mode: single

MyEnergi Boost Automations:

Eddi Boost Automation- Useful for free sessions with the battery charge

alias: Eddi Boost Automation
description: ""
triggers:
  - entity_id:
      - input_boolean.battery_charge
    from: "off"
    to: "on"
    trigger: state
conditions: []
actions:
  - if:
      - condition: device
        device_id: [your eddi device id]
        domain: select
        entity_id: [your eddi entity id]
        type: selected_option
        option: Normal
    then: []
    else:
      - device_id: [your eddi device id]
        domain: select
        entity_id: [your eddi entity id]
        type: select_option
        option: Normal
    alias: Eddi to Normal
  - metadata: {}
    data:
      target: Heater 1
      time: 60
    target:
      device_id: [your eddi device id]
    action: myenergi.myenergi_eddi_boost
  - device_id: [your mobile device id]
    domain: mobile_app
    type: notify
    message: Eddi Boost - 60 min
    title: Eddi Boost Automation
mode: single

Zappi Boost Automation - Useful for free sessions with the battery charge

alias: Zappi Boost Automation
description: ""
triggers:
  - entity_id:
      - input_boolean.battery_charge
    from: "off"
    to: "on"
    trigger: state
conditions: []
actions:
  - if:
      - condition: device
        device_id: [your zappi device id]
        domain: select
        entity_id: [your zappi entity id]
        type: selected_option
        option: Eco+
    then: []
    else:
      - device_id: [your zappi device id]
        domain: select
        entity_id: [your zappi entity id]
        type: select_option
        option: Eco+
    alias: Change Zappi to ECO+
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.octopus_energy_a_73c93e89_intelligent_bump_charge
    alias: Zappi Bump Charge ON
  - device_id: [your mobile device id]
    domain: mobile_app
    type: notify
    message: Zappi Charging Started
    title: Zappi Bump Mode ON
mode: single

Dashboard:

title: Octopus Saving Session Time
type: entities
show_header_toggle: false
entities:
  - entity: automation.octopus_saving_session
  - entity: sensor.time
    name: Current Time
  - entity: input_datetime.octopus_saving_session_start
  - entity: input_datetime.octopus_saving_session_stop
  - entity: automation.battery_charge_automation
  - entity: input_datetime.battery_charging_start
  - entity: input_datetime.battery_charging_stop
  - entity: automation.eddi_boost_automation
  - entity: automation.zappi_boost_automation

image