Show attributes of fritzbox_callmonitor sensor

Hello everybody!
I’m new to HA and I need some advice on how to display values (actually I think they are called “attributes”) from the Fritz!Box Call monitor sensor. The documentation of the sensor is poor, but I noticed that a lot of attributes are caught by the sensor, like the caller-id, the duration of a call, etc… So I would like to make a box in my HA interface and show all these values, now the sensor shows only its state (idle, ringing, dialing, or talking).
My understanding is that I have to use the templates, but at the moment I’m groping in the dark.

Could someone point me in the right direction? A little example would be awesome :blush:

1 Like

Use template sensors for this

Both sensors contain a wide variety of examples.

Hurray! Thanks! I made a first template for the FRITZ!Box callmonitor, here below all the lazy people (like me) can find the code:

  - platform: template
    sensors:
      line_status:
        value_template: >-
            {%- if is_state("sensor.phone", "idle") %}
                Free
            {%  elif is_state("sensor.phone", "dialing") %}
                Dialing '{{ states.sensor.phone.attributes.to }}'
            {%  elif is_state("sensor.phone", "ringing") %}
                Incoming call from '{{ states.sensor.phone.attributes.from }}'
            {% else %}
                Talking with '{{ states.sensor.phone.attributes.with }}'
            {%- endif %}
        friendly_name: 'Line status'

I think it is pretty straightforward to understand, it only needs to be put in a nice box like this:

group:
  phone:
    name: phone
    icon: mdi:phone-classic
    view: no
    entities:
      - sensor.line_status

And then you will see who is calling/are you calling/talking to.
Now, since among the attributes there also the dates and duration of the calls, it would be nice to implement also a call log, but for the moment this is beyond my abilities.

P.S. I don’t know why the indentation of the code is lost :frowning:

3 Likes

Call history would also be very cool. Has this already been implemented by someone? I am very new to HA (started a couple of days ago), so I am not yet familiar with all details …

I just found https://github.com/pklaus/starzel.whoiscalling which could be used for that, but I no next to nothing about Python :frowning:

Don’t know what all the entries mean, but i think there’s work in progress. :slight_smile:

Phonebook lookup works in 0.41. Thanks @DavidMStraub
Here’s a template sensor, if someone needs it.

- platform: template
  sensors:
    phone_line_status:
      friendly_name: 'Line status'
      value_template: >-
          {% if is_state("sensor.phone", "idle") %}
              Idle
          {% elif is_state("sensor.phone", "dialing") %}
              {{ states.sensor.phone.attributes.to_name }} ({{ states.sensor.phone.attributes.to }})
          {% elif is_state("sensor.phone", "ringing") %}
              {{ states.sensor.phone.attributes.from_name }} ({{ states.sensor.phone.attributes.from }})
          {% else %}
              {{ states.sensor.phone.attributes.with_name }} ({{ states.sensor.phone.attributes.with }})
          {% endif %}
      icon_template: >-
          {% if is_state("sensor.phone", "idle") %}
              mdi:phone-classic
          {% elif is_state("sensor.phone", "dialing") %}
              mdi:phone-outgoing
          {% elif is_state("sensor.phone", "ringing") %}
              mdi:phone-incoming
          {% else %}
              mdi:phone-in-talk
          {% endif %}
3 Likes

Hi,

how to find the Number of the Phonebook ?

Thanks

@ElGrande72, if you export your phonebook and open the xml file you’ll see something like:
<phonebook owner="2" name="Test">
I think the phonebook owner is the ID.

Edit:
This entry is missing in the default phonebook, which is ID 0.
Greets

Perfekt, thank you.

It would nice to see some kind of lookup extension to this.

https://wiki.freepbx.org/display/FPG/CallerID+Lookup+Sources+User+Guide

So you can use service like. http://www.reverseaustralia.com/developer/callerid.html

I am using the default phone book. but still getting phone numbers instead of names in my sensor when receiving calls. How do i troubleshoot this? I have downloaded the phonebook from the fritz router, but there is no owner id, because it is phonebook 0. the following code i am using:

  - platform: fritzbox_callmonitor
    host: !secret fritz_ip
    name: phone
    username: !secret fritz_callmonitor_user
    password: !secret fritz_callmonitor_pass
    phonebook: 0

Hello everybody,

am I missing something or is it at the moment really not possible to get a list of the caller history?

Thanks
Markus