❌ [Request Removed] Widget click {trigger}

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
Yam
Posts: 54
Joined: 23 Nov 2019 09:07

❌ [Request Removed] Widget click {trigger}

Post by Yam » 11 Jan 2020 03:03

Hi there!

When using a widget click action to start a flow, could there be a method to show which widget click element started the operation?

For example -

Prerequisites:
> Widget has two action clicks.
> Both actions trigger the same flow.

What happens:
- {trigger} = "Widget Click"

Feature request:
- {trigger} = "Widget Click<action integer>"


Being able to distinguish which widget click triggered a flow with "{trigger} = Widget Click 0" would allow the ability to contain one widget to one flow.


Hope someone else would like this feature.

Regards ~
Last edited by Yam on 19 Jan 2020 17:59, edited 2 times in total.
Every life altering decision you have made, has lead to you reading this.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: [Feature Request] Widget click {trigger}

Post by Desmanto » 11 Jan 2020 17:16

Sorry, I would against this feature. Because I have built several flows based on widget action - execute flows. And maybe others too. Adding this might break the flow.

Thinking about it, trigger widget action might be useful and can be added without conflicting all current concept. But somehow, the trigger need to be linked properly to each action in the widget, which I think might got lost if you edit the widget. Example if you add new action block at the widget, then your trigger will now point to different block. You have to synchronize the widget and the trigger and it will be very confusing once you have several pairs. So I still stay on the same ground, leave current implementation as it, leave the widget action on the widget, not to the trigger.

Solution
Now, to your need. You can distinguish the source of the click by looking at the {widget_cell_x} and {widget_cell_y}. If your widget has 3 action horizontally, then y is always 0, but the x will now give 0, 1, 2, depends on which one you click. You can get maximum 8x8 from each (0-7), giving maximum 64 mapping point. If you need to map multiple row and column, you can always do it in a map. i usually just create a nested map with the concat of y and x. Example, for my yeelight 3x3 widget to be shown on the watch.
Image
It has 3 x 3 actions block and all of them point to execute flow, yeelight control. At the flow, I create a map like this.

Code: Select all

db = newMapFromValues(
"CLICK", newMapFromValues(
"00", "RGB : Red 100%",
"01", "RGB : Green 100%",
"02", "RGB : Blue 100%",
"10", "RGB : Yellow 100%",
"11", "Turn Off",
"12", "RGB : White 100%",
"20", "CF : RGBY",
"21", "CF : Police Siren",
"22", "CF : White Red"),

"LONG_CLICK", newMapFromValues(
"00", 1,
"01", 20,
"02", 50,
"10", 80,
"11", 100,
"12", "",
"20", "",
"21", "",
"22", "Hide Widget") );

point = concat(widget_cell_y, widget_cell_x);
value = db[gesture][point];
First I concat the y and x. Then create a map with the {getsure} (CLICK, LONG_CLICK and other swipes). y = 0 and x = 0 means the top left. y = 0 and x = 1 means top center and so on. Then to get the value, pass the gesture and the point to the map, as seen in the last line to get {value}. This way, I can reuse the same flow to map every possible actions from a single widget. All the action always the same, execute flow.

I still have to change the map structure if I add new action block, by adding more key-value to the map.


Anyway, I am still open to the other method. Maybe the trigger can be directly linked to the widget, so any changes in the widget will automatically reflected on the trigger. If it is so, then adding the trigger should be a better solution.
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.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: [Feature Request] Widget click {trigger}

Post by Rafi4 » 11 Jan 2020 23:16

Hi Desmanto
Please upload a example flow and widget to learn. I Am in a bit confusion how to do mapping gestures (widget click) ?

I want to use gestures as you described. I am using widget clicks as expressions for example

widget_cell_x == 0 AND widget_cell_y ==0

Thanks in advance from record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: [Feature Request] Widget click {trigger}

Post by Desmanto » 12 Jan 2020 16:02

It is difficult to share the flow, as my flow are tie one to another. That script above is the main database mapping already. You are actually correct already using the expression above, by checking the x and y. I just take it one step further, by mapping it to map first. And then use another multiple parallel expression to branch the flow.

Code: Select all

value == "RGB : Red 100%"
I do this for all the map point. Which is kinda the same as yours, except you use the x y.

The screenshot example is different than above, since above one still mapped to another flow again.
Wear Widget Mapping.png
Wear Widget Mapping.png (76.72 KiB) Viewed 19194 times
So why bother mapping it first if I still need to create multiple expression? The answer it is more tidy and flexibile. If I want to move the RGB : Red 100% to another block, I simply copy it to another mapping. I don't need to rearrange all the expression connector again. I only need to modify the map. This is less confusing and more flexible. And I also can randomize the whole command just by changing the map, instead of deleting/adding back the connection. (randomize maybe for password).
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.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: [Feature Request] Widget click {trigger}

Post by Rafi4 » 15 Jan 2020 23:57

Hi Desmanto
You are Amazing . You make the widget expressions so simple way.

Thanks a lot for sharing the screen shot and example script.


from record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
Yam
Posts: 54
Joined: 23 Nov 2019 09:07

Re: [Feature Request] Widget click {trigger}

Post by Yam » 19 Jan 2020 11:28

Absolutely speechless from that design.

Edit: Didn't even know about the widget x and y.
It's so crazy that I'm still learning stuff about Automatic <3
Every life altering decision you have made, has lead to you reading this.

Locked