nstrelow / ha_philips_android_tv

Home Assistant custom component for the newer (2016+) Philips Android TVs
109 stars 28 forks source link

Entity does not go in Off state when turned off #42

Open rafuz opened 4 years ago

rafuz commented 4 years ago

From the latest update on this integration my Philips 32PFS6402/12 does not show "Off" state:

image

The TV turns off and on from home assistant but when turned off it does show only "unavailable" state. Before it was working correctly.

nstrelow commented 4 years ago

Thank you for reporting.

38 Made some changes, because the TV would show off, when the API was not reachable, but the TV was actually on. The change puts the TV into UNKOWN state when the API is not reachable.

UNKNOWN makes sense, because when the API is not reachable, the TV could be off or on or it could have a different problem. We just do not know the state of the device when the API is not reachable.

What are the downsides of having the state UNKNOWN? The UI still shows as playing something? Or can you not turn it on again?

The advantages are that should the API have connection issues, the UI goes into unknown instead of off.

Maybe @mikicof can add his thoughts.

rafuz commented 4 years ago

Ok, I undestand why it shows Unknown and not Off. This could be something related to my configuration. I have connected the TV to cabled ethernet and I see that it goes in sleep mode as soon as it is turned off. In sleep mode the API does not respond. I can't turn it on when it is unavailable but maybe this is related to the api not reachable. There is way to turn it on using a magic packet on wired lan? Can we find an alternative way to mark the entity "Off" when the TV goes in sleep mode?

nstrelow commented 4 years ago

It should support Wake On LAN/WLAN, but it was always not 100% working reliably. I cannot test anything right now sadly, but maybe in the next 3 weeks.

It may be better to display the state OFF, when API is not reachable.

mikicof commented 4 years ago

In my case having the state to OFF when unreachable would break the automations (and for all models PUS7304), it seems that when unknown doesn't make the call to turn on and maybe a better solution would be to make the call independently from the state

mikicof commented 4 years ago

Anyway, @rafuz, check your configuration if you have enabled start with chromecast, in my case wowlan wasn't working until i've enabled that.

rafuz commented 4 years ago

Anyway, @rafuz, check your configuration if you have enabled start with chromecast, in my case wowlan wasn't working until i've enabled that.

What is start with chromecast?

mikicof commented 4 years ago

I don't have the TV at the moment, I'll send a screenshot when home

rafuz commented 4 years ago

Is it an option of the TV? Maybe on my model it is not available. It was not updated to Android TV 8 last year.

rafuz commented 4 years ago

I don't have the TV at the moment, I'll send a screenshot when home

@mikicof Please post the screen :-)

mikicof commented 4 years ago

IMG_0071 sorry, completely forgot about it, also sorry about the spanish language

On network you can find it below start with wowlan

rafuz commented 4 years ago

Thank you for the screen but I can confirm that on my model I don't have this option. I still can't turn on the TV remotely when connected by lan cable. If I use Wifi it works but I don't have good coverage in the point where the tv is installed and I usually use cables for everything fixed to a wall.

nstrelow commented 4 years ago

Ok so for you: Wake WoWLAN works, but LAN does not and you prefer LAN. Good to know.

Also in your problem is: "In sleep mode the API does not respond." And this was working before? Then we will revert the change with STATE_UNKNOWN.

rafuz commented 4 years ago

Actual state is:

Maybe the state (off or unknown) could be set as a custom config?

mikicof commented 4 years ago

Maybe if the api version is different we could change if to set state unknown or off so it will work for both tv's

nstrelow commented 4 years ago

@rafuz Was the Wake up for cable working before? How is State Unknown breaking your automation ?

I think the best way is to revert the behavior and add a custom config.

@mikicof Your suggestion would be perfect, but I think we have not enough data to decide what works for which TV. Do you want to have a look at integration a custom config option?

rafuz commented 4 years ago

Wake up on cable never worked for me, but this could be related to my network infrastructure. I use wireless bridges in some points of my property and I know that WoL packets cannont cross them.

I used the Off state to activate some automation. I can modify them to a "not on" state but it is not the same.

Xitro01 commented 3 years ago

I actually have the exact same set-up as rafuz, and am using the 'not on' state now as well, but that's not perfect. Setting the state to off on different API versions would be great, or a custom config parameter that changes unknown to off. If help, or information is needed, please let me know!