Comments (4)
Hello @dmqgit, sure looks like this:
Here the JSON to Import in NodeRed. You need to set <YourCity>
and <YourAPIKey>
and maybe lang from de to en:
[ { "id": "d2886601.ec3c68", "type": "inject", "z": "fa87d6b3.a5fec", "name": "alle 2h", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "7200", "crontab": "", "once": true, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 100, "y": 80, "wires": [ [ "a3d88fda.33fe48" ] ] }, { "id": "1692069.b679df9", "type": "http request", "z": "fa87d6b3.a5fec", "name": "VisualCrossing Weather API", "method": "GET", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "authType": "", "credentials": {}, "x": 640, "y": 80, "wires": [ [ "93477d7.5f0d3" ] ] }, { "id": "93477d7.5f0d3", "type": "switch", "z": "fa87d6b3.a5fec", "name": "StatusCode", "property": "statusCode", "propertyType": "msg", "rules": [ { "t": "eq", "v": "200", "vt": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 850, "y": 80, "wires": [ [ "843028a.34c8ad8" ], [ "ca8ea481.d979e8" ] ] }, { "id": "ca8ea481.d979e8", "type": "debug", "z": "fa87d6b3.a5fec", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1010, "y": 120, "wires": [] }, { "id": "58aafc13.5c0fb4", "type": "function", "z": "fa87d6b3.a5fec", "name": "Set up url", "func": "msg.daysun = msg.payload;\nmsg.url = \"https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/<YourCity>/\";\n\n// set up the data/time\nvar now = new Date(); \nvar dd = String(now.getDate()).padStart(2, '0');\nvar mm = String(now.getMonth() + 1).padStart(2, '0'); //January is 0!\nvar yyyy = now.getFullYear();\n\nnow.setDate(now.getDate() - 1);\nmsg.url += now.toISOString().slice(0, 10) + '/';\nnow.setDate(now.getDate() + 8);\nmsg.url += now.toISOString().slice(0, 10) + '/';\nmsg.url += '?unitGroup=metric&lang=de&key=<YourAPIKey>';\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 420, "y": 80, "wires": [ [ "e763833f.6047e8", "1692069.b679df9" ] ] }, { "id": "e763833f.6047e8", "type": "debug", "z": "fa87d6b3.a5fec", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "url", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 580, "y": 120, "wires": [] }, { "id": "28d3827f.a4e676", "type": "debug", "z": "fa87d6b3.a5fec", "name": "", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1250, "y": 120, "wires": [] }, { "id": "843028a.34c8ad8", "type": "function", "z": "fa87d6b3.a5fec", "name": "Get Days & Hours", "func": "var result = [];\nvar pl = msg.payload;\nvar sun = msg.daysun;\nvar dSunFrom = new Date(sun.startTime);\nvar SunFromSecs = dSunFrom.getSeconds() + (60 * dSunFrom.getMinutes()) + (3600 * dSunFrom.getHours());\nvar dSunTo = new Date(sun.endTime);\nvar SunToSecs = dSunTo.getSeconds() + (60 * dSunTo.getMinutes()) + (3600 * dSunTo.getHours());\n\nfor (var nDay in pl.days)\n{\n var day = pl.days[nDay];\n for (var nHour in day.hours)\n {\n var hour = day.hours[nHour];\n \n var dAt = new Date(hour.datetimeEpoch * 1000);\n var dAtSecs = dAt.getSeconds() + (60 * dAt.getMinutes()) + (3600 * dAt.getHours());\n \n var daytime = dAtSecs > SunFromSecs && dAtSecs < SunToSecs;\n var daytime_show = daytime ? -10 : 0;\n var nightime_show = daytime ? 0 : -10;\n var cloud_cover = (hour.cloudcover ? hour.cloudcover : 0) / 100;\n var sun_cover = daytime ? 1 - cloud_cover : 0;\n\n var data = {\n measurement: 'forecast',\n fields: {\n precipIntensity: (hour.precip ? hour.precip : 0) + (hour.snow ? hour.snow : 0),\n precipProbability: hour.precipprob ? hour.precipprob : 0,\n temperature: hour.temp ? hour.temp : 0,\n apparent_temperature: hour.feelslike ? hour.feelslike : 0,\n dew_point: hour.dew ? hour.dew : 0,\n humidity: hour.humidity ? hour.humidity : 0,\n wind_speed: hour.windspeed ? hour.windspeed : 0,\n wind_bearing: hour.winddir ? hour.winddir : 0,\n cloud_cover: cloud_cover,\n sun_cover: sun_cover,\n pressure: hour.pressure ? hour.pressure : 0,\n uvindex: hour.uvindex ? hour.uvindex : 0,\n daytime: daytime,\n daytime_show: daytime_show,\n nightime_show: nightime_show,\n solarradiation: hour.solarradiation ? hour.solarradiation : 0,\n solarenergy: hour.solarenergy ? hour.solarenergy : 0\n },\n tags: {\n source: 'visualcrossing'\n },\n timestamp: hour.datetimeEpoch * 1000\n };\n \n result.push(data);\n }\n}\n\nmsg.payload = result;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1050, "y": 80, "wires": [ [ "28d3827f.a4e676", "1cb7ae26.9541aa" ] ] }, { "id": "a3d88fda.33fe48", "type": "sun-position", "z": "fa87d6b3.a5fec", "name": "Sonnenstand", "positionConfig": "8c7609ce.dd5798", "rules": [], "onlyOnChange": "true", "topic": "", "outputs": 1, "start": "sunriseStart", "startType": "pdsTime", "startOffset": 0, "startOffsetType": "none", "startOffsetMultiplier": 60000, "end": "sunsetEnd", "endType": "pdsTime", "endOffset": 0, "endOffsetType": "none", "endOffsetMultiplier": 60000, "x": 260, "y": 80, "wires": [ [ "58aafc13.5c0fb4" ] ] }, { "id": "1cb7ae26.9541aa", "type": "influxdb batch", "z": "fa87d6b3.a5fec", "influxdb": "9fbecbdb.cc6cc", "precision": "ms", "retentionPolicy": "", "name": "", "x": 1260, "y": 80, "wires": [] }, { "id": "8c7609ce.dd5798", "type": "position-config", "name": "DACH-1", "isValide": "true", "longitude": "0", "latitude": "0", "angleType": "deg", "timeZoneOffset": 99, "timeZoneDST": 0, "stateTimeFormat": "3", "stateDateFormat": "12", "contextStore": "" }, { "id": "9fbecbdb.cc6cc", "type": "influxdb", "hostname": "127.0.0.1", "port": "8086", "protocol": "http", "database": "openhab", "name": "openhab", "usetls": false, "tls": "", "influxdbVersion": "1.x", "url": "http://localhost:8086", "rejectUnauthorized": true } ]
from darksky2influxdb.
I think best option is to move to https://openweathermap.org/
from darksky2influxdb.
Thanks, but I managed it meanwhile with https://weather.visualcrossing.com REST API and NodeRed.
from darksky2influxdb.
Thanks, but I managed it meanwhile with https://weather.visualcrossing.com REST API and NodeRed.
Looks good @PanicMan. Would you mind sharing your solution with node-red and visualcrossing? Thanks in advance.
from darksky2influxdb.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from darksky2influxdb.