How to post weather widget through openWeatherMap node

858 views
Skip to first unread message

chris....@gmail.com

unread,
Sep 30, 2017, 1:09:03 AM9/30/17
to Node-RED
Dear,

I am learning openWeatherMap node and try to post weather widget  as follows, anyone know how to post ? P.S. Below is code get from OpenWeatherMap

<div id="openweathermap-widget-15"></div>
<script>window.myWidgetParam ? window.myWidgetParam : window.myWidgetParam = [];  window.myWidgetParam.push({id: 15,cityid: '5263045',appid: 'c58e72bfa7ecb35e35428e2e794373dc',units: 'metric',containerid: 'openweathermap-widget-15',  });  (function() {var script = document.createElement('script');script.async = true;script.charset = "utf-8";script.src = "http://openweathermap.org/themes/openweathermap/assets/vendor/owm/js/weather-widget-generator.js";var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(script, s);  })();</script>

Auto Generated Inline Image 1

Julian Knight

unread,
Sep 30, 2017, 8:56:11 AM9/30/17
to Node-RED
When you say "post", do you mean that you want to see that widget in your ui Dashboard?

If so, you need to pass the code from OWM through to the Dashboard front-end because it is processed in the browser not on the Node-RED server.

Alternatively, you could use the OWM API to get the data directly and build your own weather dashboard.
Message has been deleted

Jan Van den Audenaerde

unread,
Oct 2, 2017, 3:02:45 PM10/2/17
to Node-RED
Hi Chris,

You can copy paste the widget code in a node-red-dashboard (ui) template node.
See example below (I have masked my API key !!!).

kr
jan


[{"id":"622eb770.7a39b8","type":"ui_template","z":"cf01c82.351d938","group":"f1577d10.1161c","name":"","order":0,"width":"11","height":"13","format":"<div id=\"openweathermap-widget-15\"></div>\n<script>window.myWidgetParam ? window.myWidgetParam : window.myWidgetParam = [];  window.myWidgetParam.push({id: 15,cityid: '2643743',appid: 'PUT_HERE_YOUR_API_KEY',units: 'metric',containerid: 'openweathermap-widget-15',  });  (function() {var script = document.createElement('script');script.async = true;script.charset = \"utf-8\";script.src = \"https://openweathermap.org/themes/openweathermap/assets/vendor/owm/js/weather-widget-generator.js\";var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(script, s);  })();</script>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":822,"y":164,"wires":[[]]},{"id":"f1577d10.1161c","type":"ui_group","z":"","name":"test 13","tab":"efa50434.954ad8","order":1,"disp":true,"width":"11"},{"id":"efa50434.954ad8","type":"ui_tab","name":"Tab 13","icon":"dashboard","order":13}]



chris....@gmail.com

unread,
Oct 8, 2017, 11:09:01 PM10/8/17
to Node-RED
Thanks Jan, I copy paste your widget code and update my API Key. However it shows nothing and the picture as follows,


BR,
Chris

在 2017年10月3日星期二 UTC+8上午3:02:45,Jan Van den Audenaerde写道:
Auto Generated Inline Image 1
Reply all
Reply to author
Forward
0 new messages