Open jec44 opened 8 years ago
I have also this error ! Exception happened during processing of request from ('192.168.0.121', 48282) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 649, in init self.handle() File "hueUpnp.py", line 359, in handle dst = CONFIG.devices[deviceNum].set(parsedContent) File "hueUpnp.py", line 464, in set ret = self.set_on() File "hueUpnp.py", line 516, in set_on p = subprocess.Popen([self.program, self.name, "on", "true"]) File "/usr/lib/python2.7/subprocess.py", line 679, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child raise child_exception
For that 'Exec format error', can you tell me what you have set for your "devices" list in the config? The error makes me think that either 'self.program' or 'self.name' is in an unusual format and is causing the Popen to fail. Also, make sure the 'self.program' exists and is executable.
As for domoticz, I know very little about it. Just doing a little research I see it a great open source home automatic suite. I think this page would be perfect for you: https://www.domoticz.com/wiki/Scripts
It has a bunch of sample scripts in multiple scripting languages. I don't know anything about your setup (or domoticz for that matter), but if you can get a script to do your on/off activity, it will be possible to drop it into hue-upnp.py.
Let me know how I can further assist.
This is my config : device name are in French :-)
standard = {
'DEBUG': True,
#Standard Broadcast IP UPNP
'BCAST_IP': "239.255.255.250",
#Standard UPNP Port
'UPNP_PORT': 1900,
# Seconds between upnp broadcast
'BROADCAST_INTERVAL': 200,
# Callback http webserver IP (this machine)
'IP': "192.168.0.30",
# HTTP-port to serve icons, xml, json (80 is most compatible but requires root)
'HTTP_PORT': 3535,
# shouldn't matter but feel free to adjust
'GATEWAYIP': "192.168.0.254",
# shouldn't matter but feel free to adjust
'MACADDRESS': "b8:27:eb:22:80:5c",
# Set default ON state for all device to "true" or "false" when first starting
'DEFAULT_ON_STATE': "false",
# Set default BRIGHTNESS state for all device to a value 0-254 when first starting
'DEFAULT_BRI_STATE': 0,
}
from collections import OrderedDict devices = OrderedDict([
('Salon', ('script_handler', './hue-upnp-helper.sh')),
('Volets', ('script_handler', './hue-upnp-helper.sh')),
('Buffet', ('script_handler', './hue-upnp-helper.sh')),
])
1 / I created salon_on.sh and salon_off.sh for exemple (make exec) 2 / I changed hue-upnp-helper.sh : echo "$0 called with '$1' '$2' '$3'"
DEVICE1="Salon" DEVICE2="Volets" DEVICE3="Buffet"
if [ "$1" == "$DEVICE1" ]; then
echo "Running directive for $DEVICE1"
if [ "$2" == "on" ]; then if [ "$3" == "true" ]; then echo 1 on true
./domoticz_salon_on.sh
elif [ "$3" == "false" ]; then
echo 1 on false
#INSERTING SALON OFF COMMAND
./domoticz_salon_off.sh
fi
fi .............
Maybe something more simple can be done ? What is exactly 'self.program' or 'self.name' ?
Thanks for your help
if i run manually ./hue-upnp-helper.sh Salon on true it work ! But not in the script !
Hmm, if you can manually run the script, then you should be fine. My next suspicion is it has to do with the path to the scripts. Instead of using "./" in front of the scripts, could you try fully qualifying them? For example, if your script is located in "/home/username/" could you update the config to contain:
'Salon', ('script_handler', '/home/username/hue-upnp-helper.sh'))
And also update the hue-upnp-helper.sh to contain the full paths as well. For example:
/home/username/domoticz_salon_on.sh
this is what i found : add Use shell=True if you're passing a string to subprocess.call
But i don't know where to change it ?
it work ! simple .... file format was not correct, i install dos2unix sudo apt-get install dos2unix and apply on SH files ! I can now control what i want on Domoticz ! Thanks a lot for your help, and i suggest to develop script for Domoticz because your scripts can interress a lot Domoticz users ! Great job !
Thanks for the feedback. Good the know that windows format can cause this problem. I wouldn't have thought it would matter. I'd be more than will to host sample Domoticz if you have any to help out others.
Hi
I'am using Domoticz to control my home. All the script is working fine, but looking for adaptation like Wemo script (blabla. sh ON) to on or off ligts, could you help me ? https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's