DarkSky THB and dzVents

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

Moderator: leecollings

Post Reply
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

DarkSky THB and dzVents

Post 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
}
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: DarkSky THB and dzVents

Post 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
}
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: DarkSky THB and dzVents

Post 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
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest