API : Commander la box domotique Fibaro Home Center par des requêtes HTTP
Vous trouverez ici les principales commandes de l' "API" permettant de contrôler le Home Center 3 et Home Center Lite et via des requêtes HTTP.
Cela peut permettre par exemple de développer sa propre interface Web ou application pour smartphone, ou bien aussi de faire dialoguer le Home Center 2 avec d'autres équipements capables de générer des requêtes HTTP.
Signification des variables :
- <LOGIN> = L'utilisateur autorisé à effectuer l'action (ex: admin)
- <PASS> = Votre mot de passe
- <IP> = L'adresse IP de votre Home Center, il est donc nécessaire de lui attribuer une IP fixe (via la rédervation de bail de votre box / routeur Internet)
- <ID> = identifiant du module Z-Wave (comment trouver l'ID d'un module ?)
- name = action (ex: turnOff, turnOn, setValue)
- <Value> = valeur (ex: niveau de variation à 39 % --> arg1=39 )
Exemples :
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=setValue&arg1=<VALUE>
... devient :
http://admin:mot_de_passe@192.168.1.5/api/callAction?deviceID=4&name=turnOff
http://admin:mot_de_passe@192.168.1.5/api/callAction?deviceID=7&name=setValue&arg1=39
Liste des API
- Variateurs
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=setValue&arg1=<VALUE>
- ON/OFF (ex: Wall Plug, micro-modules FGS211, FGS221, etc.)
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=turnOn
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=turnOff
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=setValue&arg1=<VALUE>
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=setAjar
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=stop
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=turnOff
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=turnOn
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=setColor&arg1=<VALUE>&arg2=<VALUE>&arg3=<VALUE>&arg4=<VALUE>
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=startProgram&arg1=<PROGRAM ID>
- Modules virtuels
ID = device ID
arg1 = button ID
arg2 = slider value (only for slider)
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=pressButton&arg1=<BUTTON ID>
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=setSlider&arg1=<SLIDER ID>&arg2=<VALUE>
- Scenes
ID = SceneID
http://<LOGIN>:<PASS>@<IP>/api/sceneControl?id=<SCENE ID>&action=start
http://<LOGIN>:<PASS>@<IP>/api/sceneControl?id=<SCENE ID>&action=stop
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=setTargetLevel&arg1=<TEMP VALUE>
http://<LOGIN>:<PASS>@<IP>/api/callAction?deviceID=<ID>&name=setTime&arg1=<TIME VALUE>
- Notifications
ID = Device (Iphone, e-mail et cetera)
arg1 = Notification template
http://<LOGIN>:<PASS>@<IP>/api/callActiondeviceID=9&name=sendDefinedPushNotification&arg1=1
- Panneau "Energie"
http://<LOGIN>:<PASS>@<IP>/api/energy/now-3600/now/single/devices/power/58
- Récupérations d'états et de valeurs par requettes JSON :
http://<LOGIN>:<PASS>@<IP>/api/rooms
http://<LOGIN>:<PASS>@<IP>/api/scenes
http://<LOGIN>:<PASS>@<IP>/api/devices
http://<LOGIN>:<PASS>@<IP>/api/devices?id=316 # Specific value of a device
http://<LOGIN>:<PASS>@<IP>/api/virtualDevices
http://<LOGIN>:<PASS>@<IP>/api/globalVariables
http://<LOGIN>:<PASS>@<IP>/api/weather
http://<LOGIN>:<PASS>@<IP>/api/sections
http://<LOGIN>:<PASS>@<IP>/api/users
http://<LOGIN>:<PASS>@<IP>/api/energy/now-3600/now/single/devices/power/58
etc.
- Modification / création de variables
curl -X PUT -d '{"name": "Test", "value": "122"}' http://admin:admin@192.16...globalVariables
curl -X POST -d 'name=newvariable&value=0' .....
curl -X PUT -d '{"name":"newvariable", "value":"0", "isEnum":true, "enumValues":["0", "1"]}' .....
http://forum.fibaro.com/viewtopic.php?t=1252&postdays=0&postorder=asc&start=30
Trouver l'ID d'un module Z-Wave :

Recommandez cet article
TweeterCes articles pourraient aussi vous intéresser