Heating Time Limitation don't work

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
TimH
Posts: 11
Joined: Friday 11 November 2016 8:56
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Germany
Contact:

Heating Time Limitation don't work

Post by TimH »

Hi,
i'm new with dzvents. In my First Script i want a time limitation of the Setpoint. When the Setpoint over a specific temperatur set it should be back to the specific temperatur.
My Problem is: When I set the Setpoint over the temperatur they write the uservariable in Time, but after 2-3 Minutes go back to orginal temperatur.

Where is my mistake?
Here is the mini script:

Code: Select all

--Script zum Überwachden der Heizung im Bad, getriggert nach dem Thermostat oder Timer
return {
	on = {
		devices = {
			34
		},
	},
	
	execute = function(domoticz,device)
    local now = os.date('%H')+1 ..':'.. os.date('%M')
    local BadHeizungThermo = domoticz.devices(34)
	local BadHeizungValue = tonumber(BadHeizungThermo.state)
	local HeizungausTemp = domoticz.variables('Heizungaus').value
	local BadHeizungTime = domoticz.variables('HeizungBad')
	
    if BadHeizungValue ~= HeizungausTemp and BadHeizungTime.value == '00:00' then
        domoticz.log('Heizung wurde eingeschaltet. Max. 1 Stunde an',domoticz.LOG_INFO)
        domoticz.log('Heizungbadzeit:'..now..'  BadHeizungTime='..BadHeizungValue)
	    BadHeizungTime.set(now)
   elseif BadHeizungTime.value <= now and BadHeizungTime ~= '00:00' then
 	    domoticz.log('Bad Heizung wird ausgeschaltet und Timer zurückgestellt',domoticz.LOG_INFO)
	    domoticz.log('Heizungbadzeit:'..BadHeizungTime.value..'BadHeizungtemperatur:'..BadHeizungValue,domoticz.LOG_INFO)
	    BadHeizungTime.set('00:00')
	    BadHeizungThermo.updateSetPoint(HeizungausTemp)
    end
    end
}
And the log:

Code: Select all

2018-11-01 11:06:02.729 Status: dzVents: Info: Handling events for: "Bad Heizung", value: "17.00"
2018-11-01 11:06:02.729 Status: dzVents: Info: ------ Start internal script: Bad_Heizung_neu: Device: "Bad Heizung (Razberry)", Index: 34
2018-11-01 11:06:02.730 Status: dzVents: Info: Bad Heizung wird ausgeschaltet und Timer zurückgestellt
2018-11-01 11:06:02.730 Status: dzVents: Info: Heizungbadzeit:00:00BadHeizungtemperatur:17
2018-11-01 11:06:02.730 Status: dzVents: Info: ------ Finished Bad_Heizung_neu
2018-11-01 11:06:02.809 Status: Set UserVariable HeizungBad = 00:00
2018-11-01 11:06:03.020 Status: dzVents: Info: Handling events for: "Bad Heizung", value: "18.00"
2018-11-01 11:06:03.020 Status: dzVents: Info: ------ Start internal script: Bad_Heizung_neu: Device: "Bad Heizung (Razberry)", Index: 34
2018-11-01 11:06:03.021 Status: dzVents: Info: Heizung wurde eingeschaltet. Max. 1 Stunde an
2018-11-01 11:06:03.021 Status: dzVents: Info: Heizungbadzeit:12:06 BadHeizungTime=18
2018-11-01 11:06:03.021 Status: dzVents: Info: ------ Finished Bad_Heizung_neu
2018-11-01 11:06:03.093 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-11-01 11:06:03.132 Status: Set UserVariable HeizungBad = 12:06
2018-11-01 11:06:35.212 (Razberry) Temp (Temperature)
2018-11-01 11:06:58.355 (Razberry) Thermostat (Esszimmer Heizung)
2018-11-01 11:07:03.443 (Razberry) Thermostat (Bad Heizung)
2018-11-01 11:07:03.721 (Razberry) Thermostat (Bad Heizung)
2018-11-01 11:07:03.582 Status: dzVents: Info: Handling events for: "Bad Heizung", value: "21.00"
2018-11-01 11:07:03.582 Status: dzVents: Info: ------ Start internal script: Bad_Heizung_neu: Device: "Bad Heizung (Razberry)", Index: 34
2018-11-01 11:07:03.583 Status: dzVents: Info: Bad Heizung wird ausgeschaltet und Timer zurückgestellt
2018-11-01 11:07:03.583 Status: dzVents: Info: Heizungbadzeit:12:06BadHeizungtemperatur:21
2018-11-01 11:07:03.583 Status: dzVents: Info: ------ Finished Bad_Heizung_neu
2018-11-01 11:07:03.664 Status: Set UserVariable HeizungBad = 00:00
2018-11-01 11:07:03.881 Status: dzVents: Info: Handling events for: "Bad Heizung", value: "17.00"
2018-11-01 11:07:03.881 Status: dzVents: Info: ------ Start internal script: Bad_Heizung_neu: Device: "Bad Heizung (Razberry)", Index: 34
2018-11-01 11:07:03.882 Status: dzVents: Info: Bad Heizung wird ausgeschaltet und Timer zurückgestellt
2018-11-01 11:07:03.882 Status: dzVents: Info: Heizungbadzeit:00:00BadHeizungtemperatur:17
2018-11-01 11:07:03.882 Status: dzVents: Info: ------ Finished Bad_Heizung_neu
2018-11-01 11:07:03.985 Status: Set UserVariable HeizungBad = 00:00
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Heating Time Limitation don't work

Post by waaren »

TimH wrote: Thursday 01 November 2018 11:07 I want a time limitation of the Setpoint. When the Setpoint over a specific temperatur set it should be back to the specific temperatur.
My Problem is: When I set the Setpoint over the temperatur they write the uservariable in Time, but after 2-3 Minutes go back to orginal temperatur.
Where is my mistake?
I don't know why the setpoint goes back to the original temperature and how your script could switch the setpoint back.
Can you try the script below and let me know what your findings are ?

Code: Select all

--[[ Hi,
i'm new with dzvents. In my First Script i want a time limitation of the Setpoint. When the Setpoint over a specific temperatur set it should be back to the specific temperatur.
My Problem is: When I set the Setpoint over the temperatur they write the uservariable in Time, but after 2-3 Minutes go back to orginal temperatur.

Where is my mistake?
Here is the mini script:

--Script zum Überwachden der Heizung im Bad, getriggert nach dem Thermostat oder Timer
]]--
return {
    on          = { devices      = { 34          },
                    variables    = { "HeizungBad"}},
    
    logging     = { level   = domoticz.LOG_DEBUG,              -- Change to ERROR when script is behaving as expected  
                    marker  = "Heizung"},   
	
	execute = function(dz,item)
        
        local function logWrite(str,level)
            dz.log(str,level or dz.LOG_DEBUG)
        end
    
        local now = os.date('%H')+1 ..':'.. os.date('%M')
        local BadHeizungThermo = dz.devices(34)
        local BadHeizungValue = tonumber(BadHeizungThermo.state)
        local HeizungausTemp = dz.variables('Heizungaus').value
        local BadHeizungTime = dz.variables('HeizungBad')

        if item.isDevice then
            if BadHeizungValue ~= HeizungausTemp and BadHeizungTime.value == '00:00' then
                logWrite('Heizung wurde eingeschaltet. Max. 1 Stunde an')
                logWrite('Heizungbadzeit:'..now..'  BadHeizungTime='..BadHeizungValue)
                BadHeizungTime.set(now)
                BadHeizungTime.set('00:00').afterSec(3600)
            end       
       elseif BadHeizungTime.value == '00:00' then
            logWrite('Bad Heizung wird ausgeschaltet und Timer zurückgestellt')
            logWrite('Heizungbadzeit:'..BadHeizungTime.value..'BadHeizungtemperatur:'..BadHeizungValue)
            BadHeizungThermo.updateSetPoint(HeizungausTemp)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
TimH
Posts: 11
Joined: Friday 11 November 2016 8:56
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Germany
Contact:

Re: Heating Time Limitation don't work

Post by TimH »

Yes, thank you.
Your script works. Now I must learn so much .
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest