rule "Test - eingehender Anruf"
when
Item Call_Incoming received update
then
val tel00 = Call_Incoming_No.state.toString.split(',').get(0)
val tel01 = Call_Incoming_No.state.toString.split(',').get(1)
logInfo("Fritzbox", "TEST 00 --- Incomming call first number" +tel00)
logInfo("Fritzbox", "TEST 01 --- Incomming call second number " +tel01)
end
Output in log-file:
2017-07-05 09:56:31.222 [INFO ] [ipse.smarthome.model.script.Fritzbox] - TEST 00 --- Incomming call first number 0123456789
2017-07-05 09:56:31.222 [INFO ] [ipse.smarthome.model.script.Fritzbox] - TEST 01 --- Incomming call second number 0987654321
@halloween - it’s been a while since you posted this and I just found it. As I seem to have some issues with a working
Fritzbox rule I started to switch to your val definition which works great, but sometimes I get this error at an incoming call. The funny thing is, at the next call the rule works again as expected without the error… since upgrading to 2.2 I get occassionally this error message and no caller identification…:
2018-01-05 21:22:55.732 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Eingehender Anruf': Index is out of range
rule "Eingehender Anruf"
when
Item fboxRinging changed to ON
then
// Read Data of Calltype
val callerNumber = fboxIncomingCall.state.toString.split(',').get(1)
val incCall2 = fboxIncomingCallResolved.state as StringListType
val LastCallName = incCall2.getValue(1)
val CallTo = fboxIncomingCall.state.toString.split(',').get(0)
// Remove own number from the variables
LastCallName = LastCallName.removeStart("123456")
// Check if caller is unknown
if(LastCallName.startsWith("Name not found for"))
{
// Update Name with Unbekannt
LastCallName = "Unbekannt"
}
// Update Caller data into Sitemap items
fbLastNumber.postUpdate(callerNumber)
fbLastName.postUpdate(LastCallName)
logInfo("RuleLastCaller", "Der Anruf von " + callerNumber + " (" + LastCallName + ")" + " an die Nummer " + CallTo + " wurde als Letzter Anrufer gespeichert.")
if (callerNumber == "017212345") {
sendTelegram("mygroup", "mymessage!")
}
end
I get two validation issues when refreshing the rule: Assignment to final variable
But I have no glue why this in 2.2 works sometimes and sometimes not.
Are you probably aware of any changes in 2.2 that could have impacted this rule?