Seeking Help for Peak/Off-Peak Energy Automation with Shelly 3EM

Greetings, fellow Home Assistant enthusiasts! I’m thrilled to be diving into the world of smart home automation, and I’m eager to learn from your experiences.

I’ve recently set up a Shelly 3EM to monitor my energy consumption, and it’s been working like a charm so far. I’ve configured a utility meter in Home Assistant to track my energy usage, distinguishing between peak and off-peak hours. The setup is detailed below, but I’m now stuck on creating the automation to switch between these tariffs automatically.

Here’s my current configuration:
yaml

Energy Monitoring Configuration

sensor:

  • name: “Total Power Consumption”
    unit_of_measurement: “W”
    device_class: power
    state: >
    {{ [ states(‘sensor.l1_power’), states(‘sensor.l2_power’), states(‘sensor.l3_power’) ] | map(‘float’) | sum }}
    availability: >
    {{ not ‘unavailable’ in [ states(‘sensor.l1_power’), states(‘sensor.l2_power’), states(‘sensor.l3_power’)] }}

  • name: “Total Energy Consumption”
    unit_of_measurement: “kWh”
    device_class: energy
    state: >
    {{ [ states(‘sensor.l1_energy’), states(‘sensor.l2_energy’), states(‘sensor.l3_energy’) ] | map(‘float’) | sum }}
    availability: >
    {{ not ‘unavailable’ in [ states(‘sensor.l1_energy’), states(‘sensor.l2_energy’), states(‘sensor.l3_energy’)] }}

The peak hours are from Monday to Friday, 7:00 AM to 8:00 PM, and on Saturdays, 7:00 AM to 1:00 PM. Off-peak hours cover the remaining times. I’ve tried setting up a calendar schedule but haven’t figured out how to integrate it into the automation workflow.

Could someone guide me on how to create this automation? I’m particularly interested in how to structure the rules to switch between the two tariffs seamlessly. Any advice or examples would be invaluable!

Thank you in advance for your help! I’m excited to unlock the full potential of my energy monitoring setup and contribute to the community as I grow more comfortable with Home Assistant.