Netatmo + openweathermap

Hi,

I'm using a robonect module for my automower which has connection to openweathermaps to get weather data. The problem for me is that the collected data is far away and therefor not accurate.

I've purchased a netatmo weather station where I get the local information from and now I'm trying to use the openweathermap api to create my own weather station and send the data I've got from the netatmo weather station using node red and openweathermaps api.

Has anyone else done something similar and is familiar with on how to create the node for it?

Thanks

/ M

1 Like

While googling for this module, it appears that it has an API, you can send commands to your mower from node-red as well, which means you can start/stop mowing based on the information you get from your netatmo station. (ie you are not dependent on openweathermap)

Get the status from the module:

http://<your-mower-ip-address>/xml?cmd=status&user=<username>&pass=<password>

Replace the ip, user, password with your details and set it in a http request node.

Then use an inject-node -> http-request node -> xml node -> debug node

Click the inject node and you get the status of your mower.

More information about the available commands. [Source].

Mäher in automatischen Modus (Timer) setzen: <http:///xml?cmd=mode&mode=auto&user=Nutzername&pass=passwort>
Mäher zurück in Basis (Modus Home) setzen: <http:///xml?cmd=mode&mode=home&user=Nutzername&pass=passwort>
Mäher starten (abhängig vom Mäher und Status, was gestartet wird): <http:///xml?cmd=start&user=Nutzername&pass=passwort>
Mäher stoppen: <http:///xml?cmd=stop&user=Nutzername&pass=passwort>
Mäher ab sofort für x Stunden arbeiten lassen (Manueller Job, fährt aber zwischendurch zum Laden zurück
): <http:///xml?cmd=mode&mode=job&duration=xxx&user=Nutzername&pass=passwort> (xxx=Zeit in Minuten)
Mäher macht für heute Feierabend (= ab 0:00 Uhr wieder im vorherigen Modus, welcher auch immer das war): <http:///xml?cmd=mode&mode=eod&user=Nutzername&pass=passwort>

Hey

Thanks for the reply.

I know the that I can control the mower towards the Netatmo. The thing is that I don’t really get it to work 100%.

Why I want to great my own weather station on openweathermaps is because there is a weather function listening to owm in robonect.

Having my own ID on owm will make the robonect module control it instead of having trouble making the flow 100% correct.

1 Like

I understand. But you say that openweathermap is not accurate for your location. If you submit netatmo to owm there is no difference between direct from netatmo to mower and netatmo -> owm -> mower other than the settings that you show in the screenshots. Personally I would find it easier to query your netatmo and use that as the source for the flow.

You can update owm with their API

This comes down to, register your station once and after that update the weather information for the station id.

Example flow;

[{"id":"e14e3bcc.6a5f78","type":"inject","z":"a767d395.f10e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156,"y":576,"wires":[["b56374b6.8a38a"]]},{"id":"d31b669a.199d4","type":"http request","z":"a767d395.f10e8","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":502,"y":576,"wires":[["8673a6a3.47313"]]},{"id":"8673a6a3.47313","type":"debug","z":"a767d395.f10e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":672,"y":576,"wires":[]},{"id":"b56374b6.8a38a","type":"function","z":"a767d395.f10e8","name":"","func":"appid = \"123456\" \nmsg.url = \"http://api.openweathermap.org/data/3.0/stations?APPID=\"+appid\nmsg.payload = {\n    \"external_id\": \"SF_TEST001\",\n    \"name\": \"San Francisco Test Station\",\n    \"latitude\": 37.76,\n    \"longitude\": -122.43,\n    \"altitude\": 150\n}\nmsg.headers = {};\nmsg.headers['Content-type'] = 'application/json';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":324,"y":576,"wires":[["d31b669a.199d4"]]},{"id":"9ebe977.25d1868","type":"comment","z":"a767d395.f10e8","name":"Setup once - change details in function node","info":"","x":242,"y":528,"wires":[]},{"id":"c6af9ba6.d07eb8","type":"inject","z":"a767d395.f10e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156,"y":720,"wires":[["dc588fa7.a7a038"]]},{"id":"d4f89c10.a430b8","type":"http request","z":"a767d395.f10e8","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":502,"y":720,"wires":[["a837a7c3.9310d8"]]},{"id":"a837a7c3.9310d8","type":"debug","z":"a767d395.f10e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":672,"y":720,"wires":[]},{"id":"dc588fa7.a7a038","type":"function","z":"a767d395.f10e8","name":"","func":"appid = \"123456\" \nmsg.url = \"http://api.openweathermap.org/data/3.0/stations?APPID=\"+appid\nmsg.payload = [\n  {\n    \"station_id\": \"583436dd9643a9000196b8d6\",\n    \"dt\": 1479817340,\n    \"temperature\": 18.7,\n    \"wind_speed\": 1.2,\n    \"wind_gust\": 3.4,\n    \"pressure\": 1021,\n    \"humidity\": 87,\n    \"rain_1h\": 2,\n    \"clouds\": [\n        {\n            \"condition\": \"NSC\"\n        }\n    ]\n  }\n]\nmsg.headers = {};\nmsg.headers['Content-type'] = 'application/json';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":324,"y":720,"wires":[["d4f89c10.a430b8"]]},{"id":"1432ead2.889f55","type":"comment","z":"a767d395.f10e8","name":"Update the weather station to owm","info":"","x":212,"y":672,"wires":[]}]

