Skip to content

Instantly share code, notes, and snippets.

@stone
Created October 30, 2022 16:10
Show Gist options
  • Save stone/f5387aa318218746c08b7c953f9d91c7 to your computer and use it in GitHub Desktop.
Save stone/f5387aa318218746c08b7c953f9d91c7 to your computer and use it in GitHub Desktop.
Execute actions based in Tibber integration prices changes
blueprint:
name: Tibber price Actions
description: "Perform actions when price changes"
domain: automation
input:
tibber_price_sensor:
name: Tibber price sensor
selector:
entity:
domain: sensor
multiple: false
very_cheap_actions:
name: Very Cheap Actions
description: Actions to perform when prices become Very Cheap
default: []
selector:
action: {}
cheap_actions:
name: Cheap Actions
description: Actions to perform when prices become Cheap
default: []
selector:
action: {}
normal_actions:
name: Normal Actions
description: Actions to perform when prices become Normal
default: []
selector:
action: {}
expensive_actions:
name: Expensive Actions
description: Actions to perform when prices become Normal
default: []
selector:
action: {}
very_expensive_actions:
name: Very Expensive Actions
description: Actions to perform when prices become Very Expensive
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input tibber_price_sensor
attribute: price_level
action:
- variables:
old_level: '{{ trigger.from_state.attributes.price_level }}'
new_level: '{{ trigger.to_state.attributes.price_level }}'
- choose:
- conditions:
- '{{ new_level != old_level }}'
- '{{ new_level == "VERY_CHEAP" }}'
sequence: !input very_cheap_actions
- conditions:
- '{{ new_level != old_level }}'
- '{{ new_level == "CHEAP" }}'
sequence: !input cheap_actions
- conditions:
- '{{ new_level != old_level }}'
- '{{ new_level == "NORMAL" }}'
sequence: !input normal_actions
- conditions:
- '{{ new_level != old_level }}'
- '{{ new_level == "EXPENSIVE" }}'
sequence: !input expensive_actions
- conditions:
- '{{ new_level != old_level }}'
- '{{ new_level == "VERY_EXPENSIVE" }}'
sequence: !input very_expensive_actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment