Hello, i have some issues with my setup.
I run OpenHAB and mosqitto on Raspberry PI 2 with OSMC (debian).
I try to controll a 4 channel relay that is connected to Aarduino Nano.
I use nrf24l01 tranceivers on the RPI2 and Nano.
I have got the 2 units to talk to eachother with a ping-pong tutorial.
I have also made the relay switch on every channel so the problem is not with the hardware (not from MQTT command but with a "local" sketch uploaded to the Nano).
In openHab i have made a binding so that it sends MQTT commands to the Mosquitto broker and i can see that the commands is getting to the broker.
But now im stuck, does anyone have a link or tips on how to set up the sketch on the Nano to receive and execute commands from the broker?
Do i need anything else on the RPi or is the broker (and openHAB) everything?
The most recommended MQTT arduino client appears to be http://pubsubclient.knolleary.net/ but this doesnt support TCP/IP over nrf24 radio. There is some information on running TCP/IP over nrf24 radio at New: RF24Ethernet TCP/IP library for nrf24l01+ radio modules - Networking, Protocols, and Devices - Arduino Forum but I've no experience with the code.
It will likely be easier to control your arduino via serial commands rather than trying to implement mqtt directly on the arduino. An obvious way would be to run a separate mqtt client on your RPi that subscribes to the relevant channel(s) and transmits serial commands via the nrf24 radio link.
I am working on a wifi control for a heater. I have mosquito and openhab running on a rpi2 (jessey). Cabled clients work with it without any issues.
For the wifi enabled controller I use an Arduino nano, an esp8266 and a relay module. esp and the relay module have their own power supply. Esp is connected to the Arduino using software serial (to have usb serial). For the mqtt connection I use mqtt, not pubsubclient. I have tested both and mqtt seems to be more stable, pubsub client tends to miss messages.
The whole thing works fine while I just read mqtt messages with this wifi enabled controller. As soon as I want to publish anything (room temperature and power consumption), the connection to the mosquito server is lost. The wifi connection is ok, ping shows no packet drops. The mosquito log tells: timeout exceeded, disconnecting. What timeout?
Mosquitto is the latest version (1.4.9), just like the mqtt client (0.16.1, according to Arduino IDE). I get the very same result with pubsubclient, too.
What do you recommend to check/test/change?
Thanks in advance,