I started some basic automation via HA to charge my battery 10kwH if electricity is cheap on Octotpus Agile import
I use a scheduled trigger with the 30-minute rates that I create every day to switch between self-consumption and Time of Use for that period.
This is boring to look at the next time with cheap tariffs to charge the battery.
So I want to do is to set a price bracket where I want to charge let say below 0.1898 kWh and above 0.1899 kWh to not charge the battery.
So far so good the challenge I have is I want to let HA check every 30 minutes for the next tariff as above.
Hope that makes sense.
so far I have the below how can I integrate the 30-minute check for the new tariff or what else could I use to determine the next time I want to charge?
choose:
- conditions:
- condition: state
entity_id: select.battery_working_mode
state: Maximise Self Consumption
- condition: numeric_state
entity_id: >-
sensor.octopus_energy_electricity_XXXXXX_current_rate
below: 0.1898
sequence:
- device_id: XXXXXXXXXXXXXXXXXXXXXXXX
domain: select
entity_id: select.battery_working_mode
type: select_option
option: Time Of Use
- conditions:
- condition: state
entity_id: select.battery_working_mode
state: Time Of Use
- condition: numeric_state
entity_id: >-
sensor.octopus_energy_electricity_XXXXXXXXX_current_rate
above: 0.1899
sequence:
- device_id: XXXXXXXXXX
domain: select
entity_id: select.battery_working_mode
type: select_option
option: Maximise Self Consumption
I am looking to do something similar,
What integration are you using to get the rates please.
I have control over the inverter and can set the charge time using the Solax Modbus integration and a Waveshare Industrial Serial Server RS485 To RJ45 Ethernet. Soldered it into the WiFi adaptor and set the Waveshare to be multi-host to avoid conflict.
I am missing the Octopus Agile rates to switch the charge on and off.
I also saw a warning regarding writing to the inverter too often.
Solis Rai-3K inverter with Pylontech batteries.
Octopus Agile tariff.
I’m new to Home Assistant and working on a similar process to automate charging of a plug in hybrid vehicle. I’ve added a Shelly relay to my dumb charger which then allows me to remotely control the vehicle charging. I’m on Octopus Agile and use the Octopus integration from BottlecapDave to read back the rates
I’ve made a simple integration of an input box where I can enter the target rate to charge the vehicle by adding the following code in the Configuration.yaml file
I’ve then created a couple of simple automation routines to toggle the Shelly relay if the current rate is above or below the value entered in the input box.
Here is the code in the Automations yaml editor which switches the charger via the Shelly relay.
alias: Turn on below charge limit
description: |-
If cost is below charge limit p/kWh
turn on socket
trigger:
- platform: state
entity_id:
- sensor.octopus_energy_electricity_**(MY ACCOUNT)**_current_rate
condition:
- condition: numeric_state
entity_id: input_number.box1
above: sensor.octopus_energy_electricity_**(MY ACCOUNT)**_current_rate
action:
- type: turn_on
device_id: **(SHELLY RELAY)**
entity_id: **(SHELLY RELAY SWITCH)**
domain: switch
mode: single
alias: Turn off above charge limit
description: |-
If cost is above charge limit p/kWh
turn off socket
trigger:
- platform: state
entity_id:
- sensor.octopus_energy_electricity_**(MY ACCOUNT)**_current_rate
condition:
- condition: numeric_state
entity_id: input_number.box1
below: sensor.octopus_energy_electricity_**(MY ACCOUNT)**_current_rate
action:
- type: turn_off
device_id: **(SHELLY RELAY)**
entity_id: **(SHELLY RELAY SWITCH)**
domain: switch
mode: single
I’m sure there is a more elegant way of doing this and open to suggestions on my code but it seems to work well so far.
Now I need to find a way to automatically determine the optimum value put in the input box based on today’s/tomorrow’s rate to get the cheapest possible charging.