This may help or give you inspiration:
This basically (ab)uses the fact that playing a video on Android keeps the screen from turning off, right?
I don’t think this will help here, because it would also keep the screen at full brightness. I don’t want to do that because of AMOLED display burn-in.
Thanks for the suggestion though.
Yeah it (ab)uses iframes to keep the screen on, but you can also do that with command notifications or wallpanel mqtt. Command notifications need to be resent every x minutes depending on what time out you set on the tablet, and to turn it off, just dont use that caffeine tile and let the timeout timer elapse. Wake the screen whenever there is motion again, or the lights go on.
I use that method on out two tablets.
I send a message to the tablet with topic “turn off” and message “turn off” and tasker reacts on it to switch it off.
Then I have a boolean that is the condition of an automation, and the trigger is the screen interactive on.
When all that is combined, it’s a way to make your kids stop using the tablets (or phones).
I think I already have what I want with WallPanel, although it’s still quite a mess because I haven’t had time to completely move away from Home Assistant Companion yet.
I don’t use Caffeine Tile, and I have the screen timeout set to 5 minutes. I have an automation that sends command_screen_on
every 290 seconds.
I still have the Home Assistant Companion app running in background, and use that to get the “interactive” sensor status and to handle command_screen_on
notifications.
I have configured WallPanel to reduce screen brightness by 99% after 15 seconds. This way, the screen is at minimal brightness most of the time, and all I need to do to wake it up is to touch it.
Thank you all for your help.
Could you elaborate this (HA and tasker), cause I’m looking for that solution…
I’m currently busy but here is a description of part of the solution, the event.
Then the action is just screen off in Tasker.
Thanks, it works but…
I have a tablet wich should wake up and show me a camera when there is motion.
Your solution works when the tablet is alive or just in sleep mode…after about 1 minute in sleep mode it doesn’t wake up anymore. I turned off battery optimization for tasker and HA, but this doesn’t help.
In tasker I made a task wich does 3 things : turn on, call HA and give a beep. When the tablet doesn’t wake up and I manualy turn on the tablet, I hear the beep and HA is opened.
Any idea ?
No I don’t have any ideas
I think it’s about connection…
When I manual turn on my tablet, I see the HA app with a message “Lost connection…”. After that it reconnects and I get the beep.
Do you know a way to resolve this ?
Sounds like it’s a wifi sleep issue.
See if you can keep the wifi on even when the phone is in sleep
I use AUTOMATION. its foss, you can download from fdroid and you can turn off the screen usin a notification.
I got something working with the vanilla companion app; I’m able to replicate the screen on / screen off functionality, though this does involve a work-around on what I suspect is a bug in the command_screen_on
command.
I use the following to turn off the Android screen (shown below) when occupancy is cleared, and turns on the screen (shown below) when occupancy is detected.
Screen On
This enables the always on screen then opens companion app (this is needed since sometimes when the phone goes to sleep the app is put in background).
action:
- service: notify.mobile_app_a12
data:
message: command_screen_on
data:
command: keep_screen_on
- service: notify.mobile_app_a12
data:
message: command_webview
data: {}
Screen Off
This part is tricky because I’m pretty sure there’s a bug. When the command_screen_on
is set to default, the setting isn’t applied until either the app restarts or the user goes into settings (without doing anything) then goes back to dashboard.
The screen off timeout set to 1 ms (or something really low; assuming your device has support), is needed for the screen to actually turn off around the time requested.
The sending of command_webview
essentially re-opens the app, effectively applying the bug work-around described above.
action:
- service: notify.mobile_app_a12
data:
message: command_screen_off_timeout
data:
command: 1
- service: notify.mobile_app_a12
data:
message: command_screen_on
data:
command: keep_screen_off # Per the doc, this can be any arbitrary command to set back to the default value.
- service: notify.mobile_app_a12
data:
message: command_webview
data: {}
the settings will apply when the screen turns off, or the next time you send command_webview
which forces the activity to restart. Its by design since the setting can only be read when the webview activity loads or is resumed.
Understood. The current workaround is functioning perfectly for now.
After looking through the Android API doc, I now understand.
It looks like by design the Android system manages the screen based on activity. At first I thought since the phone app can turn off the screen when proximity is detected, surely home assistants app could do the same. But nope, apparently the proximity screen off is a function of the system.
Thanks for the hint! I think this is exactly what I was looking for. Too bad that MQTT is not supported as a trigger.
I just want to keep the screen on from 8 to 23.
Turn on works, after the timeout the screen turns off.
Turn on + keep on works, after turning on remains on no matter what.
Turn off didn’t work for me.
As far as I can understand you can force to keep the screen on but, once forced, you cannot disable it unless you first disable to keep it on and then restart the app?
This is the code, any ideas?
id: '1690028390586'
alias: Cuina
description: ''
trigger:
- platform: time
at: '23:00:00'
condition: []
action:
- service: notify.mobile_app_lenovo_tb125fu
data:
message: command_screen_off_timeout
data:
command: 1
- service: notify.mobile_app_lenovo_tb125fu
data:
message: command_screen_on
data:
command: keep_screen_off
- service: notify.mobile_app_lenovo_tb125fu
data:
message: command_webview
data: {}
This worked perfectly. Thanks! Damn, I love HA.
Sorry this thread is confusing. I don’t see the solution, only someone asking why it doesn’t work. Which post are you referring to as the solution?