mireco icon indicating copy to clipboard operation
mireco copied to clipboard

Anyway to know if device is awake or in sleep mode ?

Open badaz opened this issue 10 months ago • 4 comments

Hi, very nice job! Sorry to open an issue but I don't know where to ask this.

I have a Xiaomi Mijia ALPD 3.0. When it is powered on, sending a request with the "power" action param actually toggles it between sleep and wake mode, which is nice. I use this in Home Assistant to be able to turn it on / off in automations. However, I have no way of knowing if it is already awake or if it is in sleep mode. Therefore, for the moment I have a dumb switch entity that sends the power http request when turned ON, then sets itself OFF again.

What I'd like is to have a way to poll the device at regular intervals in order to reflect its current state on the switch entity.

Do you know the parameters to send in order to check if the device is actually in sleep mode or if it is awake ? Something like getVolum that would return the sleep/wake status?

badaz avatar Feb 04 '25 18:02 badaz

I think I found a (disappointing) answer in the Readme of this repo : https://github.com/simse/pymitv/blob/master/README.md#check-tv-status

According to the author, there is no way to know if the TV/projector is actually sleeping or awake.

I guess this is because we're are asking android, and it is always running, whereas the lamp / screen is off. I could sort of confirm this by sending commands while the device was sleeping, when waking it up again, it looked like the commands had been executed (home, back, volumeup, etc.)

Anyways, if you found a way to know if the screen / lamp is asleep or awake I'd be glad to know ;)

Thanks again

badaz avatar Feb 04 '25 21:02 badaz

I've not experimented it myself as I never put my projector in stadby mode, but your might have a way to detect it that way : adb shell dumpsys power | grep mWakefulness It will be Asleep or Awake But I'm not sure which HA integration will let you run custom adb commands. Seems there's a new ADB Sensor that might fit your needs.

spocky avatar Feb 06 '25 01:02 spocky

Thanks, I'll give it a try

badaz avatar Feb 10 '25 07:02 badaz

Hi, I managed to add the Xiaomi ALPD3.0 as a media player in Home Assistant using the Android Debug Bridge integration. Turn on / turn off work well and state is correct even when in standby mode. It solved my problem, thanks for the hint.

badaz avatar Jun 09 '25 16:06 badaz