433mhz, infrared IR to and from MQTT on ESP8266

Hi all,
I discovered OMG yesterday, so i bought components and build the board in photo.

I’ve uploaded OMG 0.9 on that nodemcu
i’ve defined:
#define simplePublishing true
#define simpleReceiving true
#define DumpMode true
in their respective files

i had it connected to my HomeAssistant MQTT

and i’m now trying to receive an IR from a Eizo remote to test the IR receiver, but i dont get any IR code.
Did i do something wrong?

btw, i’ve read mostly of the documents, but i’m missing something. In the example code for switching a a samsung TV on and off

switch:
  - platform: mqtt
    name: "tvonoff"
    state_topic: "home/OpenMQTTGateway/IRtoMQTT" # defined by subjectGTWIRtoMQTT in User_config.h
    command_topic: "home/OpenMQTTGateway/commands/IR_SAMSUNG"
    payload_on: "3772793023"
    payload_off: "3772793023"
    optimistic: false
    retain: true

what i have to put on payload for an LG TV, besides using IR_LG in the command topic?

  • Did you use the correct topic for receiving? Can you check the output of command mosquitto_sub -h 192.168.x.xx -d -t “#” when IR commands are sent?
  • Have you changed the following to “true” in config_IR.h? (case the protocol is not recognized it won’t be published)
    #define pubIRunknownPrtcl false // key to avoid mqtt publication of unknown IR protocol (set to true if you want to publish unknown protocol)

Yes, i see the MQTTGateway sending LWT and some more infos to the MQTT server. And i see it online in Home Assistant.

Yes i did.
I’m not sure of the positioning of the transistor, because it’s a different model (but same type) from the one in the drawing in OMG git site.

I managed to get the Ir Receiver part working, there were many problems,
First, in the OMG Wiki for the 8266, the IR is powered by 5v rail, and it’s output is connected directly to the nodemcu pin. That is wrong, pins works at 3,3.
Second i discovered that the nodemcu i was using is an 8285, not an 8266, and the numbers on the pins where the GPIO numbers, not the Dx of a nodemcu.

Now i’m woking on the transmitter part, but i removed transistor, resistors, and i’m powering the IR Led iretly with 3,3 from another Nodemcu pin.

Yeap, there is no need for additional electronic components besides the NodeMCU and emitter/receiver. Haven’t used a breadboard either :slight_smile:

For emitter just removed the IR module from an old remote. For receiver I only use this one (it has a wider voltage range so no need to pay additional attention to pin used for power):

I think the schematic on OMG site needs to be corrected.
For the receiver, i bought a TSOP34838 and it’s working perfectly. I do receive ir codes from other remotes.

For the emitter, i reintroduced the transistor, so i can power the IR leds by the 5v rail, using the 3,3 output of the nodemcu PIN as B on the 2N2222.
Just for the sake of IR power/distance of 5V over 3,3V.

Now i’m fiddling with codes, because when i press some buttons on some remote, i receive more than one code. And still i have to manage have a single command working on my TV, like power it off.

Might want to have a look at this issue (as the buffer was too short, the payload was split):

For devices such as split AC, a button press is unlikely to send the same payload twice (as it sends, alongside temperature, also the vent speed and speed, etc. thus it will change each time), however I don’t know if there are TVs that do the same.

Look on remotecentral site for on/off discrete codes for your device.

Hi,

Sorry if this is the wrong thread, but I’m currently exploring some 433MHz -> HomeAssistant options.
There seem to be two approaches - this current approach, which is the ESP8266 with MQTT, or an ArduinoMega (possibly with an ESP8266) with RFLink.

What are the differences in the two approaches, especially since an ESP seems to be a part of either approach …

Hi,

I think you can use OpenMQTT with most 433 Mhz devices. Have a look also in https://community.openmqttgateway.com/

In terms of hardware you might want to use Arduino Mega + Ethernet shield as it gives the best performance and lowest latency as compared to a wifi solution.

Hi,

You can also use OpenMQTTGateway with an arduino mega.

The differences between the 2 approachs are the followings:

  • rflink is the free software that support the most of 433mhz protocols, this said the keypoint will be; are you building a new installation or converting an existing one. In other words do you have already RF devices RFlink compatibles or not. If yes you should take a look to RFLink if not you can select compatible devices with RCSwitch and Pilight libraries that are supported by OMG & most of the open source gateways. And choose between both systems later on.
    Nevertheless if building a new home automation system you can also ask yourself is 433mhz is the good technology but it is another debate.
  • rflink is a free to use with closed source, OMG is open source
  • OMG support also bluetooth low energy and infrared communications
  • OMG support MQTT which play a key role in home automations systems like HASS, OpenHAB and DomoticZ making it “easy” to integrate.
  • OMG enable to add extra sensors
  • OMG enable Over The Air updates, deduplicates, json integration … more here
    I stop here I feel like a commercial guy :slight_smile:

I agree with @Petrica the arduino mega + ethernet shield gives the best performances compared to an ESP.

Thanks for the replies! I guess some details on my actual use case then…

I’m actually just playing around with home automation, by I do have one if those 433mhz bbq temperature probes, and these solutions seemed interesting, so want to have a play, see if I can get it working and visible in home assistant.

Latency won’t be an issue, as I’ll just be receiving the data.
Also, I’m guessing arduino mega + esp (for WiFi) will have the same latency issues as an esp on its own?

Switch on-off problem
I am trying this first time, sonoff rf bridge gets HA mqtt message but it doesnt send signal.

CONFIG WARNING:

Your configuration contains extra keys that the platform does not support (but were silently accepted before 0.88). Please find and remove the following.This will become a breaking change.

[payload_on], [payload_off], [optimistic], [retain]. (See /config/configuration.yaml, line 111).

switch:

  • platform: mqtt
    name: “2222”
    state_topic: “home/OpenMQTTGateway/433toMQTT” # defined by subjectGTWRFtoMQTT in User_config.h
    command_topic: “home/OpenMQTTGateway/commands/MQTTto433”
    payload_on: “5731328”
    payload_off: “5731329”
    optimistic: false
    retain: true

Hello,

If I understand well [payload_on], [payload_off], [optimistic], [retain]. need to be removed in autodiscovery now?

I have a config warning on home screen https://www.dropbox.com/s/qbentj4z5ecvhdf/Screenshot%202019-02-27%2021.59.37.png?dl=0

but no info under https://www.home-assistant.io/components/switch.mqtt/

(im using latest HA 0.88.1)

Please check these switches, do you see any problem because “on” is working but “off” position is not working

  • platform: mqtt
    name: “2222TEST”
    state_topic: “home/OpenMQTTGateway/MQTTtoSRFB”
    command_topic: “home/OpenMQTTGateway/commands/MQTTtoSRFB”
    payload_on: ‘{“raw”:“268E013603C057740C”}’
    payload_off: ‘{“raw”:“268E014003B6577400”}’
    optimistic: false

  • platform: mqtt
    name: “2222rawTEST”
    state_topic: “home/OpenMQTTGateway/MQTTtoSRFB”
    command_topic: “home/OpenMQTTGateway/commands/MQTTtoSRFB”
    payload_on: ‘{“raw”:“268E013603C057740C”,“value”:“5731340”,“delay”:“9870”,“val_Thigh”:950,“val_Tlow”:310}’
    payload_off: ‘{“raw”:“268E014003B6577400”,“value”:“5731328”,“delay”:“9870”,“val_Thigh”:950,“val_Tlow”:320}’
    optimistic: false

If you set value you don’t need to set raw. Try maybe:

name: “2222rawTEST”
state_topic: “home/OpenMQTTGateway/MQTTtoSRFB”
command_topic: “home/OpenMQTTGateway/commands/MQTTtoSRFB”
payload_on: ‘{“value”:“5731340”,“delay”:“9870”}’
payload_off: ‘{“value”:“5731328”,“delay”:“9870”}’
optimistic: false

Try to remove delay if not working.

Could you give me an extract of your configuration.yaml line 122 please?

line 122 https://www.dropbox.com/s/xy1wfct6qfqvlne/Screenshot%202019-02-27%2022.31.47.png?dl=0

OFF position for HA to SRFB is not working (MQTT.FX and SRFB didnt get message) but
ON/OFF positions MQTT.FX to SRFB works fine.

So HA doesnt send payload_off: '{"value":"5731328"}'

(Note: If i set both raw and value SRFB gets raw no problem using both)

Thanks for the extract.

Regarding payload_off sending, maybe something is broken with the last version of HA?

If you define some sensors with simpleReceiving old style does HA send the payload to the broker?

I think payload_off broken with latest HA

On/off didnt work (im using SRFB )

switch:

  • platform: mqtt
    name: “onlyValue”
    state_topic: “home/OpenMQTTGateway/MQTTtoSRFB”
    command_topic: “home/Evakilli/OpenMQTTGateway/MQTTtoSRFB”
    payload_on: “5731340”
    payload_off: “5731328”
    optimistic: false
    #retain: true

ok thanks for the test.

Does other persons reproduce this issue?