Interrupteur Domoticz

 

1°)Domoticz :

Dans Domoticz, créez un capteur virtuel : Réglages->Matériel->VIRTUAL SWITCH ->Créez un capteur virtuel : type « Interrupteur Sélecteur » (le nommer par exemple Alarme cabane de jardin)

Dans Réglages->Dispositifs, récupérez son IDX (exemple 187)

Pour activer un switch la commande est (avec switchcmd ON ou OFF) :

http://<<ip_domoticz>>/json.htm?username=xxxx=&password=xxxxx&type=command&dparam=switchlight&idx=188&switchcmd=On

Il y a aussi la possibilité de commander un switch de type « bascule » :

switchcmd=Toggle

Mais aussi, pour une alarme de déclarer un switch de type « Alerte » et de lui assigner des valeurs et un texte selon la syntaxe

Alert sensor

/json.htm?type=command&param=udevice&idx=IDX&nvalue=LEVEL&svalue=TEXT
  • IDX = id of your device (This number can be found in the devices tab in the column « IDX »)
  • Level = (0=gray, 1=green, 2=yellow, 3=orange, 4=red)
  • TEXT = Text you want to display

http://<<ip_domoticz>>/json.htm?username=xxxx=&password=yyy=&type=command&dparam=udevice&idx=187&nvalue=1&svalue=D%C3%A9tection

2°) Montage :

bro chesReliez CH_PD et VCC pour activer l’ESP

example_button

Résistance 10k

3°) Code :

 

Sketch :

 

Références :

https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s

http://www.forward.com.au/pfod/ESP8266/GPIOpins/ESP8266_01_pin_magic.html

https://randomnerdtutorials.com/door-status-monitor-using-the-esp8266/

Articles récents
Commentaires récents
fatima dans Bienvenue !
AdminDroid dans Bienvenue !
fatima dans Bienvenue !
Archives
Catégories
%d blogueurs aiment cette page :