fritzbox_callmonitor: Caller phone number from attribut 'from' will not be fetched
Closed this issue · 6 comments
The problem
Hello,
i integrated the fritzbox_callmonitor integration into my home assistant os setup.
with this script wich i use in a home assistant automation, i want to spell the callers name (if it is in the phonebook) or if not available spell the callers phone number. As result of my research i found that this should be done with the 'from' attribute, but i can't get it to work. Every time a caller is not in the fritz!box phonebook it spells call from unknown.
Am I doing something wrong? Or is the 'from' attribut not available anymore?
See the complete home assistant automation script below.
Thanks in advance
Bye
What version of Home Assistant Core has the issue?
core-2024.10.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
fritzbox_callmonitor
Link to integration documentation on our website
https://www.home-assistant.io/integrations/fritzbox_callmonitor
Diagnostics information
No response
Example YAML snippet
alias: spell call from external
description: ""
triggers:
- entity_id: sensor.fritz_box_call_monitor_phonebook
to: ringing
trigger: state
conditions: []
actions:
- action: media_player.volume_set
metadata: {}
data:
volume_level: 0.7
target:
entity_id: media_player.homepod_all
- repeat:
sequence:
- data:
message: >
{% if state_attr('sensor.fritz_box_call_monitor_phonebook',
'from_name') %}
Call from {{ state_attr('sensor.fritz_box_call_monitor_phonebook', 'from_name') }}
{% elif
state_attr('sensor.fritz_box_call_monitor_phonebook',
'from') %}
Call from number {{ state_attr('sensor.fritz_box_call_monitor_phonebook', 'from') }}
{% else %}
Call from unknown
{% endif %}
media_player_entity_id: media_player.homepod_all
cache: true
target:
entity_id: tts.piper
action: tts.speak
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
while:
- condition: state
entity_id: sensor.fritz_box_call_monitor_phonebook
state: ringing
- action: media_player.volume_set
metadata: {}
data:
volume_level: 0.5
target:
entity_id: media_player.homepod_all
mode: single
Anything in the logs that might be useful for us?
No response
Additional information
No response
Hey there @cdce8p, mind taking a look at this issue as it has been labeled with an integration (fritzbox_callmonitor
) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of fritzbox_callmonitor
can trigger bot actions by commenting:
@home-assistant close
Closes the issue.@home-assistant rename Awesome new title
Renames the issue.@home-assistant reopen
Reopen the issue.@home-assistant unassign fritzbox_callmonitor
Removes the current integration label and assignees on the issue, add the integration domain after the command.@home-assistant add-label needs-more-information
Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.@home-assistant remove-label needs-more-information
Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
fritzbox_callmonitor documentation
fritzbox_callmonitor source
(message by IssueLinks)
The sensor always sets the from_name
. For unknown callers it's just unknown
. Therefore your if statement never get's to the second condition. Try something like:
{% if state_attr('sensor.fritz_box_call_monitor_phonebook', 'from_name') != 'unknown' %}
Call from {{ state_attr('sensor.fritz_box_call_monitor_phonebook', 'from_name') }}
{% else %}
Call from number {{ state_attr('sensor.fritz_box_call_monitor_phonebook', 'from') }}
{% endif %}
Thanks for your quick answer. I tried it now. Now it doesn't say: call from unknown. But now it says nothing, if there is no fritz!box phonebook entry available.
So my original plan was, to let home assistant say, call from name or call from number if a fritz!box phonebook entry is available and if no fritz!box phonebook entry is available, to say call from number or if there is no number information available, to say call from unknown.
Is this possible or is it only possible if a fritz!box phonebook entry exists?
Thanks in advance
I tried it now. Now it doesn't say: call from unknown. But now it says nothing, if there is no fritz!box phonebook entry available.
Are you sure / have you deleted the elif
clause?
Have you tried debugging the template using the Developer tools? Please check the States
tab in both cases (known and unknown number). Also try the Template
tab.
Yes. I have replaced my script part with yours and then restarted home assistant completely. There is no elif clause anymore.
I looked at the trace from my test calls when the automation run.
You are right. The phone number is therefore transmitted. See:
params:
domain: tts
service: speak
service_data:
message: Call from number 0**************
media_player_entity_id: media_player.homepod_all
cache: true
entity_id:
- tts.piper
target:
entity_id:
- tts.piper
running_script: false
Therefore i think it must have something to do with the piper tts addon which apparently cannot read out the number.
I will take a look at this.
This is strange. If i manually let the piper tts addon speak out the phrase Call from number 0************** it works. But this behavior has nothing to do with the fritz!box callmonitor integration i think. i'll have to test and check again myself. thanks anyway.