You will need to change the function nodes with your own information.

To update the weather station data, you will need to modify it in such a way that you get information from your netatmo station (there is a netatmo node) and read it into the function node, so that it can be submitted.

But as said, I think it is easier to just read your netatmo and use that information directly to start/stop/home your mower. You can even get the public information from all netatmo stations around you so that you can determine the chance on rain more accurately with some average.

Aah...
What I was thinking was sending the Netatmo info to owm and get the id. There for I’ve got the actuall weather from my location and not the one 20 km from here.

When reading the openweathermap api there the measurements url I'm suppose to use to send the weather information.

I've tried to rewrite the function you posted to the one below.
I do get a status code 204 back from their API which apparently means that the data has arrived. But, checking the URL I only see brackets with no information.

Should I do something else with the msg.payloads I've typed and shouldn't I have them included in the URL?

appid = "xxx" 

msg.url = "https://api.openweathermap.org/data/3.0/measurements?station_id=xxx&type=h&limit=100&appid=xxx&from=xxx&to=xxx"

msg.payload = [
  {
    "station_id": "xxx",
    "dt": msg.payload.detailed[0].dashboard_data.time_utc,
    "temperature": msg.payload.compact.outdoor.temperature,
    "pressure": msg.payload.compact.pressure,
    "humidity": msg.payload.compact.outdoor.humidity,
    "rain_1h": msg.payload.compact.rain.sum_rain_1,
  }
]
msg.headers = {};
msg.headers['Content-type'] = 'application/json';
return msg;

Going this owm route makes it convoluted in my opinion, what is the reason you want to do this ? Just to use the interface ? The information you submit to omw is the information you submit yourself, the interface of your mower uses the same information but cannot make predictions because there is only 1 station, which is your own.

You have this information available from your netatmo.

Let's say you want to mow once a week. In a simple form; use an inject node with an weekly interval, check the data from the netatmo, if not raining and humidity lower than 85%, send start mow command to your mower.

Why doing this detour is because I’ve tried making a flow where it only listens to the Netatmo. It doesn’t really do what I want though.

It looks for the humidity and starts to mowe. But while mowing it stops in parked mode, then starts to mowe again. This happens each 5 min since that’s the time interval in the inject.

By Sending the information to owm I’ll get my if for the submitted data from the weather station. That ID is submitted in the weather control in the robonect module which is working without any problems. Only that I’ve got the wrong location.

I have created an example to give you some hints, how you can do this in node-red.

The idea is: every 10 minutes, store the netatmo data into a flow variable called weather.

Once a week (or how often you want to mow) the mowing flow starts; it reads a variable: isMowing, if it does not exist, check the humidity, check temperature (both from the weather variable), if they are all within the set range, then isMowing is set to true. So whenever you execute the mowing flow it will not execute again because the variable is still set.

The start mowing node should be followed with http request node that actually calls your mower to start.
When it finishes or stops, delete the isMowing variable.

This should work. One element is not covered and that is, when the parameters are not met, it will wait for a week (as it is scheduled for once a week), that part can be tweaked as well. I can help if needed.

