MQTT-Help me understand about the MQTT Gateway.
-
Th purpose of the mqtt gateway with an NRF24L01 is, I assume , to collect data from RF based sensors and pass the data through to controller. In my situation, I create a temperature node using an esp8266 and a nRF24L01. The MQTT gateway handles the data just like any other gateway. Goes anyone have an example of a sensor node that posts a mqtt message to the gateway? The GatewayESP8266MQTTClient.ino example doesn't show me much. Sorry to be a pain. just saying...
-
@dpcons sensor nodes can not post a mqtt message. Sensor nodes can’t even be aware that they talk to a mqtt gateway: the nodes don’t know if the gateway is wifi, mqtt, serial or any other type.
With that said, sensor nodes can send any message to a gateway, and the gateway will forward the message on mqtt (if it is a mqtt gateway). Simplest example is probably something like https://github.com/mysensors/MySensors/blob/development/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino or https://github.com/mysensors/MySensors/blob/development/examples/BinarySwitchSleepSensor/BinarySwitchSleepSensor.ino
-
@dpcons All the esp8266 devices with which I have experience have WiFi and can be Tasmotized. Fundamental to Tasmota is to WiFi; you specify the SSID and passphrase. Also fundamental to Tasmota is connecting to an MQTT broker; you supply IP address and, if necessary, name and password. In addition, there exists DHTxx configurations. Load this software and your data is going to the broker.
(Home Assistant has an integration for Tasmota whch requires the MQTT integration.)
I have done this many times and for me it takes less time that it did to write this response to get a DHT12 putting data to the broker. Tasmota is incredibly well supported, so it shouldn't take you much longer.
I make the assumption that you already have a way to program the esp8266. The process to which I refer ggoes something like this:
- Put your esp8266 in the programmer
- connect your programmer to a usb port of the your computer
- open the tasmota web installer
- In following the istructions, be sure to do the load SSID/passphrase, if you don't you'll have to connect to your esp8266 over WiFi (http://192.168.4.1) and enter them on that web page. If the connection goes well, an IP address on your network will be presented... briefly.
- Once your esp8266 device is connected to your WiFi, you connect to the ip address of your esp8266 device.
- from there, after searching "Tasmota DHT12" you can configure you esp8266 device to read your temperature sensor.
All that said, I still like an Arduino Nano with the nRF radio (or an RF Nano) and MySensors. I have yet to brick or lose the program of a Nano but have done both on several esp8266's.
OK, back to what I came here to do ... make a serial gateway.
-
@mfalkvidd Sorry, I guess I'm dense. I didn't think you necessarily needed a radio connected to the MQTT gateway. I thought the MQTT gateway was to be used in addition to the other gateways in the system, and used to send data to the broker. If that's not the case, is there a point to having one, if I already have an esp8266 WIFI gateway with a nRF24L01. If a radio is required on the MQTT, does that mean another nRF24L01 can be connected to the system? Is that possible? I guess what you're saying is that you only need one 2.4G network, be it wifi, mqtt or serial. True?
Again thanks.
-
@OldSurferDude Thanks for the reply. So you're going straight to the MQTT broker itself and basically bypassing a gateway? I'm using My Sensors and Domoticz and I like them. I see Domiticz is compatible with Tasmota. I'll have to do some research.
Thanks much