Local and national news on a dashboard?

I plan on using an old android tablet as a static display of weather info, status info and hopefully some news.

Anyone aware of any guides for setting up a news story slide show of some sort, or even a list of headlines? I’m looking into RSS but if there is some good documentation out there that someone has done it would be very helpful.

Thanks!

You could have a look at the Feedreader integration. Then see if any of your preferred news providers have RSS feeds.

2 Likes

Or just create something easy …

###
### FoxNews
###
- platform: rest
  name: Fox News Breaking
  scan_interval: 360000
  unique_id: sensor.fox_new_breaking
  resource_template: https://moxie.foxnews.com/google-publisher/latest.xml
  value_template: "{{ now() }}"
  json_attributes_path: "$.rss"
  json_attributes:
    - channel

Which flowed into markdown without any bells/whistles (You could add logos, links, filtering/sorting by categories) …

type: markdown
content: |-
  {% for story in state_attr('sensor.fox_news_breaking','channel').item %}
    <h4>{{story.title}}</h4>
  {% endfor %}

Better yet, how about a little flair?

{% for story in state_attr('sensor.fox_news_breaking','channel').item %}
  <h4>{{story.title}}</h4>
  <table>
  <tr>
  <td>
     <p><img src="{{ story['media:content']['@url']}}"/></p>
  </td>
  <td>
      <p>{{story.description}}</p>
  </td>
  </tr>
  </table>
  <hr/>
{% endfor %}

7 Likes

That’s really nicely done, @kbrown01 !

Another option you might consider, @rahlquist , is Dakboard. I like their weather display options, as well as their newsfeed options. I just tested adding some sensor information from Home Assistant via the API, and that looks like it might allow for a pretty nice, rich, semi-static display.

1 Like

Thanks, I added Sports and Politics. Might bust them into story cards,
I would note that the REST sensor contains the full article text, could easily built a collapsible div that would show/hide the content.

1 Like

Any idea on how to limit the number of articles that are displayed?

Top 5 stories …

{% for story in state_attr('sensor.fox_news_breaking','channel').item %}
{% if (loop.index < 6) %}
  <h4>{{story.title}}</h4>
  <table>
  <tr>
  <td>
     <p><img src="{{ story['media:content']['@url']}}"/></p>
  </td>
  <td>
      <p>{{story.description}}</p>
  </td>
  </tr>
  </table>
  <hr/>
{% endif %}
{% endfor %}

Applied to only first column (headlines) in my setup:

2 Likes

I want to try this but when I create a markdown card and copy in the code it generates an error:

