since it represents the current connection state, it is triggered multiple times per day
i guess single glovar for every state is the safest and simplest way
Global variable trigger - not triggering
Moderator: Martin
Re: Global variable trigger - not triggering
Oh, you use the glovar trigger and still check the value. If that is the case, then current 10 glovar is the way to go. Maybe you can append some tag to the name, so you don't have to see/scroll glovar all the time. Such as global_z_homewifi, global_z_officewifi, etc. This way, all your glovar trigger will be at the end of the list.
Other way to really save the space is you must combine all the flows which use glovar trigger into single giant flow, separated by multiple parallel expression. This way, the glovar only trigger once, and then branch accordingly. You still need 2 glovar, 1 the triggerer, the other is the glovar map.
Other way to really save the space is you must combine all the flows which use glovar trigger into single giant flow, separated by multiple parallel expression. This way, the glovar only trigger once, and then branch accordingly. You still need 2 glovar, 1 the triggerer, the other is the glovar map.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Global variable trigger - not triggering
Hi coconutxyz
use global variable in json format. You can use map, boolean, list or any . For example as below
Trigger = global_trigger
Action = get the value of the variable global_trigger (list,map or any)
Condition = enter the last value which was modified.
I think this is the most perfect solution for you.
If not please post.
if you don't understand, I can make a simple flow and share here.
From record4
use global variable in json format. You can use map, boolean, list or any . For example as below
Trigger = global_trigger
Action = get the value of the variable global_trigger (list,map or any)
Condition = enter the last value which was modified.
I think this is the most perfect solution for you.
If not please post.
if you don't understand, I can make a simple flow and share here.
From record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1
Samsung Galaxy j2 non rooted.
Android 5.1.1
-
- Posts: 38
- Joined: 16 Sep 2019 12:51
Re: Global variable trigger - not triggering
Thanks rafi4,
i dont understand this part-->
Action = get the value of the variable global_trigger (list,map or any)
Condition = enter the last value which was modified.
i dont understand this part-->
Action = get the value of the variable global_trigger (list,map or any)
Condition = enter the last value which was modified.
Re: Global variable trigger - not triggering
Hi coconutxyz
Are you know about json? If yes you can add any type of values list,map or boolean . The variable converts into string. So every time when you add any values into the variable the trigger global_trigger will be executes the flow.
Trigger = global_trigger
Action = get the desired value
Condition = use the value in expression.
I hope I have explained in a better way.
If you still have doubts ? post.
From record4
Are you know about json? If yes you can add any type of values list,map or boolean . The variable converts into string. So every time when you add any values into the variable the trigger global_trigger will be executes the flow.
Trigger = global_trigger
Action = get the desired value
Condition = use the value in expression.
I hope I have explained in a better way.
If you still have doubts ? post.
From record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1
Samsung Galaxy j2 non rooted.
Android 5.1.1
-
- Posts: 38
- Joined: 16 Sep 2019 12:51
Re: Global variable trigger - not triggering
Hi Rafi,
unfortunately i don't know about json but can the trigger global variable act upon changes in json file but not map/list?
unfortunately i don't know about json but can the trigger global variable act upon changes in json file but not map/list?
Re: Global variable trigger - not triggering
Hi coconutxyz
Every value trigger the flow list ,map or any type of values the variable contains.
To use json
Action = script
For example
Js= fromJSON(global_trigger)
Add any thing here
Finally
global_trigger = toJSON(js);
Example script for understanding
create_list=fromJSON(getMapValue(global_json,"Count"));
set_values=newMapFromValues("Count time",triggertime,"Count text","{value} started at");
addElement(create_list,set_values);
global_json["Count"]=toJSON(create_list);
From record4
Every value trigger the flow list ,map or any type of values the variable contains.
To use json
Action = script
For example
Js= fromJSON(global_trigger)
Add any thing here
Finally
global_trigger = toJSON(js);
Example script for understanding
create_list=fromJSON(getMapValue(global_json,"Count"));
set_values=newMapFromValues("Count time",triggertime,"Count text","{value} started at");
addElement(create_list,set_values);
global_json["Count"]=toJSON(create_list);
From record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1
Samsung Galaxy j2 non rooted.
Android 5.1.1
Re: Global variable trigger - not triggering
@coconutxyz : Rafi4's method is the toJSON() method I mention in my previous post. If you convert the map into JSON before storing to glovar, the glovar now contain (JSON) string instead of map object. Hence it always get triggered, even you only change one of the key from the map.
To do this, you have to convert toJSON() before storing, and always use fromJSON() when retrieving value from the glovar. (as shown above by Rafi4). Only one glovar is needed. However, this still pose the same problem, which is all 10 flows will be triggered at the same time. To save the flow count, you have combine all of them into single flow.
To do this, you have to convert toJSON() before storing, and always use fromJSON() when retrieving value from the glovar. (as shown above by Rafi4). Only one glovar is needed. However, this still pose the same problem, which is all 10 flows will be triggered at the same time. To save the flow count, you have combine all of them into single flow.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 38
- Joined: 16 Sep 2019 12:51
Re: Global variable trigger - not triggering
I have a rough idea but Rafi's script got me good lol, need some time to digest it