rrd-tool with a switch event dosn't work

996 views
Skip to first unread message

Falk Sauer

unread,
Aug 22, 2012, 3:30:23 PM8/22/12
to ope...@googlegroups.com
Hi,

for my planned solution i need a rrd view with related switch events.
if i make in demo project in file rrd4j.persist a extension for switches like:

Items {
    Temperature*,Weather_Chart*,Lights* : strategy = everyMinute
}

then i see in the etc/rrd4j folder all the switch*.rrd files

so far so good. Then i make a little bit switching around on the interesting switches.

if i want to see the rrd chart i become a empty chart. i used it with

http://localhost:8080/rrdchart.png?items=Light_Outdoor_Terrace,Light_Outdoor_Garage,Light_Outdoor_Frontdoor&period=h

and also with the method from the demo in sitemap

Chart item=Light_C_Corridor_Ceiling period=h refresh=10000
Chart item=Light_GF_Corridor_Ceiling period=h refresh=10000

The interesting thing is that rrd tool is knowing the value range, it displays in the empty chart the range from 0...1
this says me the rrd tool has imho values received.

has anybody a idea why i can't see the charts?
Is the problem that rrd tool has a problem with values on the upper and the bottom line?
can i configure the display range from -0,1...1,1 if this is the solution?

Regards
   Falk

Thomas Eichstädt-Engelen

unread,
Aug 22, 2012, 6:08:01 PM8/22/12
to ope...@googlegroups.com
Hi Falk,

how long are the periods between ON and OFF?

The diagram is configured to show hourly intervals so this is quite coarse grained for short switching actions, isn't it?

Regards,

Thomas E.-E.


--
You received this message because you are subscribed to the Google Groups "openhab" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openhab/-/Vb4o6g9CG5wJ.
To post to this group, send email to ope...@googlegroups.com.
To unsubscribe from this group, send email to openhab+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openhab?hl=en.

Falk Sauer

unread,
Aug 22, 2012, 11:43:21 PM8/22/12
to ope...@googlegroups.com

Hi Thomas,

the Time interval is imho long enough, in the case of temperatures i see also events with a lenght of few minutes, the time line should imho show Events from around 2..3 minutes in hour config. I think i should see a line in case of no event over an hour, the legend of the line with name i see, the line itself not.

Regards
   Falk

Falk Sauer

unread,
Aug 23, 2012, 1:19:56 AM8/23/12
to ope...@googlegroups.com
Hi,

i have found a workaround, not smart, imho too load sucking anyway it's works.

in the item file i have declared few numerical values like:

/* Switch history values */
Number Light_Hist_GF_Corridor_Ceiling    "LHGFCorrCeil"        <schalterh>    (SchalterH)
Number Light_Hist_Outdoor_Garage        "LHOutGarage"        <schalterh>    (SchalterH)
Number Light_Hist_Outdoor_Terrace        "LHOutTerrace"        <schalterh>    (SchalterH)
Number Light_Hist_Outdoor_Frontdoor        "LHOutFrontdoor"    <schalterh>    (SchalterH)

a Group for them for further use in the group section, not relevant for the solution:

Group:Number                    SchalterH    "Alle Schalter Historie"            <schalterh>     (All)

and new rules for updating this numerical values:

// rules for updating history of light switches
rule "Set number var for Light_GF_Corridor_Ceiling On"
when
    Item Light_GF_Corridor_Ceiling received command ON
then
    postUpdate(Light_Hist_GF_Corridor_Ceiling, 3)
end

rule "Set number var for Light_GF_Corridor_Ceiling Off"
when
    Item Light_GF_Corridor_Ceiling received command OFF
then
    postUpdate(Light_Hist_GF_Corridor_Ceiling, 1)
end

rule "Set number var for Light_Outdoor_Frontdoor On"
when
    Item Light_Outdoor_Frontdoor received command ON
then
    postUpdate(Light_Hist_Outdoor_Frontdoor, 2.9)
end

rule "Set number var for Light_Outdoor_Frontdoor Off"
when
    Item Light_Outdoor_Frontdoor received command OFF
then
    postUpdate(Light_Hist_Outdoor_Frontdoor, 0.9)
end

rule "Set number var for Light_Outdoor_Garage On"
when
    Item Light_Outdoor_Garage received command ON
then
    postUpdate(Light_Hist_Outdoor_Garage, 2.8)
end

rule "Set number var for Light_Outdoor_Garage Off"
when
    Item Light_Outdoor_Garage received command OFF
then
    postUpdate(Light_Hist_Outdoor_Garage, 0.8)
end

rule "Set number var for Light_Outdoor_Terrace On"
when
    Item Light_Outdoor_Terrace received command ON
then
    postUpdate(Light_Hist_Outdoor_Terrace, 2.7)
end

rule "Set number var for Light_Outdoor_Terrace Off"
when
    Item Light_Outdoor_Terrace received command OFF
then
    postUpdate(Light_Hist_Outdoor_Terrace, 0.7)
end

// end of  rules for updating history of light switches

the trick is a numerical value, i trapped in while i read yesterday in a posting from anybody Kai? that binary values from switches ever parsed as 0/1 this works not with rrd in the moment i think.
The smart aspect of this solution is i can configure how the lines are staying together in y and not staying in the same y line, this is better for the reader of long term states to see the actual state with one look.

and last but not least we need a persist setting for our history switch states:

Items {
    Temperature*,Weather_Chart*,Heating*,Lights*,SchalterH* : strategy = everyMinute
}

please correct my rules definition if it goes smarter, then we can this linking in wiki as solution.

Regards
   Falk
rrdchart.png

Kai Kreuzer

unread,
Aug 24, 2012, 6:49:49 PM8/24/12
to ope...@googlegroups.com
Hi Falk,

I have just pushed a change (http://code.google.com/p/openhab/source/detail?r=50ff3c3c50f32c45203251172066b63e5c12575b), which makes it possible to have Switches, Dimmers and Rollershutters displayed as well on rrd4j charts. All of these items are mapped to values in the range 0..1.
So it still won't look nice, if you do many switches on the same chart (because all lines will be on top of each other), but the general support is now available (in the 1.1 SNAPSHOT build at https://openhab.ci.cloudbees.com/job/openHAB/).

FYI: I plan to provide a much more powerful "expert mode" for rrd4j databases and charts for openHAB 1.1. The rrdtool syntax is very powerful and you can put a lot of information on your charts. Yet, it is pretty complicated for the average user, that's why I started with something simple in openHAB 1.0. The "expert mode" should then make it possible to use things like areas, manual scales etc. (see e.g. https://picasaweb.google.com/118079479345366575052/OpenHAB#5775902578801741570 - this picture is actually cheated, you cannot do such a chart with openHAB 1.0 - but I want to make it possible for 1.1, so stay tuned ;-))

Regards,
Kai

To view this discussion on the web visit https://groups.google.com/d/msg/openhab/-/lK2cOT7GEk8J.

To post to this group, send email to ope...@googlegroups.com.
To unsubscribe from this group, send email to openhab+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openhab?hl=en.
<rrdchart.png>

Falk Sauer

unread,
Aug 26, 2012, 2:12:59 PM8/26/12
to ope...@googlegroups.com
Hi Kai,


Am Samstag, 25. August 2012 00:49:49 UTC+2 schrieb Kai:
Hi Falk,

I have just pushed a change (http://code.google.com/p/openhab/source/detail?r=50ff3c3c50f32c45203251172066b63e5c12575b), which makes it possible to have Switches, Dimmers and Rollershutters displayed as well on rrd4j charts. All of these items are mapped to values in the range 0..1.
So it still won't look nice, if you do many switches on the same chart (because all lines will be on top of each other), but the general support is now available (in the 1.1 SNAPSHOT build at https://openhab.ci.cloudbees.com/job/openHAB/).

this is a good news! your effort is impressive.
 
FYI: I plan to provide a much more powerful "expert mode" for rrd4j databases and charts for openHAB 1.1. The rrdtool syntax is very powerful and you can put a lot of information on your charts. Yet, it is pretty complicated for the average user, that's why I started with something simple in openHAB 1.0. The "expert mode" should then make it possible to use things like areas, manual scales etc. (see e.g. https://picasaweb.google.com/118079479345366575052/OpenHAB#5775902578801741570 - this picture is actually cheated, you cannot do such a chart with openHAB 1.0 - but I want to make it possible for 1.1, so stay tuned ;-))

now is the only solution if you want to mix a switch with a temperature in normal environment range my workaround, i think this expert mode is a very good idea. You are right the rrd tool is the swiss army knife for fast and rock solid data history visualisation.
For normal mode (without expert behind the scene ;-) ) a good possibility can be a little correction value with ( value[line_index] - 0,01..0,02*line_index ) (i hope you know what i mean) for better visibility of the 1 value and maybe also for the 0 value with + sign.
 
Regards
  Falk

Kai Kreuzer

unread,
Aug 26, 2012, 3:24:09 PM8/26/12
to ope...@googlegroups.com
Hi Falk,

> For normal mode (without expert behind the scene ;-) ) a good possibility can be a little correction value with ( value[line_index] - 0,01..0,02*line_index ) (i hope you know what i mean) for better visibility of the 1 value and maybe also for the 0 value with + sign.

