Great works fine!
-
Fritzbox WLAN Script SomeOneAtHome
-
Since I use the FritzBox Version 6.83 I got sometimes this error message:
error [pimatic-shell-execute]: [ShellPresenceSensor#iphone] Error: Command failed: /bin/sh -c /home/pi/someOneAtHome_new.php AA:BB:CC:DD:EE:FF PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /home/pi/someOneAtHome_new.php:19 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://fritz.bo...', 'urn:dslforum-or...', 1, 0) #1 /home/pi/someOneAtHome_new.php(19): SoapClient->__call('GetSpecificHost...', Array) #2 /home/pi/someOneAtHome_new.php(19): SoapClient->GetSpecificHostEntry(Object(SoapParam)) #3 {main} thrown in /home/pi/someOneAtHome_new.php on line 19
It must some kind of timeout of the Fritzbox because the connection is established.
Has anyone else this error? -
What interval settings are you set for your device? If interval is to short, you can get a timeout, 'cause the box is busy.
This script will start with each request from pimatic. If the request time (interval) is to short in the meanwhile you ask to much often and don’t get an answer. The result is a timeout. My interval time is set to 60000 and works very well.
-
The interval is set to 30000, which worked for some months.
But i found out that i have some packet drops on the connection between pimatic and fritzbox.
I try to fix this and have a look if it still happens. -
If you really have drop packages then sort this issue out, otherwise i recommend to set interval to 60000. Each minute is enough time to check if device is in network or not. The fritzbox has so many features and all this features takes cpu time also. And the CPU in this box has much to do with other things. So my suggestion is to set interval settings higher that the box will not get so much pressure. But you can try it out when the box will not respond by manual execute via console on your pi. Start request in short times and sort out the limit. I investigate this in throttling up request and best value is 60000.
I’m not totally an expert with soap requests and i don’t know why the box will sometimes not respond on querys. Otherwise i can modify the code to check if a response is given, when not take the script in a waiting position an try again. PHP on console via bash is able to work like a c or python code. This #!/usr/bin/php opens so much doors that you can run php like a normal program. But if we do that we must secure that not a second request comes up we need also time in interval settings. Otherwise we can run a php as program and php write a file like a json to request in realtime if a network device is on or of… But this are ways they we don’t need in real time and break out the hole system… I don’t have any experience in coffee script to write a plugin…
-
@Swen i have no Problems i use interval 120000… I have a Fritzbox 7490 with Version 06.83 !
-
Thanks for your feedback. Your time interval is set well. I think that’s the reason that should be OK.
-
@Swen i dont think its a Intervall problem i have also used a long time a short Intervall but i checked thats make no matter because the fritzbox will not refreash the info that fast …so i changed it to a high Intervall.
But i only use the Script for one device, for my other devices i use the ping plugin…maybe it will be a problem with multiple devices.
-
It was definitly the packet drop which caused the problem. Fixed the connection and now it works.
-
Awesome. Thanks for your feedback.
-
Hello, i have a question.
I have copy the Script and it works fine. But how can i put it in Pimatic?
I would to check if my Android Handy is present and then turn on/off a device.Best Regards.
-
you can use here a shell presence sensor
{ "command": "/home/pi/someOneAtHome.php 192.168.178.20 1 0", "id": "test", "name": "WindowsPhone Fritzbox hack", "class": "ShellPresenceSensor", "interval": 150, "autoReset": false }
- in the command is the path to the script
- the rest self explanatory i think
-
Thank you very much. It works
-
Now i have a Problem. When i start the script i became the Message “Illegal instruction”.
From yesterday to today works fine. But since 1 hour i became the Error.
I have restart the FritzBox and the Raspberry on which PiMatic is installed.My Config:
{ "command": "/home/pi/Presence.php AC:37:43:A0:19:B9 1 0", "interval": 120000, "autoReset": false, "xPresentLabel": "Zuhause", "xAbsentLabel": "Nicht Zuhause", "id": "phil-handy", "name": "Philipp", "class": "ShellPresenceSensor" },
-
What does it mean if you write “i start the script”.
Are you starting the php script and get this error? Are you get this error with more information? Where are you get this error?
-
When i start the php Script i become this Output:
user@raspberry:~ $ php /home/pi/Presence.php AC:37:43:A0:19:B9
Illegal instructioni get this Error in Putty and in Pimatic.
-
This post is deleted!
-
#!/usr/bin/php did you have this on first line??? if yes then you don’t need php! you need only path to script and the script must be executable.
-
This post is deleted!
-
@philreis which version of php are you using? Older versions of PHP had an issue with the soap client extensions.
Both versions of the script work fine at my end with PHP 5.6.27-0+deb8u1"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law