NEWS
UNSOLVED RSS feed formatierung
-
Hallo zusammen,
habe diese script am laufen aber die formatierung ist fürn ars..
Kann mir einer helfen und mir sagen was ich tun kann das es in der VIS ordentlich zu lesen ist.Also Titel - Absatz - Text usw
Danke für eure Hilfe
-
Keiner eine Idee?
-
Was nimmst du für ein Widget?
-
Müsste ganz normales html widget sein.
[{"tpl":"tplHtml","data":{"visibility-cond":"==","visibility-val":1,"refreshInterval":"0","html":"<br>{javascript.1.RSS-Feed.Bild.Tabelle}","visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"name":"NWnews feed"},"style":{"left":"10px","top":"9px","z-index":"20","width":"1270px","height":"750px","color":"#0000000","font-family":"RobotoCondensed-Light","font-size":"xx-large","font-weight":"bold","background-color":"#ffffff","opacity":"0.7","border-radius":"15px","box-shadow":"5px 5px 5px black"},"widgetSet":"basic"}]
-
Da gibt es viele Möglichkeiten, alles in den Rechten Einstellungen! ZB.:
[{"tpl":"tplHtml","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":true,"g_css_border":true,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","refreshInterval":"0","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html":"{javascript.0.RSS-Feed.Bild.Tabelle}"},"style":{"left":"12px","top":"11px","width":"1353px","height":"800px","z-index":"2","color":"#d7cec1","border-width":"","border-style":"","border-radius":"","font-family":"RobotoCondensed-Light","line-height":"200%","text-align":"left","font-size":"medium","padding":"10px"},"widgetSet":"basic"},{"tpl":"tplFrame","data":{"visibility-cond":"==","visibility-val":1,"title":"","title_color":"#d7cec1","title_top":"-30","title_left":"0","header_height":"0","header_color":"","gestures-offsetX":0,"gestures-offsetY":0,"signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/icons-mfd-svg/control_ok.svg","signals-icon-size-0":"72","signals-blink-0":false,"signals-horz-0":"90","signals-vert-0":"81","signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":"false","signals-icon-1":"/icons-mfd-svg/control_ok.svg","signals-icon-size-1":"72","signals-blink-1":false,"signals-horz-1":"90","signals-vert-1":"81","signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis.0/main/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"visibility-groups-action":"hide","lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"signals-oid-0":"","signals-oid-1":"","signals-icon-style-1":"","g_css_border":false},"style":{"left":"3px","top":"3px","width":"1403px","height":"836px","font-family":"RobotoCondensed-Light","font-style":"normal","font-variant":"normal","font-weight":"","font-size":"large","z-index":"1","background":"","box-shadow":"2px 2px 3px rgba(20, 20, 20, 50)","background-color":"#474747"},"widgetSet":"basic"}]
-
Ich reihe mich hier mal ein.
Ich habe das Script für meine Bedürfnisse umgeschrieben, habe aber ein "kleines" Problem, mit der Ausgabe von "vbb-name"
Wenn ich es vbb/-name schreibe, bekomme ich "NaN" ausgegeben, wenn ich es ohne / schreibe, bekomme ich gar keinen Wert ausgegeben:
/* VIS VBB Newsfeed {1} Bringt einen RSS-Feed als Tabelle in ioBroker setzt die Library xml2js voraus (in Javascript Einstellungen zufügen) {1} {1} erstellt: 11.05.2017 von Torsten (auf Basis von Bluefox Code und Pix) */ createState('RSS-Feed.VBB.Tabelle', {write: true, read: true, name: 'RSS Feed VBB Tabelle', type: 'string', desc: 'VBB RSS Feed als HTML Tabelle'}); createState('RSS-Feed.Optin', true, {write: true, read: true, name: 'Optin RSS Feeds abrufen', type: 'boolean', desc: 'Sollen RSS-Feeds abgerufen werden?'}); var link = 'https://www.vbb.de/broken_lifts.xml'; //var vbb = 'vbb-name'; var idOptin = 'RSS-Feed.Optin', optin_beschreibung = 'RSS Feed', idFeedTabelle = 'RSS-Feed.VBB.Tabelle'; function RSS_einlesen () { // alle 5 Minuten var optin = getState(idOptin).val; var parseString = require('xml2js').parseString; var request = require('request'); if (optin) request(link, function (error, response, body) { if (!error && response.statusCode == 200) { parseString(body, { explicitArray: false, mergeAttrs: true }, function (err, result) { //log(JSON.stringify(result, null, 2)); if (err) { log("Fehler: " + err); } else { /* // Titel links, Inhalt rechts var tabelle ='<table class="rss_feed"><thead><tr><th>Titel</th><th>Beschreibung</th></tr></thead><tbody>'; for(var i = 0; i <result.rss.channel.item.length; i++) { tabelle += '<tr><td>' + result.rss.channel.item[i].title + '</td>'</br>'<td>' + result.rss.channel.item[i].description + '</td></tr>'; } */ // Titel oben, INhalt darunter (wie in der Zeitung) var tabelle ='<table class="rss_feed"><thead><tr><th>BVG Aufzugsstörung</p></th></tr></thead><tbody>'; for(var i = 0; i <result.rss.channel.item.length; i++) { tabelle += '<tr><td>' + result.rss.channel.item[i].title + '</td></tr><tr><td>' + result.rss.channel.item[i].description + '</td></tr><tr><td>' + result.rss.channel.item[i].vbb/-name + '</td></tr>'; } tabelle += '</tbody></table>'; setState(idFeedTabelle, tabelle); } }); } else { log(error); } }); // Ende request log('RSS-Feed ' + link + ' eingelesen'); } schedule("*/10 * * * *", RSS_einlesen); RSS_einlesen(); // Opt In setzen - Logging on( { id: idOptin, change: 'ne' }, function (obj) { if (obj.newState.val === false || obj.newState.val =='false') { log('Opt in Variable <' + optin_beschreibung + ' Push> auf <aus/' + obj.newState.val + '> gesetzt ', 'info'); } else if (obj.newState.val === true || obj.newState.val =='true') { log('Opt in Variable <' + optin_beschreibung + ' Push> auf <ein/' + obj.newState.val + '> gesetzt ', 'info'); } });
Hat da jemand eine Idee, wie ich das ausgeben kann?
-
hier ein beispiel aus meinem script - der bindestrich wird wohl als minus verstanden
respa.data[0]["speedtest-status"]
hier wird der bindestrich umgangen
-
@liv-in-sky habe ich ausprobiert, gab mir ne Reihe von "NAN..." aus.
Hier wurde die Lösung gepostet:
https://forum.iobroker.net/topic/1402/rss-parser/38