seb821 / esprflinkmqtt Goto Github PK
View Code? Open in Web Editor NEWESP8266 gateway between RFLink and MQTT server
ESP8266 gateway between RFLink and MQTT server
I have tried IDE 1.8.13 and 1.8.15. ESP8266 library is v2.7.4
Trying to compile the currently published code gives:
/espRFLinkMQTT/espRFLinkMQTT.ino: In function 'void loop()':
espRFLinkMQTT:1466:6: error: 'rflinkSerialRX' was not declared in this scope
if(rflinkSerialRX.available()) {
^
The hardware setup is a standard Mega clone with a custom shield holding the rf modules plus an ESP-01. The setup is currently running an espRFLinkMQTT release from 2019 and I was just aiming to update to a more recent version.
I am using software serial so I have commented/uncommented config.h as follows:
// HardwareSerial & rflinkSerialRX = Serial; // rflinkSerialRX is used for data from RFLink - uncomment this line to listen on hardware serial (ESP RX pin)
// HardwareSerial & rflinkSerialTX = Serial; // rflinkSerialTX is used for commands to RFLink
#include <SoftwareSerial.h> // rflinkSerialTX is used for commands to RFLink: by default, it uses ESP TX pin ; in order to use another pin, comment previous line and uncomment this line and two following ones to write on software serial (GPIO2/D4) - software serial RX listens on GPIO4/D2 pin (unused)
SoftwareSerial softSerial(4, 2, false); // software serial TX to RFLink on GPIO2/D4 ; software serial RX from GPIO4/D2 pin (unused)
SoftwareSerial & rflinkSerialTX = softSerial;
#define DEFAULT_MEGA_RESET_PIN -1 // ESP pin connected to MEGA reset pin ; this is the default value and it can be changed from the web interface ; examples: -1 for none, 16 for GPIO16 (D0)
#define DEFAULT_MEGA_AUTO_RESET_INTERVAL 0 * 60 * 1000 // Auto reset MEGA if no data is received during this period of time (in ms), 0 to disable ; this is the default value and it can be changed from the web interface
Thanks
Thanks for providing this software!
I would like to use MQTT QOS for messages sent by your software to the broker. Is this possible? If yes, how do I do it?
Hi,
the official wifi daughter board from Nodo-shop has an hardware watchdog (ATtiny) which keeps resetting the nodemcu.
In ESPeasy this watchdog is supported (WD), the value to set is i2C "38". Is it possible to add this to the code?
https://github.com/letscontrolit/ESPEasy/blob/mega/src/Hardware.ino#L61-L81
if (Settings.WDI2CAddress != 0)
{
delay(500);
Wire.beginTransmission(Settings.WDI2CAddress);
Wire.write(0x83); // command to set pointer
Wire.write(17); // pointer value to status byte
Wire.endTransmission();
Wire.requestFrom(Settings.WDI2CAddress, (uint8_t)1);
if (Wire.available())
{
byte status = Wire.read();
if (status & 0x1)
{
String log = F("INIT : Reset by WD!");
addLog(LOG_LEVEL_ERROR, log);
lastBootCause = BOOT_CAUSE_EXT_WD;
}
}
}
and
https://github.com/letscontrolit/ESPEasy/blob/mega/src/ESPEasy.ino#L764-L770
// I2C Watchdog feed
if (Settings.WDI2CAddress != 0)
{
Wire.beginTransmission(Settings.WDI2CAddress);
Wire.write(0xA5);
Wire.endTransmission();
}
thanks
Hello,
When trying to compile the code in Arduino IDE with latest "Generic ESP8266 Module" version (2.6.3) the following error appears:
config.h:15:52: error: no matching function for call to 'SoftwareSerial::SoftwareSerial(int, int, bool, int)'
SoftwareSerial softSerial(4, 2, false,BUFFER_SIZE+2); // software serial RX from GPIO4/D2 pin (unused pin on ESP01), software serial TX to RFLink on GPIO2/D4 pin - uncomment to use software serial
...
SoftwareSerial(int8_t rxPin, int8_t txPin = -1);
SoftwareSerial.h:94:5: note: candidate expects 2 arguments, 4 provided
no matching function for call to 'SoftwareSerial::SoftwareSerial(int, int, bool, int)
Using version 2.5.2 solves the issue.
Hi, first of all thank you for this project, you saved my life.
That said I managed to connect Home Assistant via TCP with Node Red using the debug data over MQTT.
I want to share my considerations:
Another thing I've seen with my two-code door switch is that it sends a message with one ID for open and a message with a different ID for closed.
espRFLinkMQTT turns these into two different topics:
open: rflink/SelectPlus-065afa
close: rflink/SelectPlus-065af8
With the same payload for both.
{"SWITCH":"02","CMD":"ON","SWITCH02":"ON","CHIME":"01"}
It might help in some cases if there was the option to keep the topic at just the name (rflink/SelectPlus) and move the ID down as an item in the JSON payload {"ID":"065afa"}
Thank you!
-TimG
Hi,
I love the idea of this project and i'm quite sure i will love it once i got it working.
Is it possible to provide a .bin file?
It seems i can't get the web browser after loading the sketch into the nodemcu yet and don't know why.
My setup is is using the RFlink prints and nodeMCU of www.nodo-shop.nl.
Greetings
A feature that I haven't easily been able to figure out how to add myself to the sketch would be to set the MQTT published message with the retain=1.
Case: door/window switches send code when their state changes such as the door opens. If home home automation software (Home Assistant) is not running or is rebooting at the time then it will miss that message and think the door or window is closed when it is actually open.
Setting the message to be retained will keep it available for when HA comes back up.
I'm not sure the impact for all published messages being retained or if it would really matter. Ideally the ability to specify which IDs get retained messages would be nice.
Thank you. Aside from some little tweaks, this has been working nicely for me.
-TimG
HI seb821,
amazing job, love this piece of code. Thank you very much for your work.
using the following kit from nodo shop:
https://www.nodo-shop.nl/nl/rflink-gateway/127-rflink-arduino-antenne-.html
got everything up and running based on your instruction but unfotunately no sensor MQTT messages are published to my broker.
I can see everything on the webinterface see screenshot attached but if I subscribe to the topic rflink/#, can only see the online and uptime topics.
If I enable debug mode, all debug messegaes are beeing correctly published.
Sorry maybe I miss something, I'm still a noob ;)
Hope you can help.
System info:
Version | 20200328 |
---|---|
Uptime | 1 min |
WiFi network | XXXXXXXXXXXXXXX (E0:28:6D:14:XX:XX) |
WiFi RSSI | -52 dB |
IP address (MAC) | 192.168.1.79 (CC:50:E3:2B:XX:XX) |
ESP pin to reset MEGA | GPIO 0 |
MQTT server and port | 192.168.1.55:1883 |
MQTT debug | disabled |
MQTT connection state ❔ | 0 |
MQTT topics | publish (json)rflink/Protocol_Name-IDcommands to rflinkrflink/cmdlast will ( 1 / 0 )rflink/onlineuptime (min, every 5)rflink/uptimedebug (data from rflink)rflink/debug |
publish (json) | rflink/Protocol_Name-ID |
commands to rflink | rflink/cmd |
last will ( 1 / 0 ) | rflink/online |
uptime (min, every 5) | rflink/uptime |
debug (data from rflink) | rflink/debug |
Free Mem | 19000 |
Free Stack | 3664 |
Heap Max Free Block | 18736 |
Heap Fragmentation | 1% |
Bonjour,
J'essaie de compiler votre projet afin de le modifier en vue d'integrer un moniteur d'énergie OWL, une station meteo e tpeut-être une PAC Atlantic.
Mon problème est d'arriver à compiler votre projet sans modification ... et j'ai une erreur "WiFi' was not declared in this scope" .
Je n'arrive donc pas à recréer votre .bin !
Merci pour vos conseils !
Hi @seb821, I'm sylvain from jeedom old forum.
I upgrad my two esprflinkMQTT, but I use Wemose D1 mini, and soft serial to change TX pin.
I Think that you must reverse 3 lines in you code to better understand:
You write:
//SoftwareSerial& rflinkSerialTX = softSerial;
//SoftwareSerial softSerial(4, 2, false);
//#include <SoftwareSerial.h>
But it's (i think):
//#include <SoftwareSerial.h>
//SoftwareSerial softSerial(4, 2, false);
//SoftwareSerial& rflinkSerialTX = softSerial;
PS: Good features in this version !
Hi,
Thank you for sharing your very useful code. I would like to know if json data is stored in SPIFFS on the device? If so roughly how many messages can be stored with 3 MB Spiffs partition?
Thanks.
Using a MEGA 2560 (proberbly a china clone) and the ESP01 When I have the ESP01 in teh programmer it works and it gets an IP address and I could connect to the web.
When connectiong it to the MEGA it seems like it does not go pass the initial serial connection. It gets no IP, and it seems like it just hangs.
Running latest: RFLink Gateway V1.1 - R48
Have I connected it wrong?:
ESP // Mega
GND // GND
VCC // 3.3V
RX // TX0 (1)
TX // RX0(0)
Hi Seb,
You mention the possibility to do over-the-air updates in the readme, but I was wondering how to do this exactly. Which file is needed and is the current configuration saved?
Thanks!
Hello
I have configured my 433MHz switch IDs. I have a Jonson MQTT publication and in Home Assistant I do not create entities.
I have correct communication with the MQTT HA broker
2022-12-08 21:18:13: Client espRFLinkMQTT-2336 has exceeded timeout, disconnecting.
2022-12-08 21:19:02: New client connected from 172.20.1.120:57732 as espRFLinkMQTT-2160 (p2, c1, k15, u'mqtt').
2022-12-08 21:26:53: New client connected from 172.20.1.120:60674 as espRFLinkMQTT-1430 (p2, c1, k15, u'mqtt').
2022-12-08 21:27:01: Client espRFLinkMQTT-2160 has exceeded timeout, disconnecting.
Where can I look for the reason for the lack of entity visibility in HA.
Regards
ID filtering *
1 0aa564 0aa564 switch1 1s 3min 3min {"SWITCH":"3","CMD":"OFF","SWITCH3":"OFF"}
2 0aa560 0aa560 switch2 1 sec 3 min 3 min {"SWITCH":"10","CMD":"OFF","SWITCH10":"OFF"}
3 09a561 09a561 sleep 1 p
4 0aa561 0aa561 switch3 1s 3min 3min {"SWITCH":"3","CMD":"OFF","SWITCH3":"OFF"}
Thanks for this awesome tool, cheers.
I just want my mqtt to output as raw rflink data as if it is connected to homeassistant serial port
like for example 20;2A;Xiron;ID=2801;TEMP=0043;HUM=29;BAT=OK; this way I can re-use my old serially connected rflink node red nodes with no changes. But with esprflink the data comes with part of it stripped as mqtt topic. Its fine and okay but will need more programming/nodes to fix it for and I do not have those skills. It will be nice to have the same data forward option available as shown on esprflink esp page under Live Data tab and under Raw data.
Cheers and thanks again.
Shah
Could you please consider adding "serial to TCP bridge" option to your project? Unfortunately Domoticz doesn't support RFLink via MQTT. Home assistant support only one RFLink over TCP connection, more than one RFLinks only through MQTT.
There are project which implements "serial to TCP bridge" (e.x. Tasmota or esp-link) but non of them has both features together.
I'd like to connect 3 my RFLinks (different frequencies) to Domoticz and Homeassistant at the same time.
Hi, Not sure if you can help. Tyring to connect with Home Assistant
I can see my devices are being received by espRFLinkMQTT on the live data screen:
It is a Thermostat with a receiver switch that simply turns the relay on/off
This is Off
20;90;X2D;ID=0011818;SWITCH=00;CMD=ON;RC=00fe;S=0c;EXT=Tybox;BAT=OK; | rflink/X2D-0011818 | {"SWITCH":"00","CMD":"ON","SWITCH00":"ON","RC":00fe,"S":0c,"EXT":Tybox,"BAT":"OK"}
This is On
20;8F;X2D;ID=0011818;SWITCH=00;CMD=ON;RC=1cfe;S=0c;EXT=Tybox;BAT=OK; | rflink/X2D-0011818 | {"SWITCH":"00","CMD":"ON","SWITCH00":"ON","RC":1cfe,"S":0c,"EXT":Tybox,"BAT":"OK"}
If i use MQTTLens I can see the topics being created on my mqtt server but what I am struggling with is that I cannot create/see the device Home Assistant
Any assistance would be appreciated
It is working fine for a day or so, after that I don't receive rflink codes anymore (rflink/uptime keeps receiving). If I reset the esp from the webpage, it works again for a day or so.
Hi Seb,
You mention the possibility to do over-the-air updates in the readme, but I was wondering how to do this exactly. Which file is needed and is the current configuration saved?
Thanks!
Hi,
I have the following board:
https://robotdyn.com/mega-wifi-r3-atmega2560-esp8266-flash-32mb-usb-ttl-ch340g-micro-usb.html
I like this firmware a lot - unfortunately it is not working with this board. Did maybe already someone test it with this board?
Dip-Switches are on:
USB <-> ATmega2560<-> ESP8266 ON ON ON ON OFF OFF OFF To RXD3/TXD3
I can see the output of the RFLink firmware on serial but nothing reaches the firmware on the esp.
Thanks in advance
Bonjour Seb821
Je suis très interessé par votre projet pour l'intégrer dans ma domotique mais meme apres avoir suivi correctement le read.me,je ne parviens pas a compiler votre derniere release avec Arduino 1.13 sur une Wemos d1 mini avec cette erreur
exit status 1
'g_pcont' was not declared in this scope` le problème se situe sur esprflinkmqtt.ino aux lignes html 725,726,727 , je pense qu'il s'agit d'un souci de librairie,j'ai tenté également avec platformio mais sans résultat positif
Merci par avance pour votre aide
Will you release v1 from dev branch or it's still not stable for now ? Thanks.
Hi all,
I'm using the RFLink / WIFI koppelprint which can be purchased for the RFLink. This PCB holds an Nodemcu V2.
The Nodemcu V2 is reset by the Arduino Mega with the RFLink software when the Arduino Mega is not triggered periodically by the Nodemcu.
Looking at the ESP Easy project I believe an I2C watchdog pulse is used at decimal address 38 that sends a pulse every second or so to the Arduino Mega. SDA is at GPIO4 (D2) and SCL is at GPIO5 (D1) on the Nodemcu.
The espRFLinkMQTT doesn't provide this i2C watchdog pulse so the Arduino Mega resets the Nodemcu every couple of seconds and cannot be used.
Can you add this I2C watchdog functionality to the espRFLinkMQTT software?
Hi,
What kind of hardware are you recommending for the RFLink-device ifself? I've plenty of hardware laying around, but i'm not sure what the best "on cheap"-solution would be? :-)
Is it possible to add the possibility to activate / deactivate the retain flag from the web interface?
I would like to use your code for web UI it offers. I do not have any RFLink devices but I get some MQTT messages from several devices onlocal network which are in following format:
received topic 'DeviceStatus/{"Location":"Bedroom1","SingnalStrength":-58,"DeviceMode":0,"DeviceIP":6,"WiFiChannel":7,"SleepTime":1,"UpTime":130}
received topic 'SensorValues/{"Location":"Kitchen","Volts":2.62,"Sensor1":"Temperature","SensorValue1":1,"Sensor2":"Humidity","SensorValue2":2,"Sensor3":"Pressure","SensorValue3":244,"Sensor4":"Light","SensorValue4":81}
received topic 'Warning/Battery Low/Kitchen
received topic 'DeviceStatus/{"Location":"Kitchen","SingnalStrength":-52,"DeviceMode":0,"DeviceIP":16,"WiFiChannel":7,"SleepTime":1,"UpTime":139}
received topic 'Warning/Battery Low/Livingroom
Is there any possibility to strip all code for RFLink and use your Web server to display these MQTT messages? I tried to do that but I broke to many things in code so it does not compile. Please give me some hints if possible.
Thanks.
Hi I tested the the espRFLinkMQTT and i tryed the latest dev one but I get an error on my DKW2012 Weather station on the json that is published to my mqtt server . This is the json that is returned
{"TEMP":15.8,"HUM":48,"WINSP":0.0,"WINGS":0.0,"RAIN":5.4,"WINDIR":0010,"BAT":"OK"}
if I run this thru json validate at https://jsonlint.com/ I get thats WINDIR value that's not valid.
My Milight is working and also my other Temp sensors.
Would it be possible to describe all the steps (step-by-step) required to install and configure a RFLInk to work with MQTT in Home Assistant?
Hi, good work thanks for sharing.
It is not clear on the documentation that you have to set a USERID filter in order to get anything out in MQTT other than the uptime.
Is it possible to just forward/send every message received straight to MQTT and avoid the lengthy configuration of the UserIDs? i can do the filtering as i consume the messages in MQTT. I have many devices and entering each code is very time consuming, is there an option to just publish everything that comes in and disable userids? thanks
Hello,
I am using the code on an NodeMCU together with an Mega 2560 loaded with RFLink release 48.
It seems that about every 10 seconds the NodeMCU is rebooted.
Other implementations for serial over net for example include the option to enable the watchdog with id 38 to prevent the NodeMCU from being rebooted.
Could this be implemented in this code also or should I disable this feature in the RFLink software somehow?
Kind regards,
Vincent Voorheijen
Hi all,
This may be the wrong place to ask but I will try it anyway.
Using espRFLinkMQTT for about a day now with Domoticz 2022.1.
Receiving sensors works great but switching a switch doesn't seem to work.
I used the mosquitto client to subscribe to rflink/out to see what Domoticz is sending when a switch was switched ON.
What I expected to see is for example: 10;NewKaku;1234567;1;ON;
What was sent by Domoticz is: 10;NewKaku;1234567;1;ON;SYNCID=65fdd29e;
The RFLink doesn't respond to the string received because of the SYNCID=65fdd29e; part, so the switch is not switched to ON.
What is that SYNCID=65fdd29e; part doing there? Why is Domoticz sending it?
I use Domoticz in a docker pulled from docker hub from LinuxServer.io
Is there something wrong with my Domoticz docker or is espRFLinkMQTT missing something that filters the SYNCID part?
Best regards
Just cosmetic:
Version | 20200310
Uptime | 9 d 229 h 59 min
Hours are wrong displayed.
New domoticz finally has support for RFLink over MQTT. Unfortunately it's not compatible with your software because it listen on:
#define TOPIC_OUT "rflink/out"
#define TOPIC_IN "rflink/in"
Any plans to make it compatible with new Domoticz?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.