Yes, I know what you mean. But with the same argument we could add support for areas instead of lines, transparency, adding values together, stacking them, chaning colors, etc. ;-) So instead of making the normal mode only slightly better, I want to do the full-fledged solution that brings it all. Sorry that this means that you will have to live a while with your rules workaround.

Regards,
Kai

Falk Sauer

unread,
Aug 26, 2012, 4:29:09 PM8/26/12
to ope...@googlegroups.com
Hi Kai,

my idea with the correction factor was only meant as additional possibility for people who don't want to use the expert mode, the alternative is a very good explanation with many examples for such a expert mode. A good up to date documentation of the tricky features in many open source projects is mostly underestimated - (this is no critism! only empirically). For example the problem with the mixing of switches and numerical values in one chart is in any automatic mode not easy to solve, you're right any automatic solution can't fit all needs.
Such a expert mode needs from admin imho a good knowledge of the possibilities from rrd tool and a minimum of experience with them. I use this rrd tool at many years for network traffic and nagios events and know how complicated the understanding of the possibilities of them can be by the first contact. ;-)  

ps: i can live with the workaround without any problems. ;-)

Regards
   Falk

Thomas Eichstädt-Engelen

unread,
Aug 27, 2012, 6:53:53 AM8/27/12
to ope...@googlegroups.com
Hi Falk,

A good up to date documentation of the tricky features in many open source projects is mostly underestimated - (this is no critism! only empirically). 

do you know any good Tool to document such little code snippets?

We took a  look at Ghist and Smipple. None of them does provide the flexibility/structuredness we are looking for. E.g. there is no category to structure the given snippets. What comes closest is stackexchange.com. But we'd have to apply for an account and we won't reach the critical mass i'm afraid.

Anybody else any good hint?

Regards,

Thomas E.-E.


Falk Sauer

unread,
Aug 27, 2012, 8:18:43 AM8/27/12
to ope...@googlegroups.com
Hi Thomas,

ghist i don't know, smipple is very good in formatting of code but i don't know if its structuring skills meet all needs (grouping, indexing and external linking). In any wiki pages i saw also good templates for code snippets i don't remember where ... the problem can be the syntax highlighting for openhab.
On stackexange a little project can't get such a big icon like windows or databases, for functional aspects i think this is not necessary.
Hosting of dokumentation outside the self controlled (in other words, self backuped ;-) ) domain world can be problematic if the financier behind the external service throw in the towel.

Regards
   Falk

Falk Sauer

unread,
Aug 28, 2012, 7:51:42 AM8/28/12
to ope...@googlegroups.com
Hi Thomas,

additional to my post from yesterday i found this:

http://de.wikipedia.org/wiki/Hilfe:Syntaxhighlight

i don't know how google wiki software - what in use in the moment - works in detail,
this solution can be modified for openhab syntax.

Has anybody more knowledge over the google wiki?

Regards
    Falk

Thomas Eichstädt-Engelen

unread,
Aug 28, 2012, 8:17:43 AM8/28/12
to ope...@googlegroups.com
Hi Falk,

google wiki does support syntax highlighting. We don't use it because the permission system is very coarse grained. You can either have access to the wiki at all or not. AFAIK there is no possibility to administer permissions page wise.

Anyhow, thanks for investigating further!

Regards,

