Hi, perhaps you can use my script...
I use only one setpoint and i dont change the heat mode, only the temperature
Code: Select all
-- altijd op thermo mode op mode heat zetten..
-- setpoint pakken dat bij heat hoort als huidige adhoc stand
-- andere setpoints verwijderen, springen soms op 0 en heb je niets aan
-- dz.devices('Slaapkamer_thermostaat_mode').updateMode('Manufacturer Specific')
-- dz.devices('Slaapkamer_thermostaat_mode').updateMode('Heat')
-- dz.devices('Slaapkamer_thermostaat_mode').updateMode('Heat Eco')
-- dz.devices('slaapkamer_heat_temp').updateSetPoint(21)
-- dz.devices('slaapkamer_heat_temp').setPoint uitlezen van setpoint
-- de hook is los van dz_verwarming gemaakt zodat de schakelaar zelf ook aangepast wordt bij een webhook call voor dashticz
local hook1 = 'Hook_DZ_dag'
local hook2 = 'Hook_DZ_nacht'
local OffTimer1 = 'at 22:05 on mon,tue,wed,thu,sun'
local OffTimer2 = 'at 22:50 on fri,sat'
return {
on = {
devices = {'Default_heating', 'pc-niels-ga*'},
httpResponses = {hook1,hook2},
timer = {OffTimer1, OffTimer2}
},
logging = { level = domoticz.LOG_ERROR , -- Uncomment to override the dzVents global logging setting
marker = "verwarming"},
execute = function(dz, item, info)
local dagnorm = 20
local nachtnorm = 16
local messageTable = {}
local countpc = dz.devices().reduce(function(acc, device)
if dz.helpers.matchesWildCardedString(dz,device.name, 'pc-niels*') then
if device.state == 'On' then
acc = acc + 1
end
end
return acc -- always return the accumulator
end, 0) -- 0 is the initial value for the accumulator
if item.isDevice then
if (item.name == 'Default_heating') then
if (item.state == 'dag') then
dz.devices('Niels_slaapkamer_thermostaat_instelling').updateSetPoint(dagnorm) -- via default heating de echte opdracht
else
dz.devices('Niels_slaapkamer_thermostaat_instelling').updateSetPoint(nachtnorm)
end
else -- er is een pc van niels aangezet of uitgezet
if dz.time.matchesRule('at 06:00-22:05') then
if countpc >0 and dz.devices('Default_heating').state == 'nacht' then -- er is een pc van niels aan en heating staat op nacht
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' VERWARMING: radiator zolder wordt op ' .. item.state .. 'stand(' .. tostring(dagnorm) .. ') gezet door: ' .. item.name)
dz.devices('Default_heating').switchSelector('dag') -- via pc-niels devices via switch selector aansturen, die komt dan nogmaals door dit script via default heating
end
else -- het is buiten 06:00 en 22.05
if dz.devices('Default_heating').state == 'dag' then
dz.devices('Default_heating').switchSelector('nacht') -- via pc-niels devices via switch selector aansturen, die komt dan nogmaals door dit script via default heating
dz.devices('Niels_slaapkamer_thermostaat_instelling').updateSetPoint(nachtnorm)
end
end
end
elseif item.isTimer then
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' VERWARMING: Verwarming wordt op nachtstand gezet door: ' .. item.trigger,0) -- uitgezet krijgt melding via switchselector/devices if then else
dz.devices('Default_heating').switchSelector(20)
elseif item.isHTTPResponse then
local hookwaarde = item.trigger
if hookwaarde == hook1 then dz.devices('Default_heating').switchSelector(10)
elseif hookwaarde == hook2 then dz.devices('Default_heating').switchSelector(20)
end
dz.helpers.globalMessage2(dz,item,info,messageTable,'add', ' VERWARMING: Verwarming wordt op ' .. hookwaarde .. ' stand gezet door httpResponses..')
end
dz.helpers.globalMessage2(dz,item,info,messageTable,'chg') -- dump
end
}
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea