Page 1 of 1

Strange behavior conversion

Posted: Thursday 10 December 2020 23:05
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 567 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
}

Re: Strange behavior conversion  [Solved]

Posted: Thursday 10 December 2020 23:47
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.

Re: Strange behavior conversion

Posted: Friday 11 December 2020 6:12
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).