Thomas E.-E.


--
You received this message because you are subscribed to the Google Groups "openhab" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openhab/-/ZBxT0T6t-5UJ.

Kai Kreuzer

unread,
Sep 2, 2012, 4:10:36 PM9/2/12
to ope...@googlegroups.com
Hi all,

We were looking around for a while, but didn't really find something that completely suits our needs.
In the end, we decided to start with Dropbox for sharing code among each other.

We have created a shared folder, which is meant to store example rules, scripts and whatever else might be useful to others and is provided from the community. Everybody should be directly able to access it at https://www.dropbox.com/sh/3qtx1vqs8gxa6ti/VVTtudFkgz

Whoever wants to add or change something, simply request to have it shared with you from somebody who already has write access (e.g. Thomas or me).

Let us start with this, if it turns out to be not useful or there is anything better at the horizon, we are anytime free to switch :-)

Regards,
Kai

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openhab/-/rN8_D0L3ql4J.

Sam

unread,
Oct 29, 2012, 5:52:19 AM10/29/12
to ope...@googlegroups.com
"I have just pushed a change (http://code.google.com/p/openhab/source/detail?r=50ff3c3c50f32c45203251172066b63e5c12575b), which makes it possible to have Switches, Dimmers and Rollershutters displayed as well on rrd4j charts. All of these items are mapped to values in the range 0..1."


Seems to work but what about Contact? It seems that one still cannot display Contact type items in rrd4j charts? Is there a simple workaround?

Sam

Kai Kreuzer

unread,
Oct 29, 2012, 6:14:20 PM10/29/12
to ope...@googlegroups.com
Seems to work but what about Contact? It seems that one still cannot display Contact type items in rrd4j charts? Is there a simple workaround?

Looks as if I had missed that. Should not be difficult to add it as well - but which way around does it make most sense? CLOSED=0, OPEN=1? Or the other way round (as a magnet contact is "on/active" if it is closed…)?

Regards,
Kai

Sam

unread,
Oct 30, 2012, 2:34:45 AM10/30/12
to ope...@googlegroups.com, k...@openhab.org

Looks as if I had missed that. Should not be difficult to add it as well - but which way around does it make most sense? CLOSED=0, OPEN=1? Or the other way round (as a magnet contact is "on/active" if it is closed…)?

Thanks Kai, For me the first proposition would make most sense as e.g. my windows are open when the magnet switch is open.

Kai Kreuzer

unread,
Oct 31, 2012, 5:56:12 PM10/31/12
to ope...@googlegroups.com
Hi Sam,

I have just pushed the change for the Contact items, so with tomorrows CI build, it should be possible to use them in the rrd charts as well.

Regards,
Kai

Am Oct 30, 2012 um 7:34 AM schrieb Sam <samc...@hotmail.com>:


Looks as if I had missed that. Should not be difficult to add it as well - but which way around does it make most sense? CLOSED=0, OPEN=1? Or the other way round (as a magnet contact is "on/active" if it is closed…)?

Thanks Kai, For me the first proposition would make most sense as e.g. my windows are open when the magnet switch is open.

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openhab/-/0mGfzIGisj8J.

Thomas Brettinger

unread,
Jul 9, 2013, 10:37:16 AM7/9/13
to ope...@googlegroups.com, k...@openhab.org

Hi,

I'm using 1.2 currently, and when I try to chart a Switch Item, the log shows the following error:

16:18:02.978 WARN  o.e.j.servlet.ServletHandler[:553]- /rrdchart.png
java.lang.IllegalStateException: RRD file does not contain RRA: AVERAGE archive
        at org.rrd4j.core.RrdDb.findMatchingArchive(Unknown Source)
        at org.rrd4j.core.RrdDb.fetchData(Unknown Source)
        at org.rrd4j.core.FetchRequest.fetchData(Unknown Source)
        at org.rrd4j.data.DataProcessor.fetchRrdData(Unknown Source)
        at org.rrd4j.data.DataProcessor.processData(Unknown Source)
        at org.rrd4j.graph.RrdGraph.fetchData(Unknown Source)


and naturally, no chart is drawn.

Any ideas?

Regards
Thomas

Reply all
Reply to author
Forward
Message has been deleted
0 new messages