FritzboxTR064 -Binding rules

Dear Community,

i need help für my project “output of the callername” over “text to speech” via marytts.I use the FritzboxTR064-Binding on OH2. All items work, but the rule doesnt work. I copied it from the Binding-wiki. I think that is not all what i need. I use follow entries:in the rules file:


rule "Phone is ringing"
    when
                // fboxRinging is a switch item which switches to ON if call is detected
           Item fboxRinging changed from OFF to ON 
             then
       say("hello") // my testtext , work
            logInfo("Anrufermeldung", "Generating caller name message...")  // logentrie is ok
            // fboxIncoming call receives numbers/name of incoming call
            val CallType incCall = fboxIncomingCall.state as CallType
            var callerName = incCall.destNum //destNum is external number OR resolved Name if no              
                                                               //phonebook entry exists
        say("test")   // another testtext, doesnt work
            // do something with callerName
           // here i wish to say the callerName, how?

I dont find.any information about this in all discussions. An entrie - say(“hello”) - after the “then” section work, an entrie after the varibles declaration dont work.
I think it is missing entries like

import org.openhab.library.tel.types.CallType

???

Can anyone help me to understand the function and correct my code? I want output the var callerName per marytts in the kind of say(callerName) What is the correct syntax for the handover
of the var “callerName” and which parts are missing in the code?

JanL

i found my answer himself

it works only under OH1 (1.8.3 other Versions not tested)

correct content of fritzboxtr064.rules is:


import org.openhab.library.tel.types.CallType
rule "Phone is ringing"
    when
        // fboxRinging is a switch item which switches to ON if call is detected
        Item fboxRinging changed from OFF to ON 
    then
        			
			logInfo("Anrufermeldung", "Generating caller name message...")
            // fboxIncoming call receives numbers/name of incoming call
            val CallType incCall = fboxIncomingCall.state as CallType
            var callerName = incCall.destNum //destNum is external number OR resolved Name if no phonebook entry exists
            // do something with callerName
			say("Anruf von " +callerName)
end

it says only the callerNumber, the number was not resolved to the name of the phonebook (entry exist), I dont know why not.

under openhab_homedir\server\plugins can you find the importfile … under OH2 the directory and the importfile doesnt exist - a copy doesnt work.

I’ve the same problem with this rule. Under OH1 it runs, after migrating to OH2 it doesn’t. Do you run OH2 and have a solution for this?

If the documentation here is somehow incorrect when running on OH2, please open an issue against it here.

@watou I can confirm that this rule works within OH2 : https://community.openhab.org/t/fritzbox-tr064-binding-creation-of-esh-event-failed/10064/13

Before I’ve seen this topic I just opened another one as I’m struggeling to work with these item definitions how
to check for a specific number: https://community.openhab.org/t/fritzbox-tr064-rule-for-identifying-number/22263

Which rule works within OH2? The one above with CallType in it? So there is nothing wrong with the documentation?

this one here works:

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)

Thanks! But it appears to be missing an end statement.

Any takers to correct the documentation for this binding?

I would, but have to get this working first… :slight_smile:

1 Like