NEWS
Projekt WetterView von sigi234
-
Jetzt taucht plötzlich ein anderes Problem auf, am PC ist alles perfekt aber auf meinem Android Tablet sehe ich wieder die Wetter-Icons nicht und auch das Mond-Icon fehlt.
Was kann da die Ursache sein? -
@heli-wolf sagte in Projekt WetterView von sigi234:
Android Tablet
So geht er ja auf deinen lokalen Ordner
Dann musst du http://ipvomPc davorstellen. -
Aber das Projekt liegt ja am Raspberry, auf dem ist der iobroker installiert und genau diese Raspberry IP wähle ich aus.
Bzw. ich verwende die iobroker.App und in dieser wähle ich das Projekt aus. -
@heli-wolf sagte in Projekt WetterView von sigi234:
Bzw. ich verwende die iobroker.App
daran liegt es.
Mit der App funktionieren nicht alle Widgets.
Dies dauert oft, bis Widgets in die App aufgenommen werden.Lass die App links liegen, öffne die VIS im Browser und füge sie dann zum Startbildschirm (vom Tablet) hinzu.
Am Startbildschirm siehst du dann das Icon. Klicken und die VIS wird als Vollbild ausgeführt. -
@heli-wolf sagte in Projekt WetterView von sigi234:
iobroker.App
Aha, wie @Negalein geschrieben hat.
-
Das habe ich gerade probiert, komme aber nicht auf mein Projekt?
Wenn ich von meinem PC die VIS aufrufe, dann wird folgende URL angezeigt:
http://192.168.xxx.xxx:8082/vis/index.html?Wetter_komplett#MainGenau das habe ich jetzt im Firefox meines Tablets eingegeben, ist das falsch ??
-
@heli-wolf sagte in Projekt WetterView von sigi234:
Das habe ich gerade probiert, komme aber nicht auf mein Projekt?
Wenn ich von meinem PC die VIS aufrufe, dann wird folgende URL angezeigt:
http://192.168.xxx.xxx:8082/vis/index.html?Wetter_komplett#Main
Genau das habe ich jetzt im Firefox meines Tablets eingegeben, ist das falsch ??was kommt für eine Seite?
Oder kommt nichts?
Schon mit Chrome probiert?
Scheinen mit F12 Errors auf? -
Perfekt mit Chrome funktioniert es.
Vielen Dank !! -
nachdem mein raspberry immer wieder abstürzt habe ich mir jetzt einmal das Log angesehen und dabei einen Fehler im UWZ Skript entdeckt.
Nachdem ich keine Erfahrung mit Skripten habe, stelle ich die Fehlermeldung mal hier rein. Vielleicht kann mir da bitte jemand weiterhelfen.29.11.2019, 18:18:53.488 [info ]: javascript.0 Stop script script.js.common.uwz 29.11.2019, 18:18:54.389 [info ]: javascript.0 script.js.common.uwz: compiling TypeScript source... 29.11.2019, 18:18:54.389 [warn ]: javascript.0 script.js.common.uwz: TypeScript compilation had errors: AreaChannelId=ChannelId+"."+warncellid[j]; ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".ShortText","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".LongText","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".object","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".begin","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".end","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".severity",0,forceInitStates,{type: 'number'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".type",0,forceInitStates,{min:0, max:11, type: 'number',states:UWZTypesArray}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".type",0,forceInitStates,{min:0, max:11, type: 'number',states:UWZTypesArray}); ^ ERROR: No overload matches this call. The last overload gave the following error. Type 'boolean' has no properties in common with type 'Partial<StateCommon>'. createState(AreaChannelId+".warning."+i+".uwzLevel",0,forceInitStates,{min:0, max:5, type: 'number'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".uwzColor",0,forceInitStates,{type:'number'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".HTMLShort","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. createState(AreaChannelId+".warning."+i+".HTMLLong","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. for (i=0; i<thedata.results.length; i++) { ^ ERROR: Cannot find name 'i'. for (i=0; i<thedata.results.length; i++) { ^ ERROR: Cannot find name 'i'. for (i=0; i<thedata.results.length; i++) { ^ ERROR: Cannot find name 'i'. warnings.push(new processResultEntry(thedata.results[i])); ^ ERROR: Cannot find name 'i'. dwmlog(JSON.stringify(warnings)); ^ ERROR: Expected 3 arguments, but got 1. for (i=0; i<numOfWarnings; i++) { ^ ERROR: Cannot find name 'i'. for (i=0; i<numOfWarnings; i++) { ^ ERROR: Cannot find name 'i'. for (i=0; i<numOfWarnings; i++) { ^ ERROR: Cannot find name 'i'. if (i<warnings.length) { ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".LongText",warnings[i].LongText); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".LongText",warnings[i].LongText); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".ShortText",warnings[i].ShortText); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".ShortText",warnings[i].ShortText); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".object",warnings[i].object); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".object",warnings[i].object); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".begin",warnings[i].begin); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".begin",warnings[i].begin); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".end",warnings[i].end); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".end",warnings[i].end); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".severity",warnings[i].severity); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".severity",warnings[i].severity); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".type",warnings[i].type); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".type",warnings[i].type); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzLevel",warnings[i].uwzLevel); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzLevel",warnings[i].uwzLevel); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzColor",warnings[i].uwzColor); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzColor",warnings[i].uwzColor); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLShort",warnings[i].HTMLShort); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLShort",warnings[i].HTMLShort); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLLong",warnings[i].HTMLLong); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLLong",warnings[i].HTMLLong); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".LongText",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".ShortText",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".object","{}"); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".begin",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".end",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".severity",0); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".type",0); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzLevel",0); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzColor",0); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLShort",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLLong",""); ^ ERROR: Cannot find name 'i'. var request = require('request'); ^ ERROR: Cannot redeclare block-scoped variable 'request'. var request = require('request'); ^ ERROR: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node`. dwmlog("AREA: "+getAreaFromURI(response.request.uri.href),4); ^ ERROR: Expected 3 arguments, but got 2. dwmlog("UWZ Body: " + body,4); ^ ERROR: Expected 3 arguments, but got 2. 29.11.2019, 18:18:54.390 [info ]: javascript.0 script.js.common.uwz: registered 0 subscriptions and 1 schedule
Mod-Edit: Code/Log in Code Tags gepackt. Bitte benutzt die Code Tags Funktion -> </>
Hier gehts zur Hilfe. -
@heli-wolf sagte in Projekt WetterView von sigi234:
AreaChannelId
Hast du die auch Richtig eingetragen?
Und das:
-
Bei mir schaut das folgendermaßen aus:
Die zusätzlichen NPM Module habe ich nicht ??
Wie komme ich zu diesen? -
@heli-wolf sagte in Projekt WetterView von sigi234:
Wie komme ich zu diesen?
reinschreiben, aber nur das Rot unterstrichene.
request
-
habe ich gemacht, muss ich jetzt den PI neu durchstarten oder reicht es den javascript Adapter neu zu starten.
Wie merke ich ob das der Fehler war? -
@heli-wolf sagte in Projekt WetterView von sigi234:
habe ich gemacht, muss ich jetzt den PI neu durchstarten oder reicht es den javascript Adapter neu zu starten.
Wie merke ich ob das der Fehler war?Beides und im Log
-
das hat nichts geändert. Im Skript wird folgendes ausgegeben.
29.11.2019, 19:44:45.973 [info ]: javascript.0 Stop script script.js.common.uwz 29.11.2019, 19:44:50.276 [info ]: javascript.0 script.js.common.uwz: compiling TypeScript source... 29.11.2019, 19:44:50.277 [warn ]: javascript.0 script.js.common.uwz: TypeScript compilation had errors: AreaChannelId=ChannelId+"."+warncellid[j]; ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".ShortText","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".LongText","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".object","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".begin","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".end","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".severity",0,forceInitStates,{type: 'number'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".type",0,forceInitStates,{min:0, max:11, type: 'number',states:UWZTypesArray}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".type",0,forceInitStates,{min:0, max:11, type: 'number',states:UWZTypesArray}); ^ ERROR: No overload matches this call. The last overload gave the following error. Type 'boolean' has no properties in common with type 'Partial<StateCommon>'. createState(AreaChannelId+".warning."+i+".uwzLevel",0,forceInitStates,{min:0, max:5, type: 'number'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".uwzColor",0,forceInitStates,{type:'number'}); ^ ERROR: Cannot find name 'AreaChannelId'. Did you mean 'AreaChannelID'? createState(AreaChannelId+".warning."+i+".HTMLShort","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. createState(AreaChannelId+".warning."+i+".HTMLLong","",forceInitStates,{type: 'string'}); ^ ERROR: Cannot find name 'AreaChannelId'. for (i=0; i<thedata.results.length; i++) { ^ ERROR: Cannot find name 'i'. for (i=0; i<thedata.results.length; i++) { ^ ERROR: Cannot find name 'i'. for (i=0; i<thedata.results.length; i++) { ^ ERROR: Cannot find name 'i'. warnings.push(new processResultEntry(thedata.results[i])); ^ ERROR: Cannot find name 'i'. dwmlog(JSON.stringify(warnings)); ^ ERROR: Expected 3 arguments, but got 1. for (i=0; i<numOfWarnings; i++) { ^ ERROR: Cannot find name 'i'. for (i=0; i<numOfWarnings; i++) { ^ ERROR: Cannot find name 'i'. for (i=0; i<numOfWarnings; i++) { ^ ERROR: Cannot find name 'i'. if (i<warnings.length) { ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".LongText",warnings[i].LongText); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".LongText",warnings[i].LongText); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".ShortText",warnings[i].ShortText); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".ShortText",warnings[i].ShortText); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".object",warnings[i].object); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".object",warnings[i].object); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".begin",warnings[i].begin); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".begin",warnings[i].begin); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".end",warnings[i].end); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".end",warnings[i].end); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".severity",warnings[i].severity); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".severity",warnings[i].severity); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".type",warnings[i].type); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".type",warnings[i].type); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzLevel",warnings[i].uwzLevel); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzLevel",warnings[i].uwzLevel); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzColor",warnings[i].uwzColor); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzColor",warnings[i].uwzColor); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLShort",warnings[i].HTMLShort); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLShort",warnings[i].HTMLShort); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLLong",warnings[i].HTMLLong); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLLong",warnings[i].HTMLLong); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".LongText",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".ShortText",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".object","{}"); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".begin",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".end",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".severity",0); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".type",0); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzLevel",0); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".uwzColor",0); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLShort",""); ^ ERROR: Cannot find name 'i'. setState(AreaChannelId+".warning."+i+".HTMLLong",""); ^ ERROR: Cannot find name 'i'. var request = require('request'); ^ ERROR: Cannot redeclare block-scoped variable 'request'. var request = require('request'); ^ ERROR: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node`. dwmlog("AREA: "+getAreaFromURI(response.request.uri.href),4); ^ ERROR: Expected 3 arguments, but got 2. dwmlog("UWZ Body: " + body,4); ^ ERROR: Expected 3 arguments, but got 2. 29.11.2019, 19:44:50.278 [info ]: javascript.0 script.js.common.uwz: registered 0 subscriptions and 1 schedule
Mod-Edit: Code/Log in Code Tags gepackt. Bitte benutzt die Code Tags Funktion -> </>
Hier gehts zur Hilfe. -
Modul jetzt erfasst. -
@heli-wolf sagte in Projekt WetterView von sigi234:
Modul jetzt erfasst.
Ok, zeig mal dein Skript vom UWZ
Bitte benutzt die Code Tags Funktion -> </>
Hier gehts zur Hilfe. -
Ok, sorry aber man lernt NIE aus !!
var debuglevel = 1; var debugchannel = 'info'; function dwmlog( message, level, channel) { if (typeof channel === 'undefined') { channel = debugchannel; } if ( typeof level === 'undefined') { level = debuglevel; } if ( debuglevel >= level ) { log (message, channel ); } } var AdapterId = "javascript."+instance; var ChannelId = "UWZ"; var forceInitStates = false; var numOfWarnings = 3; var url='http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=getWarning&language=de&areaID=XXXAREAXXX'; /********************* Hier die Warnzellen-Id's eintragen *****************************/ var warncellid = ['UWZAT01026']; /**************************************************************************************/ var UWZTypesArray=["n/a","unbekannt","Sturm/Orkan","Schneefall","Starkregen","Extremfrost","Waldbrandgefahr","Gewitter","Glätte","Hitze","Glatteisregen","Bodenfrost"]; function createStates(n){ var AreaChannelID = null; for (var j=0; j<warncellid.length; j++) { AreaChannelId=ChannelId+"."+warncellid[j]; for (var i=0; i<n; i++) { createState(AreaChannelId+".warning."+i+".ShortText","",forceInitStates,{type: 'string'}); createState(AreaChannelId+".warning."+i+".LongText","",forceInitStates,{type: 'string'}); createState(AreaChannelId+".warning."+i+".object","",forceInitStates,{type: 'string'}); createState(AreaChannelId+".warning."+i+".begin","",forceInitStates,{type: 'string'}); createState(AreaChannelId+".warning."+i+".end","",forceInitStates,{type: 'string'}); createState(AreaChannelId+".warning."+i+".severity",0,forceInitStates,{type: 'number'}); createState(AreaChannelId+".warning."+i+".type",0,forceInitStates,{min:0, max:11, type: 'number',states:UWZTypesArray}); createState(AreaChannelId+".warning."+i+".uwzLevel",0,forceInitStates,{min:0, max:5, type: 'number'}); createState(AreaChannelId+".warning."+i+".uwzColor",0,forceInitStates,{type:'number'}); createState(AreaChannelId+".warning."+i+".HTMLShort","",forceInitStates,{type: 'string'}); createState(AreaChannelId+".warning."+i+".HTMLLong","",forceInitStates,{type: 'string'}); } } } function getUWZLevel (warnName){ var result = -1; // -1 is an error! var alert = warnName.split("_"); var colors = ["green","darkgreen","yellow","orange","red","violet"]; if (alert[0]=="notice") { result = 1; } else if (alert[1] == "forewarn") { result = 2; } else { result = colors.indexOf(alert[2]); } return result; } function getUWZUrgency (warnName){ var result = 0; var alert = warnName.split("_"); if (alert[1] == "forewarn") { result = 1; } else { result = 2; // immediate; } return result; } function getLevelColor(uwzLevel) { var uwzColor = [ 0x00ff00, // 0 - Grün 0x009b00, // 1 - Dunkelgrün 0xffff00, // 2 - Gelb Wetterwarnungen (Stufe 1) 0xffb400, // 3 - Orange Warnungen vor markantem Wetter (Stufe 2) 0xff0000, // 4 - Rot Unwetterwarnungen (Stufe 3) 0xff00ff, // 5 - Violett Warnungen vor extremem Unwetter (Stufe 4) ]; if (uwzLevel>=0 && uwzLevel<=5) return uwzColor[uwzLevel]; else return 0; } function createHTMLShort(w){ var html = '<div style="background: #'+w.uwzColor.toString(16)+'" border:"10px">'; var theData = JSON.parse(w.object); html += '<h3>'; if (w.uwzUrgency==1) html+="Vorwarnung vor "; else html+="Warnung vor "; html += UWZTypesArray[w.type]; html +="</h3>"; html += "<p>Zeitraum von "+formatDate(new Date(theData.dtgStart*1000),"WW, DD. OO YYYY hh:mm")+" Uhr bis "+formatDate(new Date(theData.dtgEnd*1000),"WW, DD. OO YYYY hh:mm")+" Uhr </p>"; html += '<p>'+w.ShortText+'</p>'; html += "</div>"; return html; } function createHTMLLong(w){ var html = '<div style="background: #'+w.uwzColor.toString(16)+'" border:"10px">'; var theData = JSON.parse(w.object); html += '<h3>'; if (w.uwzUrgency==1) html+="Vorwarnung vor "; else html+="Warnung vor "; html += UWZTypesArray[w.type]; html +="</h3>"; html += "<p>Zeitraum von "+formatDate(new Date(theData.dtgStart*1000),"WW, DD. OO YYYY hh:mm")+" Uhr bis "+formatDate(new Date(theData.dtgEnd*1000),"WW, DD. OO YYYY hh:mm")+" Uhr </p>"; html += '<p>'+w.LongText+'</p>'; html += "</div>"; return html; } function processResultEntry(w) { this.object = JSON.stringify(w); this.begin=formatDate(new Date(w.dtgStart*1000),"DD.MM.YYYY hh:mm"); this.end=formatDate(new Date(w.dtgEnd*1000),"DD.MM.YYYY hh:mm"); // dwmlog (formatDate(this.begin,"DD.MM.YYYY hh:mm"),4); // dwmlog (formatDate(this.end,"DD.MM.YYYY hh:mm"),4); this.LongText = w.payload.translationsLongText.DE; this.ShortText = w.payload.translationsShortText.DE; this.severity = w.severity; this.type = w.type; this.uwzLevel = getUWZLevel(w.payload.levelName); this.uwzUrgency = getUWZUrgency(w.payload.levelName); this.uwzColor = getLevelColor(this.uwzLevel); var x = this; this.HTMLShort = createHTMLShort(x); this.HTMLLong = createHTMLLong(x); } function processData(Area,data) { if (!data) { return; } var AreaChannelId=ChannelId+"."+Area; var thedata = JSON.parse(data); var warnings= []; if (thedata.results.length>0) { for (i=0; i<thedata.results.length; i++) { warnings.push(new processResultEntry(thedata.results[i])); } } warnings.sort(function(a,b){ var asort = a.severity; var bsort = b.severity; return bsort-asort; }); dwmlog(JSON.stringify(warnings)); for (i=0; i<numOfWarnings; i++) { if (i<warnings.length) { setState(AreaChannelId+".warning."+i+".LongText",warnings[i].LongText); setState(AreaChannelId+".warning."+i+".ShortText",warnings[i].ShortText); setState(AreaChannelId+".warning."+i+".object",warnings[i].object); setState(AreaChannelId+".warning."+i+".begin",warnings[i].begin); setState(AreaChannelId+".warning."+i+".end",warnings[i].end); setState(AreaChannelId+".warning."+i+".severity",warnings[i].severity); setState(AreaChannelId+".warning."+i+".type",warnings[i].type); setState(AreaChannelId+".warning."+i+".uwzLevel",warnings[i].uwzLevel); setState(AreaChannelId+".warning."+i+".uwzColor",warnings[i].uwzColor); setState(AreaChannelId+".warning."+i+".HTMLShort",warnings[i].HTMLShort); setState(AreaChannelId+".warning."+i+".HTMLLong",warnings[i].HTMLLong); } else { setState(AreaChannelId+".warning."+i+".LongText",""); setState(AreaChannelId+".warning."+i+".ShortText",""); setState(AreaChannelId+".warning."+i+".object","{}"); setState(AreaChannelId+".warning."+i+".begin",""); setState(AreaChannelId+".warning."+i+".end",""); setState(AreaChannelId+".warning."+i+".severity",0); setState(AreaChannelId+".warning."+i+".type",0); setState(AreaChannelId+".warning."+i+".uwzLevel",0); setState(AreaChannelId+".warning."+i+".uwzColor",0); setState(AreaChannelId+".warning."+i+".HTMLShort",""); setState(AreaChannelId+".warning."+i+".HTMLLong",""); } } } function getAreaFromURI(uri) { var searchstr = "&areaID="; var n = uri.search(searchstr); var result = uri.slice(n+searchstr.length,uri.length); return result; } createStates(numOfWarnings); // processData(jsond2); var request = require('request'); schedule ("3 * * * *", function(){ for (var i=0; i<warncellid.length; i++) { request({ uri: url.replace("XXXAREAXXX",warncellid[i]), method: "GET", timeout: 10000, followRedirect: true, maxRedirects: 10 }, function(error, response, body) { // dwmlog("UWZ Error" + error,2); // dwmlog("UWZ Response: " + JSON.stringify(response),4); dwmlog("AREA: "+getAreaFromURI(response.request.uri.href),4); dwmlog("UWZ Body: " + body,4); if (response.statusCode == 200) { processData(getAreaFromURI(response.request.uri.href),body); } }); } });
-
Getestet, bei mir geht es.
AHA!
script.js.common.uwz
Du hast es in common! Da gehört es nicht hin.
-
@sigi234 sagte in Projekt WetterView von sigi234:
Da gehört es nicht hin.
meins läuft auch Common. Das passt normal schon so.