DzVents cannot find device but it is there

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

Moderator: leecollings

Post Reply
elgringo
Posts: 96
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

DzVents cannot find device but it is there

Post by elgringo »

So I have a sensor:
Schermafbeelding 2022-11-20 090218.png
Schermafbeelding 2022-11-20 090218.png (34.26 KiB) Viewed 671 times
And a dzvents script:

Code: Select all

local sensorBuiten = "Temperatuur buiten"
local sensorBuitenBackup = "Temperatuur buiten tuin"

local sensorExtern = "KNMI - Temperatuur"
local sensorExternWind = "KNMI - Wind"
local sensorExternAlarm = "KNMI - Weeralarm"

return {
  on = {
    --timer = {'at 6:00'}, 
    devices = { sensorExternAlarm },
    timer = {'every minute'},
  },

  execute = function(domoticz)
    local lastUpdate = domoticz.devices(sensorBuiten).lastUpdate.minutesAgo
    local lastUpdateBackup = domoticz.devices(sensorBuitenBackup).lastUpdate.minutesAgo
    local tempLokaal = -999
    
    if (lastUpdate < lastUpdateBackup) then
      if (lastUpdate < 30) then
        tempLokaal = domoticz.helpers.round(domoticz.devices(sensorBuiten).temperature, 1)
      end
    else
      if (lastUpdateBackup < 30) then
        tempLokaal = domoticz.helpers.round(domoticz.devices(sensorBuitenBackup).temperature,1)
      end
    end
    
    local tempExtern = domoticz.helpers.round(domoticz.devices(sensorExtern).temperature,1)
    local tempExternGevoel = domoticz.helpers.round(domoticz.devices(sensorExternWind).chill,1)
    local alarm = domoticz.devices(sensorExternAlarm).text
        
    if (tempLokaal > -50) then
      domoticz.notify(tempExtern.."C ("..tempExternGevoel.."), lokaal "..tempLokaal.."C", alarm, domoticz.PRIORITY_LOW, nil, nil, domoticz.NSS_FIREBASE_CLOUD_MESSAGING)
    else
      domoticz.notify(tempExtern.."C ("..tempExternGevoel..")", alarm, domoticz.PRIORITY_LOW, nil, nil, domoticz.NSS_FIREBASE_CLOUD_MESSAGING)
    end
  
  end
}
It complains that it cannot find the "KNMI - Weeralarm" device. Changed it with a id (761) but this also does not work.

Code: Select all

2022-11-20 09:04:00.668 Error: dzVents: Error: (3.1.8) There is no device with that name or id: 761
2022-11-20 09:04:00.668 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler ochtend
2022-11-20 09:04:00.668 Error: dzVents: Error: (3.1.8) /home/pi/domoticz/scripts/dzVents/scripts/ochtend.lua:32: attempt to index a nil value

2022-11-20 08:55:01.213 Error: dzVents: Error: (3.1.8) There is no device with that name or id: KNMI - Weeralarm
2022-11-20 08:55:01.213 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler ochtend
2022-11-20 08:55:01.213 Error: dzVents: Error: (3.1.8) /home/pi/domoticz/scripts/dzVents/scripts/ochtend.lua:32: attempt to index a nil value
Line 32 is: local alarm = domoticz.devices(sensorExternAlarm).text

How is this possible?
hestia
Posts: 361
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: DzVents cannot find device but it is there

Post by hestia »

have you just create your device?
or it is an old ones?
restart domoticz to check again...
elgringo
Posts: 96
Joined: Thursday 18 May 2017 8:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Left
Contact:

Re: DzVents cannot find device but it is there

Post by elgringo »

Device was rather new a restart did the trick
hestia
Posts: 361
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: DzVents cannot find device but it is there

Post by hestia »

what hardware / plugin?
Anyway it's not normal...
roblom
Posts: 408
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

Re: DzVents cannot find device but it is there

Post by roblom »

DzEvents always need a restart in order to be able to read it is my experience.
hestia
Posts: 361
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: DzVents cannot find device but it is there

Post by hestia »

I've never seen this except recently with a specific hardware /pluging ; that why I'm asking with what hardware / pluging you experienced this behaviour.
@roblom, it seems that's it for all the hardware you've got? A lot of ? If not which ones?
@elgringo, which hardware please?
roblom
Posts: 408
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

Re: DzVents cannot find device but it is there

Post by roblom »

I've had this in the past several times but can't remember which specific hardware that was. I thought the last time it was with a Fibaro wall rollershutter which was added with mqtt ad.
hestia
Posts: 361
Joined: Monday 25 December 2017 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Paris
Contact:

Re: DzVents cannot find device but it is there

Post by hestia »

I'm just perform 2 inclusions test
1 with a zwave MQTT Autodiscovery: a power plug Neo CoolcamVersion: 2022.2
1 with a ZigbeeForDomoticz: a motion sensor Sonoff SNZB-03
the test was with 2 scripts: DzVents et LUA
I had errors at the beginning (not sure I've forgotten to set "Set Used" or a rename, or a delay), but in the end, both LUA and Dzvents were ok for both devices without restarting dz!
Some time ago I had this issue with ZigbeeForDomoticz
but it was another version of dz

Code: Select all

Version: 2022.1 (build 14305)
Build Hash: 67f94077d
Compile Date: 2022-04-05 13:18:48
dzVents Version: 3.1.8
now

Code: Select all

Version: 2022.2
Build Hash: eea9db734
Compile Date: 2022-11-05 13:05:35
dzVents Version: 3.1.8
and I also changed the ZigbeeForDomoticz version...
and it was with a temp sensor

So for me it is the normal behavior to have the device available after inclusion w/o restarting dz!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest