PWS + Meteobridge + Humidity Trend N/A ** Solved **

Hi Wim,
Is it possible to have Humidity Trend added to realtimeMB.txt and then loaded into $weather-array? At the moment according to this it’s “n/a”:
I don’t yet understand how realtime.txt is read and loaded into $weather["humidity_trend"] to do this myself.

Contents of $weather-Array
(
    [barometer] => 1025.9
    [barometer_max] => 1026.4
    [barometer_max_time] => 10:37
    [barometer_min] => 1024.7
    [barometer_min_time] => 02:45
    [barometer_trend] => 0.1
    [barometer_trend_text] => n/a
    [barometer_units] => hPa
    [currentdescription] => n/a
    [currentweathericon] => n/a
    [date] => 2023-05-16
    [datetime] => 1684256286
    [dewpoint] => 9
    [dewpoint_low] => n/a
    [dewpoint_low_time] => n/a
    [heat_index] => 14.6
    [humidity] => 66
    [humidity_indoor] => 53
    [humidity_trend] => n/a
    [loaded] => MB_rt
    [loaded_from] => /home/domains/vol2/825/2991825/user/htdocs/pws/realtime.txt
    [lux] => 3305
    [rain_lasthour] => 0
    [rain_month] => 44.4
    [rain_rate] => 0
    [rain_today] => 0
    [rain_units] => mm
    [rain_yday] => 2
    [rain_year] => 411.4
    [solar] => 27
    [solar_max] => n/a
    [solar_max_time] => n/a
    [swversion] => MB_rt_5.5
    [temp] => 15.3
    [temp_feel] => 14.6
    [temp_high] => 18.3
    [temp_high_time] => 14:02
    [temp_indoor] => 21.2
    [temp_indoor_feel] => 20.8
    [temp_low] => 5.1
    [temp_low_time] => 04:56
    [temp_trend] => -0.3
    [temp_units] => C
    [time] => 17:58:06
    [uv] => 0
    [uv_max] => n/a
    [uv_max_time] => n/a
    [wetbulb] => n/a
    [wind_direction] => 27.0
    [wind_direction_avg] => 26.0
    [wind_gust_speed] => 3.4
    [wind_gust_speed_max] => 8.9
    [wind_gust_speed_max_time] => 08:35
    [wind_run] => n/a
    [wind_speed] => 0
    [wind_speed_avg] => 0.9
    [wind_speed_max] => 2.2
    [wind_speed_max_time] => 15:33
    [wind_units] => mph
    [windchill] => 15.3
    [windchill_low] => n/a
    [windchill_low_time] => n/a
)

Background information:
The layout of the file uploaded by your Meteobridge is the "standard’ or default realtime.txt originally defined for the weather-program Cumulus.
More info

The only difference in the Meteobridge layout, is the use of a linefeed as a field-separator where the original file-layout used a space.

You can check the uploaded file at the debug dashboard
. . . . eather.uk/pwsWD/PWS_module_test.php
left bottom column “List contents”.

The script uses the values for the fields as in PWS_module_test.php middle bottom column “Show station values”

Sadly there is no “humidity trend” in the Cumulus definition.
So the PWS_dashboard scripts can not display that value.

Your question:
If you add field 59 to the template file, you have yo modify the PWS_livedata.php script to check the contents and process that field and then store it in the weather-array.
Not a trivial taks, but others have done these kind of customisations in the past.

Succes, Wim

Wim, success indeed!
I added [th0hum-val15:--] to the realtimeMB.txt template and refreshed meteobridge

I then changed PWS_livedata.php (realtime.txt section) to this:

#$weather[humidity_trend]      = 'n/a';
$weather[humidity_trend]      = (int) $cu[3] - $cu[59];

to give me a trend based on a 15-min change in humidity.
No other changes were required.

Thank you.

Your Meteobridge has a built -in trend value
https://www.meteobridge.com/wiki/index.php/Templates

Also you do not have to change PWS_livedata.php and maintain that version for years to come.
You should use an extra_data file and instruct your Meteobridge to upload that file

You need only one line in the extra file similar to this
|humidity_trend|hum|[h0hum-delta15.1:0]|!

I think it makes live easier to postpone changing any PWS_xx.php scripts as long as possible.

Wim