I installed the latest version and now it’s working. I think that it failed earlier because the TV was off for a long time and the state was reported as Idle. Also a few remarks, when i turn off the TV the state remains “idle” for 10 sec since the TV was turned off.
Also the set_volume_level method does not work for me.
Very nice, on/off is working almost great for me. Sometimes it takes a while to register and sometimes pressing “ON” once doesn’t work, second time does then (I can probably improve on that somehow). Is this the problem you are having?
Exactly like I detailed in my post you have to add the emoji to tell if it is an app or TV channel.
You can just copy and paste it from here or somewhere else.
TV Channel: (television)
App: (phone)
To type them in Windows use (Win + .) and type the name, but copying from here should work
Order:
&
" " aka a space
Name of the app/channel
You can also see it in the states section, just copy what is writting under source
Very nice, this state is idle is now reported better And, yeah, that is the default wait time (actually 5sec) until the update method kicks in. In theory it would make sense to report the state directly as off. Hmm, will think about it. Could be problematic if the turning off fails.
Hmm it works on my end. I also barely changed anything there.
I would try a curl POST command and check if you can set it that way.
route: /audio/volume
{
'current': targetlevel,
'muted': False
}
targetlevel: A number from 0-60
Also your api seems to be almost the same as mine, I could not imagine any command working for me, not working for you.
@nstrelow, is there any particular reason why you chose to use idle state rather than on?
I use universal media player and now it doesn’t work correctly at all after all changes re power state. As far as I understand idle for media player is considered “closer” to state off than on. Would it be better to use conventional states in case you decide to publish this component as an official?
Don’t have that much experience with HA code but digging into your code it might be the fact that the TV it’s turned off and only when the next poll interval happens the state it’s updated.
Yeah that is exactly it. It will probably be better to set it to OFF right away. The calling of the “powerstate” command gives us certainty that it’s off. If the command fails, then we would show it as OFF for 10sec before the powerstate is updated and detects the TV has not been shut down.
This is the only though I have in mind right now. Setting the powerstate should actually not fail, so it could be save. If it fails, well you would have to wait 10 secs, before being able to turn it off again.
Very sad Probably nothing to be done about it. You can try finding other ways of APIs for setting the volume
Well what are you playing? A TV channel? But probably this part of the API is also not working.
You can check the States Tab in HA. All the detected channels and applications should be there under source_list. I assume you have nothing there.
Very sad that this is not working for you.
I do have “NA” too, when I have no app opened and just some HDMI channel.
Yes there is a very good reason. (correct me if I’m wrong)
Idle shows the player controller, e.g. the Play button.
An earlier version of somebody used STATE_ON, and that didn’t display the play button. As we have (currently) no way of checking if a video is playing or not, setting it to idle when on, enables resuming and pausing videos.
What could also work is setting “WoWLAN” to on, I think this makes the api more available throughout the TV.
Or try launching the commands when the home menu is opened.
Puh replying to so many people, I feel like Philips tech support.
I should ask them if they pay me for that
Anyway, to sleep, have fun hacking around. Pull requests or also GitHub issues are always welcome.
But please add as much information as possible.
Great would be the /system GET call. That contains much useful information and shows directly if we have the same API.
I see your point, but are you sure that it is a correct logic for media player to have a pair of states off and idle? Sorry for my ignorance but what is the use of Play button for automation purposes? If the pair off/idle is correct than it must be something else is wrong with the code why it does not integrate with universal player correctly.
I had to go back to my old code since it is more important for me to be able to combine cast and other players in one and to automate on/off, mute/unmute and use other attributes rather than to play/stop youtube from HA.
Yes i was playing a tv channel. In the Ha i can see the entire list of channels and qpps. More on that the activites/tv it’s returning the correct information for the current channel.
So that means that activities/current shows NA
But you are playing a TV channel which is correctly displayed at activities/tv ?
When TV is playing it is showing org.droidtv… something when using activities/current. I could change that and if activities/current is NA, but activities/tv is playing something then use the info from that.
The simple answer is that the state of universal player is determined by states of child players as the following: OFF_STATES = [STATE_IDLE, STATE_OFF, STATE_UNAVAILABLE]
This would be too long, however, I also use Alexa to on/off Tv, automatically mute/unmute when there are voice notifications; pause audio system when TV is on; turn off/dim lights when films start playing etc. All this possible only when the media player reports the correct on/off state of course.