TheThingsNetwork weather station with Node-Red and Domoticz

Yeah, I know what you might think, why do you want to do that? Well just because it can be done and I want to see the weather data in my Domoticz dashboard.

But most of all because normal RF range is limited to close to the house and LoRa ranges kilometers!

So what is this about?

  • A TheThingsNetwork Node with Arduino Nano, RN2483 and 2 sensors;
    • BH1750 Light sensor
    • ME280 humidity, barometric pressure and humidity sensor.
  • This node sends the weather stations’ data through the ThingsNetwork
  • Within Node-Red, the data gets picked up using MQTT connection to TTN
  • The data is sent through to Domoticz via an HTTP request

ttnweerstation_nodered_domoticz

 

As you can see above I use my good old Synology NAS to parse the MQTT data from TTN and send it through to Domoticz running on the same box.

Here is the Node-Red flow I use to get data through:

ttnweerstation_nodered_flow

The Node-Red TTN device nodes can be easily downloaded as described in the quickstart guide found here: https://www.thethingsnetwork.org/docs/applications/nodered/quick-start.html.

I configured it with my node parameters and messages came in directly.

Now to get the data to Domoticz you need to parse the MQTT data message, prepare an HTTP request and send it.

As the data is dependent on what you send from your node I will not go into this too deeply; the function “Get the payload” prepares the data, then the CSV function is used to convert it in comma separated values.

The “Send to domoticz” function then adds the data to the Domoticz API URL and the request is done to Domoticz.

For more information on the Domoticz API please go to their wiki page which explains how to send Temperature/Humidity/Barometer data: https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Temperature.2Fhumidity

To receive the temperature and humidity data within Domoticz you need to create a dummy device within the Setup->Hardware section.

Once created you need to assign what sensor it represents (click on it in the list of Hardware) For my weather station this was the Temp+Hum+Baro virtual sensor.

ttnweerstation_domotiz_sensor

That’s it! Now the Node sends it data through the ThingsNetwork and Node-Red picks the data up with MQTT and passes it on to Domoticz. Here is a picture of the data within Domoticz:

ttnweerstation_domotiz_graph

 

Advertenties

3 reacties op ‘TheThingsNetwork weather station with Node-Red and Domoticz

  1. Hi. Can you explain what the role or advantage of using Node-Red is in this case? Wouldn’t it be possible to connect TTN directly to Domoticz?

    Like

    1. At the time I developed this this was the option for me to use. ( If i had to set it up today i would indeed do it directly) although that said i use nodered to also store in into a database..

      Like

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit /  Bijwerken )

Google photo

Je reageert onder je Google account. Log uit /  Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )

Verbinden met %s