Create a simple switch with JSON

Moderator: leecollings

Post Reply
lumjajo
Posts: 67
Joined: Wednesday 26 April 2017 20:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Germany
Contact:

Create a simple switch with JSON

Post 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...
sion
Posts: 113
Joined: Friday 08 January 2016 12:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Create a simple switch with JSON

Post 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.
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.

Next: harmony hub.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Create a simple switch with JSON

Post 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)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
lumjajo
Posts: 67
Joined: Wednesday 26 April 2017 20:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Germany
Contact:

Re: Create a simple switch with JSON

Post 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..
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest