Counting every time the temperature exceeds x

Moderator: leecollings

Post Reply
affeunbk
Posts: 5
Joined: Friday 13 May 2016 21:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Counting every time the temperature exceeds x

Post by affeunbk »

Hi there!

Can anyone help me? :?:
I would like to know how I should do when I want to create a functional counter which could detect when a temp on a termometer reaches the temp x.

Dear
Andreas
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Counting every time the temperature exceeds x

Post by Toulon7559 »

A few questions for better understanding of your request:
1) What is the interval for checking that temperature > X?
2) What tolerance do you accept for that checking?
In other words, how accurate do you want to make the check?
3) Is the check from lower temperature upwards and/or from higher temperature downwards?
4) Any hysteresis to be considered?
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
affeunbk
Posts: 5
Joined: Friday 13 May 2016 21:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Counting every time the temperature exceeds x

Post by affeunbk »

1. I guess I want it to have no interval, but only starts checking when x is above 30celsius
2. Well, so accurate as possible.
3. upwards
4. I already have a temprature sensor. I want to use an "if" set which count everytime the temprature is above 30celsius. The thing I want to know is the "if" set which can calculate everything to make that happen.

Thanks again!
commodore white
Posts: 63
Joined: Sunday 14 July 2013 11:19
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Ipswich, UK
Contact:

Re: Counting every time the temperature exceeds x

Post by commodore white »

You should check out the developer version of dzVents. It enables you keep a timestamped list of temperatures in a data array then do simple stats on the list. The following is an example from the documentation.
It would be easy to add criteria so that only temperatures above a certain value were logged. Other examples show methods you could use to maintain a count of those that exceed a threshold. An alternative approach would be to change the maxItems parameter to maxMinutes or maxHours so you can maintain a count of times a temperature, when sampled, has exceed the threshold in a given time.

Its got to be a lot easier than trying to roll your own. Go see https://github.com/dannybloe/dzVents/tree/dev

Code: Select all

return {
    active = true,
    on = {
        'MyTempSensor'
    },
    data = {
        temperatures = { history = true, maxItems = 10 }
    },
    execute = function(domoticz, sensor)
        -- add new data
        domoticz.data.temperatures.add(sensor.temperature)

        -- average
        local average = domoticz.data.temperatures.avg()

        -- maximum value in the past hour:
        local max = domoticz.data.temperatures.maxSince('01:00:00') 
    end
}
Peter
affeunbk
Posts: 5
Joined: Friday 13 May 2016 21:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Counting every time the temperature exceeds x

Post by affeunbk »

Thanks for the support

I will try but beginners :)
commodore white
Posts: 63
Joined: Sunday 14 July 2013 11:19
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Ipswich, UK
Contact:

Re: Counting every time the temperature exceeds x

Post by commodore white »

dzVents has a lot of documentation, more than Domoticz. Theres a few examples in the documentation. Nice thing is youll not have to deal with commandArrays, no looking up multiple tables, doing stupid arithmetic on dates is thing of the past, complex triggers are a breeze.

Try it. You'll like it sooner than you think.
affeunbk
Posts: 5
Joined: Friday 13 May 2016 21:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Counting every time the temperature exceeds x

Post by affeunbk »

Thanks for the help
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests