Skip to content

Instantly share code, notes, and snippets.

@hanfil
Last active September 10, 2022 11:11
Show Gist options
  • Save hanfil/35960f3dba0fc66bc392708e8f95d254 to your computer and use it in GitHub Desktop.
Save hanfil/35960f3dba0fc66bc392708e8f95d254 to your computer and use it in GitHub Desktop.
blueprint:
name: High electricity price
description: 'This automation blueprint sends a notification on high 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.8 + 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 highest: {{energy_sensor_state}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment