-- Prosty termostat z histereza . Dodaj skrypt dzVents (all) return { on = { timer = { 'every minute' }, devices = { 'Termostat', 'Temp woda' }}, logging = { level = domoticz.LOG_DEBUG }, -- change to LOG_ERROR if script works as expected execute = function(dz, item) _G.logMarker = _G.moduleLabel local hysteresis = 0.1 local boiler = dz.devices('Bojler') local temperature = dz.utils.round(dz.devices('Temp woda').temperature) local setpoint = dz.utils.round(dz.devices('Termostat').setPoint) dz.log('Boiler stan: ' .. boiler.state,dz.LOG_DEBUG) dz.log('Zmierzona temperatura: ' .. temperature,dz.LOG_DEBUG) dz.log('Termostat ustawiony na: ' .. setpoint,dz.LOG_DEBUG) if setpoint < ( temperature - hysteresis ) and boiler.state == 'On' then boiler.switchOff() dz.log('boiler off',dz.LOG_DEBUG) elseif setpoint > ( temperature + hysteresis ) and boiler.state == 'Off' then boiler.switchOn() dz.log('boiler on',dz.LOG_DEBUG) end end }