Page 1 of 1

Shift setpoint up and down Heatpump

Posted: Monday 26 December 2022 13:38
by Derik
Hi,
I have a Panasonic heatpump with a heishamon so i can switch with mqtt.
I will make a simple dz vents script so i can switch my heatcruve up and down. [ on different variable setpoints ]

I do have:
ScreenShot298.png
ScreenShot298.png (18.48 KiB) Viewed 345 times
ScreenShot297.png
ScreenShot297.png (10.91 KiB) Viewed 345 times
And try a simple script to start:

Code: Select all

return {
	on = {
		timer = {'every 1 minutes' },
	},
	
	execute = function(domoticz)
        local setPoint = 12956 -- wp warm shift
        local roomTemperatureId = "TV Woonkamer.rawData[1]"-- Woonkamer TV 14844
        local Time = require('Time')
        local currentTime = Time()

        if currentTime.matchesRule("between 6:05 and 15:35") and roomTemperatureId <= 22 then
            updateSetPoint(-1)
            domoticz.notify("tester aan", domoticz.PRIORITY_NORMAL,domoticz.SOUND_DEFAULT, "" , "")
            domoticz.log('1 WP shiften if -1 !')
            
        elseif currentTime.matchesRule("between 6:05 and 15:35") and roomTemperatureId > 22.0 then
            updateSetPoint(2)
            domoticz.notify("Tester uit", domoticz.PRIORITY_NORMAL,domoticz.SOUND_DEFAULT, "" , "")   
            domoticz.log('1 WP shiften if 2 !')

            
        end
    
	end
}
Log says:

Code: Select all

2022-12-26 13:37:00.384 Status: dzVents: Info: ------ Start internal script: 1 WP Shiften:, trigger: "every 1 minutes"
Only no change @ all

I think Setpoint is the problem? Only when i read the wiki i cannot find a other option to switch or set a other setpoint.

Where do i go wrong?

Re: Shift setpoint up and down Heatpump

Posted: Monday 26 December 2022 14:19
by waltervl
To get a current temperature value of a temperature device use something. Like

Code: Select all

local currentTemp = domoticz.devices(IDX).temperature
To set a setpoint to -1 use something like

Code: Select all

 domoticz.devices(IDX).setSetpoint(-1)

Re: Shift setpoint up and down Heatpump

Posted: Monday 26 December 2022 14:42
by Derik
Thanks...
Make some changes..:-0:

Code: Select all

return {
	on = {
		timer = {'every 1 minutes' },
	},
	
	execute = function(domoticz)
        local setPoint = 12956 -- wp warm shift
        local currentTemp = domoticz.devices(14844).temperature
        local Time = require('Time')
        local currentTime = Time()

        if currentTime.matchesRule("between 6:05 and 15:35") and currentTemp <= 22 then
            domoticz.devices(12956).setSetpoint(1)
            domoticz.notify("tester aan", domoticz.PRIORITY_NORMAL,domoticz.SOUND_DEFAULT, "" , "")
            domoticz.log('1 WP shiften if -1 !')
            
        elseif currentTime.matchesRule("between 6:05 and 15:35") and currentTemp > 22.0 then
            domoticz.devices(12956).setSetpoint(-1)
            domoticz.notify("Tester uit", domoticz.PRIORITY_NORMAL,domoticz.SOUND_DEFAULT, "" , "")   
            domoticz.log('1 WP shiften if 2 !')

            
        end
    
	end
}
Not switching anything, lag says the same .

Re: Shift setpoint up and down Heatpump

Posted: Monday 26 December 2022 15:52
by waltervl
Try to remove the currenttime.matchrule to debug if temp is working.

Re: Shift setpoint up and down Heatpump

Posted: Monday 26 December 2022 16:20
by Derik
mmm also not working:

Code: Select all

return {
	on = {
		timer = {'every 1 minutes' },
	},
	
	execute = function(domoticz)
        local setPoint = 12956 -- wp warm shift
        local currentTemp = domoticz.devices(14844).temperature
        local Time = require('Time')
        local currentTime = Time()

        --if currentTime.matchesRule("between 6:05 and 22:35") and currentTemp <= 22 then
                    if debug("between 6:05 and 22:35") and currentTemp <= 22 then

            domoticz.devices(12956).setSetpoint(1)
            domoticz.notify("tester aan", domoticz.PRIORITY_NORMAL,domoticz.SOUND_DEFAULT, "" , "")
            domoticz.log('1 WP shiften if -1 !')
            
        --elseif currentTime.matchesRule("between 6:05 and 22:35") and currentTemp > 22.0 then
                    elseif debug("between 6:05 and 22:35") and currentTemp > 22.0 then

            domoticz.devices(12956).setSetpoint(-1)
            domoticz.notify("Tester uit", domoticz.PRIORITY_NORMAL,domoticz.SOUND_DEFAULT, "" , "")   
            domoticz.log('1 WP shiften if 2 !')

            
        end
    
	end
}

Re: Shift setpoint up and down Heatpump

Posted: Monday 26 December 2022 17:17
by waltervl
Please do not take me to literally :-)
Just remove the matchrule stuff to end up with something something like.

Code: Select all

if currentTemp <= 22 then