433mhz, infrared IR to and from MQTT on ESP8266

Hi, I’ve just found OpenMQTTGateway, is looks like a nice way of working with 433Mhz devices.

Is there a way I can get it to talk to my MQTT server using TLS?

Using Tasmota I use the fingerprint method here:

Can I do something similar using OpenMQTTGateway?

Thanks

Hi @Codec303

Unfortunately not yet

Ah OK, thanks for letting me know. I think I may be able to find some sort of workaround :slight_smile:

@1technophile

Hi, hoping you could assist with a Sonoff RF Bridge?

Flashed RFBRIDGE_OpenMQTTGateway_V092.zip

Messed around a whole lot until I finally found that the default device name is OpenMQTTGateway_SRFB and not the default OpenMQTTGateway.

Got binary sensors working,

binary_sensor:
  - platform: mqtt
    name: "OpenMQTTGateway"
    state_topic: "home/OpenMQTTGateway_SRFB/LWT"
    payload_on: "online"
    payload_off: "offline"
    device_class: "connectivity"

  - platform: mqtt
    name: "Door RF"
    state_topic: "home/OpenMQTTGateway_SRFB/SRFBtoMQTT"
    value_template: "{{ value_json.value}}"
    json_attributes_topic: '["protocol"]'
    payload_on: "13655790"
    payload_off: "13655783"
    device_class: opening

  - platform: mqtt
    name: "Button RF"
    state_topic: "home/OpenMQTTGateway_SRFB/SRFBtoMQTT"
    value_template: "{{ value_json.value}}"
    json_attributes_topic: '["protocol"]'
    payload_on: "3624197"
    off_delay: "1"
    
  - platform: mqtt
    name: "Motion RF"
    state_topic: "home/OpenMQTTGateway_SRFB/SRFBtoMQTT"
    value_template: "{{ value_json.value}}"
    json_attributes_topic: '["protocol"]'
    payload_on: "15906678"
    device_class: Motion
    off_delay: "10"

Regular sensors,

sensor:
  - platform: mqtt 
    name: "Wifi OpenGateway 8266" 
    state_topic: "home/OpenMQTTGateway_SRFB/SYStoMQTT"
    value_template: "{{ value_json.rssi}}"
    json_attributes_topic: "home/OpenMQTTGateway_SRFB/SYStoMQTT"

  - platform: mqtt
    name: "OpenGateway input"
    state_topic: "home/OpenMQTTGateway_SRFB/SRFBtoMQTT"
    value_template: "{{ value_json.value}}"
    json_attributes_topic: "home/OpenMQTTGateway_SRFB/SYStoMQTT"

And lastly, a switch.

switch:
  - platform: mqtt
    name: "test send"
    state_topic: "home/OpenMQTTGateway_SRFB/MQTTtoSRFB"
    command_topic: "home/OpenMQTTGateway_SRFB/commands/MQTTtoSRFB"
    payload_on: "3624197"
    payload_off: "3624197"
    optimistic: false
    retain: false

The problems.

  1. The sensor for input, used to keep showing data/codes. Now it disappears instantly, usually too quickly to highlight or copy. Mostly it’s just blank.

  2. The switch seems to send. There’s a flicker on the RF LED on the Sonoff, but the receiving device doesn’t change/do anything. Tried with a RGB controller and a doorbell. (I can capture the remote codes via MQTTlens

  3. Can’t read anything from serial monitor. Just prints rows of ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮
    I was using the Arduino IDE on 115200.

  4. Getting false readings on the motion sensor now. Shows motion, but there’s no movement in the room.

I had a nodemcu, and cheap rf kit previously. Same issue with the input sensor, and couldn’t send, but no false positives, and could read get data from serial monitor. Was thinking maybe my transmitter hardware was faulty, so I got the Sonoff today, but now I still can’t send…

Using Home assistant 0.96.5 and OpenMQTTGateway v0.9.2 as mentioned above.

Any ideas on how to resolve these?

Thanks in advance!

Hi,

I suppose you see this behaviour on HA isn’t it? Could you check what is happening on the mqtt broker side and post the results?

Could you indicate the receiving device type/model?

For the sonoff rf bridge the speed has to be set to 19200

Could you post what you are seeing on the mqtt broker ?

Hi,

I suppose you see this behaviour on HA isn’t it? Could you check what is happening on the mqtt broker side and post the results?

Yes, it’s on Home Assistant, and using this broker, which mainly just shows connections.

Logbook also doesn’t show the code, just a blank space.

image

Do now have serial monitor so when pressing the doorbell button:

Creating SRFB buffer
isAdupl?
Adv data SRFBtoMQTT
Pub json into:
home/OpenMQTTGateway_SRFB/SRFBtoMQTT
{"raw":"147800B40208374D05","delay":5240,"val_Tlow":180,"val_Thigh":520,"value":3624197}
Pub data per topic
raw
147800B40208374D05
delay
5240
val_Tlow
180
val_Thigh
520
value
3624197
Store val
Min ind: 
0
store code :
3624197/43895
Col: val/timestamp
0:3624197/43895
1:0/0
2:0/0
3:0/0
4:0/0
5:0/0
6:0/0
7:0/0
8:0/0
9:0/0
10:0/0
11:0/0
[RFBRIDGE] Sending ACK

MQTTlens for button as well.

{
  "raw": "145000BE0208374D05",
  "delay": 5200,
  "val_Tlow": 190,
  "val_Thigh": 520,
  "value": 3624197
}

And then serial monitor when I activate the switch to send same signal as received above.

Hey I got a callback 
MQTTtoSRFB prts
[RFBRIDGE] Sending MESSAGE '%s' %d time(s)


⸮⸮%@⸮7MU

And MQTTlens for switch too.

Could you indicate the receiving device type/model?

Doorbell is a “local” SA brand. Ellies. Not a super lot of info.
RGB Controller is one of these

If I can receive the codes, I should be able to send them as well, or is there something regarding RF I’m missing?

For the sonoff rf bridge the speed has to be set to 19200

This is working now, thanks!

I’ll keep an eye on the false readings issue. Hasn’t happened again today.

Does any of this help narrow down the issue with sending? From the serial monitor log is does seem like something’s going wrong.

Thanks again!

Regarding the sensor it seems to be related to HA configuration, did you tried this configuration

Regarding MQTTtoSRFB did you uncommented simpleReceiving in your configuration (user_config.h) indeed your yaml definition correspond to simpleReceiving and per default OMG expect json.
You can either uncomment simpleReceiving or modify your yaml to make HA send json.

Hi,

I did try those, but get errors relating to json_attributes needing to be updated to
json_attributes_topic. If I change my sensor from “value” to any of those others, (version/uptime/etc) it works, and displays without disappearing.

MQTTtoSRFB - I didn’t un-comment anything. Just flashed the pre-compiled .bin file.
What was the default set to on RFBRIDGE_OpenMQTTGateway_V092.zip?

Thanks!

Hi,

Does the value disappearing event correspond to an mqtt publication ?
You could subscribe to all the subjects to see that. Or maybe use mqtt explorer.
I m suspecting that simplePublishing overwrite the values of jsonPublishing.

For info I have removed simplePublishing from binaries file, you can try to upload again if you want to see if it was due to that.

Hi, thanks. I’ve managed with Tasmota for now, but I’ll try this on my other setup. Which bin was modified?

All were modified. Indeed there is no need of simplePublishing per default.

A new board compatible with OpenMQTTGateway :

Hi,

Something happened to the images at the site/blog. May you check, plz?

Thanks for pointing that, issue corrected!

1 Like

Hi,

just installed your project @1technophile and almost got it working!

The following code allows me to sync the HA switch to the button presses on my remote. However, the actual HA switch immediatly reverts to off when i try and switch it on. I does actually turn on my outlet/plug but the state is wrong. The state moves to the ON position if i press my remote.

Any ideas?

- platform: mqtt
  name: “Energenie3remotesync”
  state_topic: OMG/OpenMQTTGateway/433toMQTT
  command_topic: OMG/OpenMQTTGateway/commands/MQTTto433
  value_template: '{{ value_json.value}}'
  payload_on: 13451403
  payload_off: 13451402
  # state_on: 13451403
  # state_off: 13451402
  # optimistic: true
  retain: true
  qos: "0"

Hi,

Maybe others HA expert will have a better advice but I think you should set the optimistic value to false so as to take into the gateway feedback.

But first, your states seems to be commented, I will uncomment them before changing the optimistic parameter. It is possible that HA go into optimistic mode per default as it can’t see the expected state values.

Hey,

Thanks for your speedy response - got it working now!

I set up 6 variations of the switch with different quotes, some as strongs, some as values etc… and in the end they all work which is quite frustrating for a beginner that 6 different versions of a code all do the same thing!

Thank you so much!

- platform: mqtt
  name: “Energenietest1”
  state_topic: OMG/OpenMQTTGateway/433toMQTT
  command_topic: OMG/OpenMQTTGateway/commands/MQTTto433
  value_template: '{{ value_json.value}}'
  payload_on: '{"value":"13451403","protocol":"1","length":"24","delay":"212"}'
  payload_off: '{"value":"13451402","protocol":"1","length":"24","delay":"212"}'
  state_on: "13451403"
  state_off: "13451402"
  # optimistic: true
  retain: true
  qos: "0"

  #dont toggle
- platform: mqtt
  name: “Energenietest2”
  state_topic: OMG/OpenMQTTGateway/433toMQTT
  command_topic: OMG/OpenMQTTGateway/commands/MQTTto433
  value_template: '{{ value_json.value}}'
  payload_on: '{"value":13451403,"protocol":1,"length":24,"delay":212}'
  payload_off: '{"value":13451402,"protocol":1,"length":24,"delay":212}'
  state_on: "13451403"
  state_off: "13451402"
  # optimistic: true
  retain: true
  qos: "0"

# dont toggle
- platform: mqtt
  name: “Energenietest3”
  state_topic: OMG/OpenMQTTGateway/433toMQTT
  command_topic: OMG/OpenMQTTGateway/commands/MQTTto433
  value_template: '{{ value_json.value}}'
  payload_on: '{"value":"13451403"}'
  payload_off: '{"value":"13451402"}'
  state_on: "13451403"
  state_off: "13451402"
  # optimistic: true
  retain: true
  qos: "0"

  # dont toggle
- platform: mqtt
  name: “Energenietest4”
  state_topic: OMG/OpenMQTTGateway/433toMQTT
  command_topic: OMG/OpenMQTTGateway/commands/MQTTto433
  value_template: '{{ value_json.value}}'
  payload_on: '{"value":"13451403"}'
  payload_off: '{"value":"13451402"}'
  state_on: 13451403
  state_off: 13451402
  # optimistic: true
  retain: true
  qos: "0"

- platform: mqtt
  name: “Energenietest5”
  state_topic: OMG/OpenMQTTGateway/433toMQTT
  command_topic: OMG/OpenMQTTGateway/commands/MQTTto433
  value_template: '{{ value_json.value}}'
  payload_on: '{"value":13451403}'
  payload_off: '{"value":13451402}'
  state_on: "13451403"
  state_off: "13451402"
  # optimistic: true
  retain: true
  qos: "0"

- platform: mqtt
  name: “Energenietest6”
  state_topic: OMG/OpenMQTTGateway/433toMQTT
  command_topic: OMG/OpenMQTTGateway/commands/MQTTto433
  value_template: '{{ value_json.value}}'
  payload_on: '{"value":13451403}'
  payload_off: '{"value":13451402}'
  state_on: 13451403
  state_off: 13451402
  # optimistic: true
  retain: true
  qos: "0"
1 Like

Can you use two transmitters on the one esp8266. RF transmitter and a IR on the same board. Both on different pins and using the same library ?

Yes you can have an IR transmitter and an RF transmitter on the same board. You can also add an RF receiver and an IR receiver.