Page 1 of 1

DarkSky THB and dzVents

Posted: Monday 02 October 2017 9:20
by poudenes
Hi All,

Im playing around to let my other dzVent script work. Im getting smarter and smarter but need some help.

When temperature outside (info from DarkSky) above 16 degrees then set NEST to 10 degrees.
When i remove the line with DS THB Device i can change NEST higher then 16 degrees and it will update back to 10.
But when i use the DS THB device nothing change. I think i do something wrong but can't find it.

I read the dzVent documents and at the line with "Temperature, Humidity, Barometer sensor" i see the "temperature: Number" line.
My idea i can use this as "temperature > 16" when temperature is higher then 16 degrees.

Can someone tell me how to do this :)

Thank !!

Code: Select all

return {
    active = true,
    on = {
        devices = {
            'DS THB',
            'Thermostaat'
            }
    },
    execute = function(domoticz, device)

-- ALWAYS ----                
-- OUTSIDE ABOVE 16 DEGREES
    if
    domoticz.devices('Full Manual Modus').state == 'Off' and
    domoticz.devices('DS THB').temperature > 16 and
    domoticz.devices('Thermostaat').setPoint > 16
    then
        domoticz.variables('lagerdan16graden').set(0)
        domoticz.variables('hogerdan16graden').set(1)
        domoticz.devices('Thermostaat').updateSetPoint(10)
        domoticz.log('--------------------==<[TEMP ABOVE 16 NEST TO 10]>==--------------------', domoticz.LOG_FORCE)
   end
end
}

Re: DarkSky THB and dzVents

Posted: Wednesday 04 October 2017 8:58
by BakSeeDaa
I must admit I haven't fully understood the question but why don't you just add a few lines of debugging to your code?

If nothing happens (e.g the code inside the if statement won't execute), then the if statement hasn't evaluated as true.
Try something like this, maybe it can help you forward a bit...

Code: Select all

return {
	active = true,
	logging = {
		marker = "DSTHB"
	},
	on = {
		devices = {
			'DS THB',
			'Thermostaat'
			}
	},
	execute = function(domoticz, device)
		domoticz.log('Script has been triggered  by' .. device.name, domoticz.LOG_FORCE)
		domoticz.log((domoticz.devices('Full Manual Modus').state == 'Off') and 'true' or 'false', domoticz.LOG_FORCE)
		domoticz.log((domoticz.devices('DS THB').temperature > 16) and 'true' or 'false', domoticz.LOG_FORCE)
		domoticz.log((domoticz.devices('Thermostaat').setPoint > 16) and 'true' or 'false', domoticz.LOG_FORCE)

		-- ALWAYS ----				
		-- OUTSIDE ABOVE 16 DEGREES
		if
		domoticz.devices('Full Manual Modus').state == 'Off' and
		domoticz.devices('DS THB').temperature > 16 and
		domoticz.devices('Thermostaat').setPoint > 16
		then
			domoticz.variables('lagerdan16graden').set(0)
			domoticz.variables('hogerdan16graden').set(1)
			domoticz.devices('Thermostaat').updateSetPoint(10)
			domoticz.log('--------------------==<[TEMP ABOVE 16 NEST TO 10]>==--------------------', domoticz.LOG_FORCE)
	   end
	end
}

Re: DarkSky THB and dzVents

Posted: Wednesday 04 October 2017 9:45
by poudenes
2017-10-04 09:43:50.348 dzVents: !Info: DS THB: Script has been triggered by Thermostaat
2017-10-04 09:43:50.351 dzVents: !Info: DS THB: true
2017-10-04 09:43:50.353 dzVents: !Info: DS THB: false
2017-10-04 09:43:50.353 dzVents: !Info: DS THB: false

If im right this means it work. the result gives the right status. So it has to be work then.

Thanks for the lines to add so i can check the triggers etc. :D