MrAsterisco / homebridge-hisense-tv

A Homebridge plugin to control RemoteNow-compatible HiSense TVs.
MIT License
21 stars 8 forks source link

Display Inputs as inputs, not as separate devices? #31

Closed mensa84 closed 2 months ago

mensa84 commented 2 years ago

Hello,

thanks for your plugin :) Finally I managed to install the plugin and add it to HomeKit now.

The only thing which is not so nice is, that the plugin adds an device for each input. I know that it can be grouped and it is by default, but it still does not look nice. Why don't you display the inputs really as inputs? Like it is done for example by the homebridge-harmony plugin? https://github.com/nicoduj/homebridge-harmony

Hisense: image

image

Harmony: image

image

MrAsterisco commented 2 years ago

@mensa84 Hallo and thanks for reporting this!

Well... technically, they are displayed as inputs... Infact, on my setup they appear as inputs exactly as your second screenshot. I'm not sure what's going wrong here, to be honest...

Have you tried to force quit the Home app and open it again after turning on the TV?

mensa84 commented 2 years ago

Yes, I tried to force quit the Home app, but did not change anything.

You mean, your inputs do appear like that screenshot? image That's the way it should be, but I am confused, cause it is not my second screenshot, it is my fourth.

mensa84 commented 2 years ago

I did this quitting and re-opening a few times now and it seems as it helped - thank you very much!

But do you know why one input does appear as "Unknown" and how to change this to correct name?

image

MrAsterisco commented 2 years ago

@mensa84 The force quitting usually forces HomeKit to fetch inputs again, but as mentioned in the Readme, there are some issues with inputs. Technically, the code should update inputs in real-time, but for some reason this doesn't work... and from what I'm standing, this looks like a Homebridge bug.

As for the Unknown input, where does it take you on the TV if you select it?

mensa84 commented 2 years ago

As for the Unknown input, where does it take you on the TV if you select it?

Nowhere. When I select "Unknown" it jumps back to the last input.

MrAsterisco commented 2 years ago

That's very weird o.O

Looking at the code, it looks like the TV returns an Input that we don't recognize, so it gets marked as Other, which is then probably represented in Home as "Unknown".

Are you able to run the Python script that you find in the bin folder separately? If so, could you please run it with --get sources (you'll also need to specify the IP Address of the TV and the network interface name) and post the result?

mensa84 commented 2 years ago

Yes:

root@Server:/usr/lib/node_modules/homebridge-hisense-tv-remotenow/bin# python3.9 hisensetv.py 192.168.1.40 --ifname ens3 --certfile /usr/lib/node_modules/homebridge-hisense-tv-remotenow/rcm_certchain_pem.cer --keyfile /usr/lib/node_modules/homebridge-hisense-tv-remotenow/rcm_pem_privkey.pkcs8 --get sources
[2022-01-17 10:58:39,216] [INFO    ] SSL context created with cert file (/usr/lib/node_modules/homebridge-hisense-tv-remotenow/rcm_certchain_pem.cer) and private key (/usr/lib/node_modules/homebridge-hisense-tv-remotenow/rcm_pem_privkey.pkcs8)
[
    {
        "sourceid": "4",
        "sourcename": "HDMI1",
        "displayname": "HDMI1",
        "is_signal": "1",
        "is_lock": "0",
        "hotel_mode": "0"
    },
    {
        "sourceid": "0",
        "sourcename": "TV",
        "displayname": "TV",
        "is_signal": "0",
        "is_lock": "0",
        "hotel_mode": "0"
    },
    {
        "sourceid": "1",
        "sourcename": "AV",
        "displayname": "AV",
        "is_signal": "0",
        "is_lock": "0",
        "hotel_mode": "0"
    },
    {
        "sourceid": "5",
        "sourcename": "HDMI2",
        "displayname": "HDMI2",
        "is_signal": "0",
        "is_lock": "0",
        "hotel_mode": "0"
    },
    {
        "sourceid": "6",
        "sourcename": "HDMI3",
        "displayname": "HDMI3",
        "is_signal": "0",
        "is_lock": "0",
        "hotel_mode": "0"
    }
]
mensa84 commented 2 years ago

Strange, after all that testing I am not able to turn on the TV through Home app. Turn off Works. Do you know how to power on problem now or how to see what's the problem?

MrAsterisco commented 2 years ago

@mensa84 even weirder, the output doesn't contain that input. I'll have to look into it, there might be a bug hidden somewhere in the code.

As for the turn on, it needs to be supported and turned on by the TV. It is based on Wake-on-LAN protocol and relies on the MAC Address of your TV: some network configuration do not allow this type of communication, but also some TV have it turned off by default. You might want to check in the TV settings that it is turned on (if it's not called "Wake on LAN", it is also sometimes referred to as "Wake on network access" or "Wake via Ethernet/WiFi").

Also, follow up question: are you able to turn on the TV using the RemoteNow app? If that's the case, I also know that some TV models don't actually turn off, they just turn off the display. In that case, the Wake-on-LAN won't work and it's probably a different command sent via MQTT.

mensa84 commented 2 years ago

The Wake via WiFi in the TV settings menu is enabled and it works to turn the TV on by using the RemoteNow app.

Yesterday it also worked to turn on by HomeKit. Today it is not working anymore :(

MrAsterisco commented 2 years ago

@mensa84 Mmm... Could you please try to force restart the TV? If you don't have a button to do so in the Settings, you can also just unplug the power cord and plug it back again.

My TV also has the same issue every once in a while and a hard restart fixes it.

stunrelay commented 2 years ago

Was a solution ever found for this? I have the exact same behaviour on my Hisense 65P7, which is persistent despite a hard restart.

  1. An ‘unknown’ source, however the other sources are correct.
  2. The TV can be controlled via home app whilst on however refuses to turn on with command whilst off. The remotenow app has no trouble with this however (WOL setting is on).
MrAsterisco commented 2 years ago

@stunrelay unfortunately, I only have my TV to test, so... no, there is no solution for it 😞

I was hoping for somebody to pick this up and test it locally with their TV, but it looks like nobody is up for the task. I would love to fix this problem, but I'm not experiencing it anymore on my TV since the latest iOS update (also, the TV got an update in the meantime which fixed the turn-off via HDMI, so I'm assuming they also made changes).

Would you be able to test the plugin locally and make the necessary changes?

LeLunZ commented 4 months ago

@mensa84 hey, do you still have the tv and the plugin running? if yes could you update it and check if the issue still persist? (there is also a beta version available)

I think this probably was a bug with homebridge or apple homekit.

LeLunZ commented 4 months ago

Was a solution ever found for this? I have the exact same behaviour on my Hisense 65P7, which is persistent despite a hard restart.

  1. An ‘unknown’ source, however the other sources are correct.
  2. The TV can be controlled via home app whilst on however refuses to turn on with command whilst off. The remotenow app has no trouble with this however (WOL setting is on).

The unknown source is kind of intentional. Is your tv connected via lan cable or wifi? If wifi: there is also an extra setting for wake on lan over wifi.

LeLunZ commented 2 months ago

@mensa84 if you have any new input please let me know. Will close it for now.