Rain Value Confusion

113 views
Skip to first unread message

Stefan Runge

unread,
Dec 22, 2016, 2:51:13 PM12/22/16
to pywws
Hi Jim,

sorry for that dump question, but i did not figure it own on my own.

Today it was raining here and i saw that my rain values are strange.
My weather station displays:

Total 24.3
Month 24.3
Week 3.6
24h 3.3
1h: 0.3

My Template uses:
Rtot #rain "%0.1f"#
R1h #calc "rain_hour(data)" "%0.1f" "0.0"#
R24h #calc "rain_day(data)" "%0.1f" "0.0"#

And the reult file shows:
Rtot 0.3
R1h 0
R24h 0

That looks quite wired for me.
Is the rain value not the total value?
Why is the rain_day, rain_hour not filed? The 0.3 which is showed was in the last hour.

Best regards,
Stefan

Jim Easterbrook

unread,
Dec 22, 2016, 2:57:17 PM12/22/16
to py...@googlegroups.com
On 22/12/16 19:51, 'Stefan Runge' via pywws wrote:
>
> Today it was raining here and i saw that my rain values are strange.
> My weather station displays:
>
> Total 24.3
> Month 24.3
> Week 3.6
> 24h 3.3
> 1h: 0.3
>
> My Template uses:
> Rtot #rain "%0.1f"#
> R1h #calc "rain_hour(data)" "%0.1f" "0.0"#
> R24h #calc "rain_day(data)" "%0.1f" "0.0"#

Which data (raw, hourly, or daily) is your template using at this point?
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

Stefan Runge

unread,
Dec 22, 2016, 3:21:39 PM12/22/16
to pywws
Does this mean in which section i put it in the wether.ini file?
It is included in Live and Logged.

I use this template to transport the data in a format my FHEM can read.
So i want the data to be updated frequently.

Fhem reads at the moment only 1 input file and parses the data from it.

If i get your comment right i would have to put the rain section in a second template which runs on raw data to get correct data here?
So i would get a second result file and i have to adapt the logic in FHEM?


Best regards,
Stefan


Jim Easterbrook

unread,
Dec 22, 2016, 3:39:42 PM12/22/16
to py...@googlegroups.com
On 22/12/16 20:21, 'Stefan Runge' via pywws wrote:
> Does this mean in which section i put it in the wether.ini file?

No, it means which type of processed data has your template selected
with the appropriate directive. It could be #raw#, #hourly#, #daily#, or
#monthly#.
http://pywws.readthedocs.io/en/latest/api/pywws.Template.html#processing-instructions

> If i get your comment right i would have to put the rain section in a
> second template which runs on raw data to get correct data here?
> So i would get a second result file and i have to adapt the logic in FHEM?

No, you just need to select the type of data that has the rain value(s)
you need. You can change data during the template if you want.

Stefan Runge

unread,
Dec 22, 2016, 4:53:42 PM12/22/16
to pywws
Hi Jim,

thanks again,

i changed for rain now to raw and get exact the values my weather station shows. Perfect!

Thanks so much.

By the way,
what data should i use for Zambretti and Zambretti code?
Is the live data ok, or it is better to do it with hourly data?

Best regards,
Stefan



Jim Easterbrook

unread,
Dec 22, 2016, 5:07:07 PM12/22/16
to py...@googlegroups.com
On 22/12/16 21:53, 'Stefan Runge' via pywws wrote:
>
> By the way,
> what data should i use for Zambretti and Zambretti code?
> Is the live data ok, or it is better to do it with hourly data?

It needs hourly data.
http://pywws.readthedocs.io/en/latest/api/pywws.Forecast.html

Stefan Runge

unread,
Dec 22, 2016, 5:17:27 PM12/22/16
to pywws
Thanks, Jim,

i did not see this.
I want to ask one last question, i will open a new topic to match the titel.

Best regards,
Stefan


Witek Wojcik

unread,
Jul 14, 2017, 3:54:49 AM7/14/17
to pywws
Hi Jim,
I am new to pywws but already really like the software, great job!. I have question similar to Stefan's related to rain data from the station (1080). 
I started using it for my sprinkler control with openhab2 over mqtt (and independently to wunderground). Normally all data is reported as expected but for the rain I need a raw data from the station to see last 24h rain (rather than since midnight, so now for example 24h rain showed on station is 2.7mm whereas reported is 0 which I believe is since midnight). Eventhough I read documentation it is not clear to me how to get this into mqtt template being still reported live.

my mqtt template is:
#live#
{
#idx          '"idx"            : "%Y-%m-%d %H:%M:%S",'#
#wind_dir     '"wind_dir"       : "%.0f",' '' 'winddir_degrees(x)'#
#wind_ave     '"wind_ave"       : "%.2f",' '' 'wind_kmph(x)'#
#wind_gust    '"wind_gust"      : "%.2f",' '' 'wind_kmph(x)'#
#hum_out      '"hum_out"        : "%.d",'#
#hum_in       '"hum_in"         : "%.d",'#
#temp_in      '"temp_in_c"      : "%.1f",'#
#temp_in      '"temp_in_f"      : "%.1f",' '' 'temp_f(x)'#
#temp_out     '"temp_out_c"     : "%.1f",'#
#temp_out     '"temp_out_f"     : "%.1f",' '' 'temp_f(x)'#
#rel_pressure '"rel_pressue"    : "%.2f",' '' 'x+4.5'#
#calc 'rain_inch(rain_hour(data))' '"rainin" : "%g",'#
#calc 'rain_inch(rain_day(data))' '"dailyrainin" : "%g",'#
#calc 'rain_hour(data)' '"rain" : "%g",'#
#calc 'rain_day(data)' '"dailyrain" : "%g",'#
}

I could overcome this problem by changing rules in openhab2 sprinkler trigger to calculate 24 rain myself but I'm pretty sure pywws can do it so don't want to overcomplicate.
Do I need #raw# section for just rain_day in parallel to #live# or I can grab this somehow within live section? I tried different things but always pywws was throwing error

Jim Easterbrook

unread,
Jul 14, 2017, 4:35:11 AM7/14/17
to py...@googlegroups.com
On 14/07/17 08:52, Witek Wojcik wrote:
> Hi Jim,
> I am new to pywws but already really like the software, great job!. I
> have question similar to Stefan's related to rain data from the station
> (1080).
> I started using it for my sprinkler control with openhab2 over mqtt (and
> independently to wunderground). Normally all data is reported as
> expected but for the rain I need a raw data from the station to see last
> 24h rain (rather than since midnight, so now for example 24h rain showed
> on station is 2.7mm whereas reported is 0 which I believe is since
> midnight). Eventhough I read documentation it is not clear to me how to
> get this into mqtt template being still reported live.

There's no official way to do this, but you might manage it with some
undocumented and unsupported cleverness. Something like this:

#calc "data['rain']-data_set[data_set.nearest(data['idx']-DAY)]['rain']"

This simply subtracts the rain data from 24 hours ago from the current
value, so could return a negative value if your outside sensors are
reset for any reason or the rain counter reaches its max value and
resets to zero.

Witek Wojcik

unread,
Jul 14, 2017, 5:25:02 AM7/14/17
to pywws
Thanks Jim for the quick turnaround. This shows me the way to do it but need to tune it (probably due to my poor explanantion it doesn't do what I needed actualy displays what station does, but this is the direction for me).
isn't there a way to get it as a parameter from the station? I did a quick check with EasyWeather on Windows and station sends this param to it (although inserts in a non-sense field as Total Max Rain which isn't true for me unless it is a big coincidence). I can't find it in the station.ini though...

Jim Easterbrook

unread,
Jul 14, 2017, 5:36:20 AM7/14/17
to py...@googlegroups.com
On 14/07/17 10:25, Witek Wojcik wrote:
> Thanks Jim for the quick turnaround. This shows me the way to do it but
> need to tune it (probably due to my poor explanantion it doesn't do what
> I needed actualy displays what station does, but this is the direction
> for me).
> isn't there a way to get it as a parameter from the station? I did a
> quick check with EasyWeather on Windows and station sends this param to
> it (although inserts in a non-sense field as Total Max Rain which isn't
> true for me unless it is a big coincidence). I can't find it in the
> station.ini though...
There's no way to directly access what's displayed on the station
console. All we can do is perform a similar calculation based on the
same data.

I'm still not clear what you want to show. I thought it was the amount
of rain in the last 24 hours, which is what my suggested calculation
should do.

Witek Wojcik

unread,
Jul 14, 2017, 5:45:47 AM7/14/17
to pywws
Jim, 
this is exactly what I want to show - rain in the period of last 24h (to simply switch off sprinkler if higher than threshold).
and your rule gives me data but it's different than on the station - station shows 2.7mm, your rule 3.3 and wunderground graph shows something yet different for the last 24h (IMICHAOW9) :). Therefore I assumed that station counts it properly whereas other rules are making some assumptions which are not clear to me. I know it can partially come from the fact that I restarted pywws (when moving station to my windows computer etc) because I'm not persisting data anywhere, just sending over mqtt (and obviously raw is in txt files on the raspPI)

Jim Easterbrook

unread,
Jul 14, 2017, 5:57:59 AM7/14/17
to py...@googlegroups.com
On 14/07/17 10:45, Witek Wojcik wrote:
> Jim,
> this is exactly what I want to show - rain in the period of last 24h (to
> simply switch off sprinkler if higher than threshold).
> and your rule gives me data but it's different than on the station -
> station shows 2.7mm, your rule 3.3 and wunderground graph shows
> something yet different for the last 24h (IMICHAOW9) :). Therefore I
> assumed that station counts it properly whereas other rules are making
> some assumptions which are not clear to me.

Given the incompetence of other parts of the weather station design I
wouldn't trust its reading over my own calculation. Anyway, now you have
a means of calculating the rain over any period you can adjust it until
you get the value you want. E.g. to get the rain over the last 23 hours:

#calc
"data['rain']-data_set[data_set.nearest(data['idx']+HOUR-DAY)]['rain']"

Witek Wojcik

unread,
Jul 14, 2017, 6:35:28 AM7/14/17
to pywws
Jim, this is correct and very much appreciated. I already took a decision that I'll rely on your method so I'll have it under control but will also be able to change (or add variations of it when needed). Many thanks again!
Reply all
Reply to author
Forward
0 new messages