Skip to content

Commit 71869a9

Browse files
authored
Merge pull request #107 from fisuda/feature/openweathermap
ADD OpenWeatherMap to NGSI custom node
2 parents 7520e79 + 0b79499 commit 71869a9

File tree

15 files changed

+1233
-0
lines changed

15 files changed

+1233
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## node-red-contrib-letsfiware-NGSI v0.10.0-next
22

3+
- ADD OpenWeatherMap to NGSI custom node (#107)
34
- UPDATE documentation (#105)
45

56
## node-red-contrib-letsfiware-NGSI v0.10.0 - 21 February, 2023

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Node-RED implementation for FIWARE Open APIs
3232
- [NGSI Timeseries](docs/en/custom_nodes/ngsi_timeseries.md) (Quantumpleap)
3333
- [NGSI to Worldmap](docs/en/custom_nodes/ngsi_to_worldmap.md)
3434
- [NGSI to Dashboard](docs/en/custom_nodes/ngsi_to_dashboard.md)
35+
- [OpenWeatherMap to NGSI](docs/en/custom_nodes/openweathermap_to_ngsi.md)
3536
- [GTFS realtime to NGSI](docs/en/custom_nodes/ngsi_gtfs_realtime.md)
3637
- [FIWARE version](docs/en/custom_nodes/fiware_version.md)
3738
- [FIWARE Service and ServicePath](docs/en/custom_nodes/service-and-servicepath.md)

README_ja.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ FIWARE Open APIs の Node-RED 実装
3030
- [NGSI Timeseries](docs/en/custom_nodes/ngsi_timeseries.md) (Quantumpleap)
3131
- [NGSI to Worldmap](docs/ja/custom_nodes/ngsi_to_worldmap.md)
3232
- [NGSI to Dashboard](docs/ja/custom_nodes/ngsi_to_dashboard.md)
33+
- [OpenWeatherMap to NGSI](docs/ja/custom_nodes/openweathermap_to_ngsi.md)
3334
- [GTFS realtime to NGSI](docs/ja/custom_nodes/ngsi_gtfs_realtime.md)
3435
- [FIWARE version](docs/ja/custom_nodes/fiware_version.md)
3536
- [FIWARE Service and ServicePath](docs/ja/custom_nodes/service-and-servicepath.md)
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# OpenWeatherMap to NGSI
2+
3+
This custom node is a simple node that allows to transform current weather and forecast data of OpenWeatherMap to an NGSIv2 entity.
4+
5+
![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/openweathermap-to-ngsi/openweathermap-to-ngsi-01.png)
6+
7+
## Contents
8+
9+
<details>
10+
<summary><strong>Details</strong></summary>
11+
12+
- [Properties](#properties)
13+
- [Example](#example)
14+
15+
</details>
16+
17+
## Properties
18+
19+
![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/openweathermap-to-ngsi/openweathermap-to-ngsi-02.png)
20+
21+
- `name`: a name for a node instance
22+
23+
## Example
24+
25+
#### input
26+
27+
A `msg.data` should contain current weather data or forecast data of OpenWeatherMap.
28+
29+
```
30+
{
31+
"coord": {
32+
"lon": 139.6917,
33+
"lat": 35.6895
34+
},
35+
"weather": [
36+
{
37+
"id": 803,
38+
"main": "Clouds",
39+
"description": "broken clouds",
40+
"icon": "04n"
41+
}
42+
],
43+
"base": "stations",
44+
"main": {
45+
"temp": 278.23,
46+
"feels_like": 275.04,
47+
"temp_min": 275.4,
48+
"temp_max": 280.12,
49+
"pressure": 1022,
50+
"humidity": 55
51+
},
52+
"visibility": 10000,
53+
"wind": {
54+
"speed": 4.12,
55+
"deg": 320
56+
},
57+
"clouds": {
58+
"all": 75
59+
},
60+
"dt": 1677100198,
61+
"sys": {
62+
"type": 2,
63+
"id": 2001249,
64+
"country": "JP",
65+
"sunrise": 1677100803,
66+
"sunset": 1677140982
67+
},
68+
"timezone": 32400,
69+
"id": 1850144,
70+
"name": "Tokyo",
71+
"cod": 200
72+
}
73+
```
74+
75+
#### Output
76+
77+
A `msg.payload` contains a NGSIv2 entity.
78+
79+
```
80+
{
81+
"coord": {
82+
"type": "StructuredValue",
83+
"value": {
84+
"lon": 139.6917,
85+
"lat": 35.6895
86+
}
87+
},
88+
"weather": {
89+
"type": "StructuredValue",
90+
"value": [
91+
{
92+
"id": 803,
93+
"main": "Clouds",
94+
"description": "broken clouds",
95+
"icon": "04n"
96+
}
97+
]
98+
},
99+
"base": {
100+
"type": "Text",
101+
"value": "stations"
102+
},
103+
"main": {
104+
"type": "StructuredValue",
105+
"value": {
106+
"temp": 278.23,
107+
"feels_like": 275.04,
108+
"temp_min": 275.4,
109+
"temp_max": 280.12,
110+
"pressure": 1022,
111+
"humidity": 55
112+
}
113+
},
114+
"visibility": {
115+
"type": "Number",
116+
"value": 10000
117+
},
118+
"wind": {
119+
"type": "StructuredValue",
120+
"value": {
121+
"speed": 4.12,
122+
"deg": 320
123+
}
124+
},
125+
"clouds": {
126+
"type": "StructuredValue",
127+
"value": {
128+
"all": 75
129+
}
130+
},
131+
"dt": {
132+
"type": "Number",
133+
"value": 1677100198
134+
},
135+
"sys": {
136+
"type": "StructuredValue",
137+
"value": {
138+
"type": 2,
139+
"id": 2001249,
140+
"country": "JP",
141+
"sunrise": 1677100803,
142+
"sunset": 1677140982
143+
}
144+
},
145+
"timezone": {
146+
"type": "Number",
147+
"value": 32400
148+
},
149+
"id": "urn:ngsi-ld:OpenWeatherMapWeather:1850144",
150+
"name": {
151+
"type": "Text",
152+
"value": "Tokyo"
153+
},
154+
"cod": {
155+
"type": "Number",
156+
"value": 200
157+
},
158+
"location": {
159+
"type": "geo:json",
160+
"value": {
161+
"type": "Point",
162+
"coordinates": [
163+
139.6917,
164+
35.6895
165+
]
166+
}
167+
},
168+
"type": "OpenWeatherMapWeather"
169+
}
170+
```
171+
172+
#### Flow
173+
174+
![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/openweathermap-to-ngsi/openweathermap-to-ngsi-03.png)

docs/en/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Node-RED NGSI integration
2222
- [NGSI Timeseries](custom_nodes/ngsi_timeseries.md) (Quantumpleap)
2323
- [NGSI to Worldmap](custom_nodes/ngsi_to_worldmap.md)
2424
- [NGSI to Dashboard](custom_nodes/ngsi_to_dashboard.md)
25+
- [OpenWeatherMap to NGSI](custom_nodes/openweathermap_to_ngsi.md)
2526
- [GTFS realtime to NGSI](custom_nodes/ngsi_gtfs_realtime.md)
2627
- [FIWARE version](custom_nodes/fiware_version.md)
2728
- [FIWARE Service and ServicePath](custom_nodes/service-and-servicepath.md)
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# OpenWeatherMap to NGSI
2+
3+
このカスタム・ノードは、OpenWeatherMap の現在の天気と予報データを NGSIv2 エンティティに変換できるノードです。
4+
5+
![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/openweathermap-to-ngsi/openweathermap-to-ngsi-01.png)
6+
7+
## コンテンツ
8+
9+
<details>
10+
<summary><strong>詳細</strong></summary>
11+
12+
- [プロパティ](#properties)
13+
- [](#example)
14+
15+
</details>
16+
17+
## プロパティ
18+
19+
![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/openweathermap-to-ngsi/openweathermap-to-ngsi-02.png)
20+
21+
- `name`: ノード・インスタンスの名前
22+
23+
##
24+
25+
#### 入力
26+
27+
`msg.data` には、OpenWeatherMap の現在の気象データまたは予測データが含まれている必要があります。
28+
29+
```
30+
{
31+
"coord": {
32+
"lon": 139.6917,
33+
"lat": 35.6895
34+
},
35+
"weather": [
36+
{
37+
"id": 803,
38+
"main": "Clouds",
39+
"description": "broken clouds",
40+
"icon": "04n"
41+
}
42+
],
43+
"base": "stations",
44+
"main": {
45+
"temp": 278.23,
46+
"feels_like": 275.04,
47+
"temp_min": 275.4,
48+
"temp_max": 280.12,
49+
"pressure": 1022,
50+
"humidity": 55
51+
},
52+
"visibility": 10000,
53+
"wind": {
54+
"speed": 4.12,
55+
"deg": 320
56+
},
57+
"clouds": {
58+
"all": 75
59+
},
60+
"dt": 1677100198,
61+
"sys": {
62+
"type": 2,
63+
"id": 2001249,
64+
"country": "JP",
65+
"sunrise": 1677100803,
66+
"sunset": 1677140982
67+
},
68+
"timezone": 32400,
69+
"id": 1850144,
70+
"name": "Tokyo",
71+
"cod": 200
72+
}
73+
```
74+
75+
#### 出力
76+
77+
`msg.payload` には、NGSIv2 エンティティが含まれています。
78+
79+
```
80+
{
81+
"coord": {
82+
"type": "StructuredValue",
83+
"value": {
84+
"lon": 139.6917,
85+
"lat": 35.6895
86+
}
87+
},
88+
"weather": {
89+
"type": "StructuredValue",
90+
"value": [
91+
{
92+
"id": 803,
93+
"main": "Clouds",
94+
"description": "broken clouds",
95+
"icon": "04n"
96+
}
97+
]
98+
},
99+
"base": {
100+
"type": "Text",
101+
"value": "stations"
102+
},
103+
"main": {
104+
"type": "StructuredValue",
105+
"value": {
106+
"temp": 278.23,
107+
"feels_like": 275.04,
108+
"temp_min": 275.4,
109+
"temp_max": 280.12,
110+
"pressure": 1022,
111+
"humidity": 55
112+
}
113+
},
114+
"visibility": {
115+
"type": "Number",
116+
"value": 10000
117+
},
118+
"wind": {
119+
"type": "StructuredValue",
120+
"value": {
121+
"speed": 4.12,
122+
"deg": 320
123+
}
124+
},
125+
"clouds": {
126+
"type": "StructuredValue",
127+
"value": {
128+
"all": 75
129+
}
130+
},
131+
"dt": {
132+
"type": "Number",
133+
"value": 1677100198
134+
},
135+
"sys": {
136+
"type": "StructuredValue",
137+
"value": {
138+
"type": 2,
139+
"id": 2001249,
140+
"country": "JP",
141+
"sunrise": 1677100803,
142+
"sunset": 1677140982
143+
}
144+
},
145+
"timezone": {
146+
"type": "Number",
147+
"value": 32400
148+
},
149+
"id": "urn:ngsi-ld:OpenWeatherMapWeather:1850144",
150+
"name": {
151+
"type": "Text",
152+
"value": "Tokyo"
153+
},
154+
"cod": {
155+
"type": "Number",
156+
"value": 200
157+
},
158+
"location": {
159+
"type": "geo:json",
160+
"value": {
161+
"type": "Point",
162+
"coordinates": [
163+
139.6917,
164+
35.6895
165+
]
166+
}
167+
},
168+
"type": "OpenWeatherMapWeather"
169+
}
170+
```
171+
172+
#### フロー
173+
174+
![](https://raw.githubusercontent.com/lets-fiware/node-red-contrib-letsfiware-NGSI/gh-pages/images/openweathermap-to-ngsi/openweathermap-to-ngsi-03.png)

docs/ja/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FIWARE Open APIs の Node-RED 実装
2222
- [NGSI Timeseries](custom_nodes/ngsi_timeseries.md) (Quantumpleap)
2323
- [NGSI to Worldmap](custom_nodes/ngsi_to_worldmap.md)
2424
- [NGSI to Dashboard](custom_nodes/ngsi_to_dashboard.md)
25+
- [OpenWeatherMap to NGSI](custom_nodes/openweathermap_to_ngsi.md)
2526
- [GTFS realtime to NGSI](custom_nodes/ngsi_gtfs_realtime.md)
2627
- [FIWARE version](custom_nodes/fiware_version.md)
2728
- [FIWARE Service and ServicePath](custom_nodes/service-and-servicepath.md)

0 commit comments

Comments
 (0)