i have script blockly which works
Script Blockly
IF Time => 14:00 and Lux <= 560 and device "Jadalnia" state Off and group "Salon" state Off
SET Jadalnia and Salon On
SET Write to log Light is On
ELSEIF Time => 14:00 and Lux > 570 and device "Jadalnia" state On and group "Salon" state On
SET Jadalnia and Salon Off
SET Write to log Light is Off
I want to try with dzVents and for start I have a script that also works
Code: Select all
return {
on = {
devices = {'Ogród'},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to LOG_ERROR when tested and OK
marker = 'Jadalnia',
},
execute = function(dz,item)
local lampa = dz.devices('Jadalnia')
local Lux = dz.devices('Ogród')
local LUX = Lux.lux
if (lampa.state == 'Off' and LUX <= 560 ) then
lampa.switchOn()
elseif (lampa.state == 'On'and LUX > 570 ) then
lampa.switchOff()
end
end
}
Code: Select all
[return {
on = {
devices = {'Ogród'},
},
logging =
{
level = domoticz.LOG_DEBUG, -- set to LOG_ERROR when tested and OK
marker = 'Jadalnia',
},
execute = function(dz,item)
local group = dz.groups('Salon')
local lampa = dz.devices('Jadalnia')
local Lux = dz.devices('Ogród')
local LUX = Lux.lux
if (lampa.state == 'Off' and group.state == 'Off' and LUX <= 560 ) then
lampa.switchOn()
group.switchOn()
elseif (lampa.state == 'On'and group.state == 'On' and LUX > 570 ) then
lampa.switchOff()
group.switchOff()
end
end
}
2019-11-21 10:29:59.314 Status: dzVents: Info: Handling events for: "Ogród", value: "825.00"
2019-11-21 10:29:59.315 Status: dzVents: Info: Jadalnia: ------ Start internal script: Script #2: Device: "Ogród (Ogród)", Index: 193
2019-11-21 10:29:59.316 Status: dzVents: Error (2.4.19): Jadalnia: There is no group or scene with that name or id: Salon. If you just created the scene or group you may have to restart Domoticz to make it become visible to dzVents.
2019-11-21 10:29:59.317 Status: dzVents: Debug: Jadalnia: Processing device-adapter for Jadalnia: Switch device adapter
2019-11-21 10:29:59.317 Status: dzVents: Error (2.4.19): Jadalnia: An error occured when calling event handler Script #2
2019-11-21 10:29:59.317 Status: dzVents: Error (2.4.19): Jadalnia: ...domoticz/scripts/dzVents/generated_scripts/Script #2.lua:17: attempt to index local 'group' (a nil value)
2019-11-21 10:29:59.317 Status: dzVents: Info: Jadalnia: ------ Finished Script #2
Who will help