Project: RFLink to MQTT using ESP8266 and arduino IDE

Not using a level shifter is a slight risk.

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.

Great work @Minims.

Will await your PR - let me know if you want me to add it by hand, although you deserve the credit in the reopo!

Some time ago the CEO of Espressif apparently tweeted that the ESP’s can handle 5V no issues.

:smiley:

1 Like

@phileep PR done, I have list my changes in the commit comment. I hope it will help :-).

No crash since I’ve applied the fix. I now use a generic ESP-12F instead of my node MCU. I use the 3.3v power of the MEGA and it seems working great.

About level shifter, I 've had a voltage divider with 1k/2k resistors just for security and because it’s not the Node MCU version.

1 Like

I thought I give this a try but I’m stuck at the point of trying to login to MQTT for the lack of mqtt username and password within the Esp sketch, need your help.
thank you.

The sketch is not setup currently for a mqtt password.

You need to add it to the sketch.

I think it is as simple as adding the username & password to the mqtt client conect statement at about line 125
change if (client.connect(client_name, willTopic, 0, willRetain, willMessage)) {
to if (client.connect(client_name, username, password, willTopic, 0, willRetain, willMessage)) {

Where you define variables in the sketch or input directly your own username and password in this statement.

For more information on the syntax, see http://pubsubclient.knolleary.net/api.html#connect4

Hopefully this will get you going

Thanks that done the trick will commence with my testing. :slight_smile:

Hi,

I did make a pull request a few months ago, to fix stability, negative temperatures and Mqtt authentication. It doesn’t appear to have been merged yet.

Guys, it is not clear to me. I connected my Arduino with Rflink to NodeMCU with ESP-LINK. Esp-Link is supporting:

  1. MQTT
  2. Serial over Wifi

How do I connect with the latter to Home Assistant?

The documentation is missing how to setup Esp-Link, port etc.? While there is an information that it has been tested with Esp-Link:

Tested with Wifi serial bridge [esp-link V2.2.3](https://github.com/jeelabs/esp-link/releases/tag/v2.2.3) running on a NodeMCU (ESP8266 Wifi module) with ESP8266 TXD0 (pin D10) and RXD0 (pin D9) connected to Arduino MEGA 2560 RX (Pin 2) and TX (Pin 3) respectively.

I picked up some used sensors, and would like to play around with them. I also have a few spare transmitter and reciever devices, so i guess i can use those.

What kind of hardware is best, for a DIY RFLink “on cheap” :-)?

How to build a RFLink 433MHz radio smarthome gateway for €10.50. Test with Domoticz • DIY Projects

1 Like

Yep, i just found it too :slight_smile: Thanks!

I’ve also found this;

So both things are now ordered :smiley:

Hi, I use my rflink with MQTT gateway on ESP since 1 year without any problems:

Very good projet, just work!
I have Two rflink one 433,92 Mhz and an other for Somfy RTS 433,42 Mhz.

Hello Seb821 could you please publish an mqtt switch or cover entry from your configuration.yaml i have the issue that the state is not changed when i send to the rflink.

This is my current entry :

  • platform: mqtt
    name: “Rolluik Woonkamer”
    state_topic: “rflink/BrelMotor-7f320b”
    command_topic: “rflink/cmd”
    payload_open: “10;BrelMotor;7f320b;e1;UP;”
    payload_close: “10;BrelMotor;7f320b;e1;DOWN;”
    state_open: “UP”
    state_closed: “DOWN”
    optimistic: false
    qos: 0
    retain: false

This is how I define my switches with seb821/espRFLinkMQTT

Hi There

Trying to get my HA to send using espRFLinkMQTT

Do you have an example of you switch setup?

I can see HA is receiving the MQTT messages using MQTTLens and subscribed to my mqtt server but I cannot get HA to send anything back

Thanks in advance

  - platform: template
    switches:
      boven_fan:
        value_template: "{{ is_state('binary_sensor.sensorfanboven', 'on') }}"
        turn_on:
          - service: mqtt.publish
            data:
              payload: '10;newkaku;03a0b800;4;on;'
              topic: rflink/cmd
          - service: mqtt.publish
            data:
              payload: '{"SWITCH":"4","CMD":"ON"}' 
              topic: 'rflink/NewKaku-03a0b800'
        turn_off:
          - service: mqtt.publish
            data:
              payload: '10;newkaku;03a0b800;4;off;'
              topic: rflink/cmd
          - service: mqtt.publish
            data:
              payload: '{"SWITCH":"4","CMD":"OFF"}' 
              topic: 'rflink/NewKaku-03a0b800'
        unique_id: 286e7551-0e78-4527-b8dd-34085ddcd740

Thanks for the reply but just cannot get it to send back to espRFLinkMQTT:

This is in espRFLinkMQTT when using the physical thermostat so RFLink is seeing it and espRFLinkMQTT is seeing it

Switching Off:
Raw Data: 20;F0;X2D;ID=000c74e;SWITCH=00;CMD=ON;RC=00fe;S=01;EXT=Tybox;BAT=OK;
MQTT Topic: rflink/X2D-000c74e
MQTT JSON: {SWITCH:00,CMD:ON,SWITCH00:ON,RC:00fe,S:01,EXT:Tybox,BAT:OK}|

Switching On:
Raw Data: 20;EF;X2D;ID=000c74e;SWITCH=00;CMD=ON;RC=1cfe;S=0c;EXT=Tybox;BAT=OK;
MQTT Topic: rflink/X2D-000c74e
MQTT JSON: {SWITCH:00,CMD:ON,SWITCH00:ON,RC:1cfe,S:0c,EXT:Tybox,BAT:OK}

I then get the following in HA when I listen to rflink/#

Message 3 received on rflink/X2D-000c74e at 19:01:
{“SWITCH”:“00”,“CMD”:“ON”,“SWITCH00”:“ON”,“RC”:1cfe,“S”:0c,“EXT”:Tybox,“BAT”:“OK”}
20;32;X2D;ID=000c74e;SWITCH=00;CMD=ON;RC=1cfe;S=0c;EXT=Tybox;BAT=OK;

Message 2 received on rflink/X2D-000c74e at 19:01:
{“SWITCH”:“00”,“CMD”:“ON”,“SWITCH00”:“ON”,“RC”:00fe,“S”:01,“EXT”:Tybox,“BAT”:“OK”}
20;32;X2D;ID=000c74e;SWITCH=00;CMD=ON;RC=00fe;S=0c;EXT=Tybox;BAT=OK;

So, HA is seeing the MQTT coming into it

The only bits that change when using the physical thermostat is the part after 20; and is totally random and then “RC”:00cfe to “RC”:1cfe and back again which is how I figured which is the on/off above

This is my switch

  - platform: template
    switches:
      esprfmqtt_switch1:
        friendly_name : espRFLinkMQTT Switch1
        value_template: "{{ is_state('sensor.mqttswitch1', 'on') }}"
        turn_on:
          - service: mqtt.publish
            data:
              payload: '20;32;X2D;ID=000c74e;SWITCH=00;CMD=ON;RC=1cfe;S=0c;EXT=Tybox;BAT=OK;'
              topic: rflink/cmd
          - service: mqtt.publish
            data:
              payload: '{"SWITCH":"00","CMD":"ON","SWITCH00":"ON","RC":1cfe,"S":0c,"EXT":Tybox,"BAT":"OK"}'
              topic: 'rflink/X2D-000c74e'
        turn_off:
          - service: mqtt.publish
            data:
              payload: '20;32;X2D;ID=000c74e;SWITCH=00;CMD=ON;RC=00fe;S=0c;EXT=Tybox;BAT=OK;'
              topic: rflink/cmd
          - service: mqtt.publish
            data:
              payload: '{"SWITCH":"00","CMD":"ON","SWITCH00":"ON","RC":00fe,"S":01,"EXT":Tybox,"BAT":"OK"}'
              topic: 'rflink/X2D-000c74e'
        unique_id: 286e7551-0e78-4527-b8dd-34085ddcd740

I can see the message being sent in HA but does not seem to get to espRFLinkMQTT as I get nothing on the Home or Live Data pages

I am sure its to do with the payload but cannot figure it out

Many thanks

You have to replace the 20;32; with 10;

Changed and nothing appears in esoRFLinkMQTT but it does show the change in my MQTT listen :frowning:

Seems espRFLinkMQTT is just not listening

to my MQTT commands