can ESPEasy be used as MQTT Gateway for RFLink ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ChrisP
New user
Posts: 9
Joined: 07 Oct 2017, 16:12

can ESPEasy be used as MQTT Gateway for RFLink ?

#1 Post by ChrisP » 09 Oct 2017, 01:43

Hi,

I have a working ser2net interface on NodeMCU with ESP easy 2.0.0.dev12 to RFlink.

Now I would like to use it with MQTT, with every line coming from the serial interface published to a specific topic, (or with a topic per devices), and a topic subscribed by the ESP where every message will be sent to the serial line.

Is it possible? What would be needed ? rules ?

Thanks.

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#2 Post by LisaM » 09 Oct 2017, 09:25

I fail to see an important point here: Why?
Why choose a very limited platform like the ESP8266 for a very complex task like this when there are others who are only slightly more expensive but much more equipped for a task like this...

ChrisP
New user
Posts: 9
Joined: 07 Oct 2017, 16:12

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#3 Post by ChrisP » 09 Oct 2017, 10:54

Hi Lisa,

would that be such a complex task ? I guess my request is not that clear.

What I'm talking about is just a dumb Gateway, message coming from MQTT specific topic being send as is on the serial line to the RFlink and Vice-Versa. Of course the MQTT server is running somewhere else.

ESP Easy already provide both features (MQTT feeding and Serial Line gateway with ser2net), what I just miss is something to make both working together.

ChrisP
New user
Posts: 9
Joined: 07 Oct 2017, 16:12

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#4 Post by ChrisP » 06 Nov 2017, 15:57

Mmmmh, I just realized that I just decribed "how" I want to do it but did not described "what" I want to do !

So what I want to do is to connect RFLink to OpenHab2, where no specific binding exist for RFLink, but where managing messages with regexes and mqtt layer will implementation extensive, by formating messages for specific remote devices not too much complicated.

So "complex" task will remain on OpenHab2 and MQTT server side, and I'm fine with that, where the "simple" task remain on the ESP side, by just making a serial2mqtt gateway.

enc
New user
Posts: 5
Joined: 08 Nov 2016, 21:27

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#5 Post by enc » 06 Nov 2017, 19:02

Hi,

I'm using this bridge https://github.com/enc-X/mqtt-rflink-bridge almost year without any problems.

ChrisP
New user
Posts: 9
Joined: 07 Oct 2017, 16:12

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#6 Post by ChrisP » 10 Nov 2017, 14:29

Mmmmh, thanks for the hint, I had a look and it looks very like what I wanted to do.

It even transform to json message I didn't asked for :)

reinhold
Normal user
Posts: 15
Joined: 19 Jun 2017, 22:52
Location: Vienna, Austria
Contact:

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#7 Post by reinhold » 14 Oct 2018, 19:04

FWIW, I have now implemented an RFLink to MQTT bridge plugin for ESPEasy. It can be found as P197 in the ESPEasyPluginPlayground on GitHub: https://github.com/letscontrolit/ESPEas ... Bridge.ino

It basically combines ESPEasy's ser2net serial bridge plugin with the mqtt-rflink-bridge (which I was using previously, too). The plugin simply listenes to the serial port (TX/RX pins) and sends all output received from RFLink to the first configured MQTT controller. Either the raw message from RFLink or the parsed contents in JSON format can be sent.

It also listens to a configurable MQTT topic for commands to be sent to the RFLink over serial.
Additionally, ESPEasy commands "rflinksend" and "rflinkreceive" are implemented to either submit something to the RFLink or process a string as if it was received by the RFLink.

Local rules processing is basically taken from the serial gateway plugin, so I suppose it should work identical for my plugin than with the serial gateway plugin. However, I have never tested this part of the bridge plugin, as I'm interested in sending the parsed JSON to my MQTT controller (to be picked up by OpenHAB).

martiniman
Normal user
Posts: 13
Joined: 10 Jan 2017, 11:07

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#8 Post by martiniman » 23 Oct 2018, 09:52

Yes, i use Robotdyn Mega+esp8266 on board and RFLink shield, it receives RF and post to MQTT.
Here is rules:
seb82 wrote: 05 Sep 2018, 11:04 This is working for me with "RFLink" selected for event processing and this rule:

Code: Select all

On !RFLink#* do
Publish test,%eventvalue%
endon
Or if you select "Generic" for event processing:

Code: Select all

On !Serial#* do
Publish test,%eventvalue%
endon
I had to put a "RX Receive Timeout" of 10 ms or it would strip off a few characters.
Settings:
Image
Attachments
1234F481-C45C-426F-A847-807E915C1CAE.jpeg
1234F481-C45C-426F-A847-807E915C1CAE.jpeg (1.11 MiB) Viewed 10687 times

woody4165
Normal user
Posts: 16
Joined: 14 Mar 2016, 17:36

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#9 Post by woody4165 » 15 Nov 2018, 15:46

Hi @martiniman

I'm interested in this solution using MQTT
I have the Robotdyn Mega+esp8266 on board and RFLink shield

I use it with Home Assistant and it's possible in an easy way to configure it.
Now I'm trying also OpenHab and there in no binding to use over TCP.

So on the same installation I'm using with HA, I added an OpenHab MQTT controller which has

Code: Select all

/%sysname%/#
as Controller Subscibe and

Code: Select all

/%sysname%/%tskname%/%valname%
as Controller Publish

Controller lwl topic is set to @ and LWT Connect Message and LWT Disconnect Message are empty.

My UnitName is called Pippo.

Using now the rule

Code: Select all

On !RFLink#* do
Publish test,%eventvalue%
endon
In Ser2Net I've choosen RFLink as Event processing.

I use MQTTBox to check messages, I have subscribed to Pippo/# but I don't see any message.

What's wrong in my config?

Thanks

martiniman
Normal user
Posts: 13
Joined: 10 Jan 2017, 11:07

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#10 Post by martiniman » 21 Nov 2018, 17:54

Hi!
woody4165 wrote: 15 Nov 2018, 15:46 My UnitName is called Pippo.
Using now the rule

Code: Select all

On !RFLink#* do
Publish test,%eventvalue%
endon
What's wrong in my config?
Thanks
Here you post to topic "test", you need to change your rules to something like this:

Code: Select all

On !RFLink#* do
Publish Pippo,%eventvalue%
endon

or

On !RFLink#* do
Publish /%sysname%,%eventvalue%
endon

jobarjo
New user
Posts: 7
Joined: 28 Jan 2017, 00:16

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#11 Post by jobarjo » 22 Jan 2019, 10:14

Hi

I'm using rflink with an esp12.
I added a domoticz controller, and added the above rule. (enabled rflink event)
It works!
But: for each rflink event, I get 2 mqtt posts (one is empty):
2019-01-22 09:54:32 Topic: test Qos: 0 !RFLink#
2019-01-22 09:54:19 Topic: test Qos: 0 !RFLink#1527;ID=0a65f0;SWITCH=01;CMD=ON;

Do you know any workaround?

Also, how do you transmit something to rflink from mqtt?

Thanks

dmq
Normal user
Posts: 18
Joined: 09 Dec 2017, 19:15

Re: can ESPEasy be used as MQTT Gateway for RFLink ?

#12 Post by dmq » 27 Jan 2019, 13:43

Maybe someone can help me out.

I also use RF-Link on a Robotdyn ATmega2560+ESP8266. My plan is to use ESP-Easy as the Serial to MQTT bridge for RF-Link.

I've tested all units with the code I found here ( see below (1) - it is in russian, but this is the only tutorial I found which is well structured and logical and actually works):

- esp8266 part (works)
- Arduino Mega part (works)
- Inter-Connection between both (works) - I can use the onboard led through the web-interface (esp) -> serial (arduino).

But with RF-Link and ESP-Easy I can not get it to work.

I created a device in ESP-Easy with ‘Communication - Serial Server’ and the following attributes:

Code: Select all

a.	Name: RFLINK
b.	Enabled: checked
c.	TCP Port: 5333
d.	Baud Rate: 57600
e.	Data bits: 8
f.	Parity: No Parity
g.	Stop bits: 1
h.	Reset target after boot: - none –
i.	RX receive timeout: 0
j.	Event processing: RFLINK
When I connect to tcp/5333 I can not see any output. Further I tried to forward it to a mqtt-server with the following rule:

Code: Select all

On !RFLink#* do
Publish test,%eventvalue%
endon
Result: nothing :(

I can not get to the point, that ESP-Easy reads the values from serial.

This is the dip-switch combinations I tried (serial3 and mode independent from each other):

USB <-> ATmega2560<-> ESP8266 ON ON ON ON OFF OFF OFF To RXD3/TXD3
USB <-> ATmega2560<-> ESP8266 ON ON ON ON OFF OFF OFF To RXD0/TXD0

With the 1st combination I can connect to Serial of the Arduino and see the output.

Maybe @martiniman , @reinhold or someone else has an idea?

Should I see something in the ESP-Easy Web-UI? In the Logs or in the device column?

Thank you very much for any help

(1): http://www.sysengineering.ru/blog/%D1%8 ... 1-esp8266/

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 35 guests