Fritzbox TR064 - rule for identifying number?

Hi,

I’m using the rule trick from @Andy1402 how to make the Fritzbox TR064 binding work with caller information. It really works great here as well as in displaying the numbers within my sitemap with the item information lastIncomingcall. I’m reaching out to you as I struggle somehow how to create a rule that would check for a specific incoming number and then triggers an action e.g. a telegram.

I thought once information is stored in an item let’s use the item lastIncomingcall but cleary I seem to miss something here…the rule is just doing nothing… :unamused:

rule "Check for caller number"
     when
        Item fboxRinging changed from OFF to ON

     then
        if Item fboxlastIncomingCall received update
           if (fboxlastIncomingCall.state == 01723456)
                sendTelegram("group", "Mobile called!")
end

The new rule should extend the below working rule here:

Rule:
rule "Jemand ruft an"
  when
    Item fboxRinging changed from OFF to ON 
  then
    val incCall = fboxIncomingCallResolved.state as StringListType
    val callerNumber = incCall.getValue(1)
    var strTemp = callerNumber.toString as String 
    postUpdate(fboxlastIncomingCall, strTemp)

//Samsung-TV Ton aus
sendCommand(TV_Mute, ON)

What am I missing to check for a specific phone number?
Would appreciate your thoughts.

Regards,
Bernd

Just an idea, but is the state really of type number. The preceding null in 017323456 is actually not available when handling the state as a number.

Maybe it’s a string

@patrickse - thanks for your reply. Yes, the item “fboxlastIncomingCall” is defined as String in my items file… is there another way to check the content?

1 Like

I am not quite sure if comparing a string will work that way in xtend. At least there should be some “” around the number.

if (fboxlastIncomingCall.state == "01723456")

@patrickse thanks for your hint! I was pretty sure I tried this already but it turned out it was the missing " " as well as that I had put this rule in a separate rule file without the var declarations :confounded:

1 Like