Page 1 of 1

Can't use temperature level of sensor in dzvents

Posted: Sunday 11 August 2019 22:31
by jandirkv
Hi,

I have a temperature sensor in my fridge I want to use to send a message at a certain temp level. But I cant get it to work.

I tried all the following with no result
domoticz.devices('Temperatuur Koelkast').temperature > 7
domoticz.devices('Temperatuur Koelkast') > 7
domoticz.devices('Temperatuur Koelkast').level > 7
domoticz.devices('Temperatuur Koelkast').value > 7
domoticz.devices('Temperatuur Koelkast').data > 7
I get either the error:
OpenURL: Invalid arguments, use either a string or a table with options
attempt to index a nil value dzvents

Re: Can't use temperature level of sensor in dzvents

Posted: Sunday 11 August 2019 23:57
by waaren
jandirkv wrote: Sunday 11 August 2019 22:31 I have a temperature sensor in my fridge I want to use to send a message at a certain temp level. But I cant get it to work.

Code: Select all

if domoticz.devices('Temperatuur Koelkast').temperature > 7 then 
This line is the correct syntax ( in a dzVents script) [/quote]

A complete dzVents script could look like

Code: Select all

return  
{
    on = 
    { 
        devices = {'Temperatuur Koelkast'}, -- set device trigger 
    }, 

    logging = 
    {   
        level = domoticz.LOG_DEBUG,
        marker = "Koelkast alarm", 
    },

    execute = function(dz, item)
        koelkastTemp = dz.utils.round(item.temperature,1)
        
        dz.log("Koelkast temperature is " .. koelkastTemp .. ' degrees',dz.LOG_DEBUG)
        if item.temperature > 7 then
            dz.notify('Koelkast alarm', item.name .. ' temperature ' .. koelkastTemp .. ' degrees.')
        end
    end
}

Re: Can't use temperature level of sensor in dzvents

Posted: Wednesday 21 August 2019 22:02
by kimot
Why this complicated way???

Simply set allow e-mail notification and in device notification tab set conditions:
2019-08-21-220129_1920x1080_scrot.png
2019-08-21-220129_1920x1080_scrot.png (149.74 KiB) Viewed 1424 times

Re: Can't use temperature level of sensor in dzvents

Posted: Thursday 22 August 2019 0:26
by waaren
kimot wrote: Wednesday 21 August 2019 22:02 Why this complicated way???
Because the OP clearly looked for the right dzVents syntax.