TileBoard
TileBoard copied to clipboard
RSS Feed
Can you help me add rss/news feed type or add xml parser to iframe?
Thank you,
That would be amazing to have.
Yes you can
You can use the TYPES.CUSTOM like this: The input boolean is a helpen in Home Assistant used for state and to keep track of last_changed. You can use is for creating an interval to refresh, otherwise it refreshed every time tileboard refreshes In my example I grab the RSS feed from a Dutch weather site.
{
position: [3, 0],
type: TYPES.CUSTOM,
id: 'input_boolean.loadrain',
title: '',
width: 4,
height: 3,
state: false,
customStyles: {'background-color': '#415473'},
customHtml: function(item, entity) {
var d = new Date(entity.last_changed);
d.setSeconds(d.getSeconds() + 60);
if (entity.state == 'on' && Date.now() > d) {
$http = angular.injector(["ng"]).get("$http");
$http.get("https://data.buienradar.nl/1.0/feed/xml/rssbuienradar").then(function(data) {
document.getElementById('rssText').innerText = new window.DOMParser()
.parseFromString(data.data, "text/xml")
.querySelectorAll("item")[0]
.querySelector("description")
.firstChild
.textContent;
})
}
return '<div id="rssText" style="white-space:pre-wrap;text-align:left;padding:10px;overflow:scroll"></div>';
}
},