OK got it.
Look in the post marked as solution.
You need two Items to get this; one for the number and one for the Number resolved to name from phonebook(or to “Name not found for”).
Call fbAnruf "Anruf von [%1$s]" <phone> {fritzboxtr064="callmonitor_ringing"}//Nummer des Anrufers
Call fbAnrufName "Anruf von [%1$s]" <phone> {fritzboxtr064="callmonitor_ringing:resolveName"}//Name des Anrufers, wenn in Telefonbuch, sonst "Name not found for"
these are both Items of type “Call”, so in your rule use " as StringListType" for both.
I tried the following rule with the mentioned items:
rule "Eingehender Anruf"
when
Item fboxRinging changed from OFF to ON
then
// Daten des CallType auslesen
val incCall = fbAnruf.state as StringListType
val callerNumber = incCall.getValue(1)
// Die Variablen anlegen und mit der Nummer bzw. Namen des Anrufers füllen
val String LastCallName = fbAnrufName.state.toString()
// Die eigene Rufnummer aus der Variable entfernen
LastCallName = LastCallName.removeStart("1234567##")
// Prüfen ob der Anrufer unbekannt ist
if(LastCallName.startsWith("Name not found for"))
{
// Den Namen mit Unbekannt füllen
LastCallName = "Unbekannt"
}
// Die Daten in die Items eintragen
postUpdate(fbLastNumber, callerNumber)
postUpdate(fbLastName, LastCallName)
logInfo("RuleLastCall", "Der Anruf von " + callerNumber + " (" + LastCallName + ")" + " wurde als Letzter Anrufer gespeichert.")
end
With the following output:
Der Anruf von 0987654321 (1234567, Johannes (Mobile)) wurde als Letzter Anrufer gespeichert.
I think “LastCallName = LastCallName.removeStart(“1234567##”)” doesn’t work.
val String helper = fbAnrufName.state.toString()
// Die eigene Rufnummer aus der Variable entfernen
val String LastCallName = helper.removeStart("1234567##")
Sorry…same result. Your solution with the helper String didn’t solve the problem. It seems that .removeStart has no influence or are there any other imports for the rule file I need?. But also no errors in the log.
Any other idea or hints?
Looking at it again, i think yes.
you should use the same method for lastcallname than for callernumber
Try this:
remove:
// Die Variablen anlegen und mit der Nummer bzw. Namen des Anrufers füllen
val String LastCallName = fbAnrufName.state.toString()
// Die eigene Rufnummer aus der Variable entfernen
LastCallName = LastCallName.removeStart("1234567##")
// Prüfen ob der Anrufer unbekannt ist
with:
// Die Variablen anlegen und mit der Nummer bzw. Namen des Anrufers füllen
val incCall2 = fbAnrufName.state as StringListType
// Die eigene Rufnummer aus der Variable entfernen
val LastCallName =incCall2.getValue(1)
Glad you got it working!
sorry for the typo fixed it in the post.
fbAnrufName.state holds two values in comma separated form. Your own number that was called and the name of the caller(or "Name not found for"plus the number if not found in phonebook), like so:
123456, Karl Handy
123456, “Name not found for” +49 30 182722720)
getValue() either returns the part in front of the comma (getValue(0)) or the part behind the comma (getValue(1))
So… to finish this off; which version of the add-on needs to be loaded on OH1 to make this work?
1.9.0?
And can the outgoing call captured with name and number too?
Sorry my OH1 days are over
Using OH2, FritzboxTr064 Binding 1.10.0.201703140213
Haven’t tested outgoing call but I see no reason why it should not work.
Log shows that outgoing call Items get set appropriately.
i go mad with this binding…
presence detection is working fine, but i cannot get it running with call identification or reaction to an incoming call… I think my rules have some problems, although should be the same like her in some examples…
andy idea ?
rule “Eingehender Anruf”
when
Item fbKlingel changed from OFF to ON
then
// Daten des CallType auslesen
val call = fbAnruf.state as StringListType
// Die Variablen anlegen und mit der Nummer bzw. Namen des Anrufers füllen
val LastCallNumber = call.getValue(1)
val LastCallName2 = fbAnrufName.state as StringListType
// Die eigene Rufnummer aus der Variable entfernen
val LastCallName = LastCallName2.getValue(1)
// Prüfen ob der Anrufer unbekannt ist
if(LastCallName.startsWith(“Name not found for”))
{
// Den Namen mit Unbekannt füllen
LastCallName = “Unbekannt”
}
// Die Daten in die Items eintragen
postUpdate(fbLastNumber, LastCallNumber)
postUpdate(fbLastName, LastCallName)
logInfo(“RuleLastCall”, “Der Anruf von " + LastCallNumber + " (” + LastCallName + “)” + " wurde als Letzter Anrufer gespeichert.")
sendBroadcastNotification(“Eingehender Anruf von”, LastCallName)
sendTelegram(“bot1”,“Eingehender Anruf von”, LastCallName)
end
hope anyone finds the errors i have for sure in… its not working…