Can't use temperature level of sensor in dzvents

Moderator: leecollings

Post Reply
jandirkv
Posts: 27
Joined: Monday 19 February 2018 6:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9117
Contact:

Can't use temperature level of sensor in dzvents

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

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

Post 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 1422 times
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post by waaren »

kimot wrote: Wednesday 21 August 2019 22:02 Why this complicated way???
Because the OP clearly looked for the right dzVents syntax.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: Ragdag and 1 guest