Turn screen Android tablet off when sleep/not home

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

User avatar
bizziebis
Posts: 182
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping

Post by bizziebis »

Impossible to make good pictures in the dark, but also with daylight (reflective) haha.

I've adjusted the code so it wil round the numbers. Also converted the water usage to liters instead of m3.

I've put a 2x0.75mm2 cable in the pipe of the thermostat. It will run to the 'CV' room and goes into a usb power supply. I have some voltage drop because of the 8 meter cable lenght, but I used a iPad power supply which has a slightly higher power; 5.1V.
With display on it will very slowly drain the battery. But with display off it chargers quickly again.

In the livingroom I have a seperate temperature sensor. The thermostat is not yet coupled to Domoticz, so I don't know if I can read it in the future.
Image
Image
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping

Post by ThinkPad »

Nice.

What you could do about the charging issue, is to use a LM2596 module (very cheap on eBay). These accept a wide input range, and the output can be adjusted.
You could use an old 12V adapter (old router or so) and wire it to the LM2596. Then connect some load (small 6V bicycle lightbulb or something) at the other end of the cable (at the thermostat side), and adjust the output until you get a nice 5V out of it.
I think that will solve the issue of the battery draining slowly :) Be sure to watch the voltage carefully when adjusting, you don't want to blow up your tablet!

Or put 12V on the wire, and in the wall socket ('inbouwdoos') put a small 12V car cigarette lighter model charger... That way the 12V > 5V conversion is done at the end of the cable and the voltage drop will be gone.

This night i tried the 'RedEye Stay Awake (free)' app, but the tablet didn't wake up. I also couldn't ping it. As soon as i pushed the powerbutton on the tablet, so it woke up, it began reacting to pings...
Now going to try this one: https://play.google.com/store/apps/deta ... wakelocker and the first test seems to work. Without the app, when i locked the tablet, i couldn't ping it anymore after a few minutes. With the app enabled, i can still ping it when the screen is off. Seems promising :)
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping

Post by ThinkPad »

Yesterday evening it seemed like the screen didn't lock automatically when the virtual switch for the tablet in Domoticz was turned off. So i locked the tablet by hand.
This morning the screen was still off, so still no working solution, although it looked promising due to the fact the tablet kept responding to pings with the CPU Awake app installed and screen locked.
Maybe it has something to do if the tablet is locked by the system (Tasker in my case), or by hand...

Now going to try the frontcamera approach.
I am not active on this forum anymore.
Skippiemanz
Posts: 230
Joined: Sunday 14 July 2013 20:21
Target OS: Linux
Domoticz version: 4.10233
Location: Alkmaar, The Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping

Post by Skippiemanz »

Maybe you could use the steps i followed for the front facing camera.

http://www.domoticz.com/forum/viewtopic.php?t=4933

Ps isnt your WiFi going in sleep mode witch prevents it from replying on your ping requests?
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping

Post by ThinkPad »

Thanks, i will have a look at your topic :)

No, the 'CPU Awake' is preventing te tablet from going into deep sleep. It keeps responding to pings when i turned the screen off by hand (normally it wouldn't respond to pings anymore after a few minutes).
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping

Post by ThinkPad »

Hmm it is still not working as i would like.

It locks the screen (=screen off) nicely after a few minutes when i call the scene 'Sleeping', or when there is nobody home. But it doesn't wake up after that...

Anyone knows a trick how to wake it up via Domoticz? I don't want to use the frontcam approach, as this is already working for 50%... now only the turning on is still needed.
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping/not at home

Post by ThinkPad »

I found this tutorial: http://www.wuench.com/blog/tasker-how-t ... ur-screen/
Didn't have enough time for it today, so will look at it later.
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping/not at home

Post by ThinkPad »

NICE! I finally got it working completely! 8-) :shock:

I can now wake the tablet by setting a virtual switch in Domoticz to 'On'. When i set the switch to 'Off' the tablet will lock. It isn't instantaneously, but within 2 minutes (smallest interval possible)

See the images below for the Tasker profile. Tasker also needs the Secure Settings plugin.
http://i.imgur.com/ixWxdbB.png mirror: http://i61.tinypic.com/fwq14l.png
http://i.imgur.com/4WSl1On.png mirror: http://i58.tinypic.com/2u8jmlk.png

You also need to keep the device awake by installing: https://play.google.com/store/apps/deta ... wakelocker
Set it to 'No light' and keep both sliders at zero, so it keeps awake infinite.

Everything else needed can be found in the links i posted in this topic.
I am not active on this forum anymore.
pjeterinfo
Posts: 5
Joined: Tuesday 29 April 2014 21:34
Target OS: Linux
Domoticz version:

Re: Turn screen Android tablet off when sleeping/not at home

Post by pjeterinfo »

ThinkPad wrote:NICE! I finally got it working completely! 8-) :shock:

I can now wake the tablet by setting a virtual switch in Domoticz to 'On'. When i set the switch to 'Off' the tablet will lock. It isn't instantaneously, but within 2 minutes (smallest interval possible)

