AVS Forum banner

Introducing my_remote hub

1344 Views 13 Replies 3 Participants Last post by  benjaminmetzler
Hi All,
I’ve been working on a project for the last month to replace my Harmony Hub and I wanted to get some more eyes on it.

my_remote is a hub based remote control system. It uses a Raspberry Pi as a hub with any remote that can connect as an HID keyboard (pretty much every PC remote control I’ve seen).

Currently it can control any IR device supported by lirc. I have it controlling with my Yamaha receiver, Toshiba TV, LG Blueray, and Nvidia Shield (via flirc).

my_remote supports macros, for combining multiple actions into one key press. This allows you to press one button and have the receiver turn to HDMI2, the TV to HMDI1, and then control the STB.

my_remote has initial support for adb calls for connecting to android based devices (think Nvidia Shield). It’s slow but it works.

I am planning on adding support for Bluetooth, REST api calls via curl (think Kodi RPC), and local app calls.

Where I need help is with testing other IR devices as well as adding full bluetooth keyboard emulation.

If you are interested you can take a look at the code on the github page:
benjaminmetzler/my_remote

The README.md contains the installation instructions. There are more details in the documentation folder (especially documentation/json_format.md). I made my_remote with the intent of others using it but what is obvious to me won’t necessarily be so for others, so suggestions for improvement to the documentation are welcomed.

And feel free to submit pull requests for fixes or new features (or just reply here). git commits will kick off a pre-commit check, which does some basic code formatting checks (trailing white space cleaned up, indentation looks good) and isn’t too draconian. If you have any questions about contributing let me know.

Thanks for reading,
Ben
See less See more
  • Like
Reactions: 2
1 - 14 of 14 Posts
Following the example in the Sympathy Remote thread, I was able to connect my Logitech Companion to my Raspberry Pi. Button presses on the Companion show up at key presses in the system. Almost every button shows up as unique using the python Keyboard module. The exceptions are the Off, Music, TV, Video, Red, Green, Yellow, and Blue. Most of these work without much modification to the json files. This is interesting because I would rather use the the Harmony Companion as it is what the family is used to and the feel is generally nicer then the low-cost remotes I've gotten from Amazon and Aliexpress.
Using a couple of Sympathy Remote posts as a template I was able to get all of the buttons working on my Harmony Remote. my_remote should now see them without any issues. I've documented the process for adding new remotes at:

The basic process was to map the unknown keys to known values in the Linux event codes using the built in Hardware Database functionality (documentation here). I think the next step is to automate adding a remote to my_remote using a common set of keys. Then the json files can move away from scancodes and to more readable names (like KEY_POWER instead of 116). I'll explore that this weekend.
  • Like
Reactions: 1
Hi Ben,

This is superb.

I'm really jealous though. I have a Companion too, i.e. transport buttons under navigation, but not every button works. I don't mean a button is unknown. I mean a button really doesn't work at all when paired with a Unifying Receiver. I made the mistake of mentioning something on the internet, which means I'll end up embarrassed. But this should also mean that these buttons are working for me and I've missed something.

I need to start again. I'm sorry about this. Which model Pi are you using? And which OS? Once those two are running, would you expect evtest to show a command or unknown for every button or would something else need to be done first?

Cheers.
There are (at least) two versions of the companion remote. The original was called originally called the “Smart Remote” and is the one I have. I read some of the other messages. Are the non working buttons the ones with an outlet and lightbulb? If so I believe that is the “next generation” version they released a few years back. Or I could be completely wrong (not the first time).

I would expect them to show up with evtest unless Logitech did something out of band with just those buttons.

One thing you can try is try is a script in my repo called ‘keyboard_loop’. It will show all presses on all keyboards. evtest should also show presses but with Linux I find using multiple tools can have different results.

Ben

Hi Ben,

This is superb.

I'm really jealous though. I have a Companion too, i.e. transport buttons under navigation, but not every button works. I don't mean a button is unknown. I mean a button really doesn't work at all when paired with a Unifying Receiver. I made the mistake of mentioning something on the internet, which means I'll end up embarrassed. But this should also mean that these buttons are working for me and I've missed something.

I need to start again. I'm sorry about this. Which model Pi are you using? And which OS? Once those two are running, would you expect evtest to show a command or unknown for every button or would something else need to be done first?

Cheers.
Hello,

Ah, right. I do indeed have a Companion, not a Smart Remote or Smart Control. I was aware that there are similar remotes to the Companion but since I started looking, only a couple of weeks ago admittedly, these remotes had different names in the various resources I found.

