[ CODE ] Fritz!Box call log plugin v0.3

Please read the wiki page referred in the first post of this thread. If you still have any questions please let me know.

I installed this plugin via the market and configured it, itā€™s pretty simple to configure :slight_smile:
Will stuff like number-recognition be build in as well? If possible even using the adressbook built in the fritzbox?
Really like it, keep up the good work :slight_smile:

I donā€™t really see how number recognintion should be built inā€¦ (maybe plugin mechanism) as it is pretty country specific.

I have actually used my own fritz!box plugin to trigger a scene that looks up (via a swedish web service) who is calling and announces it in my sonos speakers. I posted the example here:

http://forum.micasaverde.com/index.php/topic,8505.msg94525.html#msg94525

Maybe you can modify it to a similar service in your country (if you donā€™t live in sweden).

@j.hoekstra.
You should probably update to version 0.3 when it has been approved on mios market (or download from source now)ā€¦ 0.1 version had a bug related to incoming phone number.

Will update then.
In principle the Fritzbox has the number info ready and seems to pass it on via the callmonitor cause other apps using the same mechanism seem to pick it up.
Connection with an adressbook seems to be done locally afaict, for me the number would just be fine :slight_smile:

Unfortunately the frizbox call log does not log the name (if it exists in Fritz!Box adressbook) only number is passed.
Iā€™ve seen Fritz!Box integrations where developers has done a regular Web Interface login to fetch adressbook from the Fritz!Box UI. But that is a bit too hacky for my taste.

For me the numbers are just fine, Iā€™ll check how I can get the number(see you made nice example on the trac-page) and pass it on to be spoken via TTS from the Karotz-plugin :slight_smile:

Has this stopped working (possibly due to firmware updates) or is it just me? :slight_smile:

Firmware update of Vera or Fritz!Box?

Fritz :wink: The plugin doesnā€™t seem to be receiving any data from the fritz anymore (I have a 7390 on 06.03. Iā€™ve double checked the port is open).

Mine is on 06.06 and everything is working fine here.

Hmm. Whatā€™s the best way to troubleshoot? Iā€™ll reinstall the plugin, see if that helps.

EDIT: Yeah, that fixed it, sorry to bother :smiley:

Hi hek,

I know you havenā€™t needed up update this in ages as it all just works, but if you find yourself bored one day and fancy adding a feature, a new variable to show the name of the person calling would be handy (pulled from the fritz address book).

Iā€™ve no idea how hard that would be to implement, and it may be more trouble than itā€™s worth, but I could make good use of it. Basically I have a scene that pauses whatever Iā€™m watching in XBMC and pops up a notification to show the number of whoever is calling. Itā€™d be a lot more useful if it showed the name instead. I could do it in the luup code, but it would get out of control pretty quickly if I have to add logic to convert every number :smiley:

Anyway, just a thought.

Thanks :slight_smile:

The name is not coming through the fritz-API. You would have to login the web-way and pick up the number via screen-scraping. Much too complicated to do from lua.

I do a name-lookup in luup (from a swedish public web-service) and say name in our sonos speakers when someone calls in.

[quote=ā€œhek, post:34, topic:173458ā€]The name is not coming through the fritz-API. You would have to login the web-way and pick up the number via screen-scraping. Much too complicated to do from lua.

I do a name-lookup in luup (from a swedish public web-service) and say name in our sonos speakers when someone calls in.[/quote]

Ah ok, yep fair enough.

Honestly most calls come through my mobile nowadays, so thereā€™s probably only 3 or 4 people who would call the home phone. I can just added some if/thenā€™s into the luup for my scene to hardcode the names. Just thought Iā€™d check anyway.

Thanks for the response :slight_smile:

Iā€™ve trying to run an action in a scene if a specific number is calling. What I tried so far is:

local action = luup.variable_get( ā€˜urn:hek:serviceId:FritzBox1ā€™, ā€œActionā€, 9)

if (action == ā€œRINGā€) then
if (luup.variable_get( ā€˜urn:hek:serviceId:FritzBox1ā€™, ā€œNumberā€, 9) == ā€œ0788788780ā€) then
return true
else
return false
end
else
return false
end

