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

The Fritz!Box is a router with build in VOIP and Dect functionality. With this plugin you can trigger scenes on incoming calls, outgoing calls and hangup.

Code and documentation:
http://code.mios.com/trac/mios_fritzbox/

@hek,
I’d recommend you start with a working set of files, and then modify them incrementally to add the stuff you need.

The nearest, and simplest, I could find would be this:
http://code.mios.com/trac/mios_monoprice-hdmi-switch/browser/trunk/I_MonopriceMatrixSwitch1.xml

With the substitutions for [tt][/tt] tag, along with the [tt]luup.io.write[/tt] calls and the [tt][/tt] declaration (as you’ve already done) along with any needed changes for ServiceId’s, DeviceTypes (etc).

The Plugin needs both a D_ file and an I_ file (minimally). Others will come later as you add UI (etc).

Once you’ve uploaded the Plugin files to Vera, you need to instantiate a Device [a Plugin instance of sorts] from them. This is also exposed via the Apps/Develop Apps menu/area, but is [roughly] described in this:
http://wiki.micasaverde.com/index.php/Install_LUUP_Plugins

On that device, a small number of attributes exist, like “ip” (the ipAddress that the Monoprice example code uses to connect)… these can be configured once the Device has been created from the Plugin [files]

PS: When something is installed from apps.mios.com, it’s basically installing the Plugin [files] and creating the “first” Device [instance] for you in a single step.

Thanks @guessed. The D_FritzBox.xml did the trick. Also I didn’t know that I needed to create the device manually.

It started logging incoming/outgoing calls now!

If I would like create events that scenes can trigger on. How do I do that? Or what is the best strategy?

Events happen when a variable changes on the device. You will need to make your implementation call luup.variable_set() to set a variable. You choose which variable.

The plugin’s static JSON file contains a list of events, and which variable that the Luup engine should watch, and what value the variable should take.

It’s best to look at source code of existing plugins that have events to see how they are coded. Look at one of the alarm panel plugins for something vaguely similar to what you are looking to do.

Ok, i’ve come a little bit further. Plese guide me.

When the “Action” and “Phone” variables changes it doesn’t show in UI. What am I doing wrong?

I can select to trigger on my “Action” in scenes but they never gets triggered… something is not connected correctly…

It could be a ton of things. Most likely you have a typo or you haven’t followed an example closely enough. Post your D_. files, but all we can do is give them a visual inspection, and it’s easy to miss the real error.

I have posted everything in the top post.

One problem I see is that your spelling of the service ID in the device XML file:

<serviceId>urn:hek:serviceId:FitzBox</serviceId>

doesn’t match the spelling in the device JSON file:

"Service": "urn:hek:serviceId:FritzBox1"

Attention to detail is very important in getting these files right. Vera is utterly unforgiving of typos.

great thanks… i’ll try it tonight.

Found some more typos… But I finally got it working. Triggering scenes works good. I still have a couple of questions.

Has anyone documented how layout works of texts/buttons in json file on dashboard (using top,x,left:y etc) ?

What happends if the connection “goes down”? Will vera/plugin try to establish a new connection again by itself?

How do I get a mios svn and “market” account to upload the plugin?

There’s a couple of wiki pages: http://wiki.micasaverde.com/index.php/UI4_UI5_Migration http://wiki.micasaverde.com/index.php/Luup_plugins:_Static_JSON_file

That’s all I know.

What happends if the connection "goes down"? Will vera/plugin try to establish a new connection again by itself?

I don’t think so. I’ve had to restart the Luup engine a few times because the LAN fell over; it wouldn’t surprise me if it was because it just gives up on a dropped connection.

How do I get a mios svn and "market" account to upload the plugin?

One of the MCV people does them.

Hi @hek

Very interesting stuff… I’m looking at the Fritz!Box web page now… :wink:

As i mention in our Sonos plugin thread exchange earlier on; the reason i was so curious about your plans to integrate your phone with Sonos was because, I have freePBX running and was looking at the Google TTS plugin for that (GitHub - phwhite/texttospeech: FreePBX Text-To-Speech Module (Cepstral Swift, eSpeak, fLite, Google-TTS, Microsoft-TTS)) hence I was curious if you we’re doing a similar thing.

I’d have love to integrate my FreePBX and VoIP line into Vera, but sadly lack the skills to do it.

You must first identify an integration point to freePBX where you can get inbound/outbound calling information.
The Fritz!Box is pretty simple to interact with (just open a connection and listen to port 1012).

You will probably learn a bit by looking at my code. It is pretty minimalistic right now.

What happends if the connection "goes down"? Will vera/plugin try to establish a new connection again by itself?

It should restart. There are cases where it doesn’t detect the situation, but I’ve not seen those since the newer UI5 releases where we had them add Keep-Alive timeouts to those connections.

It’s possible, even with the KA timeouts, to “loose” data due to it not being detected in time.

In general, it’s probably better to periodically “poll”, over the internal connection, the remote device by sending it something. This will also help to force a reconnect when it detects the dead connection.

How do I get a mios svn and "market" account to upload the plugin?

I created you a space, you should see an announcement notice from the system shortly.

I created you a space, you should see an announcement notice from the system shortly.

Great!

Added wikipage and source to the SVN repo.

How do I deploy to the Vera market thing? Is it possible to create a custom icon when adding plugin through market?

Could you add it to plugin wiki index page (where all plugin are being listed)?

How do I deploy to the Vera market thing? Is it possible to create a custom icon when adding plugin through market?
Login, using your cp.mios.com account, to apps.mios.com and it gives you options to publish.
Could you add it to plugin wiki index page (where all plugin are being listed)?
Sorry, but for that one you'll need MCV or to create yourself your own wiki account and request access (etc).

I’ve stopped doing anything on that system due to the vast amount of spam accounts, and MCV’s overall lack of Security maintenance of their systems (wiki in particular, but the others also)

ie. Junk in, Junk out.

Sorry…

I have added my plugin on apps.mios.com. When I press “Install” I get an error in log. See pictures and error message… Why is that?

Shouldn’t the device be createad automatically in my Vera when I press Install? Or doeas that only happen when installing from “Market”?

02      12/08/12 15:56:17.297   JobHandler_LuaUPnP::FetchMissingFiles need to download S_FritzBox.xml <0x2b3ce000>
02      12/08/12 15:56:17.297   JobHandler_LuaUPnP::m_sMissingFile_set S_FritzBox.xml <0x2b3ce000>
03      12/08/12 15:56:24.459   JobHandler_LuaUPnP::Run ready 91 devices installation 35104627 missing S_FritzBox.xml version *1.5.408*  allow_evt: 1 allow_ud: 1 upnp 0 netpnp: 1 reprovision: 0 changed: 0 pMem 0x1039000 start 10727424 diff: 6283264 <0x2b3ce000>

I’ve never tried the test options. Early on, these really didn’t work, and there was a “fine-line” path you could take through the UI that would actually work.

I upload the files, create a new version, and then request approval to publish.

All testing has been done prior to deploying to apps.mios.com

Ok… just wanted o test that my custom icon worked before sending it for approval.
But if it doesn’t work i’ll just send it then…

And now it is in the app-store… how to handle the app? Any guidance? site? helpfile? ??? ::slight_smile: