I can create a switch using the REST API:
http://192.168.18.1:8080/json.htm?type= createdevice & idx=29&sensorname=switch1&devicetype=244&devicesubtype=73
But, I don't know how to use API to fill the "On Action" "Off Action" of the created switch. I would like to have something like http://192.168.18.3/myscripyt1.sh in "On Action" , http://192.168.18.3/myscripyt2.sh in "Off Action".
Any help or advice is appreciated.
Using Domoticz Rest API, how to create a switch with On/Off Action Topic is solved
Moderators: leecollings, remb0
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Using Domoticz Rest API, how to create a switch with On/Off Action
You can use the "setused" REST API where the actions are base64 encoded in strparam1 and strparam2sazaki wrote: ↑Wednesday 24 March 2021 3:51 I don't know how to use API to fill the "On Action" "Off Action" of the created switch.
I would like to have something like http://192.168.18.3/myscripyt1.sh in "On Action" , http://192.168.18.3/myscripyt2.sh in "Off Action".
something like
Code: Select all
http://<domoticz ip:domoticz port>/json.htm?type=setused&used=true&idx=IDX&strparam1=base64Encoded(ON ACTION STRING)&strparam2=base64Encoded(OFF ACTION STRING)
http://<domoticz ip:domoticz port>/json.htm?type=setused&used=true&idx=<your idx>&strparam1=aHR0cDovLzE5Mi4xNjguMTguMy9teXNjcmlweXQxLnNo&strparam2=aHR0cDovLzE5Mi4xNjguMTguMy9teXNjcmlweXQyLnNo
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Re: Using Domoticz Rest API, how to create a switch with On/Off Action
Thank you very much. It works.
Who is online
Users browsing this forum: Google [Bot] and 1 guest