Created
December 7, 2021 05:50
-
-
Save shermozle/a514b19735f1e9382506fa693ca494d6 to your computer and use it in GitHub Desktop.
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
blueprint: | |
name: Solar Light | |
description: Change the colour of a lamp based on the amount of power being imported or exported from the | |
domain: automation | |
input: | |
net_current_consumption: | |
name: Net current consumption sensor | |
description: Negative for exporting, positive for importing | |
selector: | |
entity: | |
domain: sensor | |
target_light: | |
name: Light | |
description: The light you wish to use as the indicator | |
selector: | |
target: | |
entity: | |
domain: light | |
trigger: | |
- platform: state | |
entity_id: !input net_current_consumption | |
action: | |
- variables: | |
spot_price: "{{ trigger.to_state.attributes.spot_per_kwh }}" | |
customer_price: "{{ trigger.to_state.attributes.per_kwh }}" | |
low_price: !input importing | |
high_price: !input exporting | |
- service: light.turn_on | |
target: !input target_light | |
data: | |
color_name: > | |
{% if net_current_consumption > 0 %} | |
red | |
{% if net_current_consumption <= 0 %} | |
green |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment