beware using multiple esp’s with the same firmware - you have to make their mqtt client id unique - which is why I added “test” mode as I would test on an esp first before rolling it onto the “production” esp. If you have a second esp trying to connect to mqtt with the same id, it will be refused.
is 127.0.0.1 a valid mqtt server? I assume it is from the command line on the machine your mqtt server runs on? maybe try the address you would use from external. I tried equivalent to your command line and got no response either … but the HASS config below works!
The other “feature” of the arduino code is that a “malformed” command will make it reset - hence adding the \n to the end to “correct” the package. So beware that you might be making the esp reset, then sending a “correct” command whilst it is still restoring from a reset sp it is being missed. (Maybe I should work for Microsoft or Apple with that subtle shift of blame for my poor coding to the user!)
so my HASS config for a wattsclever socket based upon the raw data collected is:
Have you ever transmitted successfully from the RFLink? did you try from their load tool to confirm transmit is working? I have an antenna on my receiver, but not on my transmitter, so sometimes range to the device to be controlled is an issue also.
I have many esp, and yes the client id is unique. 127.0.0.1 is ok my RPi, i’m using 192.168.1.10 in the ESP config.
So at this point I make the same configuration as you.
My RFLink can transmit when connected via USB, this part is OK. But I think I can’t when i’m using the TX Pin on the Arduino.
I’ve tried a minimal sketch on the Arduino to check both RX and TX Pins, and it works. So it’s strange.
I’m quite sure the problem is now TX on the Arduino, I think I will check a R44 or R45 to see if I have the same behavior.
–
Last news, I tried R44, R45,R46, same issue.
On the RFLink Loader, I’ve tried to send a command like 10;PING; it works.
Now I’ve tried esp-link. I can received code. When I send data I never get an answer.
So I’ve connected the MEGA to an UNO, link RX and TX between each other to be sure a 2nd time with another sketch. RX & TX are OK in both way. RX TX Check i use
Any ideas why I’ve got this problem? On Mega 0 is RX and 1 is TX
This problem is solved, I connect I CP1202 on RX/TX and I can send data.
But I still can’t with ESP. So I put my serial between TX ESP and RX Arduino.
So if I copy paste data from serial ESP to Arduino, it’s ok.
But it doesn’t work directly…
thx @phileep for all your help and your work, I finally have a working RFLink to MQTT.
I have clean flash on ESP and Arduino, re upload sketch, power the Arduino with 12v, used and ESP-12F (generic one) with 3.3v from Mega. Wirong has not changed.
I can’t say exactly why it works now, but it works and I have my first switch in HASS Next step, hass config for all my RF.
as you can see in my mosquito_sub, I have a “\n”, the one I’ve put in home-assistant.
I’m losing one ping packet, so I suppose ESP is rebooting. But don’t know why because I’m using ‘\n’ as asked.
I have the same behavior with a direct publish on mqtt with ‘\n’ :
Last News :
I’ve tried to debug without success. I have a an Exception(28) with a stack trace every time i use swSer. I change the SoftwareSerial lib with the one design for ESP : https://github.com/plerup/espsoftwareserial but i have the same problem.
Does your unit transmit an RF code before crashing?
Also, what pins are you connecting to on your NodeMCU? some pins are a bit special and might cause issues I think. Will confirm what I am using also tonight.
Hi
I tried this project too, but replaced my 433 mhz devices with ESP8266/Sonoff instead.
I didn`t get this working when trying, but found this statement in the RFlink Hub page (Component): Due to different logic levels, a voltage level shifter is required between the 3.3V NodeMCU and 5V Arduino MEGA 2560 pins.
I cant see that phileep mentions this, but if you dont have on installed, maybe the ESP restart or maybe the voltage level shifter was reason why I could not get this working
hmm. Not sure. I think lm1117 could interupt/change the signals. Maybe a electronics guy could help us.
When looking up the type I bought I found this in additional information part: The level converter is very easy to use. The board needs to be powered from the two voltages sources (high voltage and low voltage) that your system is using. High voltage (5V for example) to the ‘HV’ pin, low voltage (3.3V for example) to ‘LV’, and ground from the system to the ‘GND’ pin.
I think I found out why I didnt get it to work… I only supplied 5v and thought I could use the LV side for other stuff…
I’ve made a level shifter for both side, but it doesn’t help.
I have continue my debug, and if I remove the wire from TX Arduino to RX ESP, it works. I can’t read data from RFLink, but activate is OK et non crash. So I suppose the problem is when RFLink say OK to the command I sent.
–
EDIT:
@phileep@Rune Found It !! I will propose a pull request on gitHub.
The problem is that RFLink send 20;xx;OK; when you send a command. (New in R46 ? if you dont have the problem ? )
The void parseData crash when it tries to get RFData. So if RFName == OK => return; to exit void. And ESP is running fine. I will add the fix for \n too. I hope I will get time this WeekEnd to propose it.
However it is only on the communications in to the ESP8266, and the NODEMCU units seem tolerant, especially to such short bursts.
If you want to be sure, cheapest is a voltage divider on the TX from the MEGA as that is 5v logic. google voltage divider - you only need 2 resistors of different ratings to get the voltage down to the proper 3.3v range for the ESP.
The proof you don’t need on is that all the inward signals have been working fine. ie we can get data from the RFLink mega without the shifter.