Split Temperature Humidity Topic is solved

Post Reply
terrorsource
Posts: 60
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: 930
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: 1201
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: 60
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.

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

Re: Split Temperature Humidity

Post by terrorsource » Sunday 28 October 2018 16:53

I've now changed to a "Heiman Temperature Humidity Sensor HS1HT-Z+" from AliExpress but the script does not work.

Data of the sensor is "23.3 C, 54 %"

The script in the post above is only updating the Humidity and not the Temperature.

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

Re: Split Temperature Humidity

Post by waaren » Sunday 28 October 2018 18:43

terrorsource wrote:
Sunday 28 October 2018 16:53
I've now changed to a "Heiman Temperature Humidity Sensor HS1HT-Z+" from AliExpress but the script does not work.

Data of the sensor is "23.3 C, 54 %"

The script in the post above is only updating the Humidity and not the Temperature.
can you execute the dumpscript below and send the dump output (preferable via PM).
Thanks

Code: Select all

-- dumper

return {

    on =        {       devices   =   { "name of your new temperature sensor"}},
              
    logging =   {       level   =   domoticz.LOG_DEBUG,
                        marker  =   "dumper" },

    execute = function(dz, item )
        item.dump()    
    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: 60
Joined: Wednesday 10 May 2017 17:57
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Split Temperature Humidity

Post by terrorsource » Monday 29 October 2018 10:14

waaren wrote:
Sunday 28 October 2018 18:43
terrorsource wrote:
Sunday 28 October 2018 16:53
I've now changed to a "Heiman Temperature Humidity Sensor HS1HT-Z+" from AliExpress but the script does not work.

Data of the sensor is "23.3 C, 54 %"

The script in the post above is only updating the Humidity and not the Temperature.
can you execute the dumpscript below and send the dump output (preferable via PM).
Thanks

Code: Select all

-- dumper

return {

    on =        {       devices   =   { "name of your new temperature sensor"}},
              
    logging =   {       level   =   domoticz.LOG_DEBUG,
                        marker  =   "dumper" },

    execute = function(dz, item )
        item.dump()    
    end
}
Script does not work.
Error: EventSystem: in dumper: [string "-- dumper..."]:7: attempt to index global 'domoticz' (a nil value)

Guess that is has something to do with "domoticz" "dz" use in the same script.
When i change them to the same, same error

User avatar
waaren
Posts: 1201
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 29 October 2018 11:04

terrorsource wrote:
Monday 29 October 2018 10:14
Script does not work.
Error: EventSystem: in dumper: [string "-- dumper..."]:7: attempt to index global 'domoticz' (a nil value)
Guess that is has something to do with "domoticz" "dz" use in the same script.
When i change them to the same, same error
No script is OK as it was. You should only enter the name of your device.
Are you sure you saved it as a dzVents script ?
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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest