Created
October 6, 2021 23:45
-
-
Save madpilot/9504ab7c3e0002d73890bce3802af2ff to your computer and use it in GitHub Desktop.
This file contains hidden or 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
blueprint: | |
name: Amber Light | |
description: Change the colour of a lamp based on the current Amber price | |
domain: automation | |
input: | |
amber_price_sensor: | |
name: Amber Price Sensor | |
description: The Amber price sensor you wish to track. If in doubt, use General Price. | |
selector: | |
entity: | |
integration: amberelectric | |
domain: sensor | |
target_light: | |
name: Light | |
description: The light you wish to use as the indicator | |
selector: | |
target: | |
entity: | |
domain: light | |
low_price: | |
name: low_price | |
description: Price above this threshold will show green. Below will show Cyan | |
selector: | |
number: | |
mode: box | |
min: -1 | |
max: 16.5 | |
default: 0.16 | |
average_price: | |
name: averge_price | |
description: Price above this threshold will show yellow. | |
selector: | |
number: | |
min: -1 | |
max: 16.5 | |
mode: box | |
default: 0.25 | |
high_price: | |
name: high_price | |
description: Price above this threshold will show red. | |
selector: | |
number: | |
min: -1 | |
max: 16.5 | |
mode: box | |
default: 0.4 | |
trigger: | |
- platform: state | |
entity_id: !input amber_price_sensor | |
action: | |
- variables: | |
spot_price: "{{ trigger.to_state.attributes.spot_per_kwh }}" | |
customer_price: "{{ trigger.to_state.attributes.per_kwh }}" | |
low_price: !input low_price | |
average_price: !input average_price | |
high_price: !input high_price | |
- service: light.turn_on | |
target: !input target_light | |
data: | |
color_name: > | |
{% if spot_price >= 3 %} | |
purple | |
{% elif customer_price > high_price %} | |
red | |
{% elif customer_price > average_price %} | |
orange | |
{% elif customer_price > low_price %} | |
green | |
{% else %} | |
cyan | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment