RSS - FEED

46 views
Skip to first unread message

Fjordey

unread,
Mar 6, 2024, 10:08:34 AMMar 6
to weewx-user
I realize not many are using the RSS feed, yet I am to just get a quick check of things while sorting through my news feeds... regaurdless the reason I need help if possible...

I'm not an expert by any means, but can fumble my way through the coding most times.

#1 I edited the template to only provide the current conditions. That works.
#2 I was trying to format the returned data:

Wind: 0 mph from N/A; Rain: 0.00

trying to remove the ";" and put Rain: 0.00 on the next line.. (have not figured that out)

#3 I have noticed that my rain total is 0.00 when it should show 0.80 for toal rain.
Note: the rain total and text formating were not working before I edited the template.

any help would be apreciated... Hopefully I'm just overlooking something simple.

https://weather.3utilities.icu/rss.xml

my current rss.xml.tmpl:

<?xml version="1.0"?>
<rss version="2.0"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" >

#set $timespans = [{"span": $day, "label": $gettext("Daily summary as of")}, {"span": $month, "label": $gettext("Monthly summary as of")}, {"span": $year, "label": $gettext("Yearly summary as of")}]

#set $observations = $to_list($DisplayOptions.get('observations_rss', ['outTemp', 'inTemp', 'barometer', 'windSpeed', 'rain', 'rainRate']))
#set $obs_type_sum = $to_list($DisplayOptions.get('obs_type_sum', ['rain']))
#set $obs_type_max = $to_list($DisplayOptions.get('obs_type_max', ['rainRate']))

  <channel>
    <title>$gettext("Weather Conditions") : $station.location</title>
    <link>$station.station_url</link>
    <description>$gettext("Current conditions, and daily, monthly, and yearly summaries")</description>
    <language>"$lang"</language>
    <pubDate>$current.dateTime.format("%a, %d %b %Y %H:%M:%S %Z")</pubDate>

    <lastBuildDate>$current.dateTime.format("%a, %d %b %Y %H:%M:%S %Z")</lastBuildDate>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>weewx $station.version</generator>
    <ttl>$current.interval.string('')</ttl>

    <item>
      <title>$gettext("Weather Conditions at") $current.dateTime</title>
      <link>$station.station_url</link>
      <description>
#for $x in $observations
  #if $getattr($current, $x).has_data
    #if $x == 'windSpeed'
        $obs.label.wind: $current.windSpeed $gettext("from") $current.windDir;
    #else
        $obs.label[$x]: $getattr($current, $x);
    #end if
  #end if
#end for
      </description>
      <pubDate>$current.dateTime.format("%a, %d %b %Y %H:%M:%S %Z")</pubDate>
      <content:encoded><![CDATA[
      <p>
      $obs.label.dateTime: $current.dateTime<br/>
#for $x in $observations
  #if $getattr($current, $x).has_data
    #if $x == 'windSpeed'
        $obs.label.wind: $current.windSpeed $gettext("from") $current.windDir;
    #else
        $obs.label[$x]: $getattr($current, $x)<br/>
    #end if
  #end if
#end for
      </p>
      ]]></content:encoded>
    </item>

  </channel>
</rss>

Tom Keffer

unread,
Mar 6, 2024, 3:12:16 PMMar 6
to weewx...@googlegroups.com
A template file is a not-very-obvious mix of HTML and Cheetah tags. To get the formatting you need, change this

#for $x in $observations
  #if $getattr($current, $x).has_data
    #if $x == 'windSpeed'
        $obs.label.wind: $current.windSpeed $gettext("from") $current.windDir;
    #else
        $obs.label[$x]: $getattr($current, $x);
    #end if
  #end if
#end for

to this

#for $x in $observations
  #if $getattr($current, $x).has_data
    #if $x == 'windSpeed'
        $obs.label.wind: $current.windSpeed $gettext("from") $current.windDir;<br/>

    #else
        $obs.label[$x]: $getattr($current, $x);<br/>
    #end if
  #end if
#end for

The "rain" tag under "Weather Conditions" is the rain that fell during the last archive period, which is generally only 5-30 minutes. If you want rain since midnight, you can find that under "Daily summary".







--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/eba24381-6fbf-437b-ad2f-a09fffa01fe0n%40googlegroups.com.

Fjordey

unread,
Mar 6, 2024, 4:58:09 PMMar 6
to weewx-user
Thanks Tom, I will make the changes, and look at the rain further in the next few days..
Reply all
Reply to author
Forward
0 new messages