Create a device
Posted: Tuesday 28 August 2018 11:27
Hi,
If there any way to check if a device exists and create it if not?
Best,
Dan
If there any way to check if a device exists and create it if not?
Best,
Dan
Join 16,000+ members discussing home automation with Domoticz. Get help with Zigbee, ZWave, MQTT, scripting, and 150+ integrations
https://forum.domoticz.com/
To check if a device exist and is set to active:DanM wrote: Tuesday 28 August 2018 11:27 Hi,
If there any way to check if a device exists and create it if not?
Best,
Dan
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