Page 1 of 1

Show the value from coldest sensor

Posted: Sunday 09 August 2020 12:13
by Zazze
Hi, new to the Forum.
I have a problem I like some help with. I'm measuring the temperature outside, due to how my house is positioned, the sun effects the sensor where ever I place it. So my idea was to use two sensors, one placed to the north and one to the west. I like to compare the two values and display the lowest as my outside temperature. But I just can't get it to work. "UTE TEMP" and "Ute Zigbee" are the sensors and "Ute_KOMBINERAD" is a dummy temp sensor.

Anyone that can point me in the right direction on how to do it correctly?
Thanks


Image

Re: Show the value from coldest sensor

Posted: Sunday 09 August 2020 14:07
by waaren
Zazze wrote: Sunday 09 August 2020 12:13 Anyone that can point me in the right direction on how to do it correctly?
You cannot do this in domoticz Blockly (see the mouseover helptext below)
Blockly helptext.png
Blockly helptext.png (19.39 KiB) Viewed 727 times


Using dzVents it could look like below

When not yet familiar with dzVents please start with reading Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."

Code: Select all

return 
{
    on = 
    {
        devices = 
        {
            'UTE Temp',
            'Ute Zigbee',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,  -- Change to domoticz.LOG_ERROR when script is OK
        marker = 'get min temperature',
    },

    execute = function(dz)
        local ute1 = dz.devices('UTE Temp').temperature
        local ute2 = dz.devices('Ute Zigbee').temperature
        local minCombined = dz.devices('UTE_KOMBINERAD')

        minCombined.updateTemperature(math.min(ute1,ute2))
    end
}

Re: Show the value from coldest sensor

Posted: Monday 10 August 2020 12:37
by Zazze
Thanks for your help Warren. The script is implemented and working. I just had to “round” the value otherwise it was displayed with a lot of decimals. Why I don’t know, but it was easily fixed.
Once again, thanks for your help.

Re: Show the value from coldest sensor

Posted: Tuesday 11 August 2020 18:38
by jake
Zazze wrote:Thanks for your help Warren. The script is implemented and working. I just had to “round” the value otherwise it was displayed with a lot of decimals. Why I don’t know, but it was easily fixed.
Once again, thanks for your help.
I've had that before too, that a sensor value in a script had many digits all of a sudden. I had to round the number as well to get rid of it.

Re: Show the value from coldest sensor

Posted: Tuesday 11 August 2020 19:13
by waaren
Zazze wrote: Monday 10 August 2020 12:37 The script is implemented and working. I just had to “round” the value otherwise it was displayed with a lot of decimals.
This is because the temperatures from the sensors are send from domoticz to dzVents as floats. I will have a look if it make sense to round them before presenting to a user script.