Phone Cell GSM issue

Post your questions and help other users.

Moderator: Martin

Post Reply
lchiocca
Posts: 69
Joined: 15 Aug 2013 10:11

Phone Cell GSM issue

Post by lchiocca » 16 Jun 2015 05:56

Hi Martin (or others)

I'm trying to automate a couple of things related to the gsm cell id. In my area (regensdorf, switzerland) the cid tend to change over a month (don't ask me what sunrise are doing). So for the automation tasks I've got, I can mostly identify things using two trigger point. Let's make a simple example. Like most people, I go to work and go back home. I've got things that should happen when entering home or work. Usually, I search for the wlan ssid to trigger the tasks, but sometimes I turn wifi off, so the gsm cell id works great in those situations. Now since my gsm provider changes cell ids over time, I don't want to adapt my automation tasks manually, but would rather let them do everything on their own. So I've got another script that would capture the cell ids for the appropriate wifi networks and store them in a map (actually, I would have preferred a set, but I'll take what I've got at hand). The problem with my "cell id recorder" is that it needs to capture "unknown" cell ids. I've tried to use the wildcard "*" to capture all, but automagic - I think - is creating a "group" of all the cid and only triggering if connecting to the "group". Hence it never works.

What is the correct setup of a gsm cell trigger to get triggered upon *each* cell id change?

Thanks
Loris

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Phone Cell GSM issue

Post by Martin » 16 Jun 2015 18:37

Hi,

The trigger Phone Cell GSM was meant to use a list of cell IDs to create an area, so if you add the wildcard * to the list it means that the area covers all cells and hence will never trigger again once entered.
At the moment there's no good solution except by using a condition Phone Cell GSM to periodically determine the cell and to add the ID to a list or map.
I have a feature request on my todo-list to add a trigger that executes a flow whenever the cell changes but I did not yet have the time to work on this feature yet.

Regards,
Martin

lchiocca
Posts: 69
Joined: 15 Aug 2013 10:11

Re: Phone Cell GSM issue

Post by lchiocca » 17 Jun 2015 10:40

Hi Martin,

For the Phone Cell GSM trigger, there is an option section with currently one option. Would an additional option "Trigger on each change" be something that could be done? Default would be "false" to keep the current behavior and upgrade methods. From a code perspective, it should be pretty easy as well. From:

Code: Select all

if (!specifiedCellIds.contains(lastTriggeredCid) && specifiedCellIds.contains(triggeredCid)) {
  trigger();
}
to:

Code: Select all

if ((options.triggerOnEachChange() || !specifiedCellIds.contains(lastTriggeredCid)) && specifiedCellIds.contains(triggeredCid)) {
  trigger();
}
The code might look different, but I guess you know that ;)

Loris

User avatar
Nerey
Posts: 102
Joined: 07 Mar 2014 16:59

Re: Phone Cell GSM issue

Post by Nerey » 18 Jun 2015 08:08

You can use simple hack to do this now
I can explain
Create new flow
Add trigger: Connected to CIDs*
Add action that stores variable cid in global variable (global_cid for example)
And magic: add trigger Disconnected to CIDs {global_cid}

Doing that way you will get a flow, that runs when phone connecting to CID (if you lost any connection) or change cell

I used this here:
http://automagic4android.com/forum/view ... f=3&t=3753
Sorry for bad english, my native is russian.

lchiocca
Posts: 69
Joined: 15 Aug 2013 10:11

Re: Phone Cell GSM issue

Post by lchiocca » 18 Jun 2015 10:38

Thanks Nerey, but it's a workaround that wouldn't work in my case. But thanks anyway. I'll wait for Martin to implement a proper solution :)

Post Reply