I found that the pressure which my WMR200 shows is dependent on indoor temperature.
E.g. indoor temp is 22°C, pressure is 1010 hPa. At 16°C indoor temp it shows 1012 hPa.
Is it possible to create a virtual sensor (thb1) to adjust this?
My trials with selectmaster and –slave were not successful, I didn’t check the right parameters. The example in the meteohub manual uses temp only.
I need a formula like this: pressure = pressure + (indoor temp -22) / 3
It would be helpful to know which parameters are required to use thb0 as trigger for a virtual sensor thb1.
Thanks for your help.
Create virtual sensor from thb0
Moderator: Mattk
Re: Create virtual sensor from thb0
Doesn't anyone have an idea?
My problem is to find the right parameters.
I tried to define thb1 with the following parameters (no operation with the values):
selectmaster 5 300 | awk '{ printf ''%d %d %d %d %d %d'', $1, $2, $3, $4, $5, $6 }'
selectslave 5 300 | awk '{printf ''%d %d %d %d %d %d'', $1, $2, $3, $4, $5, $6 }'
This returns "1018.0° 100% 0.0mb (0.0mb) fc:0"
instead of "23.5° 25% 1018.0mb (1018.0mb) fc:4" which are the current values.
What is wrong with the parameters ???
My problem is to find the right parameters.
I tried to define thb1 with the following parameters (no operation with the values):
selectmaster 5 300 | awk '{ printf ''%d %d %d %d %d %d'', $1, $2, $3, $4, $5, $6 }'
selectslave 5 300 | awk '{printf ''%d %d %d %d %d %d'', $1, $2, $3, $4, $5, $6 }'
This returns "1018.0° 100% 0.0mb (0.0mb) fc:0"
instead of "23.5° 25% 1018.0mb (1018.0mb) fc:4" which are the current values.
What is wrong with the parameters ???
Re: Create virtual sensor from thb0
No idea ???
- YJB
- Platinum Boarder
- Posts: 387
- Joined: Thu Feb 19, 2009 5:53 pm
- Location: Venhuizen, Netherlands
- Contact:
Re: Create virtual sensor from thb0
Hi,
I've not really played with this, but what you are trying to do is wrong from an awk perspective:
This tells awk to expect 6 variables and display those as Decimal integers (that's what %d is telling awk).
If you just want all the variables back you can use:
or if you are really hooked to printf:
If you want to do some formatting you can use the following printf format specifiers:
Does that help?
Ysbrand
I've not really played with this, but what you are trying to do is wrong from an awk perspective:
Code: Select all
'{printf ''%d %d %d %d %d %d'', $1, $2, $3, $4, $5, $6 }'
If you just want all the variables back you can use:
Code: Select all
'{print $1, $2, $3, $4, $5, $6 }'
Code: Select all
'{printf ''%s %s %s %s %s %s'', $1, $2, $3, $4, $5, $6 }'
Code: Select all
c ASCII Character
d Decimal integer
e Floating Point number
(engineering format)
f Floating Point number
(fixed point format)
g The shorter of e or f,
with trailing zeros removed
o Octal
s String
x Hexadecimal
% Literal %
Ysbrand
Re: Create virtual sensor from thb0
Hi,
thanks for your answer.
I'm not familiar with awk, so I only copied the examples from the meteohub manual
and expanded it because thb0 has more parameters than th0.
But why is "%d" wrong when I expect decimal integers?
I tried the codes which you recommended, in combination with selectmaster and -slave:
selectmaster 5 300 | awk '{ print $1, $2, $3, $4, $5, $6 }'
selectslave 5 300 | awk '{print $1, $2, $3, $4, $5, $6 }'
and
selectmaster 5 300 | awk '{ printf ''%s %s %s %s %s %s'', $1, $2, $3, $4, $5, $6 }'
selectslave 5 300 | awk '{printf ''%s %s %s %s %s %s'', $1, $2, $3, $4, $5, $6 }'
but both gave NO results.
The code which I mentioned in my 2nd post gave results, but the wrong values.
cgn
thanks for your answer.
I'm not familiar with awk, so I only copied the examples from the meteohub manual
and expanded it because thb0 has more parameters than th0.
But why is "%d" wrong when I expect decimal integers?
I tried the codes which you recommended, in combination with selectmaster and -slave:
selectmaster 5 300 | awk '{ print $1, $2, $3, $4, $5, $6 }'
selectslave 5 300 | awk '{print $1, $2, $3, $4, $5, $6 }'
and
selectmaster 5 300 | awk '{ printf ''%s %s %s %s %s %s'', $1, $2, $3, $4, $5, $6 }'
selectslave 5 300 | awk '{printf ''%s %s %s %s %s %s'', $1, $2, $3, $4, $5, $6 }'
but both gave NO results.
The code which I mentioned in my 2nd post gave results, but the wrong values.
cgn
- YJB
- Platinum Boarder
- Posts: 387
- Joined: Thu Feb 19, 2009 5:53 pm
- Location: Venhuizen, Netherlands
- Contact:
Re: Create virtual sensor from thb0
HI,
I have no access to my test rig at the moment, so I can't try this, you will need to wait I guess.
23.5°: is a real and a trailing character: °
25%: is indeed an integer but has a trailing character "%"
1018.0mb: is a real and a trailing string "mb"
(1018.0mb): is a real with a character preceeding and a string trailing
fc:4: is indeed an integer but with a leading string
So, things are not really that straightforward. I guess that Boris' code expects indeed reals, which means that you will need to tear apart the numbers from the strings etc, not really straightforward.
I have no access to my test rig at the moment, so I can't try this, you will need to wait I guess.
All of the values are not really integers when you look closely:But why is "%d" wrong when I expect decimal integers?
23.5°: is a real and a trailing character: °
25%: is indeed an integer but has a trailing character "%"
1018.0mb: is a real and a trailing string "mb"
(1018.0mb): is a real with a character preceeding and a string trailing
fc:4: is indeed an integer but with a leading string
So, things are not really that straightforward. I guess that Boris' code expects indeed reals, which means that you will need to tear apart the numbers from the strings etc, not really straightforward.
Re: Create virtual sensor from thb0
Hi,
the awk instructions only use the raw data of the sensor which are without units.
E.g. "thb0 158 39 0019 10230 6 10230"
After computation with 'awk' meteohub displays the units like '°' or 'mb'.
The command awk '{ printf ''%d %d %d %d %d %d'', $3, $4, $5, $6, $7, $8 }'
returns the correct values: 15.8° 39% 1023.0mb (1023.0mb) fc:6 with their units.
After some further trials it seems that "selectmaster/selectslave" does only return one value,
so it's not usable to return all values from a combined sensor like thb0.
the awk instructions only use the raw data of the sensor which are without units.
E.g. "thb0 158 39 0019 10230 6 10230"
After computation with 'awk' meteohub displays the units like '°' or 'mb'.
The command awk '{ printf ''%d %d %d %d %d %d'', $3, $4, $5, $6, $7, $8 }'
returns the correct values: 15.8° 39% 1023.0mb (1023.0mb) fc:6 with their units.
After some further trials it seems that "selectmaster/selectslave" does only return one value,
so it's not usable to return all values from a combined sensor like thb0.