Page 1 of 1

Qubino (Goap) ZMNHSDx temperature with DzVents

Posted: Tuesday 08 December 2020 8:50
by aukesp
Hello i am queit a newbee and trying to understand DzVents.
I have an Qubino (Goap) ZMNHSDx din dimmer.
I try via DzVents to get the temperature.

This is my test script.

Code: Select all

return {
	active = true,
	on = {       timer = {'every minute'} },
	
	execute = function(domoticz, mySensor)
		outTemp = domoticz.device('Temp_voliere')
		print(outTemp)
		if (Temp_voliere.temperature < 5) then
			domoticz.notify('Hey!', 'temperature is below 5 degrees!!')
				print("Outside temperature: "..Temp_voliere)
			domoticz.log('Fire alert', domoticz.LOG_ERROR)
		end

	end
}
The log comes with the following message:

Code: Select all

 2020-12-08 08:47:00.299 Status: dzVents: Info: ------ Start external script: test.lua:, trigger: "every minute"
2020-12-08 08:47:00.301 Status: dzVents: Info: ------ Finished test.lua
2020-12-08 08:47:00.300 Error: dzVents: Error: (3.0.2) An error occurred when calling event handler test
2020-12-08 08:47:00.300 Error: dzVents: Error: (3.0.2) ...am Files (x86)\Domoticz\scripts\dzVents\scripts/test.lua:9: attempt to call a nil value (field 'device')
2020-12-08 08:47:52.207 (Z-stick S2) Temp (Temp_voliere) 
It looks like the "Temp_voliere" has a value zero??
What is going wrong?

Re: Qubino (Goap) ZMNHSDx temperature with DzVents

Posted: Wednesday 09 December 2020 8:38
by aukesp
Nobody an idea?

Re: Qubino (Goap) ZMNHSDx temperature with DzVents  [Solved]

Posted: Wednesday 09 December 2020 11:25
by waaren
aukesp wrote: Wednesday 09 December 2020 8:38 Nobody an idea?
Yes, some syntax errors in your script.

Can you try this ?

Code: Select all

return
{
    active = true,
    on =
    {
        timer =
        {
            'every minute',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when all OK
        marker = 'voliere temperature',
    },

    execute = function(dz)
        outTemp = dz.utils.round ( dz.devices('Temp_voliere').temperature , 2)
        dz.log('OutTemp: ' .. outTemp , dz.LOG_DEBUG)

        if outTemp < 5 then
            dz.notify('Hey!', 'temperature is below 5 degrees!! (' .. outTemp .. ')' )
            dz.log('Temperature (' .. outTemp .. ') !! ' , dz.LOG_ERROR)
        end

    end
}

Re: Qubino (Goap) ZMNHSDx temperature with DzVents

Posted: Wednesday 09 December 2020 18:04
by aukesp
Hi Waaren,

Thanks, this is working like a charm!
I did some debugging aswell, the domotcicz.LOG_ERROR in line 24 should be dz.LOG_ERROR

Again Thanks for your help!