Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IR received to mqtt payload #536

Closed
savage872 opened this issue Oct 1, 2018 · 9 comments
Closed

IR received to mqtt payload #536

savage872 opened this issue Oct 1, 2018 · 9 comments
Labels
Hacktoberfest Hacktoberfest participation question

Comments

@savage872
Copy link

Love you project. I'm a newbie.

I have a nodemcu with a ir sender connected on D2 and ir receiver on d5. I've flashed my node mcu with a mix of IRMQTTServer and IRrecvDumpV2.
What I'm trying to do is publish to mqtt ir info received on d5 with the same sort of payload and with the codes that you send on D2.
Can someone help please?
I hope I've posted in the right section.

@crankyoldgit crankyoldgit added question Hacktoberfest Hacktoberfest participation labels Oct 1, 2018
@crankyoldgit
Copy link
Owner

Hi.
Unfortunately, there isn't any example code in our library for turning received IR messages into MQTT messages. It wouldn't be hard to do, but it's not trivial or core to this library. There are plenty of projects out there that do this on the ESP8266.
For a starting point, check out our wiki page: https://github.com/markszabo/IRremoteESP8266/wiki/Related-User-Projects
That is just the tip of the iceberg. Some google searches will find plenty more.

Of course, if you are willing to write it, I'll gladly help it get merged into the library. PRs are always welcome. ;-)

@savage872
Copy link
Author

I had a look at the link and haven't found anything that would help me the matter. I could probably adapt the code if I found a working example, but writing code from scratch is not something that I can do easily.
I have tried installing https://github.com/enc-X/mqtt-ir-transceiver on my nodemcu but for some reason I couldn't get it up and running.

@crankyoldgit
Copy link
Owner

@1technophile
Copy link
Contributor

I confirm that OpenMQTTGateway support IR-->MQTT translation, don't hesitate to ask questions to OMG forum if needed

@savage872
Copy link
Author

Thanks you both, especially @crankyoldgit. I have installed openmqttgateway and it's working fine, I just need to get used to it!

crankyoldgit added a commit that referenced this issue Oct 3, 2018
- Should capture IR messages from an IR RX module and send them to MQTT
  in a "compatiable" format similar to that required for sening via MQTT.
- Slight HTML layout changes/improvements.
- Minor changes to IRutils to make life easier.
- Tested on my own D1 and Nodemcu devices. Seems to work fine.
- The new capability can be completely disabled, but should work fine
  even if no IR RX module is attached.

Inspired by Issue #536
@crankyoldgit
Copy link
Owner

@savage872 I've also added what I think you wanted to IRMQTTServer in PR #543

crankyoldgit added a commit that referenced this issue Oct 4, 2018
- Should capture IR messages from an IR RX module and send them to MQTT
  in a "compatiable" format similar to that required for sening via MQTT.
- Slight HTML layout changes/improvements.
- Minor changes to IRutils to make life easier.
- Tested on my own D1 and Nodemcu devices. Seems to work fine.
- The new capability can be completely disabled, but should work fine
  even if no IR RX module is attached.

Inspired by Issue #536
crankyoldgit added a commit that referenced this issue Oct 11, 2018
Add IR receiving support for IRMQTTServer.
- Should capture IR messages from an IR RX module and send them to MQTT
  in a "compatible" format similar to that required for sending via MQTT.
- Slight HTML layout changes/improvements.
- Minor changes to IRutils to make life easier.
- Tested on my own D1 and Nodemcu devices. Seems to work fine.
- The new capability can be completely disabled, but should work fine
  even if no IR RX module is attached.
- Add MQTT connection/disconnection time tracking
- Add MQTT disconnect counter.
Inspired by Issue #536
@crankyoldgit
Copy link
Owner

This is now live in the new v2.5.2 release of the library.

@rasp111
Copy link

rasp111 commented Dec 17, 2018

Hi
First of all Thanks for the wonderful work done by you guys.
The code works amazingly well for me & is very consistent.
I have configured Openhab to publish an MQTT command to an ESP that is acting as MQTT IR BROKER..
Whenever I publish an MQTT message to an switch (say TV ON), the ESP publishes the relevant IR_code on the "ir_server/send" Topic.
The ESP contains all the IR codes i need in my case stored & i call the relevant codes and publish on the "ir_server/send" Topic.
example:
IR Code to turn ON/ OFF Samsung TV is stored as -> const char* C1 = "7,E0E040BF,32";
I have the ESP publish channel configured to "ir_server/sent" topic using:
if (String(MQTT_V1_COMMAND_TOPIC).equals(p_topic)) {
if (payload.equals(String(ACTION_ON))) {V1();}

char IRT[15]= "ir_server/send";

void V1() {client.publish(IRT,C1);} // SAMSUNG TV ON/OFF

This succesfully turns on the Samsung TV.

Now that i want to move my code also into the same ESP that is doing IRMQTTSERVER, i want help to avoid client.publish(IRT,C1); and somehow use appropriate format and call the relevant function that already exists like callback(char* topic, byte* payload, unsigned int length).

I am pretty unskilled at programing & hence looking forward for some help to correctly format the data to be sent as payload while trying to use the callback() function:

void V1() {callback(..., ....);} // SAMSUNG TV ON/OFF

Regards
Ravi

@crankyoldgit
Copy link
Owner

Answered in #586

Repository owner locked as resolved and limited conversation to collaborators Dec 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Hacktoberfest Hacktoberfest participation question
Projects
None yet
Development

No branches or pull requests

4 participants