Page 1 of 1
AVM FritzBox DECT 200 switch supported?
Posted: Sunday 25 January 2015 20:12
by richardh
Hi all,
I'm setting up Domoticz and I was wondering if it would support my AVM Dect200 switches? As a switch they also report temperature and power usage and are controlled through an API on the Fritzbox router (7340 XS4all). If they are not supported right now, will they be in the coming future?
grtz,
richard
dect 200:
http://en.avm.de/products/fritzdect/fritzdect-200/
API info:
http://www.tdressler.net/ipsymcon/fritz_aha.html
Re: AVM FritzBox DECT 200 switch supported?
Posted: Saturday 31 January 2015 11:10
by richardh
I found a working solution. I'm using the python scripts from mperlet from github with simple shellscripts for the on and off commands. They work on my Fritzbox 7340 with fritz!os 6.10 and 3 Fritz!Dect 200 switches.
I followed the tips for getting the Lifx to work with virtual switches and the script:// url.
github:
https://github.com/mperlet/fritzl
Re: AVM FritzBox DECT 200 switch supported?
Posted: Sunday 31 May 2015 11:16
by marigo
Hi Richardh,
I own some dect200 switches from AVM and I also would like them to be triggered by Domoticz. Could you write a step-by-step plan on how to accomplished this action?
Thanks!
Marigo
Re: AVM FritzBox DECT 200 switch supported?
Posted: Tuesday 02 June 2015 20:34
by richardh
Hi,
I'll give it a try:
1. make a fritz (or whatever you like) directory in the scripts dir of domoticz, this way all fritzbox files are in one place
2. install the fritzl.py file from github:
https://github.com/mperlet/fritzl in the fritz directory
3. change the _fritz_url in the fritzl.py file to the right IP address of your fritzbox
4. make a python file in the fritz dir with a name like "Lamp1ON.py" and add:
#!/usr/bin/python
from fritzl import Fritzl
f = Fritzl('YOURPASSWORD')
f.switch_on('087610045959')
5. Replace YOURPASSWORD with your fritzbox password. Replace the AIN ID with your own ID of the Dect200 (see fritzbox interface).
6. Create a virtual switch in domoticz and add the path to the Lamp1ON.py file for the on action with the full path:
script:///home/pi/domoticz/scripts/fritz/Lamp1ON.py
7. now you should be able to switch the light on. For the off action make another python file for Lamp1OFF and replace f.switch_on(AIN....) with f.switch_off(AIN...
I hope you can get it working. If not I'll try to help. Good luck.
Re: AVM FritzBox DECT 200 switch supported?
Posted: Wednesday 03 June 2015 22:42
by marigo
Hi Richardh,
Thank you for your quick reply.
Your tutorial is really good. It worked the first time. Thank you very much for this!
Now I can control the DECT's 200 from Domoticz and make events when to turn on the light that are connected via de DECT's 200.
Top!
Re: AVM FritzBox DECT 200 switch supported?
Posted: Wednesday 10 June 2015 11:35
by Flapsie
So, I am kind of stuck with this to work, and I would need some advise.
I have a Fritz!Box 7490 with two DECT200 switches that I would like to use with Domoticz (because we can

). I am on Domoticz beta V2.2539 on a Raspberry Pi B.
I followed richardh's step-by-step plan, made a script for "On" and one for "Off" next to the fritzl.py script. I also used the tip by Thinkpad (
here) to make sure the scripts have the same owner as the scripts from Domoticz itself (in my case that is "pi"). Also made sure the scripts are executable ("0755"). I must confess I am not a script expert, but it seemed logical to me that in order for a script to be executed it needs to have that permission, right?
Then I added a dummy at "setup"->"hardware", and then a virtual switch.
I noticed that when adding a virtual switch, the fields of the dropdown menu's do not show the selected values. Is that normal behaviour for Domoticz? Or is that something to do with me running the beta (currently V2.2539)? Okay, let's assume using the beta is not relevant: I see a switch item in the "Switches" tab, and by using edit I can add the proper values (e.g. script:///home/pi/domoticz/scripts/fritz/Lamp1ON.py) for the On Action and Off Action.
However, when clicking the icon from default Off to On nothing happens.

Just to be sure, switching the DECT200 on and off from the Fritz!Box interface (or the Fritz!Fon) does work normally.
What I have tried (without success):
- - using two forward slashes instead of three in the script:/// value (the plan says three vs. the edit menu in Domoticz: "(Should start with http:// or script://)"
- removing the space in the AIN between ('08761 0045959') to match the plan (the Fritz!Box interface uses the space)
- giving the 755 permission to all three scripts (1. fritzl.py, 2. TestON.py and 3. TestOFF.py) and making sure each script has the same owner as the scripts from Domoticz itself.
Anything (obvious) I am overlooking?
Edit: the log shows this:
2015-06-10 11:37:45.794 Executing script: /home/pi/domoticz/scripts/fritz/TestON.py
2015-06-10 11:37:45.809 Error: Error executing script command (/home/pi/domoticz/scripts/fritz/TestON.py). returned: 32512
.. and similar for the TestOFF.py script, what does that mean?
Re: AVM FritzBox DECT 200 switch supported?
Posted: Wednesday 10 June 2015 19:19
by richardh
Do you have python installed? If you do test the scripts by running from the command prompt.
Re: AVM FritzBox DECT 200 switch supported?
Posted: Wednesday 10 June 2015 21:10
by Flapsie
richardh wrote:Do you have python installed? If you do test the scripts by running from the command prompt.
I must admit that I had not installed python.

A real beginner error.

My apologies.
I have now installed it (sudo apt-get install python), and it looks like this installed version 2.7.3. Is that the default version of python in Domoticz then?
I have deleted the fritzl directory from the scripts directory, and will start over to make sure I get it right. Thanks for pointing me in the right direction.
Re: AVM FritzBox DECT 200 switch supported?
Posted: Wednesday 10 June 2015 21:30
by richardh
No problem. 2.7.3 is ok.
good luck,
Re: AVM FritzBox DECT 200 switch supported?
Posted: Wednesday 10 June 2015 22:03
by Flapsie
Okay, I am now one step further. Following your plan, and testing a script from the command prompt gives this error output:
error: host not found
Traceback (most recent call last):
File "TestON.py", line 3, in <module>
f = Fritzl('MyFritzboxPassword')
File "/home/pi/domoticz/scripts/fritz/fritzl.py", line 11, in __init__
self.get_sid()
File "/home/pi/domoticz/scripts/fritz/fritzl.py", line 31, in get_sid
challenge = get_challenge.split(
UnboundLocalError: local variable 'get_challenge' referenced before assignment
I thought that "error: host not found" might refer to the space in the AIN ID, but whether or not I use the space in the AIN ID in the TestON.py file, the error output is the same. Also using chmod +x "name of file".py on the ON and OFF and fritzl.py files does not have any effect: the error output is the same.
Is there something wrong with the fritzl.py file? The error output seems to suggest so, but I am not able to figure out what or why.
Re: AVM FritzBox DECT 200 switch supported?
Posted: Wednesday 10 June 2015 22:56
by Flapsie
Flapsie wrote:Okay, I am now one step further. Following your plan, and testing a script from the command prompt gives this error output:
error: host not found
Traceback (most recent call last):
File "TestON.py", line 3, in <module>
f = Fritzl('MyFritzboxPassword')
File "/home/pi/domoticz/scripts/fritz/fritzl.py", line 11, in __init__
self.get_sid()
File "/home/pi/domoticz/scripts/fritz/fritzl.py", line 31, in get_sid
challenge = get_challenge.split(
UnboundLocalError: local variable 'get_challenge' referenced before assignment
I thought that "error: host not found" might refer to the space in the AIN ID, but whether or not I use the space in the AIN ID in the TestON.py file, the error output is the same. Also using chmod +x "name of file".py on the ON and OFF and fritzl.py files does not have any effect: the error output is the same.
Is there something wrong with the fritzl.py file? The error output seems to suggest so, but I am not able to figure out what or why.
Hey, I fixed it! (I don't quite believe it myself...)
I was looking at the fritzl.py file at mperlet's github
here because that's easier than looking at the script in nano, and I noticed line 28 contains "print(u' error: host not found'). So I guessed that this has something to do with the script not being able to find my Fritz!Box (even though the IP is correct). So I changed line 6 back into the default (__fritz_url = u'
http://fritz.box'), and ran the script from the command prompt: succesfully this time!
Same for the virtual switch from within Domoticz.
Thanks very much for your help and putting your step-by-step plan online. I have learned lots today.
Now, let's see if we can also get the temperatures or energy displays from the DECT200 in Domoticz somehow...
Re: AVM FritzBox DECT 200 switch supported?
Posted: Thursday 11 June 2015 22:13
by richardh
nice to hear you've got it working!
the energy readings are in the fritzl.py file and could be exported and placed into domoticz. I haven't done it but the wiki gives some examples of placing values in domoticz. Temperature is not in the fritzl script, but you could add it

Re: AVM FritzBox DECT 200 switch supported?
Posted: Sunday 12 July 2015 8:16
by wieserdk
Hi, maybe you have answer for 2 things:
- are you able to read status of DECT200? I mean that scenario: 1. turn on dect200 in domoticz 2. Turn of dect200 with a dedicated push-button on device 3. domoticz is still showing that device is on
- I was trying to setup power meter in domoticz, and I have no idea how to do it. I couldn't find any documents.
Re: AVM FritzBox DECT 200 switch supported?
Posted: Sunday 12 July 2015 13:39
by richardh
Yes, you can get the status from the DECT200 and put it into Domoticz. The status can be queried with a call like: (f.get_state('AIN-ID')) which will give you 1 or 0 for on or off. Next you can tell domoticz what the status is, for on it would be something like: r = urllib2.urlopen("
http://127.0.0.1:8080/json.htm?type=com ... evice&idx=" + str(dz_index_your_dect200_index) + "&nvalue=1&svalue=" + str(your_dect200) + ";1")
Put this in a python script and run it every couple of minutes and Domoticz knows the status. It would be even better if domoticz would have native support for the dect200's but that is not the case.
Re: AVM FritzBox DECT 200 switch supported?
Posted: Monday 13 July 2015 10:37
by wieserdk
Thanks,
I played a little bit, and I have following python script which is working:
where idx is domoticz device idx.
later, I will try to play with temp sensor.
Re: AVM FritzBox DECT 200 switch supported?
Posted: Monday 13 July 2015 20:59
by richardh
nice !
Re: AVM FritzBox DECT 200 switch supported?
Posted: Saturday 09 July 2016 12:17
by inphower
Hi!!!
Have you solved the script to get Temperature of the Fritz Dect???
Thanks!
Re: AVM FritzBox DECT 200 switch supported?
Posted: Thursday 27 December 2018 21:50
by visioncvg
Hi all,
I can switch dect200 with domoticz nice.
Next is see the consumption, i ll try the script from wieserdk but it will not work at this moment.
Change de password, IDX and ip adress to my domotiz ip.
After change the script i did chmod 755 smart_fritz_power.sh the name of my script.
Some tips to help me ?