Skip to content

Instantly share code, notes, and snippets.

@hanfil
Last active September 10, 2022 11:10
Show Gist options
  • Save hanfil/9a2e7f23401f201fb1f43f6b45bf1d08 to your computer and use it in GitHub Desktop.
Save hanfil/9a2e7f23401f201fb1f43f6b45bf1d08 to your computer and use it in GitHub Desktop.
blueprint:
name: Low electricity price
description: 'This automation blueprint sends a notification on low energy price.'
domain: automation
input:
energy_sensor:
name: Tibber price sensor
selector:
entity:
integration: tibber
domain: sensor
default: ''
notify_device:
name: Device to notify
description: Device needs to run the official Home Assistant app to receive
notifications
selector:
device:
integration: mobile_app
mode: single
max_exceeded: silent
variables:
energy_sensor: !input 'energy_sensor'
energy_sensor_state: '{{ float(states[energy_sensor].state)}}'
energy_sensor_max: '{{ float(states[energy_sensor].attributes[''max_price''])}}'
energy_sensor_min: '{{ float(states[energy_sensor].attributes[''min_price''])}}'
trigger:
platform: state
entity_id: !input 'energy_sensor'
condition:
condition: template
value_template: '{{energy_sensor_state < (energy_sensor_max - energy_sensor_min) * 0.2 + energy_sensor_min}}'
action:
- device_id: !input notify_device
domain: mobile_app
type: notify
title: Electricity price
message: 'The electricity price is now at its lowest: {{energy_sensor_state}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment