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

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 »

ThinkPad wrote:.....you also need to set Tasker/plugin for Tasker to give it more control ...
What?
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 »

I needed to install 'Secure Settings' plugin for Tasker, to give it more control over the tablet' hardware. Otherwise it couldn't turn the screen back on.
Was able to verify that by constantly pinging the tablet from my PC. It responded, but as soon as the screen was turned off the responses stopped.

What i also noticed, was that the CPU of the tablet went into sleep after screen was turned off. So it couldn't be turned back on by Tasker, because it was asleep.
I now keep it awake with an app, see here: viewtopic.php?f=28&t=4733&start=20#p32972 it now keeps responding if i ping it, doesn't matter if screen is on/off.
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 already installed the secure settings plugin. And also the awake app.
But the sceen switches off and doesnt switch on so it looks like there is no connection to domoticz or something.
Is there a way to test the connection? The tasker log doesn't tell much, only the task is running.
Screenshot_2015-06-07-23-32-17.png
Screenshot_2015-06-07-23-32-17.png (94.73 KiB) Viewed 3681 times
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 »

Can you still ping the tablet if the screen is off?

And can you post a screenshot of your Tasker event?
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 can keep pinging it, even if the ís off for a day.
Screenshot_2015-06-18-23-30-21.png
Screenshot_2015-06-18-23-30-21.png (89.17 KiB) Viewed 3642 times
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 »

One question, where does the "%domswitch" points to? It looks like a variable or parameter but where is it set?
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

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

Post by G3rard »

You have to add the following to domdev2.js.

Code: Select all

var domswitch=arr.result[0].Data;
Not using Domoticz 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 »

G3rard wrote:You have to add the following to domdev2.js.

Code: Select all

var domswitch=arr.result[0].Data;
This line isn't in the instruction described before....

Is it correct that the domdev2.js file is in "/mnt/sdcard/Tasker/js/" folder?
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

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

Post by G3rard »

It is not in the instruction indeed, but without it domswitch is not defined.
I got it running with this addition.

I placed the js file in a folder on the Nexus and then used the browser (magnifying glass) of Tasker to point to that file.
Not using Domoticz 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 »

G3rard wrote:It is not in the instruction indeed, but without it domswitch is not defined.
I got it running with this addition.

I placed the js file in a folder on the Nexus and then used the browser (magnifying glass) of Tasker to point to that file.
I did that already and double checked it but still the screen goes off.

When i do the json in the browser I get

http://xxx.xxx.xxx.xx:8080/json.htm?typ ... es&rid=285

Code: Select all

{
   "ActTime" : 1435262038,
   "ServerTime" : "Jun 25 2015 21:53:58",
   "Sunrise" : "05:18:00",
   "Sunset" : "22:08:00",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 2,
         "Data" : "On, Level: 100 %",
         "Favorite" : 0,
         "HardwareID" : 22,
         "HardwareName" : "Multimedia apparaten",
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "001416C",
         "Image" : "TV",
         "IsSubDevice" : false,
         "LastUpdate" : "2015-06-25 08:00:13",
         "Level" : 100,
         "LevelInt" : 15,
         "MaxDimLevel" : 15,
         "Name" : "Tablet scherm",
         "Notifications" : "false",
         "PlanID" : "0",
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : 7,
         "Status" : "On",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "AC",
         "SwitchType" : "On/Off",
         "SwitchTypeVal" : 0,
         "Timers" : "true",
         "Type" : "Lighting 2",
         "TypeImg" : "lightbulb",
         "Unit" : 1,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "285"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}
So i think the domswitch needs to use the "status" and not the "data" field, otherwise the %domswitch does not equals On because it is "On, Level: 100 %", or am I incorrect here? . But when I change in domdev2.js the

Code: Select all

var domswitch=arr.result[0].Data;
To

Code: Select all

var domswitch=arr.result[0].Status;
it still doesnt work..
The log of the tasker shows also no errors (see my screenshot above).
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

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

Post by G3rard »

Your virtual switch is a dimmer, make it a normal on/off switch and it will work.
Then the Data field will only contain On and Off.
Not using Domoticz 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 »

G3rard wrote:Your virtual switch is a dimmer, make it a normal on/off switch and it will work.
Then the Data field will only contain On and Off.
I think it's not. I create a virtual switch with type "Switch" then in devices I give it a name and then on the switch tab i set it to type "on/off".
This also matches the "SwitchType" : "On/Off"," of the json.
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

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

Post by G3rard »

Here is my json for an On/Off switch. Look at the Data part, it's only containing "On" (or "Off"). I use this switch with my tablet and it's working...

Code: Select all

{
   "ActTime" : 1435268559,
   "ServerTime" : "Jun 25 2015 23:42:39",
   "Sunrise" : "05:14:00",
   "Sunset" : "22:01:00",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 118,
         "Data" : "On",
         "Favorite" : 0,
         "HardwareID" : 3,
         "HardwareName" : "Dummy",
         "HaveDimmer" : false,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "65",
         "Image" : "TabletAndroid",
         "IsSubDevice" : false,
         "LastUpdate" : "2015-06-25 13:16:13",
         "Level" : 0,
         "LevelInt" : 0,
         "MaxDimLevel" : 0,
         "Name" : "Android Tablet Motion",
         "Notifications" : "false",
         "PlanID" : "0",
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : 7,
         "Status" : "On",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "X10",
         "SwitchType" : "On/Off",
         "SwitchTypeVal" : 0,
         "Timers" : "true",
         "Type" : "Lighting 1",
         "TypeImg" : "lightbulb",
         "Unit" : 14,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "167"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}
Not using Domoticz 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 »

Your subtype is X10, mine is AC. Only I'm not able to change this....

Besides that, can you post a screenshot of your JavaScript rule in tasker (where you also set the path).
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

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

Post by G3rard »

Add the virtual switch from the Switches tab by clicking the Manual Light/Switch button. There you can choose the subtype (standard X10), but that should not matter.

I copied the js file to my tablet (folder does not matter) and in Tasker pointed to that folder and file with the magnifying glass. Have you tried that?
What happens if you run the task in Tasker with the play button?
Not using Domoticz 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 sleep/not home

Post by ThinkPad »

I was on vacation from 13 till 27th of June, so i couldn't respond.

roblom, have you figured it out already, or do you still need some help with something?
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 »

Yesterday the screen switched on after I made a new virtual switch with a type X10. But after that no response anymore...
Tasker reports sometimes a "SocketTimeoutException: Failed to connect" error, but the ping from domoticz to the tablet seems to work (used the built in ping function from domoticz).
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 »

Weird. I also use a virtual X10 switch (on/off).
I am not active on this forum anymore.
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

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

Post by G3rard »

If you have Pushover you can also use that to trigger Tasker. http://updates.pushover.net/post/831182 ... er-support
It's easier then using the domdev2.js solution, just send a pushover message when you change a switch. The task in Tasker is started immediately when the message is received, so you don't have the 2 minute interval.

I have just configured this and when the tablet receives a certain message from Pushover it starts the Motion Detector app :D
Not using Domoticz 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 »

G3rard wrote:If you have Pushover you can also use that to trigger Tasker. http://updates.pushover.net/post/831182 ... er-support
It's easier then using the domdev2.js solution, just send a pushover message when you change a switch. The task in Tasker is started immediately when the message is received, so you don't have the 2 minute interval.

I have just configured this and when the tablet receives a certain message from Pushover it starts the Motion Detector app :D
But then you probably are using pushover only for the tablet? Because you are not able to send messages two different pushover devices, or am I wrong?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest