Hi,
If there any way to check if a device exists and create it if not?
Best,
Dan
Create a device
Moderator: leecollings
Re: Create a device
First you need a list with all devices in the system, used or not.
http://<ip>:<port>/json.htm?type=devices&filter=all&order=Name
This returns a JSON with all devices, you can now test if the device exists and create a new one if not
http://<ip>:<port>/json.htm?type=devices&filter=all&order=Name
This returns a JSON with all devices, you can now test if the device exists and create a new one if not
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Create a device
To check if a device exist and is set to active:
Code: Select all
local deviceName = "your device name"
local myDevice = domoticz.devices(deviceName)
if myDevice then
domoticz.log("device " .. myDevice.name .. " exist and is active")
else
domoticz.log("device " .. deviceName .. " does not exist or is set inactive")
end
This can be done using the openURL command in dzVents
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
Who is online
Users browsing this forum: No registered users and 1 guest