HWS-template (WD34) July version available

Don’t think Wim will mind if I do it here, others might be interested.

Build your WD customtext.txt file with all the tags you want and get the resulting customtextout.txt uploaded to the same place as clientraw.txt (for simplicity). Then edit w34_livedata.php:


#  load clientraw
    $file_live      = file_get_contents($livedata);
    $wd             = explode(" ", $file_live);
#  load customtextout
    $file_live2 = file_get_contents('../customtextout.txt');
    $customtext = explode(" ", $file_live2);

The first three lines (101-3) already exist, just add the next three and then you can define the data from your tags like so:


	$weather["barometer_max"]       = convert_baro ($wd[131],$from,$to);
	$weather["barometer_max_time"]  = $customtext[10];   # tag %highbarot% - was 'n/a'; # clientrawextra 799
	$weather["barometer_min"]       = convert_baro ($wd[132],$from,$to);
	$weather["barometer_min_time"]  = $customtext[9];    # tag %lobarot% - was 'n/a'; # clientrawextra 800

or


        $weather['temp_garden']         = convert_temp ($wd[20],$from,$to);
		$num			= heatIndex($wd[20], $wd[26]);
	$weather['temp_garden_feel']	= convert_temp ($num,$from,$to);
	$weather["temp_garden_low"]     = convert_temp ($customtext[0],$from,$to);	# tag %wmr918/68extratemplow%
	$weather["temp_garden_high"]    = convert_temp ($customtext[2],$from,$to);	# tag %wmr918/68extratemphigh%
	$weather["lowgtemptime"]        = $customtext[1];	# tag %wmr918/68templowtime%
	$weather["maxgtemptime"]        = $customtext[3];	# tag %wmr918/68temphightime%

where I have renamed Wim’s $weather[‘extra_tmp1’] and added a few extra things (some of which have not made it to the /pwsnew/ version yet but can be seen at the original url, as left).

If I was starting out afresh I’d choose a shorter name for the array than $customtext - means less typing :slight_smile:

Using a customtextout.txt file seems more efficient than “exploding” clientrawextra.txt for a few extra items.

P.S. The tag %rainlasthourmm% (or imperial equivalent) is useful, it means “rain last hour” isn’t shown as “negative rain yesterday” just after midnight:


#	$value                          = (float) $wd[109] - (float) $wd[100];  # 2019-01-14 -21
#	$weather["rain_lasthour"]       = convert_precip ($value ,$from,$to);   # 2019-01-14
	$weather["rain_lasthour"]       = convert_precip ($customtext[8],$from,$to);	# tag %rainlasthourmm%