Universal Media Player doesn't have attributes when idle

Tags: #<Tag:0x00007f3270562378>

Hello Guys,

I have a Mi Box and I’m using the Android TV integration, it works really good, but I can’t turn on, as the Mi Box breaks wifi connection when it’s powered off… I’ve tried to setup an universal media player, so I can turn it on using Broadlink IR, but for some reason it just won’t use all attributes when it is in idle attribute…
I can’t do anything from the universal media player when it’s in idle, however it works fine in the android tv component itself. I’ve attached some screenshots below for better understanding:

Obs: Mi Box is the Universal Media Player component




My Code is:

media_player:
  - platform: universal
    name: Mi Box
    children:
      - media_player.android_tv
    commands:
      turn_on:
        service: script.turn_on
        data:
          entity_id: script.ligar_mi_box_ir
      turn_off:
        service: switch.turn_off
        data:
          entity_id: switch.tv_philips
    attributes:
      state: sensor.android_tv_state
      source_list: media_player.android_tv|source_list
      volume_level: media_player.android_tv|volume_level
      app_id: media_player.android_tv|app_id
      app_name: media_player.android_tv|app_name
      source: media_player.android_tv|source
sensor:
  - platform: template
    sensors:
      android_tv_state:
        value_template: >-
          {%- if is_state('media_player.android_tv', 'unavailable') -%}
          off
          {%- else -%}
          {{ states('media_player.android_tv') }}
          {%- endif -%}

Any help would be really appreciated, I already lost a lot time and I couldn’t figure it out myself…
A HUGE THANKS!!!

I have an issue which sounds similar. I have several Sonos speakers integrated using the UI. If any of them is powered down briefly Lovelace media player cards show the last thing played by the speaker and play and pause controls are unresponsive. I am able to access the Sonos music library and play albums, but the card no longer reflects what is playing. The only way to get back to normal appears to be to delete and re-install the integration.

I don’t think media players have attributes when idle. However that doesn’t stop you turning them on.

@GSzabados also sorry for late reply… The only solution I’ve found was to create an Universal Media Player as mentioned by @JeffLIrion, and turn it on using IR via Broadlink, the downside however is:

#1 - Mi Box doesn’t always turn on using IR, especially when you just turned it off (Maybe Xiaomi will fix this later with an update)
#2 - Using Universal Media Player, it won’t show all the attributes when idle (I don’t know why), and I couldn’t turn it off, change volume or app sources… Check my problem here: Universal Media Player doesn't have attributes when idle

After messing for a long time, I then gave up and sold my Mi Box, and bought a Fire TV Stick, works perfectly with HA and no workaround is required

@Ronaldo_Cesar, thanks for the answer. I moved here the discussions as the issue should have been raised as a question from my side on the community forum.

Yeah, the Mi Box 3 has gone bonkers… The Android 9 update broke many thing. WakeLock is not working anymore as before, what solved many problems on the previous Android version. I’ve tried to experiment with the BroadLink IR as well, but unfortunately I have had the same experience.
On the 31st of December a 600+ MByte update popped up on the MiBox, I hoped the best that it would solve some issues, but it has brought the worst. After turning off and on the device Youtube is not working anymore, until the Mibox is restarted. I am thinking of your final solution as well, but I don’t really want to spend more money, and haven’t seen any decent Android TV box for a while, like 2+ GB RAM and 16+ GB disk space. The NVidia Shields would be nice, but I hate their remote and as I can recall they haven’t updated the hardware for ages.

(I used originally the MiBox to turn on my TV, an H series Samsung, which goes deep sleep when turned off, and needs IR or HDMI CEC to turn on. Now I have IR for it…)

@GSzabados yeah, it’s sad, they basically killed the box with the updates… I’m having issues since I bought it, and on the last update of Android 8 + WakeLock it was working perfectly. But after the Android 9 update it was really buggy for me, also the WiFi was doing some random disconnects, which I could no longer watch Live TV. There are 2 groups on Facebook with the Xiaomi Devs and I tried to bring all these problems to their attention, but nothing…
I was thinking of buying a Shield too, but I don’t like the remote too, and the price is a no-go here in Brazil. Personally I liked the Fire TV, and the performance is close to the Mi Box, even with 1GB RAM only (just not sure about games, which I have not tested). The only thing that I miss is the Integrated Chromecast that we have on Android TV

Can you point me to these Facebook groups please? I might give it another try.

Yeah, I am exactly in the same shoes. Android 8 was working well with WakeLock, Android 9 ruined it. The latest update made even worse, just look at the Reddit posts about it.
I am thinking the same way about the Shield as well, but not a fan of Amazon’s products. I might going to get a new Chromecast with Android TV. Tried it a few month ago, but gave it away as a present. It has a nice remote as well, and can control the TV’s volume with it.
(I mostly miss the feature now to be able to turn on with Google Home the TV and the box and start streaming.)

Oh, and it is not only the Mibox 3 it is also an issue with the Mibox S as well. It is a shame…

@GSzabados sure, the Facebook group is at: https://www.facebook.com/groups/mibox
There’s also another which is closed to beta testers, but I don’t have access to it, looks like the Xiaomi Devs chosen some people who applied a long time ago, but never opened again.

Oh yes, I’ve seen that new Chromecast and I liked too, but I bought the Fire TV from US and it was half the price of the Chromecast, and also with free customs taxes, while the Chromecast can get up to 70% of it’s price in taxes…

Mi Box S can get even worse because it doesn’t have IR, it’s a no-go for automation :frowning:

1 Like

Hi guys,
my Mi Box S is working quite good, the only thing I’m struggling lately is the turn off, the last update probably changed something and now calling the service media_player.turn_off make the box unavailable so there is no way to turn it on again with automation and need the remote control to do it. So now I’ll try to let the box go to sleep by itself after 30 minutes and will see if it change the successive availability.
I use automation to turn on Spotify, Disney+ and Prime Video and it works, okay, just elementary things.
Ah, little detail, I use the usb dongle to connect the box to ethernet, I know about the wifi problem and in that way the box is always available.