Control openhab functions via IR (NOT VICE VERSA)

Hi, I’m looking for a hardware/software solution to send comands TO openhab from a Logitech Harmony remote (without the Harmony hub). I’d like to have a simple IR Receiver sitting somewhere in my Home Theatre and sending commands using the Harmony One turn on and off a couple of lights (BTicino MyHome) without needing to shout out to Google Assistant or taking the smartphone with me everytime to turn on or off a couple of lights. Is it possible?
Thank you for your patience :slight_smile:

Sure :slight_smile:
I don’t know if this is available in your region:

I have to admit, it’s both directions, openHAB could also send IR codes and not only receive, but maybe this is acceptable, you don’t need to use this option :slight_smile:

No mr. Udo, that specific device seems not to be available here in Italy.
But I have found many Tuya / Smart Life compatible devices on Amazon. Can those be “repurposed” using Tasmota firmware? :wink:
Thank you for your help :wave:

Search at the Tasmota website

for the specific Device, there are thousands of devices, so nobody knows…

I’m doing this with standard components in a way described here.

You could use the Linux input binding and Flirc USB

I’m doing what you have asked about with a d1 mini flashed with tasmota and an IR eye that is used to plug into an IR blaster. You can buy the eye alone from Amazon for less than $10. I’m using MQTT as the protocol. Tasmota has a sketch in the standard .bin for this and I just picked and old remote and watched the console when pressing various buttons. Then I use the console output as my CMD line in MQTT on openhab. Happy to share some more info if anyone would find it useful.

Hi there :slight_smile:
I have now a working Tasmota IR Receiver, and I can see the codes I send from my Logitech Harmony in the tasmota console. Those messages are in this form :

{“Time”:“2023-02-20T11:23:40”,“IrReceived”:{“Protocol”:“NEC”,“Bits”:32,“Data”:“0x00FF00FF”}}

Now: How can I link this message to an already existing switch so when this string is received the switch changes state from OFF to ON or vice versa?

Thank you :slight_smile:

  1. Install MQTT - Bindings | openHAB.
  2. Add bridge.
  3. Read MQTT Things and Channels - Bindings | openHAB.
  4. Add Generic MQTT Thing (name it ‘Tasmota IR Receiver’).
  5. Add string channel command received to Thing.
  6. Configure channel: use JSONPATH to extract 0x00FF00FF from message.
  7. Link item to channel.
  8. Create an openHAB rule that converts 0x00FF00FF to whatever you are going to accomplish by using the item as input for the rule.

Hi Ap15e, thanks for answering me. A quick update :

1-2 ok Binding installed, bridge Mosquitto running on QNAP/container station. Connection ok. Tasmota device connected to Mosquitto (i guess…there’s no way for me to tell if everything’s fine since I have 0 experience with MQTT)

3 It’s extremely confusing. And has no reference to my specific needs.

4 done!

5 can this channel be used to receive different IR codes for different switches? I should send 4 different IR codes to 4 different switches. I should extract other information as well from the data received via IR, since many codes are received via Tasmota and I must pass “Protocol” and “Bits” as well if I wanna be sure not to trigger any unwanted action.
I have no idea about how to do this from this point forward :slight_smile:
Thanks for your kind help :slight_smile:

5 Yes.

My setup for a cheap 433 Mhz 4 button ON/OFF remote:

Channel (Button = command received)

You would have to use advanced settings (tick ‘Show advanced’):

Something like $.IrReceived.Data will transfer the hexadecimal data to your channel.

Setup a rule:

grafik

It might be possible to use $.IrReceived instead of $.IrReceived.Data to catch all three dimensions of the IR command. Of course, you would have to adjust the Command in the rule trigger accordingly.

Thank you for your quick answers Ap15e, but I think I need to give you some more context to understand the problem I have.

  1. I have an extremely basic knowledge of OpenHab, and NO knowledge at all about MQTT
  2. I suppose OpenHab and Mosquitto are able to communicate since OpenHab says the broker is online and “greenlit” in the things list, but I have no clue if the Tasmota device and the MQTT broker are actually communicating. Tasmota has no logs on its small website telling me if something went wrong with MQTT, and I have no idea about how to check the communication between Tasmota and the broker from the broker console itself using mosquitto_sub (I tried but got nothing out of it)
  3. this is the situation: i have 4 lights in my home theatre, all of them connected to my BTicino MyHome home automation. The “openwebnet” binding in OpenHab is configured and working as intended, all my items and things are correctly configured using configuration files (in items, things and sitemaps).
  4. In my Logitech Harmony Remote I have programmed a device using these 4 codes : “NEC”,“Bits”:32,“Data”:“0x00FF00FF” for light 1, “NEC”,“Bits”:32,“Data”:“0x00FF40BF” for light 2, “NEC”,“Bits”:32,“Data”:“0x00FFA05F” for number 3 and finally “NEC”,“Bits”:32,“Data”:“0x00FF609F” for the fourth light.
    I have checked, pointing the remote towards the Tasmota IR Receiver I see the codes appearing in the console when I push the buttons (but I have no idea about the MQTT broker).
  5. I need to link the 4 commands received from the remote to the aforementioned 4 light switches to turn those on and off using my Logitech Harmony.
    I hope I have given you more infos to work on :slight_smile:
    Thank you again for your kind help, I hope I described the situation clearly but I am not an English native speaker and explaining technical problems in a language different than mine it’s a challenge all by itself :slight_smile:

Thank you again !

ad 2) Try the MQTT-Explorer . This tool will let you see which changes happen on the MQTT side by subscribing to topics on mosquitto. Makes live much easier.

Just for the record that many roads lead to Rome:
I’m doing something similar in a somehow exotic way.
There is a (discontinued) IR receiver from Siemens, that is connected to my knx bus. The IR receiver is supported by the Harmony remote and capable of receiving multiple IR codes. Through the knx bus I trigger switching on my subwoofer. As OH is connected to knx as well I’m able to switch channels on e.g. EnOcean or ModBus. Life finds a way :wink:

Yes! this helped me ! The software you linked allowed me to check that Tasmota is in fact sending data to the MQTT Broker. I see my device in the list as tasmota_AA0EEC and from there the messages sent by the device itself. Now I am a step closer. I just have to figure out :

  1. how to format correctly the string for the receiver in OpenHab
  2. how to create that rule to change the switch status based on the IR codes received :slight_smile:

…and Ian Malcolm seems to find a way in this topic as well :slight_smile: welcome to Jurassic Park then !

grafik

translates to MQTT topic sensors/rtl_433/P3/I171; to get the temperature use $.temperature_C as JSONPATH transformation.

Edit:
ad 2: Rules - Basic | openHAB

So how do I use this ? The channel is a string right?
topic : tele/tasmota_AA0EEC/RESULT
and to get those parameters I have to set in JSONPATH $.Protocol,$.Bits,$.Data
and then set a rule that evaluates data from Protocol Bits and Data ?
Or I am missing something ? :slight_smile:
Thank you all for your kind help :slight_smile:

The type of your channel is String.

Your topic looks fine. Use it to set the State Topic of your channel:

Let’s keep it simple for now and use JSONPATH:$.IrReceived.Data as Incoming Value Transformation:

grafik

Then link an item to your channel and test the item. Then create an openHAB rule to link your IR codes to whatever you are going to accomplish, see Control openhab functions via IR (NOT VICE VERSA) - #11 by Ap15e.

:frowning: hen I try to link the channel to an existing item, I can select the parent thing but once I do that, no channel is displayed to select :frowning:

Create a new item:

Press buttons on your remotes, the new item should reflect the data part of the MQTT messages.

Make sure that
grafik
is installed.

To capture all three dimensions (protocol type, bit length, data) install RegEx transformation
grafik

and use the following Incoming Value Transformation (untested - it might be necessary to escape some characters …):

REGEX:s/.*ol":"(.*)","Bits":(.*),"Data":"(.*)"}}/$1_$2_$3/g

to get

NEC_32_0x00FF00FF instead of 0x00FF00FF.

Explanation: