I have the following sensors that I use to track my day/night EV kwh usage
ev_daily_energy:
source: sensor.shellyem_5e26f6_channel_2_energy
name: EV Energy Today
cycle: daily
tariffs:
- peak
- offpeak
monthly_ev_energy:
source: sensor.shellyem_5e26f6_channel_2_energy
cycle: monthly
tariffs:
- peak
- offpeak
The peak and offpeak are set by this:
- id: '1652831843092'
alias: Energy - Switch tariff
description: ''
trigger:
- platform: time
at: 09:00:00
variables:
tariff: peak
- platform: time
at: 00:00:00
variables:
tariff: offpeak
condition: []
action:
- service: select.select_option
target:
entity_id: select.daily_energy
data:
option: '{{ tariff }}'
- service: select.select_option
target:
entity_id: select.monthly_energy
data:
option: '{{ tariff }}'
mode: single
I would like to add another tariff for solar values:
ev_daily_energy:
source: sensor.shellyem_5e26f6_channel_2_energy
name: EV Energy Today
cycle: daily
tariffs:
- peak
- offpeak
- solar
But I am unsure how to switch to that tariff in the code.
I am thinking of using something along the lines of if sensor.openevse_state = Charging
and {{ ''solar'' if states(''sensor.current_solar_generation'') | int > 0}}'
but not sure how to create the automation that can toggle between all 3 tariffs.
Anyone more versed in yaml can please assist?