See the images below for the Tasker profile. Tasker also needs the Secure Settings plugin.
http://i.imgur.com/ixWxdbB.png
http://i.imgur.com/4WSl1On.png

You also need to keep the device awake by installing: https://play.google.com/store/apps/deta ... wakelocker
Set it to 'No light' and keep both sliders at zero, so it keeps awake infinite.

Everything else needed can be found in the links i posted in this topic.
Hi Thinkpad , what is the content of your domdev2.js script ?
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by ThinkPad »

I got the script from here: http://taskerdomo.blogspot.nl/2014/01/h ... asker.html

domdev2.js

Code: Select all

var arr = [];
arr = JSON.parse(global("HTTPD"));
var domstatus = arr.status;
var domhumidity = arr.result[0].Humidity;
var domtemp = arr.result[0].Temp;
var domlast=arr.result[0].LastUpdate;

// set domlasts to secs since last seen
var dtimems = global("TIMEMS")
var domtmp = new Date(domlast).getTime();
var domlasts = Math.round((dtimems - domtmp)/1000);
Let me know what you have made, i am curious to see if you can also get this working :)
I am not active on this forum anymore.
pjeterinfo
Posts: 5
Joined: Tuesday 29 April 2014 21:34
Target OS: Linux
Domoticz version:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by pjeterinfo »

ThinkPad wrote:I got the script from here: http://taskerdomo.blogspot.nl/2014/01/h ... asker.html

Let me know what you have made, i am curious to see if you can also get this working :)
Got it working, I allso found that blog. But due some typos it didn't run as expected. Thing become clear when using flash HTTPD ;-)
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by ThinkPad »

Nice you got it working!
I am not active on this forum anymore.
dompi
Posts: 2
Joined: Thursday 26 February 2015 12:33
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2284
Contact:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by dompi »

you have something appropriate to the script, or only copy/paste?
My Archos tablet stopt by the step '9. Else if'. I have follow the steps of http://i.imgur.com/ixWxdbB.png / http://i.imgur.com/4WSl1On.png
Timple
Posts: 5
Joined: Tuesday 20 January 2015 8:05
Target OS: Linux
Domoticz version:
Contact:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by Timple »

Is it possible to interupt the charger?

I have settings in my android (5.0.2) that the screen is always on while charging.

So charging = on, not charging it will automatically go off.

Now you only need to interupt the power supply.

I am sure your tablet battery will survive the night without power and screen off ;) .
dompi
Posts: 2
Joined: Thursday 26 February 2015 12:33
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2284
Contact:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by dompi »

Timple wrote:Is it possible to interupt the charger?

I have settings in my android (5.0.2) that the screen is always on while charging.

So charging = on, not charging it will automatically go off.

Now you only need to interupt the power supply.

I am sure your tablet battery will survive the night without power and screen off ;) .
Yes it is possible, i test it on battery.
I have android 4.2.2 ( not rooting)
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by ThinkPad »

Does anyone know how i can start a bookmark on the homescreen (which opens Google Chrome fullscreen) automatically?
I tried using https://play.google.com/store/apps/deta ... .autostart but that app can only automatically open real apps, not bookmarks unfortunately.
I also found the 'AutoShortcut' plugin for Tasker: https://play.google.com/store/apps/deta ... tcut&hl=nl but it doesn't seem that it can open pages fullscreen.

Would be great if the Domoticz frontpage would automatically start after boot. I now manually have to touch the bookmark icon on the homescreen.
Not that it is needed very much (don't turn the tablet on/off very often), but would be a nice extra.
I am not active on this forum anymore.
Raspberry Piet
Posts: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by Raspberry Piet »

Use the "Browse URL" in your tasker task?
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [SOLVED] Turn screen Android tablet off when sleep/not h

Post by ThinkPad »

I know, but then it doesn't open fullscreen.
I am not active on this forum anymore.
roblom
Posts: 402
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

Re: Turn screen Android tablet off when sleep/not home

Post by roblom »

I also test this method to remotely switch the screen of my old android tablet. I managed to get the settings in tasker but I have some questions.
* When I "play" the task, it looks like it stops before the last "end if" but i'm not sure because there are no errors given.
* I created a profile equal to the one shown by Thinkpad and set it to "On" but in the notification bar of android there is displayed "No active profiles".
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Turn screen Android tablet off when sleep/not home

Post by ThinkPad »

In my case it also shows: No active profiles. So that is no problem.

The order of the things in your event in Tasker can be a bit difficult to understand, but you can drag & drop them. If you press the play button it will show the steps that have matched green, and the ones not matching (for example, switch in Domoticz is off when the script expects on) it will show red.

Hope you can get it working, it is difficult to explain. Just try to build it equal like i did and it will probably work.
I'm not even sure if i can get it working again, had quite some difficulties to get it working a few months ago. If i remember correctly, you also need to set Tasker/plugin for Tasker to give it more control over the device so it can do things like turning off the screen etc.
I am not active on this forum anymore.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest