Page 1 of 1

Create a simple switch with JSON

Posted: Sunday 22 April 2018 0:40
by lumjajo
I want to create a virtual switch. This does not work within Domoticz, I always get Cannot create switch or soemthing like that. Now I want to use JSOn, but I can create sensors, like Humidity and others, but how do I create a simple switch?
Many thanks...

Re: Create a simple switch with JSON

Posted: Sunday 22 April 2018 1:43
by sion
Have you set up virtual hardware to link the switch to? When adding a virtual switch, you need to make sure that each one has a different code too.

Re: Create a simple switch with JSON

Posted: Sunday 22 April 2018 7:21
by waaren
lumjajo wrote: Sunday 22 April 2018 0:40 I want to create a virtual switch. This does not work within Domoticz, I always get Cannot create switch or soemthing like that. Now I want to use JSOn, but I can create sensors, like Humidity and others, but how do I create a simple switch?
Many thanks...
Look here for the syntax

Look here for the type definitions (in hex)

if your virtual hardware number is 35 and you want it named "mySwitch" the json call would be:

Code: Select all

http://domoticzIP:domoticzPort/json.htm?type=createdevice&idx=35&sensorname=mySwitch&devicetype=244&devicesubtype=73
btw: You can allways peek what the domoticz webpage sends when you enter a command by opening a developers tools window. (In Chrome: ctrl shift I)

Re: Create a simple switch with JSON

Posted: Sunday 22 April 2018 9:12
by lumjajo
All,
thanks, I did not find the simple switch type. That was all about.
Many thanks.,
Does anyone know why I cannot create a virtual switch out of native Domoticz (without using the json command)
I am on stable Version: 3.8153.
Many thanks, have a nice and sunny Sunday..