I finally got it working reading through google searches. I'd like to provide how I did it for anyone that may run into a similar issue in the future. While looking for this solution, I saw at least one person who had the exact same issue and their problem went unresolved.
Raspberry Pi 3 is connected to Arduino Mega through regular serial link. Raspberry pi uses uart pins that map to Serial0 in raspbian. On Arduino Mega I use Serial2 pins (16,17). There's a voltage divider circuit between the two that reduces 5v to 3.3 for the pi.
I compiled my gateway on pi with below:
./configure --my-transport=rs485 --my-rs485-serial-port=/dev/serial0 --my-rs485-baudrate=9600
On Arduino I have these define lines:
#define MY_DEBUG
#define MY_DEBUGDEVICE Serial
#define MY_RS485
#define MY_RS485_HWSERIAL Serial2
#define MY_NODE_ID 1
#define MY_RS485_BAUD_RATE 9600
#define MY_RS485_DE_PIN -1
I'm not an expert on this by any means, but out of everything I tried, this is what worked for me. There are still some remaining issues:
Possibly due to line noise or voltage being low on Arduino, I've had one crash that made Arduino print gibberish on serial and it stopped transmitting anything at all.
I use Home Assistant and it seems to give up on MySensors if it doesn't receive anything in a while. Requires restart of HA core. Not very reliable.
I still welcome any insight into this process and any alternatives/recommendations. I'd like to make this as reliable as possible, but my knowledge of these systems and electronics is limited.
I am not able to install the Library . I am getting Error
Invalid library found in C:\Documents and Settings\User\My Documents\Arduino\libraries\ESP8266MQTTMesh: C:\Documents and Settings\User\My Documents\Arduino\libraries\ESP8266MQTTMesh.
I changed the name of the zipped file to ESP8266MQTTMesh as the name of .cpp file ESP8266MQTTMesh.cpp. Still it is saying Invalid Library found in ....
What could be the problem.
@waspie: done
Doe anyone have any idea about the retries? I'd like my nodes to keep trying to reconnect as long as they have power.
Another question:
I've read different things about
#define MY_DISABLE_SIGNAL_REPORT
Some recently said this saves memory, but I've found an older post that states it's already disabled by default.
@michlb1982
A couple of things, you put the device to sleep so while it's asleep, it won't respond to the commands to change the relays. Since you are combining relays and sensors, you need to keep the unit awake and find a different way to send the sensor data occasionally. For the relay status, read the comments in the sketch. You are saving the relay state and then reading that on startup. You can eliminate all of that code and just set the relay to off in the setup section.
Cheers
Al
Thank you so much! You just saved me (a certified n00b, I know xD) from countless hours of headache!
@mfalkvidd said in ESP8266 MQTT Gateway: Can't Subscribe from Domoticz with Mosquitto running on Pi 3:
Just a guess: maybe all you need is to use the rpi3 ip instead of the esp8266 ip?