Page 2 of 4

Re: Turn screen Android tablet off when sleeping

Posted: Sunday 11 January 2015 10:43
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

Re: Turn screen Android tablet off when sleeping

Posted: Sunday 11 January 2015 10:53
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 :)

Re: Turn screen Android tablet off when sleeping

Posted: Monday 12 January 2015 11:36
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.

Re: Turn screen Android tablet off when sleeping

Posted: Monday 12 January 2015 16:24
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?

Re: Turn screen Android tablet off when sleeping

Posted: Monday 12 January 2015 17:04
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).

Re: Turn screen Android tablet off when sleeping

Posted: Saturday 24 January 2015 16:26
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.

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

Posted: Sunday 25 January 2015 22:14
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.

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

Posted: Saturday 31 January 2015 19:08
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.

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

Posted: Sunday 01 February 2015 13:04
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 ?

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

Posted: Sunday 01 February 2015 13:59
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 :)

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

Posted: Sunday 01 February 2015 17:58
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 ;-)

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

Posted: Sunday 01 February 2015 19:19
by ThinkPad
Nice you got it working!

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

Posted: Thursday 26 February 2015 15:21
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

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

Posted: Thursday 26 February 2015 16:17
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 ;) .

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

Posted: Thursday 26 February 2015 16:26
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)

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

Posted: Monday 23 March 2015 10:27
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.

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

Posted: Monday 23 March 2015 13:47
by Raspberry Piet
Use the "Browse URL" in your tasker task?

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

Posted: Monday 23 March 2015 14:30
by ThinkPad
I know, but then it doesn't open fullscreen.

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

Posted: Thursday 04 June 2015 22:28
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".

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

Posted: Thursday 04 June 2015 22:31
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.