Add new virtual switch using JSON Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Add new virtual switch using JSON

Post by korniza »

Hello guys,
I like to create a number of virtual switches using JSON so to have IDX of switch selected by me. I search forum but no post found. Also wiki describes on the way to create virtual sensors but not virtual switches.
Is there any way to perform it even using a console script? Please help!
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Add new virtual switch using JSON

Post by Egregius »

Use developer mode of your browser while adding a switch.
Don't think you can choose the idx.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Add new virtual switch using JSON

Post by Egregius »

Code: Select all

json.htm?type=createvirtualsensor&idx=2&sensorname=test&sensortype=6
idx is the idx of the dummy hardware.
korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Re: Add new virtual switch using JSON

Post by korniza »

Egregius wrote:

Code: Select all

json.htm?type=createvirtualsensor&idx=2&sensorname=test&sensortype=6
idx is the idx of the dummy hardware.
Thank you for! It does work! :)
New device was created is not assigned to any hardware (it appeared on devices as ? unknown hardware). Can I "move" it to an exist hardware or build via JSON a hardware and assign this orphan device? :?
The reason I ask them is that I like to create a script to replicate some of my hardware to another (backup) domoticz. It is a painfull situation performing by hand and always have the same IDX for particular sensors.
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Add new virtual switch using JSON

Post by Egregius »

I assume you have the dummy hardware installed and used that idx in your url?
If it's only for backup I would create a script that copies the records directly from/to the database.
korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Re: Add new virtual switch using JSON

Post by korniza »

If it was for the settings, I use the database backup/restore process. BUT is it for specific devices/sensors.
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest