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

ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Turn screen Android tablet off when sleep/not home

Post by ThinkPad »

I am using a cheap 7" Android tablet to control Domoticz, via a custom statuspage.

But i don't want to leave the screen on for 24/7. Does anyone know, how i can control the screen from remote? I would like to control it with a virtual switch in Domoticz (via on and off action).

Maybe something with Tasker or something? Most simple would be something like: http://<IP_TABLET>/?screen=off
Or maybe something that the tablets checks a certain URL every minute. Something like a virtual switch. And then two actions
If JSON switch status = On SET screen On
If JSON switch status = Off SET screen Off

Anyone else some good ideas? I think Tasker is a good option for controlling the tablet, but unfortunately i am not skilled enough to create this

Edit: Okay, like many things, getting data from Domoticz is also done before on the internet. I am now looking at this tutorial: http://taskerdomo.blogspot.nl/2014/01/h ... asker.html to see if i can create an action with Tasker that turns screen of the tablet on/off according to the status of a virtual switch.
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: Turn screen Android tablet off when sleeping

Post by Raspberry Piet »

I'm sure you can do this with Autoremote+Tasker installed on your android device.

Make a Profile "Screen Off"
Choose Event,Plugin,AutoRemote.
Configuration:
Message Filter: screen_off
Exact Message: ticked

Make a task "Screen Off"
Choose Display, System Lock

Then you can put something like this in your script:

Code: Select all

curl "https://autoremotejoaomgcd.appspot.com/sendmessage?key=xXXxXX&message=screen_off"
Now your screen is off.

URL for easy form and send your message/notification:
http://autoremotejoaomgcd.appspot.com/?key=xXXxXX
Of course change xXXxXX to your own key!

Also possible to send message/commands the other direction. (tablet to linux device, or evenghost)
Really do like Autoremote+Tasker! It's Magic!
Last edited by Raspberry Piet on Sunday 04 January 2015 12:11, edited 1 time in total.
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, sounds quite easy! However i prefer using only Tasker.

I now got it working to switch screen to high and low brightness (i am afraid of locking it, maybe it goes into a loop and i cannot get it out of it :P )
It is a task in Tasker, i followed that tutorial.

But i don't understand how to let it act automatically now. If i press the 'Play' button at the task, it works as it should (high brightness when virtual switch Domoticz is 'On', low brightness when switch is 'Off').

Tasker is really powerful software, but the learning curve is SO incredibly steep for a beginner :cry:

Edit: Ok, i got it :) I will share the details tomorrow, now going to sleep :)
IF %domswitch (variable from JS) equals 'On' then 'screen brightness = 150'
IF %domswitch (variable from JS) equals 'Off' then 'system lock'

Profile is set to time (select i timespan, i need to experiment with this, it should be 24/24h, but don't know if that is possible). And then repeat, fill in 2 minutes (2min is lowest possible). Tasker then performs the task(s) every 2 min.

Turning screen off is working now.

Unfortunately on my tablet the 'Turn on' action is not available, so i have to come up with something to wake the tablet. I also tried 'Screen brightness 0' instead of 'System lock', but with brightness of zero the screen still stays on unfortunately.
Last edited by ThinkPad on Friday 02 January 2015 0:23, edited 1 time in total.
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: Turn screen Android tablet off when sleeping

Post by Raspberry Piet »

I agree Tasker is powerfull but has a very steep learning curve!
Same with AutoRemote when you want advanced profiles/tasks.
Paid for AutoRemote, i think it is worth those bucks. (same for all other apps from that developer)
But you can find plenty of good tutorials to start the magic.

For turning screen off, you can safely use the Display / System Lock action.
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 »

I just edited my post, see above you ;)

Turning screen off (locking) is now working. However, once locked i cannot get it to turn on/unlock again. That action is not available on my device according to Tasker.


Oh and a second task i have created is to control the screen brightness. As far as i know my tablet doesn't have a light intensity sensor. So i retrieve the value of the ABST-604 dusk/dawn sensor connected to domoticz.
If sensor = on = dark = screen brightness little bit lower
If sensor = off = light = screen brightness little bit higher

Will post some screenshots tomorrow, now time to sleep. Didn't have much sleep previous night due to new year's eve :P
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: Turn screen Android tablet off when sleeping

Post by Raspberry Piet »

Yes, also not aviable on mine.
Solution: Install Secure Settings.

Choose Plugin, Secure Settings
Configuration: Actions, Wake Device.
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 »

Installed it. What did you fill in for 'duration' ? I can choose from 1 sec to 20 minutes, or 'manual on', or 'manual off' for the device wake

However it doesn't seem to wake the device. Can Tasker run when the screen is locked? ('System lock').
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 sleeping

Post by roblom »

Maybe a stupid idea but why not changing the settings in android?
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 »

What do you mean by changing the settings in Android?'

And it seems like the waking up is now working, i think i assumed too quickly it wasn't working.
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 sleeping

Post by roblom »

Sorry I didn't read it right. I thought you want to have it 24/7 on, but when i read it again you want just the opposite :-)
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 »

Exactly.

Leaving the screen on is a simple setting in Android indeed. But i want to turn it off when i am not home, or while we are sleeping.
But i think it is working now. I will post some screenshots of the Tasker settings in 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 »

The profile:
Image
(In the mean time i have changed the repeat time to 5 minutes, to prevent over-requesting Domoticz ;) )

The task:
Image
Based on this: http://taskerdomo.blogspot.nl/2014/01/h ... asker.html (Javascript code can also be found there)

The tablet as i use it:
Image
Interface: http://domoticz.com/forum/viewtopic.php?f=4&t=4698
Tablet: http://www.banggood.com/Colorfly-E708-Q ... 88159.html

The temperature on the tablet is incorrect. It is measured by a DS18B20 that i put in the upper left corner of the thermostat housing. It is connected to GPIO of Raspberry.
However, the tablet gets quite warm, and i think it warms up the sensor. So i will try if i can move the sensor to the bottom middle of the thermostat, or bottom right corner or so.
I am not active on this forum anymore.
Heisenberg
Posts: 135
Joined: Monday 27 January 2014 14:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Turn screen Android tablet off when sleeping

Post by Heisenberg »

Way to go Thinkpad! I'm gonna give my nexus 7 a second life :)
Any advice for a good looking wall mount for a tablet?
Raspberry Pi Type B
Raspberry Pi Type B2
RFXCOMtrx433e
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 »

Unfortunately no, as you can see i just have it standing on my thermostat.

Maybe modify a car mount? Maybe it could be as simple as using a mount like this: http://www.smartphonegurus.com/guru/bro ... CF2681.jpg and screw it directly to the wall (put the screws where you also see screws now). But the mount should have a flat back then.
Maybe just order a cheap car mount from China and try tweaking around a bit ;) ?
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 »

Hmmm this morning the tablet didn't wake up. Had to push the power button by hand.

Maybe it goes into some kind of deeper sleep overnight? Any ideas to fix this?
I am not active on this forum anymore.
steef84
Posts: 37
Joined: Friday 30 August 2013 20:24
Target OS: NAS (Synology & others)
Domoticz version: DS213+
Contact:

Re: Turn screen Android tablet off when sleeping

Post by steef84 »

Thinkpad you may try looking in another view and more automated. You may try using your front cam on the tablet as a motion sensor. If motion is detected the screen on your tablet will turn on for xxx seconds. Google gives some hits with "motion screen on tasker". I will also get a tab on the wall mounted one day and I thought it would be a nice route to go. Its only an idea. :) I havent tested myself.
- Stefan
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 »

I already thought of that before starting this topic. But i think that approach will eat a lot of CPU, and therefore the tablet would get quite warm. That is already happening now, the backside is getting mildly warm when it is on the whole day.

Not my ideal approach..
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 »

Hmmm i have to push the powerbutton manually each morning (or when we come home) to wake up the tablet. The virtual switch in Domoticz is turning on nicely every morning and when we arrive home.
So my thoughts that it goes into some deeper sleep or something after a while seems correct.

I am now going to try this app: https://play.google.com/store/apps/deta ... edeye.free

I think it goes into a total sleep, where the CPU is also asleep (tablet also doesn't feel warm like you would expect). Maybe the app can prevent it :)
I am not active on this forum anymore.
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 »

I did it with motion sensing from the front cam. Doesn't cost that much cpu. But I use a Nexus 7, so maybe it's already powerful enough to do it without issues. I used the programs somewhere in the topic on http://android.stackexchange.com/questi ... nal-device
Looks realy professional when you walk by :D

By the way, I used a flip cover as wallmount. Just removed the 'flip' so I only had the plastic back cover left. Sticked that to the wall with double sided tape and two small nails to get the weight off the tape. Solid as a rock. 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 »

Hmmm... i could always try the frontcam solution.

By the way, it looks awesome! 8-) (aside from the bad photo quality :lol: ).
For the electricity and gas usage (in your situation the numbers in the upper left and right corners), i use some scripting to round the figures to 1 digit (11.2 instead of 11.227) looks a bit nicer.

You can find the code for the whole page i am currently using here: http://pastebin.com/E2yxM35v it uses an external .css file, which can be found here: http://pastebin.com/hKjUfkdh

Oh and how is your tablet powered? I see the microUSB running behind the thermostat, but then? And how do you read the temperature of your livingroom? Is the thermostat connected to Domoticz? Or do you use a separate temperature sensor?
I am not active on this forum anymore.
Post Reply

Who is online

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