Alternative to WiFi trigger

eshroom

New member
I have a macro that arms and disarms my home security system depending on whether the home wifi network is in range or not.

In the past couple of days, it has been going crazy, everything arming and disarming at will, despite phone staying in the same location (and always connected to wifi). It is Macrodroid and not the alarm going crazy as there are several elements that get armed/disarmed and they are tied together by Macrodroid.

Is there anything more reliable I can use as a trigger? I though WiFi would be rock solid in terms of reliability. I am hesitant to geofence due to the battery implications.

Thanks!
 

dhj49er

Well-known member
I have a macro that arms and disarms my home security system depending on whether the home wifi network is in range or not.

In the past couple of days, it has been going crazy, everything arming and disarming at will, despite phone staying in the same location (and always connected to wifi). It is Macrodroid and not the alarm going crazy as there are several elements that get armed/disarmed and they are tied together by Macrodroid.

Is there anything more reliable I can use as a trigger? I though WiFi would be rock solid in terms of reliability. I am hesitant to geofence due to the battery implications.

Thanks!
I think WiFi connect and disconnect are more reliable triggers.
On leaving home the WiFi disconnect will happen and can be used to enable the home alarm.
I would not use WiFi scanning enabled all the time to detect when the WiFi connects on returning home, as it will use a lot of battery.
Instead I would use switching on the phone as a trigger to turn on WiFi. Do this outside the house where you know the WiFi is in range. Connecting to the home WiFi can be used to turn off the alarm.
In my experience WiFi 5GHz band is limited in range compared to the 2.4GHz. For me, my 5GHz signal reaches about 10m from the front door. The 2.4GHz signal reaches nearly a further 50m. It might be worth trying both and see if 1 band is better for you. Given my 5GHz signal covers inside my home and only meters outside, this is the one I use and would be the one if I had a home alarm like you.
 

dhj49er

Well-known member
Geofence is unlikely to provide the real time control that you need. I use Geofence for entering and leaving home. It usually takes at least a couple of minutes to register entering or leaving the area. I have Geofence polling set to the default 3 minutes.
 

eshroom

New member
I think WiFi connect and disconnect are more reliable triggers.
On leaving home the WiFi disconnect will happen and can be used to enable the home alarm.
I would not use WiFi scanning enabled all the time to detect when the WiFi connects on returning home, as it will use a lot of battery.
Instead I would use switching on the phone as a trigger to turn on WiFi. Do this outside the house where you know the WiFi is in range. Connecting to the home WiFi can be used to turn off the alarm.
In my experience WiFi 5GHz band is limited in range compared to the 2.4GHz. For me, my 5GHz signal reaches about 10m from the front door. The 2.4GHz signal reaches nearly a further 50m. It might be worth trying both and see if 1 band is better for you. Given my 5GHz signal covers inside my home and only meters outside, this is the one I use and would be the one if I had a home alarm like you.
Wifi connect/disconnect is what I use currently, the problem is it is a large property with 2 networks, one of which is a 4 node mesh network. So when switching between the networks and seemingly, even when switching between nodes it seems to trigger the wifi connect/disconnect.

I have tried looking, but is it possible to add a constraint on the disconnect trigger such that it needs to be disconnected for at least 1 minute before the macro runs? That should solve the issue.
 
Last edited:

dhj49er

Well-known member
Wifi connect/disconnect is what I use currently, the problem is it is a large property with 2 networks, one of which is a 4 node mesh network. So when switching between the networks and seemingly, even when switching between nodes it seems to trigger the wifi connect/disconnect.
The behaviour you describe is the way your phone's WiFi connects and disconnects.
Unfortunately I don't understand what you are trying to achieve via macros. Is it the use case I described in my earlier post?
If so, could use a wait after a disconnect to see if WiFi reconnects, before turning on the alarm when there is no further WiFi connection. The wait would probably need to be seconds, depends on the observed node switching times.
 

eshroom

New member
The behaviour you describe is the way your phone's WiFi connects and disconnects.
Unfortunately I don't understand what you are trying to achieve via macros. Is it the use case I described in my earlier post?
If so, could use a wait after a disconnect to see if WiFi reconnects, before turning on the alarm when there is no further WiFi connection. The wait would probably need to be seconds, depends on the observed node switching times.
Macrodroid sends a HTTP request to IFTTT and triggers a state change in SmartThings upon connect and disconnect.

If I could make the macro only trigger if the device is disconnected for more than 1 minute, that would solve the issue. But I can't see how to do that.
 

Endercraft

Moderator (& bug finder :D)
Macrodroid sends a HTTP request to IFTTT and triggers a state change in SmartThings upon connect and disconnect.

If I could make the macro only trigger if the device is disconnected for more than 1 minute, that would solve the issue. But I can't see how to do that.
Use the trigger wifi disconnected, then wait for trigger :
-> Regular Interval (1 minute, no reference time)
-> Wifi connected (any of your networks)
then, cancel macros actions with the constraint wifi not connected (your networks).

I think that should do the trick.
 

eshroom

New member
Thank you!

Trigger: WiFi disconnected
The two actions I added ahead of arming:
- Wait 1 minute
- Cancel Macro Actions - Constraint WiFi Connected to xyz
 

dhj49er

Well-known member
Thank you!

Trigger: WiFi disconnected
The two actions I added ahead of arming:
- Wait 1 minute
- Cancel Macro Actions - Constraint WiFi Connected to xyz
As written the macro will always wait 1 minute before cancelling the macro assuming WiFi connected.
An alternative based on using wait for trigger instead of wait would better.
Replace wait action with the wait until trigger action shown in the attached file. Then the macro is cancelled after 1 min or WiFi connection, whichever occurs first.
 

Attachments

  • Screenshot_20230118-144255.png
    Screenshot_20230118-144255.png
    73.9 KB · Views: 10

Endercraft

Moderator (& bug finder :D)
As written the macro will always wait 1 minute before cancelling the macro assuming WiFi connected.
An alternative based on using wait for trigger instead of wait would better.
Replace wait action with the wait until trigger action shown in the attached file. Then the macro is cancelled after 1 min or WiFi connection, whichever occurs first.
Yes, wait 1 minute works but this method is faster.
 

Jacob L

Moderator (Lawsonator)
Wifi connect/disconnect is what I use currently, the problem is it is a large property with 2 networks, one of which is a 4 node mesh network. So when switching between the networks and seemingly, even when switching between nodes it seems to trigger the wifi connect/disconnect.

I have tried looking, but is it possible to add a constraint on the disconnect trigger such that it needs to be disconnected for at least 1 minute before the macro runs? That should solve the issue.
In the green constraint area, just pit macro invoked/not invoked and set 30 seconds for example
 
Top