Page 1 of 4
Turn screen Android tablet off when sleep/not home
Posted: Thursday 01 January 2015 21:44
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.
Re: Turn screen Android tablet off when sleeping
Posted: Thursday 01 January 2015 23:46
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!
Re: Turn screen Android tablet off when sleeping
Posted: Thursday 01 January 2015 23:49
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
)
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
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.
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 0:23
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.
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 0:26
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
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 0:49
by Raspberry Piet
Yes, also not aviable on mine.
Solution: Install Secure Settings.
Choose Plugin, Secure Settings
Configuration: Actions, Wake Device.
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 11:49
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').
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 12:55
by roblom
Maybe a stupid idea but why not changing the settings in android?
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 13:19
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.
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 13:22
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
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 13:36
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.
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 14:37
by ThinkPad
The profile:
(In the mean time i have changed the repeat time to 5 minutes, to prevent over-requesting Domoticz
)
The task:
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:
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.
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 22:55
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?
Re: Turn screen Android tablet off when sleeping
Posted: Friday 02 January 2015 23:06
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
?
Re: Turn screen Android tablet off when sleeping
Posted: Sunday 04 January 2015 11:18
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?
Re: Turn screen Android tablet off when sleeping
Posted: Sunday 04 January 2015 21:42
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.
Re: Turn screen Android tablet off when sleeping
Posted: Sunday 04 January 2015 21:54
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..
Re: Turn screen Android tablet off when sleeping
Posted: Saturday 10 January 2015 21:58
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
Re: Turn screen Android tablet off when sleeping
Posted: Saturday 10 January 2015 23:17
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
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.
Re: Turn screen Android tablet off when sleeping
Posted: Saturday 10 January 2015 23:24
by ThinkPad
Hmmm... i could always try the frontcam solution.
By the way, it looks awesome!
(aside from the bad photo quality
).
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?