Sending remote control commands

I’ve recently got an IR Blaster which will accept a Base64 code over MQTT to be sent. It works in isolation, and now I need to work out how to integrate this with OpenHAB.

I want to achieve a couple of things:

  1. Remote control style buttons on the UI (sitemap mainly), which may spill over multiple widgets for different things (e.g. volume).
  2. Ability to orchestrate multiple commands in a script.

I’ve had some joy before creating command buttons for an item on a sitemap, but I’m struggling with the metadata, and I think that’s because a base64 string frequently contains an equals sign at the end for padding, which seems to bork the sitemap mapping. A backslash doesn’t seem to resolve this. Am I doing this right?

I ideally want to use “friendly” commands in the Send Command script actions (e.g. AMP_POWER) instead of having to copy and paste in Base64 strings into multiple scripts. Is this possible to do?

Thanks for any pointers!

If I were to implement something like this, I would move the base64 as close to the device as possible. To achieve that I would probably create a Switch Item for each button that can be pressed and link each to separate Items.

Another approach might be to use a single String Item/text Channel but use human readable representations for the button commands (e.g. “PLAY”). Then have a map transform on the MQTT Channel to map between “PLAY” and the base64 encoding. Or use a Rule and the publishMQTT action and do the mapping there.

Under no circumstances would I put the raw Base64 encodings in the sitemap or MainUI Widgets.

1 Like

Some months ago I got an IR blaster working for me which I described in detail here. Maybe it gives you some hints that are helpful.

1 Like