Split Temperature Humidity Topic is solved

Post Reply
terrorsource
Posts: 54
Joined: Wednesday 10 May 2017 17:57
Target OS: Raspberry Pi
Domoticz version:
Contact:

Split Temperature Humidity

Post by terrorsource » Monday 16 July 2018 12:47

Hi,

I've already found a script that splits the TemperatureHumidty from my Aeotec MultiSensor6 into 2 dummy sensors:

Code: Select all

commandArray = {}
-- Bathroom
sensorTemperature, sensorHumidity, sensorHumidityStatus = otherdevices_svalues['MS_Badkamer_TempHum']:match("([^;]+);([^;]+);([^;]+)")
table.insert (commandArray, { ['UpdateDevice'] = string.format("%d|0|%.2f", otherdevices_idx['MS_Badkamer_Temp'], tonumber(sensorTemperature)) })
table.insert (commandArray, { ['UpdateDevice'] = string.format("%d|%d|%d", otherdevices_idx['MS_Badkamer_Hum'], sensorHumidity, sensorHumidityStatus) })

return commandArray
MS_Badkamer_TempHum = Aeotec MultiSensor 6
MS_Badkamer_Temp = Dummy Temperature
MS_Badkamer_Hum = Dummy Humidity

But this is constantly updating the dummy sensors, causing a lot of lines in the logs. I would like to have it update only when the value's of the seperate dummy sensors are different from the MultiSensor 6.

Can someone help me out with this?

User avatar
emme
Posts: 856
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Split Temperature Humidity

Post by emme » Monday 16 July 2018 13:59

uh... are you sure
otherdevices_temperature['MS_Badkamer_Temp']
and
otherdevices_humidity['MS_Badkamer_Temp']

are not supported already for your device?
The most dangerous phrase in any language is:
"We always done this way"

User avatar
waaren
Posts: 941
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Split Temperature Humidity

Post by waaren » Monday 16 July 2018 14:32

terrorsource wrote:
Monday 16 July 2018 12:47

MS_Badkamer_TempHum = Aeotec MultiSensor 6
MS_Badkamer_Temp = Dummy Temperature
MS_Badkamer_Hum = Dummy Humidity

But this is constantly updating the dummy sensors, causing a lot of lines in the logs. I would like to have it update only when the value's of the seperate dummy sensors are different from the MultiSensor 6.
Something like ?

Code: Select all

-- splitBathroomSensor 

return {

    on =        {       devices   =   { "MS_Badkamer_TempHum"}},
              
    logging =   {       level   =   domoticz.LOG_ERROR,
                        marker  =   "splitBathroomSensor" },

    execute = function(dz, trigger )
        local virtualTemperatureSensor  = dz.devices('MS_Badkamer_Temp')
        local virtualHumiditySensor     = dz.devices('MS_Badkamer_Hum')
        
        local masterTemperature         = dz.utils.round(trigger.temperature,1)
        local masterHumidity            = dz.utils.round(trigger.humidity)
        local masterHumidtyStatus       = trigger.humidityStatusValue
        
        local slaveTemperature          = dz.utils.round(virtualTemperatureSensor.temperature,1)
        local slaveHumidity             = dz.utils.round(virtualHumiditySensor.humidity)
        
        if slaveTemperature ~= masterTemperature then 
            virtualTemperatureSensor.updateTemperature(masterTemperature) 
        end
        
        if slaveHumidity ~= masterHumidity then 
            virtualHumiditySensor.updateHumidity(masterHumidity,masterHumidtyStatus)
        end    
            
    end
}
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

terrorsource
Posts: 54
Joined: Wednesday 10 May 2017 17:57
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Split Temperature Humidity

Post by terrorsource » Monday 16 July 2018 17:33

emme wrote:
Monday 16 July 2018 13:59
uh... are you sure
otherdevices_temperature['MS_Badkamer_Temp']
and
otherdevices_humidity['MS_Badkamer_Temp']

are not supported already for your device?
No, Aeotec MultiSensor 6 does not have seperate sensors. Everyone who's using this sensor has this "problem".

waaren wrote:
Monday 16 July 2018 14:32
terrorsource wrote:
Monday 16 July 2018 12:47

MS_Badkamer_TempHum = Aeotec MultiSensor 6
MS_Badkamer_Temp = Dummy Temperature
MS_Badkamer_Hum = Dummy Humidity

But this is constantly updating the dummy sensors, causing a lot of lines in the logs. I would like to have it update only when the value's of the seperate dummy sensors are different from the MultiSensor 6.
Something like ?

Code: Select all

-- splitBathroomSensor 

return {

    on =        {       devices   =   { "MS_Badkamer_TempHum"}},
              
    logging =   {       level   =   domoticz.LOG_ERROR,
                        marker  =   "splitBathroomSensor" },

    execute = function(dz, trigger )
        local virtualTemperatureSensor  = dz.devices('MS_Badkamer_Temp')
        local virtualHumiditySensor     = dz.devices('MS_Badkamer_Hum')
        
        local masterTemperature         = dz.utils.round(trigger.temperature,1)
        local masterHumidity            = dz.utils.round(trigger.humidity)
        local masterHumidtyStatus       = trigger.humidityStatusValue
        
        local slaveTemperature          = dz.utils.round(virtualTemperatureSensor.temperature,1)
        local slaveHumidity             = dz.utils.round(virtualHumiditySensor.humidity)
        
        if slaveTemperature ~= masterTemperature then 
            virtualTemperatureSensor.updateTemperature(masterTemperature) 
        end
        
        if slaveHumidity ~= masterHumidity then 
            virtualHumiditySensor.updateHumidity(masterHumidity,masterHumidtyStatus)
        end    
            
    end
}
Looks like it! Although i don't really get all of it but will take a look later this evening/tomorrow.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests