Strange behavior conversion  [Solved]

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

Moderator: leecollings

Post Reply
HoogendoornJH
Posts: 37
Joined: Wednesday 31 July 2019 16:43
Target OS: Windows
Domoticz version: 12736
Location: Netherlands
Contact:

Strange behavior conversion

Post by HoogendoornJH »

Something strange happens. I have a FIBARO Smart Implant device attached to a SenseAir tSENSE CO2-meter which sends the 0-10V voltage signal of the CO2-meter to Domoticz. A virtual sensor "VoltageCO2" contains the voltage from the CO2-meter and a dzVents script converts the voltage to the virtual sensor "CO2 Woonkamer". In the Devices Current Status list the value of "CO2 Woonkamer" is displayed correctly. However, under Devices and Utility the value of "CO2 Woonkamer" is 0. What goes wrong here?

Illustration.jpg
Illustration.jpg (143.94 KiB) Viewed 565 times

The script

Code: Select all

return
{
    on =
    {
        devices =
        {
            'VoltageCO2',
        },
    },

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

    execute = function(dz, item)
        dz.devices('CO2 Woonkamer').update(item.voltage*200)
    end
}
Aeotec Z-wave Gen5, RFXtrx433xl, Philips Hue Bridge, Davies Weather Station, Honeywell HGI/S80, AurAir CO2
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Strange behavior conversion  [Solved]

Post by waaren »

HoogendoornJH wrote: Thursday 10 December 2020 23:05 Something strange happens. I have a FIBARO Smart Implant device attached to a SenseAir tSENSE CO2-meter which sends the 0-10V voltage signal of the CO2-meter to Domoticz. A virtual sensor "VoltageCO2" contains the voltage from the CO2-meter and a dzVents script converts the voltage to the virtual sensor "CO2 Woonkamer". In the Devices Current Status list the value of "CO2 Woonkamer" is displayed correctly. However, under Devices and Utility the value of "CO2 Woonkamer" is 0. What goes wrong here?
What you see on the Devices Currents Status list is the nvalue field (numeric value) from the database (table devicestatus)
The Devices and Utility tabs show the svalue (string value) field of the (custom sensor type) device.

The dzVents update function can carry both nvalue and svalue.

If you change line

Code: Select all

dz.devices('CO2 Woonkamer').update(item.voltage*200)
to

Code: Select all

dz.devices('CO2 Woonkamer').update(nil, item.voltage*200)
or

Code: Select all

dz.devices('CO2 Woonkamer').update(item.voltage*200, item.voltage*200)
You will see the value you expect.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
HoogendoornJH
Posts: 37
Joined: Wednesday 31 July 2019 16:43
Target OS: Windows
Domoticz version: 12736
Location: Netherlands
Contact:

Re: Strange behavior conversion

Post by HoogendoornJH »

Yes, that works, waaren, thank you very much! (I am learning LUA and dz.Vents, but with limited time available it will take some time to reach a certain level; until now I find for solutions by googling, but the solution does not always fit the problem exactly).
Aeotec Z-wave Gen5, RFXtrx433xl, Philips Hue Bridge, Davies Weather Station, Honeywell HGI/S80, AurAir CO2
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest