Thanks Gary, I was completely overthinking it and forgetting about 
gauge-data.txt! I've added a small script in index.html.tmpl to pull the 
forecast string out of the gauge-data.txt json string, works a treat.

<td><p class="text-dark"><dfn data-info='Short term hyperlocal forecast for 
Lerwick'>Short Term Forecast</dfn>:</p></td>
<td><p class="text-dark" id="fcst"></p></td>

<script>
const xmlhttp = new XMLHttpRequest();
xmlhttp.onload = function() {
  const gaugeData = JSON.parse(this.responseText);
  document.getElementById("fcst").innerHTML = gaugeData.forecast;
}
xmlhttp.open("GET", "ss/gauge-data.txt");
xmlhttp.send();
</script>

Thanks again,

Rory

On Saturday, November 23, 2024 at 2:21:22 AM UTC gjr80 wrote:

> Just one clarifying point; the RTGD extension generates a data file, 
> gauge-data.txt, that contains data in JSON format for use as the data 
> source for the SteelSeries Weather Gauges. The RTGD extension does not 
> generate any URL as such nor does it populate any web page with data, its 
> sole purpose is to generate gauge-data.txt. 
>
> The RTGD extension runs as a WeeWX service that uses a separate thread to 
> poll a source (in your case WU) at regular intervals for the forecast text. 
> RTGD takes this forecast text and saves it to a field in a JSON data 
> structure in the file gauge-data.txt. RTGD does not save the forecast text 
> field in any loop packets or archive records nor is there any connection 
> between RTGD and the forecast extension (I believe the forecast extension 
> may obtain data from WU but as far as I am aware it does not obtain the 
> forecast text).
>
> The simplest way to obtain the RTGD forecast text is to read and parse the 
> JSON data in gauge-data.txt. Any other approach will likely involve you 
> modifying the RTGD code base or writing your own service.
>
> Gary
> On Thursday, 21 November 2024 at 21:11:25 UTC+11 [email protected] 
> wrote:
>
>> Hi, I have both the forecast and RTGD extensions installed on my WeeWX 
>> 5.1 instance. The RTGD extension displays a text forecast (in my case using 
>> the WU API) in a <canvas> scroller which I have added to my main index page:
>>
>> [image: Screenshot 2024-11-21 at 09.50.54.png]
>>
>> The code for the above is:
>>
>> <td><h6 class="h5-responsive text-dark">  | <dfn data-info='Short term 
>> hyperlocal forecast for Lerwick'>Short Term Forecast</dfn>:</h6></td>
>> <td><canvas id="canvas_status" width="450" height="21"></canvas></td>
>>
>> I can't find any way to pull the "narrative" using the forecast 
>> extension, but as the URL is already constructed by RTGD is there a simple 
>> way to pull the text strings out of the RTGD canvas and have it in a 
>> standard <div> tag instead? The reason is I am struggling to make the 
>> <canvas> responsive so it goes off the screen on small devices / mobiles. 
>>
>> I understand that I should probably contact the extension devs directly 
>> as an issue on Github, but I know Gary frequents this group and may be able 
>> to help! TIA
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/4a0d4682-5fb0-444e-845b-85c81148087an%40googlegroups.com.

Reply via email to