So given that I probably made mistakes from the start, I cannot seem to progress this, I know you have made this decluttering way as you have multiple sources over multiple stacks, however I’m only interested in a few stories at a time, in fact, ideally I would love 1 story that cycles through the list, but thats another day
In your dashboard, decluttering templates are at the top level. Here is my whole dashboard (note you would in your case modify to move decluttering_templates to the top above views: at the same level):
Sorry I know you have been patient, I had to restart from scratch as something went screwy last night and I had a load of work to recreate to get back to this point. May I check my config as it is still not recognising.
I downloaded declutter and auto-entities from HACS
In config I have added this
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
lovelace:
mode: yaml
resources:
- url: /local/decluttering-card.js
type: module
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml
I did not set up auto-entities other than download it
I feel it’s fundamental and a little stupid, but would it be possible to glance over this, it looks really just about there and so close with all the help you have provided.
Thanks
New user here, and I fought long and hard with this as it looked good, and finally got somewhere. Firstly if you’re adding the card via the GUI, take out the hyphen, and subsequently correct the following lines indentation. So This;
Still very new to this and it took me a long while to figure out my biggest issue. It would not recognise the decluttering-card.js, kept telling me it wasn’t available despite me loading the .js into www. Turns out I had the code all wrong as in my haste didn’t find the download link so effectively made it up. It was late last night. Anyway seems a simple overwrite of the file isn’t enough, you have to convince HA it is in fact a new file and needs to be reloaded rather than drawn from it’s cache. You can do this by adding a version number to the end of the resource it seems.
It all appears to work as shown in the example.
The missus said that she does not want all the cards, just one card refreshed at a time, so I have adapted the code to reflect this. Yes it beats the whole point of declutter and everything else, but its still a learning win and I may implement this elsewhere.
So I have played around a bit with the formatting, but cannot get a decent size picture. I have been instructed by the OH she would like a picture and headline only. I assume the picture is being enlarged from the original thumbnail and may become pixilated
Any pointers as I’m also a beginner hacking away blindly trying to work things out.
decluttering_templates:
newsfeed_template:
card:
type: custom:auto-entities
card:
type: vertical-stack
title: '[[title]]'
card_param: cards
filter:
template: |
{%- for story in state_attr('[[newsfeed]]','channel').item -%}
{% if (loop.index < 2) %}
{% set title = "<h3><a href='" + story.link + "'>" + story.title + "</a></h3>" -%}
{% set table = "<font size='4'><table><tr><td width='50%'><p><img src='" + story['media:content']['@url'] + "'/></p></td><td width='2%'/><td width='48%'><p>" + story.description +"</p></td></tr></table></font>" -%}
{% set content = title + table -%}
{{-
{"type": "markdown","content": content}
-}},
{% endif %}
{%- endfor -%}
As you can see from the original card, I do not have a lot of room for it to fit in the tablet space which is mounted in the hallway
I think I recall you using Sky News feeds? I just tried one for Sky News and I get the tiny image. Other news feeds I’ve used have the full image so it’s likely and issue with the feed itself. Maybe try a different feed as a test.
Great that you got it. For my wallpads I was thinking of implementing a sensor that just rotates the news item every “X” seconds. Might do that in the future.
I used the feedreader integration to see the 5 most important news from my RSS provider, however I have not been able to organize the code so that they can all be seen, it only prints the most recent one.
This is my code in yalm:
feedreader:
urls:
- rss | La FM
scan_interval:
minutes: 3
limit: 5
You could easily enhance some of this … I would use some CSS to eliminate the numbering, you could also use the tag “source” URL to get the source name and style differently but it is in every title anyway.
The second example is a little different so the template has to change. The RSS feed could have image (or not) and also could have description (or not). It also uses media:thumbnail and not media:content. So you should have another template for it, this would work: