|
[{"id":"1224a912.eddb57","type":"inject","name":"Starter","topic":"start","payload":"27612","payloadType":"none","repeat":"","crontab":"","once":true,"x":107,"y":85,"z":"497a8838.b68578","wires":[["960d8f4.f69f27"]]},{"id":"960d8f4.f69f27","type":"http request","name":"Yandex.Weather","method":"GET","url":"export.yandex.ru/weather-ng/forecasts/27612.xml","x":234,"y":204,"z":"497a8838.b68578","wires":[["7360c88d.8c9f38"]]},{"id":"7360c88d.8c9f38","type":"xml","name":"xml->object","x":453,"y":206,"z":"497a8838.b68578","wires":[["3fccd6b.fc0332a","89d28b4c.762d78","b8222c96.47ddd","60022b4a.9ffdd4","22197a81.dde686"]]},{"id":"f8a3c581.075c38","type":"debug","name":"","active":true,"console":"false","complete":"true","x":1210,"y":197,"z":"497a8838.b68578","wires":[]},{"id":"3fccd6b.fc0332a","type":"function","name":"weather_now_temperature","func":"var newMsg = { payload: {value:msg.payload.forecast.fact[0].temperature[0]._}};\nreturn newMsg;\n","outputs":"1","x":858,"y":113,"z":"497a8838.b68578","wires":[["f8a3c581.075c38"]]},{"id":"89d28b4c.762d78","type":"function","name":"weather_now_type","func":"var newMsg = { payload: {value:msg.payload.forecast.fact[0].weather_type[0]}};\nreturn newMsg;","outputs":1,"x":837,"y":155,"z":"497a8838.b68578","wires":[["f8a3c581.075c38"]]},{"id":"b8222c96.47ddd","type":"function","name":"weather_now_wind_speed","func":"var newMsg = { payload: {value:msg.payload.forecast.fact[0].wind_speed[0]}};\nreturn newMsg;","outputs":1,"x":846,"y":199,"z":"497a8838.b68578","wires":[["f8a3c581.075c38"]]},{"id":"60022b4a.9ffdd4","type":"function","name":"weather_now_humidity","func":"var newMsg = { payload: {value:msg.payload.forecast.fact[0].humidity[0]}};\nreturn newMsg;","outputs":1,"x":844,"y":295,"z":"497a8838.b68578","wires":[["f8a3c581.075c38"]]},{"id":"22197a81.dde686","type":"function","name":"weather_now_wind_direction","func":"var direction = msg.payload.forecast.fact[0].wind_direction[0];\n\nswitch (direction){\n\tcase \"n\":\n\t\tdirection = \"серверный\";\n\t\tbreak\n\tcase \"nw\":\n\t\tdirection = \"серверо-западный\";\n\t\tbreak\n\tcase \"ne\":\n\t\tdirection = \"серверо-восточный\";\n\t\tbreak\n\tdefault:\n\t\tbreak\n}\n\nvar newMsg = { payload: {value:direction}};\nreturn newMsg;","outputs":1,"x":853,"y":247,"z":"497a8838.b68578","wires":[["f8a3c581.075c38"]]}] |