Is there any short example of where and how to do this in UI7?

The device itself seems to work just fine as I can see different state changes when the number is calling ā€¦

The code looks okā€¦

Hi,

Iā€™m trying to get my LED blinking on/off while the phone is ringing. Hereā€™s the code Iā€™m trying:

local delay = 1
local function IncomingCall()
local action = luup.variable_get( ā€˜urn:hek:serviceId:FritzBox1ā€™, ā€œActionā€, 9)
luup.call_delay(luup.call_action(ā€œurn:upnp-org:serviceId:Dimming1ā€, ā€œSetLoadLevelTargetā€, {newLoadlevelTarget = ā€œ0ā€}, G_Wohnzimmer),delay) ā€“ RGB Green
luup.call_delay(luup.call_action(ā€œurn:upnp-org:serviceId:Dimming1ā€, ā€œSetLoadLevelTargetā€, {newLoadlevelTarget = ā€œ100ā€}, G_Wohnzimmer),delay) ā€“ RGB Green
luup.call_delay(luup.call_action(ā€œurn:upnp-org:serviceId:Dimming1ā€, ā€œSetLoadLevelTargetā€, {newLoadlevelTarget = ā€œ0ā€}, G_Wohnzimmer),delay) ā€“ RGB Green
if action ~= ā€œRINGā€ Then
return
end
IncomingCall()
end

But the code fails at:

local action = luup.variable_get( ā€˜urn:hek:serviceId:FritzBox1ā€™, ā€œActionā€, 9)

Any suggestions to get this working?

A few things hereā€¦

First, to format your code properly on the forums, if you are posting a multi-line code block, put three back-ticks (```) on a line by itself, then your code, and then three back-ticks again (```) on a line by itself.

-- Then it looks like this
-- This preserves indents and (importantly) quotes, and uses a more readable typeface for code.
local delay = 1
local function IncomingCall()
    local action = luup.variable_get( ā€˜urn:hek:serviceId:FritzBox1ā€™, ā€œActionā€, 9)
-- ...etc...

If you are formatting a single line of code or putting a code fragment inline, enclose it in a single back-tick ` (before and after) and it will look like this.

To your codeā€¦ the call_delay()/call_timer() functions take a string as its first argument, and that is the name of a (global-scoped) function that is to be executed when the delay expires. You cannot pass a function reference directly, and your code as shown isnā€™t even doing that, itā€™s executing call_action() immediately and passing the result returned from that call into call_delay(), which isnā€™t going to get you where you want to go.

The correct usage of call_delay() specifically to blink a light has been covered in many other threads, so I wonā€™t rehash it here. Hereā€™s a link to one such thread that I think is a good match: Blink Light Program, is recursion necessary? - Scene Scripting - Ezlo Community

Also, be aware that there is no guaranteed timing when communicating with Z-Wave, ZigBee, or plugin devices. If Vera is busy doing something else when your delay is expected to end, your blink may not happen as scheduled, it will happen when Vera gets around to it. If the Z-Wave network is busy, same deal. The shorter your delay is, the less likely the blinking will happen accurately on your timing. While it should be theoretically possible for you to get a series of Z-Wave commands out to a device in a chain all one second apart, practically speaking, it isnā€™t likely to happen, at least not consistently. Remember that your light is not connected to a pin directly controlled by a microcontroller. In the case of any Z-Wave device, itā€™s on the far end of a wireless network that may likely rely on nodes between to relay signals back and forth, adding latency and round-trip time on top of whatever processing the device itself will need to do when it finally gets the message and how quickly it does it.

Thanks for the hint. Iā€™ll try to quote my code with this method.

Before we go for details Iā€™ need help reading the phone status.

The last example I tried was:

local action = luup.variable_get( ā€˜urn:hek:serviceId:FritzBox1ā€™, ā€œActionā€, 9)

Iā€™ve also tried:

local action = luup.variable_get( ā€˜urn:hek:serviceId:FritzBox:1ā€™, ā€œActionā€, 9)

But I only get ā€œFailed to test codeā€ error. Notifications from ā€œFritz!Box Call Logā€ are running fine.