User avatar
Site Admin
Using Home Assistant to control house battery and EV battery charging with octopus intelligent go
Using Home Assistant to control house battery and EV battery charging with octopus intelligent go to prevent discharge of battery into the car.

Community Admin / FoxESS Elite Professional

Buy me a coffee or Book a zoom meeting for remote consultancy

FoxESS Tri Inverter Installation
2 x KH & 1 x H1
24 x HV2600 (62.4kWh)
32 x 490w across 4 arrays
Dual Tesla Household
Heatpump & Low Carbon Housebuild
Re: Using Home Assistant to control house battery and EV battery charging with octopus intelligent go
Thanks Will - excellent automation - solves a lot of problems!

I have an H1 inverter - so if you set the Minimum SoC it doesn't charge the battery at all (but does stop discharge) - so below is the code / automation I use to change the working mode.

Notes:
  • When setting up, I created a blank automation, then used the 'id' for that and replaced the generated code with that below.
  • Also the notification is just so I could check it works reliably, will probably remove those after a few weeks
  • Replace the XXX with your entity / meter number
  • Is based on 7p / 25p import rates, at the point of creating this - can adjust according to need
  • This code goes into automations.yaml file - but be careful with any edits!


Enjoy... it may take some time to get the code working... but using ChatGPT can help a lot!

Code: Select all

- id: '1738061409369'
  alias: Set Inverter Mode based on electricity prices
  description: ''
  triggers:
  - entity_id: sensor.octopus_energy_electricity_XXX_current_rate
    trigger: state #this trigger happens whenever the electricity price is updated
  conditions: []
  actions:
  - if:
    - condition: template
      value_template: '{{ states("sensor.octopus_energy_electricity_XXX_current_rate")
        | float > 0.20 }}' #checks if the current price is >£0.20 - adjust as needed
    then:
    - data:
        message: Trigger above 15p. Price is £{{ states("sensor.octopus_energy_electricity_XXX_current_rate")
          }}
        title: Rate change
      action: notify.mobile_app_pixel_6 #sends notification to my phone when change has been made
    - target:
        entity_id: select.work_mode
      data:
        option: Self Use
      action: select.select_option
    else:
    - data:
        message: Trigger below 15p. Price is £{{ states("sensor.octopus_energy_electricity_XXX_current_rate")
          }}
        title: Rate change
      action: notify.mobile_app_pixel_6
    - target:
        entity_id: select.work_mode
      data:
        option: Force Charge
      action: select.select_option
  mode: single
Post Reply