Discover a new CID problem

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Discover a new CID problem

Post by mechrekt » 02 Mar 2014 09:58

The goal is to discover new gsm cells in a known area.
The flow executes every 5 minutes but every cid seems to be "new" from the given list in the variable.
Maybe I'm wrong with the use of variables?

thanks
Attachments
exported_data_20140302_104355.xml
(3.21 KiB) Downloaded 693 times

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

Re: Discover a new CID problem

Post by Martin » 02 Mar 2014 13:14

The first condition Expression checks for cid!=global_CELL_HOME but later you assign the cid to global_NEWCELL so variable global_CELL_HOME will never change which means that the first condition will always return false.
Depending on your desired result, you could change the first condition to cid!=global_NEWCELL.
Do you want to collect all unknown cells in a list and play a sound every time a new cell is detected?

User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Re: Discover a new CID problem

Post by mechrekt » 02 Mar 2014 15:25

Martin wrote: Do you want to collect all unknown cells in a list and play a sound every time a new cell is detected?
Yes
My intention is to check if a cid is different from the list of cids contained in the variable global_cell_home and store it in global_newcell.

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

Re: Discover a new CID problem

Post by Martin » 03 Mar 2014 18:14

You can use the scripting functions containsElement to check if a list contains an element and addElement to add new elements. The passed list has to be a real list, not just a string containing a comma separated text.
A flow to check if a new cid is detected could look like this:

-trigger Periodic Timer
-condition Phone Cell GSM
-->false: -condition Expression: containsElement(global_cells, cid)
-->false: -action Script: global_cells = addElement(global_cells, cid), action Vibrate

The condition Expression: containsElement(global_cells, cid) checks if the list global_cells contains the cell. If not, the cell is added to the list in the script action.
The script global_cells = addElement(global_cells, cid) also creates a new list if the variable global_cells should not exist yet (hence the assignment).

Starting with the next update of Automagic you can also create and edit lists manually in the global variables screen which should greatly simplify working with lists.

User avatar
mechrekt
Posts: 51
Joined: 21 Oct 2013 10:11

Re: Discover a new CID problem

Post by mechrekt » 03 Mar 2014 19:25

Ok thank you, i will try!!

Post Reply