Last active
August 8, 2023 15:44
-
-
Save JanPetterMG/45711db1ae0f4f7b0d10709d456f37df to your computer and use it in GitHub Desktop.
Home Assistant automation blueprint - Nord Pool top X cheapest hours
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dependency: https://github.com/custom-components/nordpool | |
blueprint: | |
name: Nord Pool top X cheapest hours | |
description: Set up automation based on which hours of the day are the cheapest or most expensive. | |
domain: automation | |
input: | |
prices: | |
name: Nord Pool | |
description: Price sensor. | |
selector: | |
entity: | |
domain: sensor | |
integration: nordpool | |
hours: | |
name: Number of cheap hours | |
description: The X cheapest hours during the day. | |
default: 12 | |
selector: | |
number: | |
min: 1 | |
max: 23 | |
mode: slider | |
step: 1 | |
cheap: | |
name: Cheap hour action | |
description: Action to run when the price is low. | |
default: [] | |
selector: | |
action: {} | |
expensive: | |
name: Expensive hour action | |
description: Action to run when the price is high. | |
default: [] | |
selector: | |
action: {} | |
variables: | |
prices_var: !input 'prices' | |
hours_var: !input 'hours' | |
trigger: | |
- platform: state | |
entity_id: !input 'prices' | |
action: | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: '{{ (state_attr(prices_var, "today") | sort)[hours_var - 1] | float < states(prices_var) | float }}' | |
sequence: !input 'expensive' | |
default: !input 'cheap' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment