- Platform information:
- Hardware: Raspberry Pi 2 Model B Rev 1.1
- OS: Raspbian GNU/Linux 9 (stretch)
- Java Runtime Environment: openjdk version “1.8.0_152” OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76) OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)
- openHAB version: openHAB 2.4.0-1 (Release Build)
- Issue of the topic:
I created (stole) a rule for monitoring outgoing calls on my Fritz!Box 7362SL using the FritzBox TR064 Binding (binding-fritzboxtr0641 - 1.13.0) and changed it to mute my media devices when dialing out.
The muting works fine, the telephone number is displayed, but the rule generates an error as follows:
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Outgoing Call: An error occurred during the script execution: index=1, size=1
which I guess is a type assignment mismatch for one of the val values.
Also as you can see I put in some loginfo statements to capture what is returned, but these don’t show up in the log (again probably the same issue).
The calledName is not resolved, which is strange, as the binding returms my name as can be seen in the logs below (I am dialing my mobile phone).
I would be grateful if someone can inform me what I am doing wrong.
Many thanks in advance!
Vincent
- Items configuration related to the issue
// FritzBox Call Monitoring
Switch fboxRinging "Phone ringing in [%s]" (FritzBox_PHO) {fritzboxtr064="callmonitor_ringing" }
Switch fboxRinging_Out "Phone ringing out [%s]" (FritzBox_PHO) {fritzboxtr064="callmonitor_outgoing" }
Call fboxIncomingCall "Incoming call: [%1$s to %2$s]" (FritzBox_PHO) {fritzboxtr064="callmonitor_ringing" }
Call fboxOutgoingCall "Outgoing call: [%1$s to %2$s]" (FritzBox_PHO) {fritzboxtr064="callmonitor_outgoing" }
// FritzBox Resolve Numbers to Names via Phonebook
Call fboxIncomingCallResolved "Incoming call: [%1$s to %2$s]" (FritzBox_PHO) {fritzboxtr064="callmonitor_ringing:resolveName" }
Call fboxOutgoingCallResolved "Outgoing call: [%1$s to %2$s]" (FritzBox_PHO) {fritzboxtr064="callmonitor_outgoing:resolveName" }
String fbLastNumber "Last Caller No.: [%s]" <phone> (FritzBox_PHO)
String fbLastName "Last Caller Name: [%s]" <phone> (FritzBox_PHO)
- Rules code related to the issue
rule "Outgoing Call"
when
// fboxRinging_Out is a switch item which switches to ON if call is made
Item fboxRinging_Out changed
then
switch fboxRinging_Out.state {
case ON: {
// Mute media devices
lounge_tv_mut.sendCommand (ON)
if (kitchen_music.state == ON) {kitchen_music_mut.sendCommand (ON)}
if (lounge_music.state == ON) {lounge_music_mut.sendCommand (ON)}
logInfo("Outgoing Call:", "Generating called name message...")
// fboxOutgoing call receives numbers/name of number dialed
val outCall = fboxOutgoingCall.state as StringListType
val calledNumber = outCall.getValue(0)
logInfo(calledNumber)
val outCallResolved = fboxOutgoingCallResolved.state as StringListType
val calledName = outCallResolved.getValue(0)
logInfo (calledName)
// do something with calledName
logInfo("Call made to:", calledName, " at ", calledNumber)
postUpdate(fbLastNumber, calledNumber)
postUpdate(fbLastName, calledName)
}
case OFF: {
// Unmute media devices
lounge_tv_mut.sendCommand (OFF)
if (kitchen_music.state == ON) {kitchen_music_mut.sendCommand (OFF)}
if (lounge_music.state == ON) {lounge_music_mut.sendCommand (OFF)}
logInfo("Phone Call Finished")
}
}
end
- Services configuration related to the issue
## Binding for accessing FritzBoxes using the TR064 protocol. Uses http(s) requests.
# URL. Either use http://<fbox-ip>:49000 or https://<fbox-ip>:49443 (https preferred!)
url=http://192.xxx.xxx.x:49000
# Refresh Interval (60000ms default)
#refresh=60000
# User Name (only use this value if you configured a user in fbox webui/config!)
# If this parameter is missing, "dslf-config" is used as default username
# It is recommended to to switch to authentication by username in fritzbox config
# and add a separate config user for this binding.
user=xxxxxx
# PW
pass=xxxxxxxxx
fritzboxtr064:phonebookid=1
- If logs where generated please post these here using code fences:
==> /var/log/openhab2/openhab.log <==
2019-01-27 01:57:55.616 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'fritzbox-tr6401-outgoing-call.rules'
==> /var/log/openhab2/events.log <==
==> /var/log/openhab2/openhab.log <==
2019-01-27 01:58:05.795 [INFO ] [tzboxtr064.internal.PhonebookManager] - Trying to resolve number 0176xxxxxxxx to name comparing 7 characters
2019-01-27 01:58:05.795 [INFO ] [tzboxtr064.internal.PhonebookManager] - Trying to resolve number 0176xxxxxxxx to name comparing 7 characters
2019-01-27 01:58:05.803 [INFO ] [tzboxtr064.internal.PhonebookManager] - Found name match 'Bevan Vincent' in phonebook by comparing incoming number '0176xxxxxxxx' with address book entry '0176xxxxxxxx'
==> /var/log/openhab2/events.log <==
2019-01-27 01:58:05.836 [vent.ItemStateChangedEvent] - fboxOutgoingCall changed from , to 0176xxxxxxxx,6409664
2019-01-27 01:58:05.846 [vent.ItemStateChangedEvent] - fboxOutgoingCallResolved changed from , to Name not found for 0176xxxxxxxx,6409664
2019-01-27 01:58:05.855 [vent.ItemStateChangedEvent] - fboxRinging_Out changed from OFF to ON
2019-01-27 01:58:09.554 [ome.event.ItemCommandEvent] - Item 'lounge_tv_mut' received command ON
==> /var/log/openhab2/openhab.log <==
2019-01-27 01:58:09.576 [INFO ] [marthome.model.script.Outgoing Call:] - Generating called name message...
2019-01-27 01:58:09.600 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Outgoing Call': An error occurred during the script execution: index=1, size=1
==> /var/log/openhab2/events.log <==
2019-01-27 01:58:09.617 [ome.event.ItemCommandEvent] - Item 'kitchen_music_mut' received command ON
2019-01-27 01:58:09.635 [vent.ItemStateChangedEvent] - lounge_tv_mut changed from OFF to ON
2019-01-27 01:58:09.726 [vent.ItemStateChangedEvent] - kitchen_music_vol changed from 100 to 0
2019-01-27 01:58:12.711 [nt.ItemStatePredictedEvent] - kitchen_music_mut predicted to become ON
2019-01-27 01:58:12.727 [vent.ItemStateChangedEvent] - kitchen_music_mut changed from OFF to ON
2019-01-27 01:58:16.181 [vent.ItemStateChangedEvent] - fboxOutgoingCall changed from 0176xxxxxxxx,6409664 to ,
2019-01-27 01:58:16.223 [vent.ItemStateChangedEvent] - fboxOutgoingCallResolved changed from Name not found for 0176xxxxxx,6409664 to ,
2019-01-27 01:58:16.235 [vent.ItemStateChangedEvent] - fboxIncomingCallResolved changed from , to ,
2019-01-27 01:58:16.244 [vent.ItemStateChangedEvent] - fboxIncomingCall changed from , to ,
2019-01-27 01:58:16.261 [vent.ItemStateChangedEvent] - fboxRinging_Out changed from ON to OFF
2019-01-27 01:58:16.494 [vent.ItemStateChangedEvent] - network_pingdevice_859d7d07_latency changed from 4136.0 to 248.0
2019-01-27 01:58:16.515 [ome.event.ItemCommandEvent] - Item 'lounge_tv_mut' received command OFF
==> /var/log/openhab2/openhab.log <==
2019-01-27 01:58:16.516 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Outgoing Call': An error occurred during the script execution: index=1, size=1
==> /var/log/openhab2/events.log <==
2019-01-27 01:58:16.529 [ome.event.ItemCommandEvent] - Item 'kitchen_music_mut' received command OFF
2019-01-27 01:58:16.541 [vent.ItemStateChangedEvent] - lounge_tv_mut changed from ON to OFF
2019-01-27 01:58:16.562 [nt.ItemStatePredictedEvent] - kitchen_music_mut predicted to become OFF
2019-01-27 01:58:16.591 [vent.ItemStateChangedEvent] - kitchen_music_mut changed from ON to OFF
2019-01-27 01:58:16.603 [vent.ItemStateChangedEvent] - kitchen_music_vol changed from 0 to 100