dllfpp
October 17, 2022, 11:07am
1
Hello,
help me with this automation:
My aim is to have a Telegram notification each day at midnight if at least one among my 6 rolling shutters has been left opened. So far what happens with this configuration is that after midnight if any of the shutters move I get the notification but not if hany has been left opened .
On top of this, how can I get the detail of which has triggered the automation?
Let’s say the one in the kitchen has been left opened but not others, I would like Telegram to say “Kitchen” and not some generic message.
Thanks to everyone who will help on this!!
pedolsky
(Pedolsky)
October 17, 2022, 5:25pm
2
No offense but nobody can read this. Please look here: Formatting
dllfpp
October 18, 2022, 5:21am
3
You’re right, let me unwrap the visual editor:
alias: Notifica Telegram - Tapparelle aperte
description: ""
trigger:
- platform: numeric_state
entity_id: cover.rolling_shutter_switch_4_window_covering
attribute: current_position
above: 5
- platform: numeric_state
entity_id: cover.rolling_shutter_switch_6_window_covering
attribute: current_position
above: 5
- platform: numeric_state
entity_id: cover.rolling_shutter_switch_5_window_covering
attribute: current_position
above: 5
- platform: numeric_state
entity_id: cover.rolling_shutter_switch_2_window_covering
attribute: current_position
above: 5
- platform: numeric_state
entity_id: cover.rolling_shutter_switch_1_window_covering
attribute: current_position
above: 5
- platform: numeric_state
entity_id: cover.rolling_shutter_switch_3_window_covering
attribute: current_position
above: 5
condition:
- condition: time
after: "00:00:00"
before: "00:00:10"
action:
- service: telegram_bot.send_message
data:
message: >
{{states.sensor | selectattr('entity_id', 'search',
'cover.rolling_shutter_switch_1_window_covering')
| map(attribute='current_position')
| map('int', 101)
| select('lt', 100)
| list}}
mode: single
The message section is still wip, I’m still figuring out how to send the message telling me which shutters have been left opened.
Thanks!
pedolsky
(Pedolsky)
October 18, 2022, 1:37pm
4
I would do it like this:
trigger:
- platform: time
at: "00:00:00"
condition:
- condition: template
value_template: "{{ x|count > 0 }}"
action:
- service: notify.persistent_notification ## replace with your notify service
data:
title: Covers still open!
message: "- {{ x |join('\\n- ') }}"
variables:
x: >-
{{ states.cover |selectattr('state', '==', 'open') |map(attribute='name') |list }}
Output: