Skip to content

Instantly share code, notes, and snippets.

@tvdsluijs
Last active February 7, 2024 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvdsluijs/96f42b18b4feca7f2c1726d9bb4f88ca to your computer and use it in GitHub Desktop.
Save tvdsluijs/96f42b18b4feca7f2c1726d9bb4f88ca to your computer and use it in GitHub Desktop.
Weekday Home Assistant Automation for Boiler Control
automation:
# Weekday Automation for Boiler Control
- alias: "Control Boiler on Weekdays Based on Energy Price"
trigger:
- platform: time
at: "00:01:00" # Check every day just after midnight to plan for the day ahead.
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: script.execute
target:
entity_id: script.weekday_boiler_control
# Weekend Automation for Boiler Control
- alias: "Control Boiler on Weekends Based on Energy Price"
trigger:
- platform: time
at: "00:01:00" # Similarly, check early in the morning for the weekend schedule.
condition:
- condition: time
weekday:
- sat
- sun
action:
- service: script.execute
target:
entity_id: script.weekend_boiler_control
script:
# Weekday Boiler Control Logic
weekday_boiler_control:
sequence:
- condition: state
entity_id: sensor.tibber_price
state: 'low' # This is a placeholder. Adjust to the actual state that indicates the lowest price.
- condition: or # Ensures the boiler is turned on only during your specified hours if the price is low.
conditions:
- condition: time
after: "06:00:00"
before: "08:30:00"
- condition: time
after: "18:00:00"
before: "22:30:00"
- service: switch.turn_on
target:
entity_id: switch.shelly_plug_s # Ensure this matches your Shelly Plug S entity ID.
# Weekend Boiler Control Logic
weekend_boiler_control:
sequence:
- condition: state
entity_id: sensor.tibber_price
state: 'low' # Check for low price.
- condition: or # More flexible time conditions for the weekend.
conditions:
- condition: time
after: "08:00:00"
before: "22:30:00" # Adjust this to cover the periods you're likely to need hot water.
- service: switch.turn_on
target:
entity_id: switch.shelly_plug_s
# Notes:
# - This setup assumes you have entities like sensor.tibber_price and switch.shelly_plug_s correctly integrated.
# - The 'state: 'low'' part under conditions needs to match the actual value from your Tibber sensor that indicates the lowest price period. Adjust accordingly.
# - You might need to further customize the time conditions and the logic based on your exact needs and the behavior of your energy pricing data.
# - Remember to test the automation to ensure it works as expected and adjust as necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment