Stop macro after trigger once

431

New member
I intend to use the light sensor of a spare Samsung J5 to control my door light (among others).

Up to now I have:
Trigger: Every 15min, starting at 5pm (to get the light sensor active).
Action: Switch on door light
Condition : Light level less than 100 Lux

Now what is missing: Once the door light is on the macro should stop to save power
and to prevent a feedback loop in case the light sensor can see the door light.

Has anyone an idea how to solve?
May be 1h before sunset can replace 3pm?
But then I need to help on how to access a calendar.

Note: There is a 2. Macro which stops the door light at 11pm anyhow.
 

431

New member
Dear Qarboz



Thank you for the quick answer. Fist of all it seems that your MacroDroid is a different release and I hop “Wait for Trigger” is the correct equivalent for the pistol. Screen of my device/release attached.



I did a try and found that the light esnsor is only active if the J5 screen is. By the way a related warning comess up when using the light sensor. Next the “turn off” action was not

Executed. On top the whole thing is more complex. Here a basic like program of what I intent:



A: if time > 7:00

check light level

if light level is above 100lx GOTO C

else switch on light

B: wait 30 min

if light level is below 100 lx GOTO B

else switch off light



C: if time > 16:00

check light level

D: if light level is above 100lx

wait 30 min GOTO D

else switch on light

if time > 23:00

switch off light

GOTO A



I hope this could be implemented in MacroDroid and will work without the necessity to have the J5 always in ON-State.
 

Attachments

  • Test.JPG
    Test.JPG
    83.3 KB · Views: 9
I could be wrong but from what I understand if you want macrodroid to do something with your apps that the screen has to be unlocked / open.

My MacrdDroid will execute some native stuff like speak some text but I think if you are having it do some external feature or work with another app to control a smart device or something then you may have to have the screen open. Some other people on this forum are more well educated on this than me so hopefully they will chime in.

I may have misunderstood your use case but hopefully something in my idea below is helpful.

As for your function, it might be worth considering if you want to use some variables to track / control your system.
Some additional variables to consider:

is it evening time? do we think it might be dark?
- set this in conditions: only run macro if time is between x and y

Do we think it's a low light condition?
- if sensor => x set "Lighting detection" to light
- if sensor < x set "lighting detection" to dark

Did we already turn the light on?
- any time light on command is sent, also set variable "bedroom_light_status" to On

did we turn the light off?
update - "bedroom_light_status" to off

Now we can add the condition to the macro, only run the macro "turn on bedroom light" if the current conditions are met:
- light status is "off"
- "lighting detection" = dark

If you make these global variables you can monitor these independently by other macros and it all weaves together.
Let me know if you have any questions or comments about what I suggested.
 
Dear Qarboz



Thank you for the quick answer. Fist of all it seems that your MacroDroid is a different release and I hop “Wait for Trigger” is the correct equivalent for the pistol. Screen of my device/release attached.



I did a try and found that the light esnsor is only active if the J5 screen is. By the way a related warning comess up when using the light sensor. Next the “turn off” action was not

Executed. On top the whole thing is more complex. Here a basic like program of what I intent:



A: if time > 7:00

check light level

if light level is above 100lx GOTO C

else switch on light

B: wait 30 min

if light level is below 100 lx GOTO B

else switch off light



C: if time > 16:00

check light level

D: if light level is above 100lx

wait 30 min GOTO D

else switch on light

if time > 23:00

switch off light

GOTO A



I hope this could be implemented in MacroDroid and will work without the necessity to have the J5 always in ON-State.
The pistol icon on green is a constraint called "Trigger Fired/Not Fired." Apply it to actions to make them contingent on which macro triggers were or weren't used. It won't affect actions before or after the constrained ones, basically.

"Wait For Trigger" is an action. As you probably know, a macro that reaches that action stops and waits for something to happen. Therefore ALL subsequent actions are delayed.

So there's a lot of overlap between the two features, sure. However, the Wait For Trigger action didn't replace the Trigger Fired constraints. You should find you have both of those as options.

Actually, it might be hard to be sure which is more efficient in any given case.
 
Top