[{"id":"4e050629.42e69","type":"get stations data","z":"105aec4b.40c1dc","name":"","creds":"e4672ecc.8be048","x":330,"y":96,"wires":[["79ee6615.1f8dd"]]},{"id":"d3473ea6.1c3c78","type":"inject","z":"105aec4b.40c1dc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":142,"y":96,"wires":[["4e050629.42e69"]]},{"id":"79ee6615.1f8dd","type":"change","z":"105aec4b.40c1dc","name":"","rules":[{"t":"set","p":"weather","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":536,"y":96,"wires":[[]]},{"id":"12df6adc.ecc82d","type":"inject","z":"105aec4b.40c1dc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * 1","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":142,"y":168,"wires":[["cd3472c5.38cef8"]]},{"id":"cd3472c5.38cef8","type":"switch","z":"105aec4b.40c1dc","name":"Is Mowing ?","property":"isMowing","propertyType":"flow","rules":[{"t":"null"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":168,"wires":[["c1141b52.d59738"]]},{"id":"11592b8e.ea0b1c","type":"debug","z":"105aec4b.40c1dc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1198,"y":168,"wires":[]},{"id":"c1141b52.d59738","type":"switch","z":"105aec4b.40c1dc","name":"Humidity <85% ?","property":"weather.devices[0].modules[0].dashboard_data.Humidity","propertyType":"flow","rules":[{"t":"lt","v":"85","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":498,"y":168,"wires":[["a06e9e91.e7b9b8"]]},{"id":"a06e9e91.e7b9b8","type":"switch","z":"105aec4b.40c1dc","name":"Temperature > 10°C and < 26°C?","property":"weather.devices[0].modules[0].dashboard_data.min_temp","propertyType":"flow","rules":[{"t":"btwn","v":"10","vt":"num","v2":"26","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":764,"y":168,"wires":[["943e52e.5dc9bb"]]},{"id":"943e52e.5dc9bb","type":"change","z":"105aec4b.40c1dc","name":"Start mowing","rules":[{"t":"set","p":"payload","pt":"msg","to":"Mowing Started","tot":"str"},{"t":"set","p":"isMowing","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1006,"y":168,"wires":[["11592b8e.ea0b1c"]]},{"id":"e4672ecc.8be048","type":"configNode","z":"","client_id":"5d50f741affea00015220661","client_secret":"PG2kN7CYYNF5stStc7xw0Nd4RAB9pXB01Zdknoz66FVN6","username":"richardbakker@me.com","password":"Swhqnl51va","device_id":"70:ee:50:13:50:28"}]

Note that I used the data from my own netatmo, i dont have a rain module, you should match the object details with your own data.

This is just an idea how you can solve these types of flows.

1 Like

I was thinking..

I was more thinking like this.. wouldn't this be enough?
I'm more into changing the status of the mower to "home" while the humidity is let say over 75% while below it will be set to auto.

I've got three modes. Manual, auto and home.
Manual is manual. Auto will go after the timer settings on my robonect module and the home mode is charging in the station.

[{"id":"1820bf1c.d7ec01","type":"inject","z":"416ecc90.fc5174","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":140,"wires":[["86638f3a.9600c"]]},{"id":"86638f3a.9600c","type":"netatmo-dashboard","z":"416ecc90.fc5174","creds":"97d8241e.de65d8","x":320,"y":140,"wires":[["e3b2b2fb.ffe9"]]},{"id":"e3b2b2fb.ffe9","type":"function","z":"416ecc90.fc5174","name":"humidity","func":"var regn = global.get(\"regn\");\nif (msg.payload.compact.outdoor.humidity >= 75)\n{\n    global.set(\"regn\",\"true\");\n    return msg;\n}\nelse (msg.payload.compact.outdoor.humidity <= 74)\n{\n    global.set(\"regn\", \"false\");\n    return msg;\n}\n\n\n\n","outputs":1,"noerr":0,"x":500,"y":140,"wires":[["94d5fcf9.e0dbd"]]},{"id":"bdde2dd.0dfdad","type":"mqtt out","z":"416ecc90.fc5174","name":"","topic":"mower/control/mode","qos":"","retain":"","broker":"2c54e5d1.9e495a","x":800,"y":80,"wires":[]},{"id":"94d5fcf9.e0dbd","type":"switch","z":"416ecc90.fc5174","name":"","property":"mower","propertyType":"global","rules":[{"t":"eq","v":"auto","vt":"str"},{"t":"eq","v":"home","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":80,"wires":[["bdde2dd.0dfdad","aee80461.9b9bb8"],["bdde2dd.0dfdad","f277263b.0aa7f8"]]},{"id":"f277263b.0aa7f8","type":"debug","z":"416ecc90.fc5174","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":140,"wires":[]},{"id":"aee80461.9b9bb8","type":"debug","z":"416ecc90.fc5174","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":20,"wires":[]},{"id":"97d8241e.de65d8","type":"netatmo-config-node","z":"","client_id":"5f0b7f4ec1230029867325e5","client_secret":"xxxxxx","username":"me@xxxxxx.se","password":"xxxxx"},{"id":"2c54e5d1.9e495a","type":"mqtt-broker","z":"","name":"Teltonika","broker":"192.168.1.1","port":"1883","clientid":"NodeRed","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.