Searching for a way to send ADB commands to non "Tv or MediaPlayer" devices

I got an Android 11 Tablet wich I would like to use as an Home Assistant Display in my House.

Since I’m using the Companion-App, I want to turn the screen on and off via ADB in conjunction with a motion sensor an Home Assistant.

On my PC I can send the command to turn on and off the screen via adb-shell.

./adb shell input keyevent KEYCODE_WAKEUP
./adb shell input keyevent KEYCODE_POWER

Is there any way to do this inside Home Assistant? Like a shell switch or something?
Note: I run Home Assistant inside Docker.

Thanks.

2 Likes

You can use notification integration and install Automate app, have the app watch for companion app notification and what’s written in it (title) then have automate app react on whatever notification title you’ve sent. U can lock unlock and do whatever you want inside automate app. In HA make an automation that sends a notification and have a helper toggle or a button to have a toggle or button to activate that automation or a sensors
as activator. Hope I’m making sense here :joy:
PS Have the automate app in a loop, if notification title is this do that and clear notification , if no notification wait for it.
To clear notifications install this App and have automate open it when u want to clear notification ( app just opens and clears notifications and closes on its own)

Thanks for your suggestion.
I might have to do that.

But since it’s in a very busy location, I might reach the 500 Push Messages Limit on some Days.
I think there is no “local push” option like in iOS.

From what I’ve read there is local push for both iOS and Android. But if you aren’t able to get that to work you can always go with telegram integration to notify

Nice, didn’t know this.

I will try using your method.

Thank you

1 Like

ever get around to figuring this one out?

1 Like

Hi,
is this really the final solution and best practice we should work with? It feels more like a workaround.
There has been the adb addon, but it is deprecated. Why is no proper successor introduced?
Companion is not (yet?) filling the gap. Is it planned to do so for the future?
I stumbled upon the same issue as the thread creator unable to find a fitting solution.
thanks,
best regards
Markus

1 Like

So here is my feedback…
I would still prefer the method to just send an adb command to turn on and off the screen.
I tried using full kiosk browser / app but 9 out of 10 times it’s stuck at “initialing” at the Homeassistant page… apparently it’s a known issue, so no luck there…

I’m using Android TV integration for an android tablet hanging on the wall to turn on/off screen. It supports natively this function. As far as I know via this integration you also able to send custom adb commands to the device

That’s an interesting approach I never thought of.
Thanks for your suggestion.
I will try that later that day

I think the name of the integration (Android “TV”) is a bit misleading because it enables you to control every kind of android device not only your TV

notify.mobile_app_(your device)
use : command_screen_on as a message.
this is all you need. and maybe change some settings for device going to sleep