mjoshd / hyperhdr-ha

HyperHDR custom component for Home Assistant
https://github.com/awawa-dev/HyperHDR
MIT License
59 stars 7 forks source link

Ability to choose USB device in HA #19

Closed roadsta closed 1 year ago

roadsta commented 1 year ago

Hey @mjoshd, thanks so much for putting this integration together! It's awesome!

I have HyperHDR (version 19) running on a Raspberry Pi Zero 2 W with some APA102 LEDs, it works great and is very responsive. I'm feeding in two USB inputs; one from a HDMI splitter for a FireTV Stick, the other is AV out from the TV that goes into a converter then into the pi. Both are detected fine in the HyperHDR Web UI, but the request/question I had was is there a way adjust the USB device in HA? I can see other options in HAs UI to choose different sources but USB Grabber is as granular as it goes.

In the Hyperion Integration page is does say that you can toggle the USB capture source, so just wondered if that would carry over to the integration that you made as well? And if it controls what USB device is active? I tried setting up different instances but the actual device setting doesnt stick to an instance.

I have an LG TV integration so the ideal would be to setup an automation that updates the capture device in HyperHDR as the TV's source changes, and also turns off with the TV.

Any input here would be hugely appreciated. Thanks.

mjoshd commented 1 year ago

I'm sorry but I've never experimented with using multiple HDMI Capture Cards (I only have one).

Regarding the ability to "toggle the USB capture source"; to my knowledge that just refers to the ability to turn it 'on' or 'off'.

Again, I have never used multiple capture cards but I think what you would want to do is create a second "Instance" on the "General" page and configure it to use your second HDMI capture device. http://yourHyperHdrIpAddress:8090/#general

Afterward you may be able to restart Home Assistant, or remove and re-add the HyperHDR integration, to get an extra toggle for the second instance (which may control the second HDMI capture card). This is just a guess, it may not work that way. I only have one capture device and a single instance.

Even if it doesn't create a new toggle for the second instance you should be able to set up REST commands (to send HTTP POST) from within Home Assistant. https://www.home-assistant.io/integrations/rest_command/

What to put into those commands will depend on your specific HyperHDR configuration but HyperHDR has a way to figure that out in the Advanced > JSON API section. http://yourHyperHdrIpAddress:8090/#json_api The ones that would probably do what you want are the "Switch instance" and/or "Start/stop an instance" sections.

Hopefully this info helps and wishing you good luck!

roadsta commented 1 year ago

Hey @mjoshd thanks for the speedy reply on this :)

No worries, I think I am a fringe case using two USB devices at once, as I havent seen anyone that has done this.

I did try the Instance route but its a similar issue, where it saves the USB as the capture method but it when you change the specific device, it changes for all instances, which doesnt work for me. Again this makes me think that its such a fringe case that it just wasnt considered in the original code.

I guess my only option is to reach out to the OG HyperHDR devs and ask if it's something they can implement, as if they could make the device stick to an instance I can use the "Switch Instance" option as you say.

Thanks again!