I wanted to make a graph bar displaying minimum and maximum temperature per day… so it should not be a flowing chart… but litterally per day the absolute max and absolute minimum temperature… so I can track the days/weeks/months for these values…
any idea on how to do this?
I could write a rule to set a value… with multiple items, but perhaps there is an easier way
on outdoor_temp change #getting highest value and lowest value)
item maxvalueinterim = outdoor_temp if (outdoor_temp > maxvalueinterim )
item minvalueinterim = outdoor_temp if (outdoor_temp < minvalueinterim )
at 0:00 (#writing max and min value per day at midnight)
item maxvalue=maxvalueinterim
item minvalue=minvalueinterim
maxvalueinterim = 0 #as max value will always be >0
minvalueinterim = 100 #as max value will always be <100
create a graph with maxvalue & min value on the same axis
thats what I was hoping for… but it still gives me the ranges (going up and down) rather than pure min/max values per day… see below example - essentially i want the big red and big blue lines… not the thin blue line
as far as I understand the thick red and blue lines were manually added in the taken screenshot; they are wanted but not yet shown in the original graph ( see there are some peaks that are higher than the red line ).
I think you only added the lables for min and max value. Not the min resp. the max curve.
Just did some experiments the first but. I have the impression that you only can have on or the other ( min or max curve but not both. At least I was not able to get both of them.
made it into this - which hopefully gives me the overview later…
rule "Set MinMax"
when
Item velbusvmbpiro_Outdoor_Temperature changed
then
logInfo("WEATHER","Minimum temperature " + minvalueinterim.state)
logInfo("WEATHER","Maximum temperature " + maxvalueinterim.state)
logInfo("WEATHER","OUTSIDE temperature " + velbusvmbpiro_Outdoor_Temperature.state)
if (velbusvmbpiro_Outdoor_Temperature.state >= maxvalueinterim.state) {
maxvalueinterim.postUpdate(velbusvmbpiro_Outdoor_Temperature.state)
}
if (velbusvmbpiro_Outdoor_Temperature.state <= minvalueinterim.state) {
minvalueinterim.postUpdate(velbusvmbpiro_Outdoor_Temperature.state)
}
logInfo("WEATHER","Minimum temperature " + minvalueinterim.state)
logInfo("WEATHER","Maximum temperature " + maxvalueinterim.state)
end
rule "midnight update"
when
Time cron "5 0 0 * * ?"
then
// set the min max temperatures for that day in the fixed variables
maxvalue.postUpdate(maxvalueinterim.state)
minvalue.postUpdate(minvalueinterim.state)
//reset the interim values for the next day
// min == 100 (it would always be less -as I hope we don't have >100C)
// max == 0 (we dont have freezing cold here.. so temp would always be >0)
maxvalueinterim.postUpdate(0)
minvalueinterim.postUpdate(100)
end
rule "Reset temps on OH Start"
// rule to set the variables on system start - we can filter these out in the graph based on max / min values
when
System started
then
// min == 100 (it would always be less -as I hope we don't have >100C)
// max == 0 (we dont have freezing cold here.. so temp would always be >0)
maxvalueinterim.postUpdate(0)
minvalueinterim.postUpdate(100)
end
MDAR
(Stuart Hanlon, UK importer of Velbus hardware)
8
Thanks for posting this.
Someone asked about this a few days ago and I said I’d need to think about it… Turns out… I just had to do a quick search…
I have tweaked your rule just a little, to make it easier for people to adopt it into their systems, by only needing to change the item name in two places
rule "Set MinMax Outdoor temp"
when
Item Meteo_Temperature changed // for testing, change this to "received update"
then
logInfo("WEATHER","MinMax Rule started")
var temp = Meteo_Temperature.state
logInfo("WEATHER","Outside temp is "+temp)
// check if null states
if (maxvalueinterim.state == NULL || maxvalueinterim.state == UNDEF) {
maxvalueinterim.postUpdate(0)
}
if (minvalueinterim.state == NULL || minvalueinterim.state == UNDEF) {
minvalueinterim.postUpdate(0)
}
logInfo("WEATHER","Previous Minimum temperature " + minvalueinterim.state)
logInfo("WEATHER","Previous Maximum temperature " + maxvalueinterim.state)
logInfo("WEATHER","OUTSIDE temperature " + temp)
if (temp >= maxvalueinterim.state) {
maxvalueinterim.postUpdate(temp)
}
if (temp <= minvalueinterim.state) {
minvalueinterim.postUpdate(temp)
}
logInfo("WEATHER","New Minimum temperature " + minvalueinterim.state)
logInfo("WEATHER","New Maximum temperature " + maxvalueinterim.state)
end
rule "midnight update"
when
Time cron "5 0 0 * * ?"
then
// set the min max temperatures for that day in the fixed variables
maxvalue.postUpdate(maxvalueinterim.state)
minvalue.postUpdate(minvalueinterim.state)
//reset the interim values for the next day
// min == 100 (it would always be less -as I hope we don't have >100C)
// max == 0 (we dont have freezing cold here.. so temp would always be >0)
maxvalueinterim.postUpdate(0)
minvalueinterim.postUpdate(100)
end
I could add a triggering item line, I’ll work on that and update this