Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support Channel Switching (show channels as inputs) #45

Open
psycoticninja opened this issue Apr 11, 2023 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@psycoticninja
Copy link

psycoticninja commented Apr 11, 2023

Is your feature request related to a problem? Please describe:

Not related to a problem.

Describe the solution you'd like:

When the TV is On, when running python3 hisensetv.py IP_ADDRESS --get state -ifname ifname, the resulting output includes a "progname" and "channel_name".

{
    "statetype": "livetv",
    "list_param": "1#0",
    "channel_num": "70",
    "eventid": "",
    "progname": "Farmer Wants A Wife",
    "starttime": 1681205530,
    "endtime": 1681211900,
    "detail": "Two farmers meet their love matches before choosing five to return to their farms. All farmers each take one special lady on a 24 hour date and the fallout leads to heartbreak.",
    "channel_param": "1#18350209#0#0",
    "channel_name": "7HD Brisbane",
    "sourceid": "0"
}

When the TV is on TV input/statetype is livetv, to replace the "On" in Home to either the progname or channel_name data.

Describe alternatives you've considered:

Not applicable.

Additional context:

Came across this thought from another Homebridge plugin - https://github.com/grzegorz914/homebridge-lgwebos-tv

@psycoticninja psycoticninja added the enhancement New feature or request label Apr 11, 2023
@psycoticninja psycoticninja changed the title Use channel_name or progname in replacement of the "On" in Home Use channel_name or progname in replacement of "On" in Home Apr 11, 2023
@MrAsterisco
Copy link
Owner

Hey @psycoticninja ! Thanks for reaching out.

I believe this should work already. Or at least, I see the channel in my Home app. Although, it doesn't work reliably: the Home app queries the state only every once in a while, which means that if you just turned it on, it will only display "On" instead of the channel name.

@psycoticninja
Copy link
Author

psycoticninja commented Apr 11, 2023

Thanks for the update - good to know it is implemented, unfortunately it does not seem to work at all (even after periods of time with the TV On) with my Hisense 49R4 TV. It'd be a pretty cool thing to display if it worked - but seems this is a HomeKit problem now, not a plugin issue.

@MrAsterisco
Copy link
Owner

Have you tried force quitting the Home app? It does work for me, but if I want it to work immediately after turning on the TV, I have to force quit the Home app. This also happens with other plugins as well.

@psycoticninja
Copy link
Author

By force quit do you mean close the app from the app switcher?

If this is the case, done this many times. Typically I don't run Home in the background, just do what I need to do in the app then completely close it. Just now the TV has been for approx 40 mins, and in Home app I open and just see it as "TV", rather than the current program/channel.

@MrAsterisco
Copy link
Owner

MrAsterisco commented Apr 12, 2023

Oooh wait, I'm dumb.

I completely misunderstood your initial report: I thought you wanted the channel (as-in "the input") to be displayed, not the actual TV program name.

I checked my TV model and it doesn't report what yours report (I only see that it's on live TV, it doesn't tell me anything about the program), so it'd be complicated for me to implement. Would you be okay taking a stab at this?

After setting up your development environment (install NodeJS, Python, running npm install in the cloned repo) and setting up a development Homebridge instance (aka. another Homebridge installation running on your local machine and added to your Home app), you'd have to modify getCurrentInputIndex() (which is used to communicate to HomeKit what is the current input here) to check whether the current input is Live TV and, in case it is, read the progname property and return that as input name.

I do believe, however, it might create some additional headaches with the fact that HomeKit wants inputs to be static: for example, I tried in the past to have application there (such as Netflix, Prime Video, etc.) but I was not able to do it, because when turning on the TV, it takes a few seconds to retrieve the list of applications and HomeKit would timeout and not show any input.

@MrAsterisco MrAsterisco added help wanted Extra attention is needed good first issue Good for newcomers labels Apr 12, 2023
@LeLunZ
Copy link
Collaborator

LeLunZ commented Jun 11, 2024

More Information if someone is willing to implement this:

just displaying the channel name or the progname is not really doable without a bit more changes. The mentioned lg-plugin does this by letting users configure channels as input sources.
This would be possible if the hisense tvs support switching to channels over mqtt. Which should be possible as the HisenseNow app shows channels to switch to, but I myself don't have any configured channels so i can't even test it.

So someone would need to:

  • listen to mqtt connection and find out which data needs to be send to switch channels
  • Add options to configure channels in the config.schema.json
  • implement the code in the plugin (taking the config and creating InputSources out of it, managing the states, sending updates over mqtt, etc.)

@LeLunZ LeLunZ changed the title Use channel_name or progname in replacement of "On" in Home Feature Request: Support Channel Switching (show channel_name or progname as inputs Jun 11, 2024
@LeLunZ LeLunZ changed the title Feature Request: Support Channel Switching (show channel_name or progname as inputs Feature Request: Support Channel Switching (show channel_name or progname as inputs) Jun 11, 2024
@LeLunZ LeLunZ changed the title Feature Request: Support Channel Switching (show channel_name or progname as inputs) Feature Request: Support Channel Switching (show channels as inputs) Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants