Congrats on getting it going - all that YAML must have taken some persistence.
I really don’t know why the tariff variable approach didn’t work. Hate not knowing so I’ve created a test utility meter with three rates and this automation to control the selector
alias: Peak/Cheap rate select for three rate Utility meter
description: ""
trigger:
- platform: time
at: "02:00:00"
variables:
tariff: Cheap
- platform: time
at: "05:00:00"
variables:
tariff: Standard
- platform: time
at: "16:00:00"
variables:
tariff: Peak
- platform: time
at: "19:00:00"
variables:
tariff: Standard
action:
- service: select.select_option
target:
entity_id: select.test_utility_meter
data:
option: "{{ tariff }}"
mode: single
Will leave it running for 24 hours and see how it goes
To be honest, I very seldom look at the energy dashboard. I have a card on my own energy dashboard that shows cumulative data, so created all the helpers to populate that.
Flex is a three rate four period tariff so had to add two new time triggers to the original Go automation and make sure the variables were set to the correct rates defined in the utility meter. The set.select_option is case sensitive so the rates in the automation YAML have to match the rates that were defined in the utility meter setup exactly.
Last point. You don’t have to use just one (complicated/YAML) automation to set the rate selector.
Everything can be done in the UI - set up one automation per rate:
Trigger on the start time for the rate.
Set the action to ‘Call Service’ and choose ‘select: select_option’
Choose the correct utility meter helper
Type the rate you want selected into the option box - case sensitive
Save and name
Repeat for the different rate periods. This approach is simple but not quite so easy to maintain as the times are in three different automations.
For Octopus Flex can set two time triggers in the automation selecting the standard rate so only need three automations.
If you need to set import and export helpers and the time periods for both are the same then can select both of the helpers to be updated in the same automation - just add a second entity - (+Choose entity) in the Targets section of the UI.
I have set up my meter helpers as shown above and created the automation to change from peak to offpeak to peak etc. The meter switches correctly. However the data useage is recording in both peak and offpeak.