Open Strange behavior Tasker

Discussion in 'Tasker' started by Raivo Kask, May 13, 2020.

  1. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    I have a strange behavior in Tasker.
    My environment is:

    1) Samsung Galaxy Tab S5e with Android 9
    2) Tasker 5.9.2
    3) Motion Detector 3.5.7
    4) Chrome 81.0.4404.138

    What I wanted to do in Tasker is very simple:

    - when the display has reached Screen timeout and gone to sleep ... it will wakeup when motion is detected ... which works OK with the Tasker Profile & Tasks & Scene I created.
    - create Screen timeout in Tasker for how long the display will stay alive (which I did not in this case but used Android Screen timeout to test)

    I set 30 sec in Settings/Display/Screen timeout and it shut down the display correctly after 30 sec ...
    But after a motion was detected and the screen woke up ... then the screen was shut down after 5 sec every time ... and in Settings/Display/Screen timeout all the options (15 sec, 30 sec ... 10 min) were unchecked ... how is that possible?
    When I disable Tasker the shutdown was correct every time according to Settings/Display/Screen timeout.
    That maybe explained why I didn't get anything working in Tasker dealing with screen issues.
    Here are my exported Profiles & Tasks:

    Profiles:
    Code (Text):

        Profile: DisplayOff (5)
        Restore: no
        Event: Display Off
        Enter: DisplayStateOff (6)
        A1: Variable Set [ Name:%DISPLAYSTATE To:0 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
     
        Profile: DisplayOn (3)
        Restore: no
        Event: Display On
        Enter: DisplayStateOn (4)
        A1: Variable Set [ Name:%DISPLAYSTATE To:1 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
     
        Profile: MotionDetected (8)
        Restore: no
        Event: Intent Received [ Action:eek:rg.motion.detector.ACTION_GLOBAL_BROADCAST Cat:None Cat:None Scheme:* Mime Type:* ]
        Enter: Display (9)
        A1: Show Scene [ Name:HASSIO Display As:Activity, No Bar Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:On Show Over Keyguard:On Continue Task Immediately:On ] If [ %DISPLAYSTATE eq 0 ]
        A2: Wait [ MS:70 Seconds:0 Minutes:0 Hours:0 Days:0 ]
        A3: Destroy Scene [ Name:HASSIO ]
     
    Tasks:

        DisplayStateOn (4)
        A1: Variable Set [ Name:%DISPLAYSTATE To:1 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
     
        DisplayStateOff (6)
        A1: Variable Set [ Name:%DISPLAYSTATE To:0 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
     
        Display (9)
        A1: Show Scene [ Name:HASSIO Display As:Activity, No Bar Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:On Show Over Keyguard:On Continue Task Immediately:On ] If [ %DISPLAYSTATE eq 0 ]
        A2: Wait [ MS:70 Seconds:0 Minutes:0 Hours:0 Days:0 ]
        A3: Destroy Scene [ Name:HASSIO ]
     
    Really appreciate help from Tasker experts ... I am totally lost.
     
    Last edited by a moderator: May 14, 2020
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Check that you're not setting the display timeout to a very large value somewhere which may be throwing the system off and resetting it to 5 seconds. Can that be it?
     
  3. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    I created a Task called 'Keep Screen' -> Display -> Display Timeout -> 1 min and then created a Profile
    called 'App Keep Screen' -> Application -> Motion Detector, Chrome and linked to 'Keep Screen'.

    Why I chose these apps is that when Motion Detector detects a motion (which work OK every time) then I display an URL with Chrome.
    This is what happens:

    1) After 1 min the screen goes dark.
    2) Then I wake the display with a motion but it goes dark after 5 sec instead of 1 min ... that happens all the time.
    3) But when I, after a motion, taps the screen then the display stays alive for 1 min and after that it goes into the 5 sec nightmare loop.

    Got a feeling that my var %DISPLAYSTATE in 'Display State On' is not updated when Motion Detector detects a motion and activates the display ... can that be the case?

    Down below you can see my exports:
    Code (Text):
        Profile: Apps Keep Screen (13)
        Restore: no
        Application: Chrome or Motion Detector
        Enter: Keep Screen (2)
        A1: Display Timeout [ Secs:0 Mins:1 Hours:0 ]
     
        Profile: Motion Detected (8)
        Restore: no
        Event: Intent Received [ Action:org.motion.detector.ACTION_GLOBAL_BROADCAST Cat:None Cat:None Scheme:* Mime Type:* ]
        Enter: Display Show (9)
        A1: Show Scene [ Name:HASSIO Display As:Activity, No Bar Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:On Show Over Keyguard:On Continue Task Immediately:On ] If [ %DISPLAYSTATE eq 0 ]
        A2: Wait [ MS:50 Seconds:0 Minutes:0 Hours:0 Days:0 ]
        A3: Destroy Scene [ Name:HASSIO ]
     
        Profile: Set Display Off (5)
        Restore: no
        Event: Display Off
        Enter: Display State Off (6)
        A1: Variable Set [ Name:%DISPLAYSTATE To:0 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
     
        Profile: Set Display On (3)
        Restore: no
        Event: Display On
        Enter: Display State On (4)
        A1: Variable Set [ Name:%DISPLAYSTATE To:1 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
        Display State On (4)
        A1: Variable Set [ Name:%DISPLAYSTATE To:1 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
     
        Display State Off (6)
        A1: Variable Set [ Name:%DISPLAYSTATE To:0 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
     
        Display Show (9)
        A1: Show Scene [ Name:HASSIO Display As:Activity, No Bar Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:On Show Over Keyguard:On Continue Task Immediately:On ] If [ %DISPLAYSTATE eq 0 ]
        A2: Wait [ MS:50 Seconds:0 Minutes:0 Hours:0 Days:0 ]
        A3: Destroy Scene [ Name:HASSIO ]
     
        Keep Screen (2)
        A1: Display Timeout [ Secs:0 Mins:1 Hours:0 ]
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Hi. Sorry for the late reply. Were you able to figure out the issue?
     
  5. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    This is Mission Impossible ... I have tested it endless times but I am lost.
    I have attached log file and as you can see there is a 30 sec time gap (17.16.02->17.16.37)
    but after that it never occurs ... only 5-8 sec when motion is detected and the screen goes dark.
    My 'Display timeout' is 30 sec.
    I have also attached my backup.xml ... maybe I missed something basic.
    Hope you can tell me what is wrong.
     

    Attached Files:

  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Did you maybe not enable Use Motion Detection in Tasker Prefrerences > Monitor > Display Off Monitoring?
     
  7. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    I hadn't but now it is enabled (checked) ... still the same story.
    Also rebooted the Samsung but it didn't help.
    Is there any debug Tasker software I can run?
     
  8. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Oh sorry, my mistake I didn't realize you were getting the motion event from another app. Maybe the other app is not sending the event if the screen is off?
     
  9. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    The other app is 'Motion Detector' and it detects a motion with the camera when the screen is off ... it wakes the display every time.
    Problem is why Tasker is not keeping the screen alive for 1 min that I have specified ... shuts down after 5-8 sec
    I sent you my backup.xml ... is there a chance that you can test it with 'Motion Detector' from Google Play on a tablet you have.
    My project is very dependent that this works.
     
  10. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    After testing & googling I think Tasker is not able to change Time out parameters for the display ...
    Please correct me if I wrong
     
  11. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Yes, the Display Timeout action should do that. But it doesn't seem you are using that action in the profiles you showed me above right?
     
  12. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    Hmm ... but I am when display goes on

    Profile: DisplayOff (5)
    Restore: no
    Event: Display Off
    Enter: Display State Off (6)
    A1: Variable Set [ Name:%DISPLAYSTATE To:0 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]

    Profile: DisplayOn (3)
    Restore: no
    Event: Display On
    Enter: Display State On (4)
    A1: Variable Set [ Name:%DISPLAYSTATE To:1 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]
    A2: Display Timeout [ Secs:0 Mins:10 Hours:0 ]

    Profile: MotionDetected (8)
    Restore: no
    Event: Intent Received [ Action:eek:rg.motion.detector.ACTION_GLOBAL_BROADCAST Cat:None Cat:None Scheme:* Mime Type:* ]
    Enter: Display (9)
    A1: Show Scene [ Name:HASSIO Display As:Activity, No Bar Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:On Show Over Keyguard:On Continue Task Immediately:On ] If [ %DISPLAYSTATE eq 0 ]
    A2: Wait [ MS:70 Seconds:0 Minutes:0 Hours:0 Days:0 ]
    A3: Destroy Scene [ Name:HASSIO ]
     
  13. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Can you try setting it to 5 minutes instead and see if that works? Maybe your phone doesn't support custom values like that...
     
  14. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    OK ... this is what I did and what happened ...
    1. In phone: Settings/Display/Screen timeout = 15 sec
    2. In Tasker: Profile/DisplayOn/Display State On/Display Timeout = 5 min
    When the screen went dark after 15 sec and was awaken by Motion Detector it stayed alive for 5-8 sec and then went dark ... this happened all the time.
    3. When I checked in phone: Settings/Display/Screen timeout ... now it had changed from initially 15 sec to 5 min !!!
    Apparently Tasker had done that but the phone ignored the new settings done by Tasker ... something is weird
     
  15. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Weird indeed. But as you can see Tasker is doing its job... For some reason your phone isn't taking it though :/
     
  16. Raivo Kask

    Raivo Kask New Member

    Joined:
    Jan 28, 2020
    Messages:
    13
    Likes Received:
    0
    FYI ...
    I installed SETEDIT from Play to check the value of 'screen_off_timeout'.
    The I ran two different test - one with Tasker disabled - one with Tasker enabled.

    Taker disabled:

    1) In 'Settings/Dislay/Screen timeout' I set to 15 sec
    2) The display shutdown occured after 15 sec first time ... OK
    3) When I woke the display its shutdown occured after 15 sec ... OK
    4) In SETEDIT the value of 'screen_off_timeout' was 15000 ms = 15 sec
    5) In 'Settings/Dislay/Screen timeout' was still 15 sec
    So it seems that without Tasker it behaves as expected.

    Taker enabled:

    1) In 'Settings/Dislay/Screen timeout' I set to 15 sec
    2) In Tasker I set 'Display Timeout' to 1 min
    2) The display shutdown occured after 15 sec first time ... OK
    3) When the display woke up due to a motion was detected ... its shutdown occured after 5-7 sec ... not OK
    4) In SETEDIT the value of 'screen_off_timeout' was changed by Tasker to 60000 ms = 1 min ... OK
    5) In 'Settings/Dislay/Screen timeout' was also changed to 1 min ... OK
    So both SETEDIT & 'Settings/Dislay/Screen timeout' shows the correct values ... why is screen shut down after 5-7 sec???
     

Share This Page