Page 3 of 4

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

Posted: Thursday 04 June 2015 23:02
by roblom
ThinkPad wrote:.....you also need to set Tasker/plugin for Tasker to give it more control ...
What?

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

Posted: Friday 05 June 2015 8:55
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.

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

Posted: Sunday 07 June 2015 23:33
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 3674 times

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

Posted: Monday 08 June 2015 9:16
by ThinkPad
Can you still ping the tablet if the screen is off?

And can you post a screenshot of your Tasker event?

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

Posted: Monday 22 June 2015 21:56
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 3635 times

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

Posted: Monday 22 June 2015 22:22
by roblom
One question, where does the "%domswitch" points to? It looks like a variable or parameter but where is it set?

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

Posted: Monday 22 June 2015 23:42
by G3rard
You have to add the following to domdev2.js.

Code: Select all

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

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

Posted: Wednesday 24 June 2015 22:21
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?

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

Posted: Wednesday 24 June 2015 23:57
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.

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

Posted: Thursday 25 June 2015 22:40
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).

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

Posted: Thursday 25 June 2015 22:49
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.

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

Posted: Thursday 25 June 2015 23:35
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.

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

Posted: Thursday 25 June 2015 23:46
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"
}

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

Posted: Thursday 25 June 2015 23:58
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).

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

Posted: Friday 26 June 2015 0:14
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?

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

Posted: Sunday 28 June 2015 11:13
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?

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

Posted: Sunday 28 June 2015 14:48
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).

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

Posted: Sunday 28 June 2015 15:00
by ThinkPad
Weird. I also use a virtual X10 switch (on/off).

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

Posted: Sunday 28 June 2015 23:52
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

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

Posted: Tuesday 07 July 2015 22:27
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?