Last active
March 20, 2024 19:28
-
-
Save wwerther/31298150a0d3957d6a5c67bc1cddb7a4 to your computer and use it in GitHub Desktop.
awtrix-fritzcallmonitor.yaml
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: ☎ AWTRIX - FritzBox Call Notification | |
description: 'Blueprint for use with Awtrix and Fritz-Box as Callmonitor. Based | |
on other flows that I found. | |
To make it work you need to add an instance of the Fritz!Box CallMonitor integration | |
if not already done. And of course you need to activate the Call-Monitor Service | |
on your Fritz-Box. Otherwise the events will not be created and calls will not | |
be shown. | |
' | |
domain: automation | |
author: Walter | |
input: | |
awtrix: | |
name: AWTRIX Device | |
description: Select the Awtrix light | |
selector: | |
device: | |
integration: mqtt | |
manufacturer: Blueforcer | |
model: AWTRIX Light | |
multiple: true | |
fritzbox: | |
name: Fritz-Box callmonitor entity | |
description: Select the Fritz-Box callmonitor | |
selector: | |
entity: | |
integration: fritzbox_callmonitor | |
multiple: false | |
push_icon: | |
name: Icon Mode | |
description: "Please select the pushIcon setting for the icon\n\n - `0` Icon | |
doesn't move\n\n - `1` Icon moves with text and will not appear again\n | |
\ \n - `2` Icon moves with text but appears again when the text starts to | |
scroll again\n" | |
selector: | |
select: | |
options: | |
- label: Icon doesn't move (default) | |
value: '0' | |
- label: Icon moves with text and will not appear again | |
value: '1' | |
- label: Icon moves with text but appears again when the text starts to | |
scroll again | |
value: '2' | |
custom_value: false | |
sort: false | |
multiple: false | |
default: '0' | |
Idle_Show: | |
name: IDLE-Active | |
description: 'If set then this blueprint will run when phone is IDLE | |
' | |
selector: | |
boolean: {} | |
default: false | |
Idle_Icon: | |
name: Idle-Icon | |
description: 'Icon to show if phone is IDLE | |
' | |
selector: | |
number: | |
mode: box | |
step: 1.0 | |
default: 35 | |
Idle_RTTTL: | |
name: Ring-Tone when going to IDLE-state | |
description: 'This tone sequence is played when phone is going to IDLE-state | |
' | |
selector: | |
text: {} | |
default: ringring:d=16,o=6,b=180:c,e,g,p,p,p,p,p,p,p,p,p,c,e,g,p,p,p,p,p,p,c,e,g,p,p,p | |
Call_Show: | |
name: CALL-Active | |
description: 'If set then this blueprint will run when phone is being CALLED | |
' | |
selector: | |
boolean: {} | |
default: true | |
Call_Icon: | |
name: Call-Icon | |
description: 'Icon to show if phone is CALLED | |
' | |
selector: | |
number: | |
mode: box | |
step: 1.0 | |
default: 35 | |
Call_AlwaysShowNumber: | |
name: Always Show Number | |
description: "If set then the phone-number will always be shown. Otherwise only | |
\ the resolved name is shown if available, otherwise the number \n" | |
selector: | |
boolean: {} | |
default: false | |
Call_RTTTL: | |
name: Ring-Tone when going to CALL-state | |
description: 'This tone sequence is played when phone is going to CALLED-state | |
' | |
selector: | |
text: {} | |
default: ringring:d=16,o=6,b=180:c,e,g,p,p,p,p,p,p,p,p,p,c,e,g,p,p,p,p,p,p,c,e,g,p,p,p | |
Dial_Show: | |
name: DIAL-Active | |
description: 'If set then this blueprint will run when phone is doing Outbound | |
calls | |
' | |
selector: | |
boolean: {} | |
default: false | |
Dial_Icon: | |
name: Dialing-Icon | |
description: 'Icon to show if phone is DIALING | |
' | |
selector: | |
number: | |
mode: box | |
step: 1.0 | |
default: 35 | |
Dial_AlwaysShowNumber: | |
name: Always Show Number | |
description: "If set then the phone-number will always be shown. Otherwise only | |
\ the resolved name is shown if available, otherwise the number \n" | |
selector: | |
boolean: {} | |
default: false | |
Dial_RTTTL: | |
name: Ring-Tone when going to DIALING-state | |
description: 'This tone sequence is played when phone is going to DIALING-state | |
' | |
selector: | |
text: {} | |
default: ringring:d=16,o=6,b=180:c,e,g,p,p,p,p,p,p,p,p,p,c,e,g,p,p,p,p,p,p,c,e,g,p,p,p | |
source_url: https://gist.github.com/wwerther/31298150a0d3957d6a5c67bc1cddb7a4 | |
variables: | |
device_ids: !input awtrix | |
fritzbox: !input fritzbox | |
devices_topics: "{%- macro get_device_topic(device_id) %} {{ states((device_entities(device_id) | |
| select('search','device_topic') | list)[0]) }} {%- endmacro %}\n{%- set ns = | |
namespace(devices=[]) %} {%- for device_id in device_ids %}\n {%- set device=get_device_topic(device_id)|replace(' | |
','') %}\n {% set ns.devices = ns.devices + [ device ~ '/notify' ] %}\n{%- endfor | |
%} {{ ns.devices }}" | |
push_icon: !input push_icon | |
trigger: | |
- platform: state | |
entity_id: | |
- !input fritzbox | |
id: change | |
action: | |
- variables: | |
fritz_status: "{% if is_state( fritzbox , \"idle\") %}\n Phone is idle\n{% elif | |
is_state(fritzbox,\"dialing\") %}\n Anruf nach {{ state_attr(fritzbox, 'to_name') | |
}} ({{ state_attr(fritzbox, 'to') }})\n{% elif is_state(fritzbox,\"ringing\") | |
%}\n Anruf von {{ state_attr(fritzbox, 'from_name') }} ({{ state_attr(fritzbox, | |
'from') }})\n{% else %}\n Telefonat {{ state_attr(fritzbox, 'with_name') }} | |
({{ state_attr(fritzbox, 'with') }})\n{% endif %} " | |
- repeat: | |
for_each: '{{ devices_topics }}' | |
sequence: | |
- service: mqtt.publish | |
data: | |
qos: 0 | |
retain: false | |
topic: '{{ repeat.item }}' | |
payload: "{\n \"icon\": \"35\",\n \"pushIcon\": \"{{push_icon}}\",\n \"text\": | |
\"{{ fritz_status }}\",\n \"repeat\": 3,\n #\"rtttl\": \"ringring:d=16,o=6,b=180:c,e,g,p,p,p,p,p,p,p,p,p,c,e,g,p,p,p,p,p,p,c,e,g,p,p,p\"\n}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment