Hi , I try convert every my blockly scripts to dzVents and it is successful. Excluding one - simple water leak script. Problem is water leak from dzVents script cannot switch on any device. Why? What is wrong? Thanks
QSKONE wrote: ↑Friday 11 January 2019 18:37
Hi , I try convert every my blockly scripts to dzVents and it is successful. Excluding one - simple water leak script. Problem is water leak from dzVents script cannot switch on any device. Why? What is wrong? Thanks
Without the log it is hard to say but my first guess is this line.
Can you try with this one. It will produce some extra loglines that might help in finding what the problem is. Also changed selector to level as selector is not a valid attribute
return {
on = { devices = { 8 }}, --- xiaomi water leak
logging = {
level = domoticz.LOG_DEBUG,
marker = "waterLeak"
},
execute = function(dz, item)
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local xWaterleak = item --- xiaomi water leak
local xButton = dz.devices( 90 ) --- xiaomi button
local xGateway = dz.devices( 1 ) --- xiaomi gateway rgb
local xAlarm = dz.devices( 2 ) --- alarm ringtone state
local xHue = dz.devices( 31 ) --- mi gateway hue
local xBrightnes = dz.devices( 32 ) --- mi gateway bri
local button = xButton.state
local waterleak = xWaterleak.state
local gateway = xGateway.state
local alarm = xAlarm.level
local hue = xHue.level
local brightnes = xBrightnes.level
logWrite("State of ".. xWaterleak.name .. " is " .. waterleak)
logWrite("State of ".. xGateway.name .. " is " .. gateway)
logWrite("level of ".. xAlarm.name .. " is " .. alarm)
logWrite("level of ".. xHue.name .. " is " .. hue)
logWrite("level of ".. xBrightnes.name .. " is " .. brightnes)
if waterleak == "On" then
xGateway.switchOn().forMin (1)
xAlarm.switchSelector(10).forMin(1)
xHue.switchSelector(100)
xBrightnes.switchSelector(100)
end
end
}
QSKONE wrote: ↑Saturday 12 January 2019 12:04
@waaren thank you for help ,inspiration and patience. Your last script work but it is huge. I rewrote completely script to tiny version.
I do not understand because I do not use 127.0.0.1 anywhere.
I specifically wrote the extra lines to help you investigating what's happening during the execution of the script. So hopefully that was useful for you to get to a working version.
the Error about 127.0.0.1 is a classic. Please read the wiki and start with Using dzVents with Domoticz , where you will read: Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz.
Mayki wrote: ↑Monday 14 January 2019 20:24
Is it possible to control multiple Xiaomi Water Leak Detector with one script?
Xiaomi Water Leak Detector and Xiaomi Water Leak Detector 2 etc.