Update 4.6n - experimental update

What's hot...

Moderator: Mattk

Post Reply
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Update 4.6n - experimental update

Post by admin »

Update to Meteohub V4.6n (NSLU2, x86, SheevaPlug) brings these features:
  • Restarts http server on SheevaPlug if this has terminated by accident.
  • Cleanup of old kernel modules when using most recent SheevaPlug image based on 2.6.32 kernel. This frees the root partition from void data and brings usage from 90% to 85%.
  • Introduction of virtual sensors (something that has been requested for ages, to support home-brew solar sensors made of modified thermo sensors). Conversion of sensor values is done by external program or by gawk scripting, which allows for specification of conversion rules via the web interface. Up to 10 virtual sensors can be defined. Virtual sensors can be used for graphing, weather networks, data exports, wd-live, dashboard and can be used for HTML template replacement. They even show up on sensors page with their actual data. This feature is quite heavily integrated into multiple Meteohub components, so I guess it will need some hardening time until it is 100% bug free and it might have unwanted side effects.
  • Manual has been updated to version 4.7 to cover virtual sensors and other modifications.
Link: http://www.meteohub.de/files/update-v4.6n.upd

Warning, this update contains major code changes for various Meteohub components. Omit this update when you are focusing on a maximum stable production system. However, virtual sensors might be something exiting to explore for early adopters taking the risk of discovering bugs.
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re: Update 4.6n - experimental update

Post by YJB »

Cleanup of old kernel modules when using most recent SheevaPlug image based on 2.6.32 kernel. This frees the root partition from void data and brings usage from 90% to 85%.
Does that mean that you are recommending to update existing Sheeva (2.6.29) instances to this kernel version as well? If so, what is the recommended procedure?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Update 4.6n - experimental update

Post by admin »

no, when your clock runs fine on your sheeva, there is no need to flash a new sd card with 2.6.32.
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re: Update 4.6n - experimental update

Post by skyewright »

admin wrote:Update to Meteohub V4.6n (NSLU2, x86, SheevaPlug) brings these features:
Warning, this update contains major code changes for various Meteohub components. Omit this update when you are focusing on a maximum stable production system. However, virtual sensors might be something exiting to explore for early adopters taking the risk of discovering bugs.
It's been running fine here for several days.

I've just added a first virtual sensor. So far so good...

Ive set up a virtual sensor data20 which is a percentage value derived from temperature t10. A t10 value of 35.0 C is regarded as 100%

My 'conversion' is:

awk ' { printf ''%d'', $2*100*100/350}'

I realise that equation could be simplified, but at this stage I felt there was a lot to be said for clarity!

t10 is a value provided by my 'fileecho' plug-in and represents the difference in temp between my standard outdoor temp sensor and my "temp in a jar" temp. At present a 35 C difference represents a (daytime) clear sky, so data20 is giving me an approximate daytime clear sky percentage. I've had such a percentage before, but that involved a double pass of data through the fileecho plug-in which inevitably added in a time delay. The virtual sensor mechanism does a better job more neatly. :)
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re: Update 4.6n - experimental update

Post by YJB »

I've installed 4.6o on my test system since I wanted to play with the virtual sensors.

As usual I probably wanted to do something simple, which turns out to be complicated: I want to add the values of 2 data sensors and put the result in a virtual; sensor. As far as I can see right now, awk can only play with the values associated with one sensor, how can I refer to the other sensor?

Background:
I have 2 data sensors (data10 and data12) which are measuring the power utilization in my house (for 2 distinct phases), I want to add the values together to get the total power usage.
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re: Update 4.6n - experimental update

Post by skyewright »

YJB wrote:As far as I can see right now, awk can only play with the values associated with one sensor, how can I refer to the other sensor?
Yes.
The "Difference" virtual sensor can make use of 2 sensors, but does subtraction not addition.
Background:
I have 2 data sensors (data10 and data12) which are measuring the power utilization in my house (for 2 distinct phases), I want to add the values together to get the total power usage.
If Boris doesn't have a neat new trick waiting up his sleeve , maybe the "template echo" plug-in I mention in this topic would do the trick for you?

I used that plug-in for a "difference", but as the maths is in the html template you could tweak the maths to get addition rather than subtraction.

I'm not sure if the file attachment survided the change in Forum software; if you are interested but can't collect the file let me know and I'll see if I can make it available again.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Update 4.6n - experimental update

Post by admin »

Next update will also have a "sensadd" predefined function, similar to "sensdiff" but just adding values and a "select" function which can be used to pipe selected value of the master followed by selected value of slave sensor to an awk statement of your liking. This should give you even more flexibility to do math on data of two different sensors.

Here is the documentation on that:

Sensor Addition
Predefined conversion function "sensoraddmaster" and "sensoraddslave" allows to add data of two trigger sensors and to assign the added result to a virtual sensor. What sensor is "master" and what "sensor" is slave is not important. Parameters is identical to explanation in previous paragraph "Sensor Difference".

Sensor Data Selection
To arrange more complicated math on data coming from two different sensors, Meteohub provides predefined functions "selectmaster" and "selectslave". Both take the position parameter, which determines what parameter from the sensor to take, followed by a time-out value, which defines how old the data of the corresponding is allowed to be in order to still be regarded as valid. When data is regarded being timed-out "none" is returned instead of a numeric value. Values piped to the next evaluation step is data of master sensor followed by data of slave sensor (or simply "none" when one of the sensor data is timed-out). This data can be used for further processing by the next step in a pipe.
Noname.png
Noname.png (3.43 KiB) Viewed 8793 times
Example above stores average temperature of "th0" and "th1" to "t9" by adding temperature values of both trigger sensors and dividing that by 2. When either "th0" of "th1" has outdated or no values, "none" is reported to indicate that no average value being available. As you can see gawk also supports if-then-else clauses apart from pure math. This gives tons of opportunities for doing things.
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re: Update 4.6n - experimental update

Post by YJB »

Thanks Boris, this looks promising.

One thing I'm wondering:
I don't want to interfere with the design, but is this approach not way to complicated? I'm probably overlooking things but wouldn't it not be simpler to have a syntax like this (only showing the conversion field):

$1=th0;$2=th1;gawk '{ if {$1 == ''none'' || $2 == ''none'') printf ''none'';else printf ''%d, ($1 -- $2)}'

(not sure if this is completely syntactically right, but one gets the idea)

In this way I would expect more flexibility and consequentially maintenance from your side
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Update 4.6n - experimental update

Post by admin »

your suggestion has a few flaws...
1) it does not tell which parameter to take from the trigger sensors
2) the math $1 -- $2 is not doing the averaging
3) as the conversion has to be started each time one of the trigger sensors have received new data, you need a way to know what the data of the other sensor included in the computation has been. "selectmaster" and "selectslave" do take care on that. without that, it will not work.

I omit that the syntax is a bit complicated, but in the end a user will touch this in only a few situations and a forum like this can provide help on the design. 95% of users will never make use of virtual sensors at all, i guess.
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re: Update 4.6n - experimental update

Post by YJB »

Ok, I see what you are trying to say.

One question, will the virtual sensor only be updated when the master is changed, or also when the salve changes?

Reason I'm asking: If I got 2 sensors that are updated every 30 seconds, one would end up with 4 updates to the virtual sensor every minute (2 triggers from the master, 2 from the slave). Things will be even worse if one has a Vantage wind-sensor in the equation, one that will be updated every 2-3 seconds).
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Update 4.6n - experimental update

Post by admin »

when you put a conversion routine into both slots (master and slave) an update of the virtual sensor will be done each time one of the trigger sensors fires. You can alter this behavior, by just placing a conversion formula into the "master" section and returning just "none" when the "slave" gets triggered. So again, lots of flexibility.
meti
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: Mon Nov 22, 2010 11:00 am
Location: Kelheim, Germany

Re: Update 4.6n - experimental update

Post by meti »

I have a question in the average function. How an I get e.g. a virtual sensor t9 with the average temperature calculated with use of 4 sensors thb0, th1, th2 and th3? Or any other combination of more than 2 sensors.
Meteohub on Alix 3D3 -- Oregon WMR928NX
Post Reply