-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblueprint-daily-cost-report.yaml
54 lines (53 loc) · 1.96 KB
/
blueprint-daily-cost-report.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
blueprint:
name: Daily Utility Cost Notification
description: "`- Version: 0.99 -`\n\n Send a notification to device every day with the usage cost of selected entities."
domain: automation
input:
sensors:
name: Electricity Cost Sensors
description: Select the sensors that track electricity usage for air conditioning.
selector:
entity:
domain: sensor
multiple: true
notify_device:
name: Device to notify push
default: false
description: 'Device needs to run the official Home Assistant app to receive notifications.'
selector:
device:
integration: mobile_app
trigger_time:
name: Trigger Time
description: Time to send the daily notification.
default: "23:55:00"
selector:
time:
variables:
notify_device: !input notify_device
sensors: !input sensors
trigger:
- platform: time
at: !input trigger_time
action:
- domain: mobile_app
type: notify
device_id: !input notify_device
title: "Spotreba"
message: >
{%- set total_usage = 0 -%}
⚡Daily Electricity Usage🔌:
{%- for sensor in sensors -%}
{%- set sensor_value = states(sensor) | float -%}
{%- if sensor_value > 0.1 -%}
{%- set total_usage = total_usage + states(sensor) | float -%}
{%- set friendly_name = state_attr(sensor, 'friendly_name') -%}
{%- set friendly_name = friendly_name | regex_replace('[0-9]', '') -%}
{%- set friendly_name = friendly_name | regex_replace('Plug', '') -%}
{%- set friendly_name = friendly_name | regex_replace('€', '') -%}
{%- set friendly_name = friendly_name | regex_replace('daily', '') -%}
{%- set friendly_name = friendly_name | regex_replace('Daily', '') -%}
- {{ friendly_name | trim }}: {{ states(sensor) | round(2) }}€
{%- endif -%}
{%- endfor -%}
mode: single