Re: [Plugin Officiel][Sujet Principal] Harmony Hub
Publié : 24 sept. 2017, 17:07
oui, il fonctionne très bien
Forum sur Jeedom
https://www.jeedom.com/forum/
Bonjour,soofiane84 a écrit : ↑26 sept. 2017, 16:40Bonjour,
j'ai une Harmony Companion, je souhaite exploiter les boutons de contrôle domotique pour envoyer des commandes à Jeedom. le problème je ne trouve pas comment créer un équipement domotique (bidon) qui peut envoyer des signaux IR via ces boutons.
Merci d'avance.
Merci pour cette réponse, c'est pile poile ce que je souhaite. juste une petite question, le script huepnp il faut l'installer sur la même machine que Jeedom ?arnog23 a écrit : ↑26 sept. 2017, 17:36Bonjour,soofiane84 a écrit : ↑26 sept. 2017, 16:40Bonjour,
j'ai une Harmony Companion, je souhaite exploiter les boutons de contrôle domotique pour envoyer des commandes à Jeedom. le problème je ne trouve pas comment créer un équipement domotique (bidon) qui peut envoyer des signaux IR via ces boutons.
Merci d'avance.
Pour ma part, j'ai mis en place ce qui est évoqué dans ce post viewtopic.php?f=142&t=7512&p=429582&hil ... np#p429582
Le lien direct : https://sites.google.com/site/au66bis/l ... ny/hueupnp.
Cela me permet d'utiliser les 4 boutons de ma télécommande Harmony réservés à la domotique (Les 2 boutons prises et les 2 boutons lumières) en faisant des appels HTTP. Soit 8 actions au total en distinguant les appuis courts/longs.
Ca marche nickel et pas de délai contrairement aux activités qui ne sont vérifier que toutes les minutes.
Oui, c'est ce que j'ai fait dans un répertoire totalement independant de Jeedom pour éviter de l'écraser lors des mises à jour.soofiane84 a écrit : ↑26 sept. 2017, 19:33Merci pour cette réponse, c'est pile poile ce que je souhaite. juste une petite question, le script huepnp il faut l'installer sur la même machine que Jeedom ?arnog23 a écrit : ↑26 sept. 2017, 17:36Bonjour,soofiane84 a écrit : ↑26 sept. 2017, 16:40Bonjour,
j'ai une Harmony Companion, je souhaite exploiter les boutons de contrôle domotique pour envoyer des commandes à Jeedom. le problème je ne trouve pas comment créer un équipement domotique (bidon) qui peut envoyer des signaux IR via ces boutons.
Merci d'avance.
Pour ma part, j'ai mis en place ce qui est évoqué dans ce post viewtopic.php?f=142&t=7512&p=429582&hil ... np#p429582
Le lien direct : https://sites.google.com/site/au66bis/l ... ny/hueupnp.
Cela me permet d'utiliser les 4 boutons de ma télécommande Harmony réservés à la domotique (Les 2 boutons prises et les 2 boutons lumières) en faisant des appels HTTP. Soit 8 actions au total en distinguant les appuis courts/longs.
Ca marche nickel et pas de délai contrairement aux activités qui ne sont vérifier que toutes les minutes.
Désolé pour le copier/coller trop rapide. Voici le lien complet :
arnog23 a écrit : ↑26 sept. 2017, 20:48Oui, c'est ce que j'ai fait dans un répertoire totalement independant de Jeedom pour éviter de l'écraser lors des mises à jour.soofiane84 a écrit : ↑26 sept. 2017, 19:33Merci pour cette réponse, c'est pile poile ce que je souhaite. juste une petite question, le script huepnp il faut l'installer sur la même machine que Jeedom ?arnog23 a écrit : ↑26 sept. 2017, 17:36
Bonjour,
Pour ma part, j'ai mis en place ce qui est évoqué dans ce post viewtopic.php?f=142&t=7512&p=429582&hil ... np#p429582
Le lien direct : https://sites.google.com/site/au66bis/l ... ny/hueupnp.
Cela me permet d'utiliser les 4 boutons de ma télécommande Harmony réservés à la domotique (Les 2 boutons prises et les 2 boutons lumières) en faisant des appels HTTP. Soit 8 actions au total en distinguant les appuis courts/longs.
Ca marche nickel et pas de délai contrairement aux activités qui ne sont vérifier que toutes les minutes.
Désolé pour le copier/coller trop rapide. Voici le lien complet :
https://sites.google.com/site/au66bis/l ... ny/hueupnp
Code : Tout sélectionner
# Some Global Variables
standard = {
#Start with a '-d' to force debug mode
'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')),
])
Code : Tout sélectionner
python hueUpnp.py
2017-09-26 21:13:34,606 [DEBUG] Adding device: PC WOL - type: script_handler
2017-09-26 21:13:34,606 [DEBUG] Adding device: Wemo Outlet - type: script_handler
2017-09-26 21:13:34,607 [DEBUG] Adding device: Wemo Light - type: script_handler
2017-09-26 21:13:34,607 [INFO ] hueUpnp: Server starting
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "hueUpnp.py", line 173, in run
sockresp.bind((CONFIG.standard['IP'], CONFIG.standard['UPNP_PORT']))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 99] Cannot assign requested address
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "hueUpnp.py", line 142, in run
sock.bind((CONFIG.standard['IP'],0))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 99] Cannot assign requested address
2017-09-26 21:13:34,614 [INFO ] hueUpnp: Starting HTTP server for 192.168.1.200:8080
2017-09-26 21:13:34,615 [INFO ] hueUpnp: Http Socket Error: [Errno 99] Cannot assign requested address
2017-09-26 21:13:34,616 [INFO ] hueUpnp: Waiting for connections to end before exiting
Traceback (most recent call last):
File "hueUpnp.py", line 703, in <module>
run(hueUpnp_config);
File "hueUpnp.py", line 651, in run
httpd.stop()
File "hueUpnp.py", line 262, in stop
self.server.shutdown()
AttributeError: 'Httpd' object has no attribute 'server'
Voici les notes que j'avais prises :soofiane84 a écrit : ↑26 sept. 2017, 21:20arnog23 a écrit : ↑26 sept. 2017, 20:48Oui, c'est ce que j'ai fait dans un répertoire totalement independant de Jeedom pour éviter de l'écraser lors des mises à jour.soofiane84 a écrit : ↑26 sept. 2017, 19:33
Merci pour cette réponse, c'est pile poile ce que je souhaite. juste une petite question, le script huepnp il faut l'installer sur la même machine que Jeedom ?
Désolé pour le copier/coller trop rapide. Voici le lien complet :
https://sites.google.com/site/au66bis/l ... ny/hueupnp
Je galère pour la configuration du fichier, j'ai juste modifier l'ip, pour le reste je sais pas quoi mettre, par exemple GATEWAYIP ou HTTP_PORT.
j'ai cette erreur :Code : Tout sélectionner
# Some Global Variables standard = { #Start with a '-d' to force debug mode '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')), ])
merci pour ton aideCode : Tout sélectionner
python hueUpnp.py 2017-09-26 21:13:34,606 [DEBUG] Adding device: PC WOL - type: script_handler 2017-09-26 21:13:34,606 [DEBUG] Adding device: Wemo Outlet - type: script_handler 2017-09-26 21:13:34,607 [DEBUG] Adding device: Wemo Light - type: script_handler 2017-09-26 21:13:34,607 [INFO ] hueUpnp: Server starting Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "hueUpnp.py", line 173, in run sockresp.bind((CONFIG.standard['IP'], CONFIG.standard['UPNP_PORT'])) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 99] Cannot assign requested address Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "hueUpnp.py", line 142, in run sock.bind((CONFIG.standard['IP'],0)) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 99] Cannot assign requested address 2017-09-26 21:13:34,614 [INFO ] hueUpnp: Starting HTTP server for 192.168.1.200:8080 2017-09-26 21:13:34,615 [INFO ] hueUpnp: Http Socket Error: [Errno 99] Cannot assign requested address 2017-09-26 21:13:34,616 [INFO ] hueUpnp: Waiting for connections to end before exiting Traceback (most recent call last): File "hueUpnp.py", line 703, in <module> run(hueUpnp_config); File "hueUpnp.py", line 651, in run httpd.stop() File "hueUpnp.py", line 262, in stop self.server.shutdown() AttributeError: 'Httpd' object has no attribute 'server'
Edit : j'ai résolu mon problème, j'ai pris le mauvais fichier de config.
ça marche super bien, réactivité immédiate.
Merci!!!!!!!!!
Edit2: je suis un peu perdu, peux tu me dire comment tu as fais pour le lancer autant que service au démarrage.
Merci a nouveau.
Ok merci beaucoup pour ton aide,arnog23 a écrit : ↑27 sept. 2017, 10:58Voici les notes que j'avais prises :soofiane84 a écrit : ↑26 sept. 2017, 21:20arnog23 a écrit : ↑26 sept. 2017, 20:48
Oui, c'est ce que j'ai fait dans un répertoire totalement independant de Jeedom pour éviter de l'écraser lors des mises à jour.
Désolé pour le copier/coller trop rapide. Voici le lien complet :
https://sites.google.com/site/au66bis/l ... ny/hueupnp
Je galère pour la configuration du fichier, j'ai juste modifier l'ip, pour le reste je sais pas quoi mettre, par exemple GATEWAYIP ou HTTP_PORT.
j'ai cette erreur :Code : Tout sélectionner
# Some Global Variables standard = { #Start with a '-d' to force debug mode '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')), ])
merci pour ton aideCode : Tout sélectionner
python hueUpnp.py 2017-09-26 21:13:34,606 [DEBUG] Adding device: PC WOL - type: script_handler 2017-09-26 21:13:34,606 [DEBUG] Adding device: Wemo Outlet - type: script_handler 2017-09-26 21:13:34,607 [DEBUG] Adding device: Wemo Light - type: script_handler 2017-09-26 21:13:34,607 [INFO ] hueUpnp: Server starting Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "hueUpnp.py", line 173, in run sockresp.bind((CONFIG.standard['IP'], CONFIG.standard['UPNP_PORT'])) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 99] Cannot assign requested address Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "hueUpnp.py", line 142, in run sock.bind((CONFIG.standard['IP'],0)) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 99] Cannot assign requested address 2017-09-26 21:13:34,614 [INFO ] hueUpnp: Starting HTTP server for 192.168.1.200:8080 2017-09-26 21:13:34,615 [INFO ] hueUpnp: Http Socket Error: [Errno 99] Cannot assign requested address 2017-09-26 21:13:34,616 [INFO ] hueUpnp: Waiting for connections to end before exiting Traceback (most recent call last): File "hueUpnp.py", line 703, in <module> run(hueUpnp_config); File "hueUpnp.py", line 651, in run httpd.stop() File "hueUpnp.py", line 262, in stop self.server.shutdown() AttributeError: 'Httpd' object has no attribute 'server'
Edit : j'ai résolu mon problème, j'ai pris le mauvais fichier de config.
ça marche super bien, réactivité immédiate.
Merci!!!!!!!!!
Edit2: je suis un peu perdu, peux tu me dire comment tu as fais pour le lancer autant que service au démarrage.
Merci a nouveau.
Il faut modifier la variable HUEUPNPDIR=/usr/share/hue-upnp par HUEUPNPDIR=/##TON_REPERTOIRE##/hue-upnp-master dans le fichier start-cript.howto
sudo cp start-script.howto /etc/init.d/hueUpnp
sudo chmod 755 /etc/init.d/hueUpnp
sudo update-rc.d hueUpnp defaults
=> Message d'erreur suivant : insserv: warning: script 'full' missing LSB tags and overrides
=> mais ne semble pas poser problème
update-rc.d -f hueUpnp remove => Pour ne plus que le script s'execute automatiquement au démarrage.
./hueUpnp start
service hueUpnp start
Merci pour ton aide, tout fonctionne correctement.arnog23 a écrit :Oui, je lance le service au démarrage. C'est juste que j'ai mis la commande dans mes notes au cas où j'avais besoin de l'enlever.
salut,arnog23 a écrit : ↑27 sept. 2017, 10:58Voici les notes que j'avais prises :soofiane84 a écrit : ↑26 sept. 2017, 21:20arnog23 a écrit : ↑26 sept. 2017, 20:48
Oui, c'est ce que j'ai fait dans un répertoire totalement independant de Jeedom pour éviter de l'écraser lors des mises à jour.
Désolé pour le copier/coller trop rapide. Voici le lien complet :
https://sites.google.com/site/au66bis/l ... ny/hueupnp
Je galère pour la configuration du fichier, j'ai juste modifier l'ip, pour le reste je sais pas quoi mettre, par exemple GATEWAYIP ou HTTP_PORT.
j'ai cette erreur :Code : Tout sélectionner
# Some Global Variables standard = { #Start with a '-d' to force debug mode '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')), ])
merci pour ton aideCode : Tout sélectionner
python hueUpnp.py 2017-09-26 21:13:34,606 [DEBUG] Adding device: PC WOL - type: script_handler 2017-09-26 21:13:34,606 [DEBUG] Adding device: Wemo Outlet - type: script_handler 2017-09-26 21:13:34,607 [DEBUG] Adding device: Wemo Light - type: script_handler 2017-09-26 21:13:34,607 [INFO ] hueUpnp: Server starting Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "hueUpnp.py", line 173, in run sockresp.bind((CONFIG.standard['IP'], CONFIG.standard['UPNP_PORT'])) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 99] Cannot assign requested address Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "hueUpnp.py", line 142, in run sock.bind((CONFIG.standard['IP'],0)) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 99] Cannot assign requested address 2017-09-26 21:13:34,614 [INFO ] hueUpnp: Starting HTTP server for 192.168.1.200:8080 2017-09-26 21:13:34,615 [INFO ] hueUpnp: Http Socket Error: [Errno 99] Cannot assign requested address 2017-09-26 21:13:34,616 [INFO ] hueUpnp: Waiting for connections to end before exiting Traceback (most recent call last): File "hueUpnp.py", line 703, in <module> run(hueUpnp_config); File "hueUpnp.py", line 651, in run httpd.stop() File "hueUpnp.py", line 262, in stop self.server.shutdown() AttributeError: 'Httpd' object has no attribute 'server'
Edit : j'ai résolu mon problème, j'ai pris le mauvais fichier de config.
ça marche super bien, réactivité immédiate.
Merci!!!!!!!!!
Edit2: je suis un peu perdu, peux tu me dire comment tu as fais pour le lancer autant que service au démarrage.
Merci a nouveau.
Il faut modifier la variable HUEUPNPDIR=/usr/share/hue-upnp par HUEUPNPDIR=/##TON_REPERTOIRE##/hue-upnp-master dans le fichier start-cript.howto
sudo cp start-script.howto /etc/init.d/hueUpnp
sudo chmod 755 /etc/init.d/hueUpnp
sudo update-rc.d hueUpnp defaults
=> Message d'erreur suivant : insserv: warning: script 'full' missing LSB tags and overrides
=> mais ne semble pas poser problème
update-rc.d -f hueUpnp remove => Pour ne plus que le script s'execute automatiquement au démarrage.
./hueUpnp start
service hueUpnp start
Code : Tout sélectionner
root@jeedom:~# time sudo /usr/bin/python /var/www/html/plugins/harmonyhub/core/class/../../3rdparty/PyHarmony/harmony/__main__.py --harmony_ip 192.168.1.34 send_command --device_id 46657239 --command Menu
Command Sent
real 0m4.922s
user 0m0.390s
sys 0m0.020s
Code : Tout sélectionner
#!/bin/bash
#examples:
#./hue-upnp-helper.sh "Wemo Light" on true
#./hue-upnp-helper.sh "hue light 2" xy [0.4544,0.511]
#./hue-upnp-helper.sh "My toaster" ct 396
#./hue-upnp-helper.sh "PC WOL" bri 254
echo "$0 called with '$1' '$2' '$3'"
DEVICE1="Plafonnier"
DEVICE2="Spots"
#HUE LIGHT 1 (DEVICE1)
if [ "$1" == "$DEVICE1" ]; then
echo "Running directive for $DEVICE1"
#ON/OFF Directive
if [ "$2" == "on" ]; then
if [ "$3" == "true" ]; then
./jeedom/jeedom-helper.sh 711 on
elif [ "$3" == "false" ]; then
./jeedom/jeedom-helper.sh 712 off
fi
#BRIGHTNESS
elif [ "$2" == "bri" ]; then
./jeedom/jeedom-helper.sh 710 bri $3
fi
elif [ "$1" == "$DEVICE2" ]; then
echo "Running directive for $DEVICE2"
#ON/OFF Directive
if [ "$2" == "on" ]; then
if [ "$3" == "true" ]; then
./jeedom/jeedom-helper.sh 1015 on
elif [ "$3" == "false" ]; then
./jeedom/jeedom-helper.sh 1016 off
fi
#BRIGHTNESS
elif [ "$2" == "bri" ]; then
./jeedom/jeedom-helper.sh 1014 bri $3
fi
else
echo "Error: Unknown Device '$1' command=$2 $3"
exit 1
fi
Code : Tout sélectionner
if [[ $# -eq 0 ]] ; then
echo 'some message'
exit 1
fi
API_KEY="JEEDOM_KEY"
JEEDOM_URL="http://127.0.0.1/core/api/jeeApi.php"
CMD_ID=$1
if [ "$2" == "on" ] || [ "$2" == "off" ] ; then
curl -s -S -H "Accept: application/json" \
-d "apikey=${API_KEY}" \
-d "type=cmd" \
-d "id=${CMD_ID}" \
${JEEDOM_URL}
elif [ "$2" == "bri" ]; then
## Calcul pourcent value
MAX_BRI=254
BRI_VALUE=$3
CMD_VALUE=$(awk "BEGIN { pc=100*${BRI_VALUE}/${MAX_BRI}; i=int(pc); round=(pc-i<0.5)?i:i+1; print round == 0 ? 1 : round == 100 ? 99 : round }")
curl -s -S -H "Accept: application/json" \
-d "apikey=${API_KEY}" \
-d "type=cmd" \
-d "id=${CMD_ID}" \
-d "slider=${CMD_VALUE}" \
${JEEDOM_URL}
fi
Code : Tout sélectionner
2017-12-03 19:27:29,030 [INFO ] hueUpnp: 192.168.86.51: reading http request
2017-12-03 19:27:29,038 [DEBUG] hueUpnp: Header-Length=174 Content-Length=19
2017-12-03 19:27:29,041 [DEBUG] hueUpnp: 192.168.86.51: HTTP Request: PUT /api/lights/1/state HTTP/1.1
connection: close, TE
content-length: 19
user-agent: LuaSocket 2.0.2
te: trailers
content-type: application/json
host: 192.168.86.2
{"on":true,"bri":0}
2017-12-03 19:27:29,042 [DEBUG] hueUpnp: 192.168.86.51 Got PUT request to do something
2017-12-03 19:27:29,042 [DEBUG] hueUpnp: 192.168.86.51 Content data=---
{"on":true,"bri":0}
---
2017-12-03 19:27:29,042 [DEBUG] hueUpnp: 192.168.86.51 Parsed Content data=---
{u'on': True, u'bri': 0}
---
2017-12-03 19:27:29,042 [DEBUG] device number:0
2017-12-03 19:27:29,042 [DEBUG] In set method. Data={u'on': True, u'bri': 0}
2017-12-03 19:27:29,042 [DEBUG] bri received: 0
2017-12-03 19:27:29,042 [DEBUG] also on received: True
2017-12-03 19:27:29,043 [DEBUG] Running: /volume1/Logiciels/hue-upnp-master/hue-upnp-helper.sh HTPC on true
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 599, 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 655, in __init__
self.handle()
File "hueUpnp.py", line 369, in handle
dst = CONFIG.devices[deviceNum].set(parsedContent)
File "hueUpnp.py", line 476, in set
ret = self.set_on()
File "hueUpnp.py", line 546, in set_on
p = subprocess.Popen([self.program, self.name, "on", "true"])
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Code : Tout sélectionner
def set_on(self):
# Use external program to do "stuff" if desired
L.debug("Running: {} {} on true".format(self.program, self.name))
#Note processes return 0 on success and Popen does not wait
p = subprocess.Popen([self.program, self.name, "on", "true"])
p.communicate() #wait to complete
return not p.returncode
Mais je ne comprends pas comment on fait le lien entre le bouton de la télécommande avec l'action (moi c'est fermer les volets avec json).python hueUpnp.py
2017-12-03 19:27:03,072 [DEBUG] Adding device: PC WOL - type: script_handler
2017-12-03 19:27:03,073 [DEBUG] Adding device: Wemo Outlet - type: script_handler
2017-12-03 19:27:03,073 [DEBUG] Adding device: Wemo Light - type: script_handler
2017-12-03 19:27:03,074 [INFO ] hueUpnp: Server starting
2017-12-03 19:27:03,082 [INFO ] hueUpnp: Starting HTTP server for 192.168.110.5:3535
2017-12-03 19:27:04,248 [INFO ] hueUpnp: received M-SEARCH from ('192.168.110.22', 60607)
2017-12-03 19:27:04,248 [DEBUG] hueUpnp: ignoring
2017-12-03 19:27:04,248 [DEBUG] hueUpnp: ----------------------
2017-12-03 19:27:04,248 [DEBUG] hueUpnp:
2017-12-03 19:27:05,111 [INFO ] hueUpnp: 192.168.110.39: reading http request
2017-12-03 19:27:05,112 [DEBUG] hueUpnp: 192.168.110.39: HTTP Request: GET /description.xml HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Accept: text/xml, application/xml
User-Agent: DAFUPnP
Host: 192.168.110.5:3535
2017-12-03 19:27:05,112 [INFO ] hueUpnp: 192.168.110.39 Sent HTTP description.xml Response
2017-12-03 19:27:05,112 [DEBUG] hueUpnp: -------------------------------
2017-12-03 19:27:05,113 [DEBUG] hueUpnp:
2017-12-03 19:27:41,813 [INFO ] hueUpnp: received M-SEARCH from ('192.168.110.39', 63753)
2017-12-03 19:27:41,813 [DEBUG] hueUpnp: ignoring
2017-12-03 19:27:41,814 [DEBUG] hueUpnp: ----------------------
2017-12-03 19:27:41,814 [DEBUG] hueUpnp:
2017-12-03 19:27:42,813 [INFO ] hueUpnp: received M-SEARCH from ('192.168.110.39', 63753)