Weekends are Offpeak - How to implement?

Hi Folks - New to Home Assistant - Even newer to Energy monitoring.

Got myself a Shelly EM and a couple of clamps and I’m monitoring currently a Heat Pump
(Aircon) and a Spa pool. I’m using instructions I found on youtube and I have Peak / Offpeak Tariffs working for time of day (Offpeak 9pm - 7am) but my plan includes offpeak all weekends so my $ values are off course off currently as per the bill.

Here is my (full credit to Speak to the Geek) YAML for Energy: Peak and Offpeak Tariffs 120A

alias: "Energy: Peak and Offpeak Tariffs 120A"
description: ""
trigger:
  - platform: time
    at: input_datetime.off_peak_energy_end
    variables:
      tariff: peak
  - platform: time
    at: input_datetime.off_peak_energy_start
    variables:
      tariff: offpeak
action:
  - service: select.select_option
    target:
      entity_id: select.grid_usage_120a
    data:
      option: "{{ tariff }}"
mode: single

I’ve tried adding condition adding

condition:
  - condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri

Under the peak bit thinking that would only trigger a change to peak on those days of the week but I get the error

Message malformed: Unexpected value for condition: ‘None’. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone @ data[‘condition’][1]

I’m absolutely green at this and haven’t even researched whether YAML is an open language I can learn or specific to HA - I guess I really should have started with that knowledge.

Hi Matt, I had a similar problem and here’s what I did to handle it.

alias: Update electric tariff hourly
description: ""
trigger:
  - platform: time_pattern
    minutes: "0"
condition: []
action:
  - variables:
      curr_month: "{{ now().month }}"
      curr_hour: "{{ now().hour }}"
      curr_weekday: "{{ now().weekday() }}"
      season: "{{ iif(curr_month >= 6 and curr_month <= 9, 'summer', 'winter') }}"
      is_weekday: "{{ iif(curr_weekday >= 0 and curr_weekday <= 4, true, false) }}"
      tariff: >-
        {{ iif(is_weekday and curr_hour >= 13 and curr_hour <= 14, 'mid-peak',
        iif(is_weekday and curr_hour >= 15 and curr_hour <= 18, 'on-peak',
        'off-peak')) }}
  - service: select.select_option
    data:
      option: "{{ season }}-{{ tariff }}"
    target:
      entity_id: select.electric_meter

The specific issue with your condition is you have not specified a before or after parameter.

Thanks @brandonp42 - I’ll give this a crack soon - I’ve just put a RS485 Wifi interface on my spa pool and I’m about to hopefully link it to Home Assistant so we can finally adjust temps over wifi, even from afar… This project has a high WAF (wife appreciation factor) so its pushed to the top of the list.

My saying “Turn the heater off, out power usage is hight” has a very low WAF at present :wink:

Cheers @jazzyisj - I’ll have a read soon - As above this project is lower on my wants and needs right now. Spa pool is being drummed into me right now as the wife has to plan more and go out in the cold to turn it up in advance :wink: