So
switch 1 is off
switch 2 is off
switch 3 is off
switch 4 is off
switch 5 is off
switch 6 is off
switch 7 is off
switch 8 is off
switch 9 is off
switch 10 is off
then
virtual switch on
are there more than 3 switches on
then
virtual switch off
How do i do that? i have a dzvents script running for one switch and on a thermostat and temperature sensor. i don't know where te begin, and i did read the wiki.
Code: Select all
--------------------------------------------------------------------------------------------------------------------------------
-- assumptions:
-- the setpoint is set by a dummy device (not a selector type)
local WP_SWITCH = 'Zolder' -- switch device
local TEMP_SETPOINT = 'Thermostaat zolder' -- selector dummy device
local TEMP_SENSOR_1 = 'Zolder temp'
local BAT_THRESHOLD = 30
local LOGGING = true
return
{
on =
{
timer =
{
'every 10 minutes',
},
},
--LOG levell: This is the log level you want for this script. Can be domoticz.LOG_INFO, domoticz.LOG_MODULE_EXEC_INFO, domoticz.LOG_DEBUG or domoticz.LOG_ERROR
--marker: A string that is prefixed before each log message. That way you can easily create a filter in the Domoticz log to see just these messages.
logging =
{
level = LOGGING and domoticz.LOG_DEBUG or domoticz.LOG_ERROR,
--level = LOGGING and domoticz.LOG_ERROR,
marker = 'dzVents Zolder',
},
execute = function(dz)
-- collect all input data
local verdeler_switch_state = dz.devices(WP_SWITCH).state
local temp_1 = dz.devices(TEMP_SENSOR_1).temperature
-- info only on log level = LOG_DEBUG
dz.log('WP_SWITCH : ' .. verdeler_switch_state, dz.LOG_DEBUG)
dz.log('Temp_1 : ' .. temp_1, dz.LOG_DEBUG)
-- now determine what to do
if (temp_1 >= setpointValue) then
dz.devices(WP_SWITCH).switchOff().afterMin(2).silent()
dz.log('Target temperature reached, group off')
elseif (temp_1 <= (setpointValue -0.3)) then
dz.log('Average temperature more than 0.3 degree below setpointValue, switchOn')
dz.devices(WP_SWITCH).switchOn().afterMin(2).silent()
end
end
}