Page 1 of 1
Counting every time the temperature exceeds x
Posted: Friday 13 May 2016 21:37
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
Re: Counting every time the temperature exceeds x
Posted: Friday 13 May 2016 21:58
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?
Re: Counting every time the temperature exceeds x
Posted: Friday 13 May 2016 22:26
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!
Re: Counting every time the temperature exceeds x
Posted: Friday 13 May 2016 22:41
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
Re: Counting every time the temperature exceeds x
Posted: Saturday 14 May 2016 10:35
by affeunbk
Thanks for the support
I will try but beginners

Re: Counting every time the temperature exceeds x
Posted: Monday 16 May 2016 21:08
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.
Re: Counting every time the temperature exceeds x
Posted: Saturday 18 June 2016 17:48
by affeunbk
Thanks for the help