Parsing temperature values in

3 posts / 0 new
Last post
Esa's picture
Parsing temperature values in

my nearby weather station (EFTP) sends temperatures in whole digits, not with decimals and this causes the grep to fail when parsing the data.
Additionally here in north we will expect subzero temperatures as well, sometimes during the nights.

The current regexp for temps is [0-9]*\.[0-9]* which fails to notice the non-decimals like "17", and also the negative values.
I played around with site and found that e.g this expression "-?\d\d*(\.\d+)?" would match below cases
except "+" characted but that is not expected to be found in weather data

But anyway, I can't get this expression working in the HiveTool nor in rpi itself - any idea is there some grep version issues ?

below data from the station:
<?xml version="1.0" encoding="utf-8" ?>
<credit>Weather Underground Personal Weather Station</credit>
<title>Weather Underground</title>
<full>, Tampere, </full>
<elevation> ft</elevation>
<observation_time>Last Updated on July 12, 12:20 PM EEST</observation_time>
<observation_time_rfc822>Tue, 12 Jul 2016 09:20:00 GMT</observation_time_rfc822>
<weather>Scattered Clouds</weather>
<temperature_string>66 F (19 C)</temperature_string>
<wind_string>From the at 15 MPH </wind_string>
<pressure_string>29.47" (998 mb)</pressure_string>
<dewpoint_string>57 F (14 C)</dewpoint_string>


Hi Esa,

Hi Esa,
I think i made a fix for that some time ago and sent it to Paul. I'll try to look for it next week.

Esa's picture
meanwhile waiting for that

meanwhile waiting for that fix to be published, could you share it here so I could hack the HiveTool myself ?

Log in to post comments