Configuration errors detected:

    missed comma between flow collection entries (4:2)

     1 | type: markdown
     2 | content: >-
     3 |   {% for story in state_attr('sen ...
     4 | {% if (loop.index < 6) %}
    ------^
     5 |   <h4>{{story.title}}</h4>
     6 |   <table>

I have DakBoard and a never ending project to replace it with WallPanel.

I am just not very good at getting the cards in the correct position compared to DakBoard which just lets me drag and drop.

Anyway my point is, if you want to replace Dakboard, use WallPanel

That looks like an indentation problem. Indent the IF two spaces (at least) to be under the FOR loop … or post the entire YAML for the card using the code button.

I think I need this little bit first but I’m unclear where to put it (newbie :thinking:). Config.yaml? Mine looks pretty empty. Seams like I should have a custom.yaml file that is included in Config.yaml where I can put “custom” stuff.

typ###
### FoxNews
###
- platform: rest
  name: Fox News Breaking
  scan_interval: 360000
  unique_id: sensor.fox_new_breaking
  resource_template: https://moxie.foxnews.com/google-publisher/latest.xml
  value_template: "{{ now() }}"
  json_attributes_path: "$.rss"
  json_attributes:
    - channel`Preformatted text`e or paste code here

Yes. You need to decide whether you want everything in one file or fragmented YAMLs.

In my case I have this is configuration.yaml:

sensor: !include sensor.yaml

And then in sensor.yaml I have:

###
### FoxNews
###
- platform: rest
  name: Fox News Breaking
  scan_interval: 3600
  unique_id: sensor.fox_new_breaking
  resource_template: https://moxie.foxnews.com/google-publisher/latest.xml
  value_template: "{{ now() }}"
  json_attributes_path: "$.rss"
  json_attributes:
    - channel
- platform: rest
  name: Fox News Sports
  scan_interval: 3600
  unique_id: sensor.fox_new_sports
  resource_template: https://moxie.foxnews.com/google-publisher/sports.xml
  value_template: "{{ now() }}"
  json_attributes_path: "$.rss"
  json_attributes:
    - channel
- platform: rest
  name: Fox News Politics
  scan_interval: 3600
  unique_id: sensor.fox_new_politics
  resource_template: https://moxie.foxnews.com/google-publisher/politics.xml
  value_template: "{{ now() }}"
  json_attributes_path: "$.rss"
  json_attributes:
    - channel

If you want it in configuration. yaml, then it should be under the key sensor:

3 Likes

OMG, thank you so much @kbrown01. This works perfectly!

1 Like

Hi, thanks for sharing this code, it was much easier to implement than the integrated newsfeeder.

I have managed to get this working but only with the news info and not the media content, is this contingent of the RSS feed I’m using BBC?

If you mean images, then just looking at the RSS XML I see a story is like this:

        <item>
            <title><![CDATA[Police failed to respond to 999 call from house where bodies found]]></title>
            <description><![CDATA[Norfolk police says the call was made just over an hour before the bodies of four people were found.]]></description>
            <link>https://www.bbc.co.uk/news/uk-england-norfolk-68040506?at_medium=RSS&amp;at_campaign=KARANGA</link>
            <guid isPermaLink="false">https://www.bbc.co.uk/news/uk-england-norfolk-68040506</guid>
            <pubDate>Sat, 20 Jan 2024 15:46:59 GMT</pubDate>
        </item>

There is only a title, description, link and pubDate … there are no images.

Contrast that with Fox News that I used:

<item>
<link>https://www.foxnews.com/politics/fulton-county-da-fani-willis-alleged-paramour-paid-plane-tickets-name-bank-statements-suggest</link>
<guid isPermaLink="true">https://www.foxnews.com/politics/fulton-county-da-fani-willis-alleged-paramour-paid-plane-tickets-name-bank-statements-suggest</guid>
<title>Fulton County DA Fani Willis' alleged paramour paid for plane tickets in her name, bank statements suggest</title>
<description>Joycelyn Wade, the estranged wife of Georgia special prosecutor Nathan Wade, alleges her husband bought plane tickets for his paramour, Fulton County DA Fani Willis.</description>
<content:encoded><p><a href="https://www.foxnews.com/category/us/us-regions/southeast/georgia" target="_blank">Georgia special prosecutor Nathan Wade</a>, the alleged paramour of Fulton County District Attorney Fani Willis, bought plane tickets in her name, according to a court filing.</p> <p>Attorneys for Wade's estranged wife, Joycelyn Wade, filed court documents on Friday that included 2022 bank statements showing purchases of flights to Miami and San Francisco. </p> <p>The statements, which were obtained by Fox News, show that Wade bought round-trip tickets for himself and Willis to Miami in October 2022, which also included a third ticket for someone named Clara Bowman on the same day from Houston to Miami. Another round-trip ticket to San Francisco for Wade and Willis was purchased in April 2023, documents show.</p> <p>Joycelyn Wade's attorneys, who seek to have Willis deposed for her divorce from Nathan Wade, argued that there "appears to be no reasonable explanation for their travels apart from a romantic relationship." </p> <p><a href="https://www.foxnews.com/politics/fulton-county-da-fani-willis-attempts-quash-subpoena" target="_blank"><strong>FULTON COUNTY DA FANI WILLIS ATTEMPTS TO QUASH SUBPOENA RELATED TO ALLEGED MISCONDUCT</strong></a></p> <p>Willis is caught in a political firestorm over allegations that she engaged in an improper relationship with Nathan Wade, whom she hired to lead the prosecution of <a href="https://www.foxnews.com/category/person/donald-trump" target="_blank">former President Donald Trump</a> and 18 others for their alleged efforts to overturn the 2020 election in Georgia.</p> <p>Willis has been subpoenaed to give a pretrial deposition in the divorce case on January 23, but in a Thursday court filing, she argued that the subpoena should be quashed. Her attorney, Cinque Axam, has argued that Joycelyn Wade has "conspired with interested parties in the criminal Election Interference Case to use the civil discovery process to annoy, embarrass, and oppress District Attorney Willis."</p> <p>Axam accused Joycelyn Wade of "obstructing and interfering" with the district attorney's ongoing case against Trump.</p> <p>In their response on Friday, Wade's attorneys denied that she is using the deposition to "harass" Willis, but "rather to seek pertinent information from her husband’s paramour regarding her relationship with Plaintiff and the extension to the Plaintiff’s financial involvement in the same."</p> <p><a href="https://www.foxnews.com/politics/georgia-trump-prosecutor-fani-willis-faces-hearing-alleged-misconduct?gate-email=cpandolfo2128%40live.com&amp;gate-email-submit=Continue" target="_blank"><strong><u>GEORGIA TRUMP PROSECUTOR FANI WILLIS FACES HEARING ON ALLEGED MISCONDUCT</u></strong></a></p> <p>While the bank records show that Nathan Wade purchased plane tickets for himself and Willis, they do not provide direct evidence of an affair — although Willis has not directly denied a romantic relationship.</p> <p>The affair allegations surfaced last week when Trump codefendant Michael Roman’s lawyer accused Willis and Nathan Wade of engaging in an <a href="https://www.foxnews.com/politics/georgia-da-fani-willis-claims-improper-relationship-accusations-based-race" target="_blank"><u>improper relationship</u></a> and mishandling public money in a separate court filing. Roman’s lawyer, Ashleigh Merchant, did not provide evidence of the alleged relationship between Willis and Wade but pointed to proof in Wade’s divorce case.</p> <p>Merchant alleges that Willis' purported relationship with Wade created a conflict of interest and that she benefited financially from the relationship in the form of lavish vacations the two took using funds his law firm had received for working on the case.</p> <p>County records show that Wade has been paid nearly $654,000 in legal fees since January 2022, an amount authorized by the district attorney, or Willis in this case.</p> <p><a href="https://www.foxnews.com/politics/georgia-da-fani-willis-claims-improper-relationship-accusations-based-race" target="_blank"><strong><u>GEORGIA DA FANI WILLIS CLAIMS 'IMPROPER' RELATIONSHIP ACCUSATIONS ARE BASED ON RACE</u></strong></a></p> <p>Wade's bank statements show more purchases, including two $1,387 and $1,284 payments for a Royal Caribbean cruise, which were made on the same day, October 4, 2022, that Wade bought the airline ticket to Miami in Willis' name. Other expenses between October 2022 and May 2023 were for Atlanta tour operator Vacation Express, the Hyatt Regency Aruba Resort and the Norwegian Cruise Line, and for the DoubleTree by Hilton Napa Valley – American Canyon. <br><br>Joycelyn Wade claimed that the bank statements show that "Ms. Willis was an intended travel partner for at least some of these trips as indicated by flights he purchased for her to accompany him." </p> <p>"It is regrettable that Ms. Willis has filed such an inflammatory Motion, which has left Defendant with no other choice than to respond forcefully and with supporting evidence in a case that is very personal in nature," the filing states.</p> <p>Fani Willis and Nathan Wade did not immediately respond to requests for comment. </p> <p><i>Fox News' Samantha Daigle; Fox News Digital's Anders Hagstrom, Brian Flood and Brandon Gillespie; and The Associated Press contributed to this report. </i></p></content:encoded>
<media:content url="https://a57.foxnews.com/static.foxnews.com/foxnews.com/content/uploads/2024/01/931/523/Fani-Willis-Nathan-Wade.jpg?ve=1&tl=1" type="image/jpeg" expression="full" width="931" height="523"/>
<category domain="foxnews.com/metadata/dc.identifier">09c52a82-1057-53e7-98c7-c7ea704916a1</category>
<category domain="foxnews.com/metadata/prism.channel">fnc</category>
<category domain="foxnews.com/metadata/dc.source">Fox News</category>
<category domain="foxnews.com/taxonomy">fox-news/us/us-regions/southeast/georgia</category>
<category domain="foxnews.com/taxonomy">fox-news/person/donald-trump</category>
<category domain="foxnews.com/taxonomy">fox-news/politics</category>
<category domain="foxnews.com/taxonomy">fox-news/us/crime</category>
<category domain="foxnews.com/taxonomy">fox-news/us/crime/police-and-law-enforcement</category>
<category domain="foxnews.com/section-path">fox-news/politics</category>
<category domain="foxnews.com/content-type">article</category>
<pubDate>Sat, 20 Jan 2024 12:20:25 -0500</pubDate>
</item>

It has media:content as well as much more infomation about the story.

Thank you and for the speedy reply.
I didn’t think to look at the source (idiot :slight_smile: ), but my assumption was the image was not included in the feed.
It’s a shame that the BBC does not do this.

Try Skynews … I see this:

    <item>
      <title>Police failed to answer 999 call from house where four people died</title>
      <link>https://news.sky.com/story/man-found-dead-alongside-young-girls-and-woman-in-norfolk-named-13052224</link>
      <description>An emergency 999 call was made by a man from the address where four people were found dead but police failed to respond, it has emerged.</description>
      <pubDate>Sat, 20 Jan 2024 13:16:00 +0000</pubDate>
      <guid>https://news.sky.com/story/man-found-dead-alongside-young-girls-and-woman-in-norfolk-named-13052224</guid>
      <enclosure url="https://e3.365dm.com/24/01/70x70/skynews-norfolk-bodies-costessey_6427425.png?20240120144505" length="0" type="image/png"/>
      <media:description type="html">Bartlomiej Kuczynski and his two daughters who were all found dead at the property</media:description>
      <media:thumbnail url="https://e3.365dm.com/24/01/70x70/skynews-norfolk-bodies-costessey_6427425.png?20240120144505" width="70" height="70"/>
      <media:content type="image/png" url="https://e3.365dm.com/24/01/70x70/skynews-norfolk-bodies-costessey_6427425.png?20240120144505"/>
    </item>

That is from here: RSS Web Feeds there is UK and many other categories but many have very abbreviated descriptions.

1 Like

I was about to put that to bed and stay with what I have, but you come in like a shining knight :star_struck:
Thanks very much, will give it a go

Great! Send a screen grab when you get finished!

Sure, just tried it in my test dashboard environment.
The pictures do not seem to be standardised in dimensions, is that what you normally see too? I can see there are slight variances with your feed, my assumption is its to do with the feed