Show the value from coldest sensor Topic is solved

Moderator: leecollings

Post Reply
Zazze
Posts: 2
Joined: Sunday 09 August 2020 11:51
Target OS: -
Domoticz version:
Contact:

Show the value from coldest sensor

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

Re: Show the value from coldest sensor

Post 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 725 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Zazze
Posts: 2
Joined: Sunday 09 August 2020 11:51
Target OS: -
Domoticz version:
Contact:

Re: Show the value from coldest sensor

Post 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.
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Show the value from coldest sensor

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

Re: Show the value from coldest sensor

Post 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.
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: No registered users and 1 guest