JPersson77 / LGTVCompanion

Power On and Off WebOS LG TVs together with your PC
MIT License
992 stars 40 forks source link

Use case involving a KVM, could use your advice #50

Closed IonCaza closed 5 months ago

IonCaza commented 2 years ago

Hey, this piece of software is absolutely amazing - I used to mess around with some early scripts back in the day that would hit the TV's APIs unreliably, but this makes it all 100x better.

My use case is the following, I use the TV as a monitor that's hooked up into an HDMI (KVM) switch. I have my Windows desktop as one source, and my Mac laptop as another source. I have LGTV Companion installed on Windows, but as soon as I switch to the Mac it turns off the TV which is not desired in my use case, but functions as intended.

I was wondering if you can think of any alternative of how we could make this work whenever one of the computers is controlling the TV (to disable functionality from the other client).

Cheers and thanks again for this awesome software!

dechamps commented 2 years ago

Did you try this?

Skärmbild 2022-07-21 084127

By the way, if you use a KVM to also switch USB inputs, you might also be interested in LGTVDeviceListener.

IonCaza commented 2 years ago

Did you try this?

Skärmbild 2022-07-21 084127

I'm using a hardware KVM switch (4k120hz) where the monitor's input never changes since the KVM deals with that.

By the way, if you use a KVM to also switch USB inputs, you might also be interested in LGTVDeviceListener.

This would've been great before I bought the KVM switch lol - I don't really need the input to change though.

This is what I ended up going with: https://www.easycoolav.com/products/8k-hdmi-kvm-switch-2-ports-usb-3-hotkey So far it's worked flawlessly - but a "nice to have" would have been the auto power on, auto power off for the TV when in use / not in use.

dechamps commented 2 years ago

Ah right, sorry, I was confused. Obviously if you're using an HDMI KVM switch then the TV's selected input never changes.

JPersson77 commented 2 years ago

Thanks for kind words! Well, it is possible to disable/enable automatic management of a device through the command line, which is what you want.

But it needs to be triggered by something.

One thing that comes to mind is to try and detect when a USB device is present, i e keyboard or mouse, as I suspect those will attach/detach to your PC depending on which input is active on your KVM. I know Eventghost, a home automation/scripting/IFTT-alternative, can be configured to detect detached/attached USB devices and can easily be scripted to send the correct command line arguments to this app.

But,, while Eventghost is a nice home automation software I think it might be a bit overkill and would therefore probably suggest that you try and use autohotkey to do the same. For inspiration on how to do this, check out the last post here: https://www.autohotkey.com/boards/viewtopic.php?style=2&t=98931&p=439480

JPersson77 commented 1 year ago

hi @IonCaza did you try out the new scripting possibilities possibly? Thinking about closing this issue since I think what you described can be achieved now with some clever scripting

JPersson77 commented 5 months ago

Closing due to inactivity