Hi,
I have a rule running for quiet some time now to identify the last caller numbers. This can be found in other posts here in the community in parts and looks currently like this:
rule "Initialize Lastcaller"
when
System started
then
postUpdate(fbLastNumber, "12345")
postUpdate(fbLastName, "openHAB")
postUpdate(fboxIncomingCall, "12345")
end
rule "Eingehender Anruf"
when
Item fboxRinging changed from OFF to ON
then
// Daten des CallType auslesen
val incCall = fboxIncomingCall.state as StringListType
val callerNumber = incCall.getValue(1)
val incCall2 = fboxIncomingCallResolved.state as StringListType
val LastCallName = incCall2.getValue(1)
// Die eigene Rufnummer aus der Variable entfernen
LastCallName = LastCallName.removeStart("12345")
// 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("RuleLastCaller", "Der Anruf von " + callerNumber + " (" + LastCallName + ")" + " wurde als Letzter Anrufer gespeichert.")
end
This one works almost perfect, besides after a restart of openHAB the first call is not put into the fblastname and fblastnumber items. Starting with the second call it runs smoothly. I started to postUpdate the values after
system initialization but without success. (running openHAB 2.1 stable).
Would appreciate a hint what I’m missing here…
Cheers, Bernd