The original was called originally called the “Smart Remote”
I didn't know (at least) one of them was renamed. Or whatever. Sorry.

I would expect them to show up with evtest unless Logitech did something out of band with just those buttons.
I expected them to too, as I mentioned before in the Sympathy thread, but this completes my full circle. Anyhow, cheers again.
As I mentioned I could be completely wrong :). I thought that they just rebranded the Smart Control but it may be a new model.

One thing I've found with the non-Logitech remotes I've tried is that they expose multiple devices to the OS.

Try the following. It will use the python keyboard module to grab all HID keyboard inputs:
Bash:
sudo pip3 install keyboard
sudo python3 -m keyboard
I can't guarantee it will show anything but it's another tool to try.

Ben




Hello,

Ah, right. I do indeed have a Companion, not a Smart Remote or Smart Control. I was aware that there are similar remotes to the Companion but since I started looking, only a couple of weeks ago admittedly, these remotes had different names in the various resources I found.



I didn't know (at least) one of them was renamed. Or whatever. Sorry.



I expected them to too, as I mentioned before in the Sympathy thread, but this completes my full circle. Anyhow, cheers again.
I've started work on creating a standardize mapping for new remotes. This will prompt users to press a button on their remote so that it can be mapped to a standard key instead of relying on the scancode in the JSON files. This will make it easier to share remote configurations. You can see the work in progress at:

One thing I noticed with my Strqua G40S is that it uses two devices, a Keyboard and a Consumer Control device. Both are in the same dongle but some buttons (up, down, left, right, numbers some others) come in via the Keyboard, while others (color buttons, play, rew, ffwd) come in on the Consumer Control device. my_remote listens to all devices, which is why this isn't an issue, but it may explain why some remotes like the Companion only seem to send some buttons.
Hi,

Try the following.
Great, thanks. The Keyboard library in Python was low-hanging fruit so one of the first things I played with. No multiple devices in the way you mention, either.

Anyhow, I was excited when you said Companion but it's not the same remote, sorry, and I'm the only person with an issue so there's nothing relevant to anyone else. Thanks again though.
Worth a try. Sorry to get your hopes up about the companion.

As I dive into standardizing remotes I'm playing with a lot of low level event devices. You might check out some of the direct access I'm doing at Standardize remotes codes by benjaminmetzler · Pull Request #4 · benjaminmetzler/my_remote, specifically the scripts/generate_keymap.py. Adjusting device it is accessing (line 4) might show different inputs then what is received at higher levels.

Ben

Hi,



Great, thanks. The Keyboard library in Python was low-hanging fruit so one of the first things I played with. No multiple devices in the way you mention, either.

Anyhow, I was excited when you said Companion but it's not the same remote, sorry, and I'm the only person with an issue so there's nothing relevant to anyone else. Thanks again though.
I've added curl functionality to my_remote. The idea is that there are components that expose a web API. curl can be used to exercise that API, meaning apps like Kodi (JSON-RPC API - Official Kodi Wiki) can be controlled via a network interface instead of IR.

I've also created a one-command install process for my_remote. ssh into the raspberry pi and run curl https://raw.githubusercontent.com/benjaminmetzler/my_remote/main/setup_pi4.sh | bash. This will pull down the install script and install everything needed by my_remote. It won't activate my remote, but it will be available on the raspberry pi. Just ssh in again and run cd my_remote; bash main.sh and my_remote will be running. You will still need to customize it to your set up.
Hi, I'm hoping to take a look at your project later this week.

While I've got everything I need for my setup working I know that my approach isn't really going to work well for keyboard and especially mouse passthrough.

Your approach should be much more suited to the real time needs there.
Hmm, not sure about my_remote being better then keyboard and mouse. my_remote could do keyboard entry though it would require each key be defined in each device. That would be somewhat cumbersome. Then again I also wanted to create a remote that would do 95% of the activity I do with my components, leaving the remaining 5% for the full sized remotes and/or an attached keyboard.

It won't work with a mouse unless I do some really fancy programing in relaying mouse movements to another channel. Not entirely undo-able but not an easy endevor.


Hi, I'm hoping to take a look at your project later this week.

While I've got everything I need for my setup working I know that my approach isn't really going to work well for keyboard and especially mouse passthrough.

Your approach should be much more suited to the real time needs there.
I’ve added a repeat option for commands. While you could do the same command multiple times in a macro the new option allows a single command to be done multiple times without a macro. Also it makes macros look cleaner :).
1 - 14 of 14 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top