Page 1 of 1
Demo Automagic <-> b4a data exchange
Posted: 14 Mar 2020 20:29
by canadaDry
Further to this posting:
viewtopic.php?f=6&t=8616 I played around a bit with the b4a tool and am able to send and receive data to Automagic flows via broadcast intents + extras.
Here is the Automagic flow I setup to receive a broadcast, then send a response:

- b4a 1 am flow Screenshot from 2020-03-14 16-16-08.jpg (22.59 KiB) Viewed 17621 times
The flow trigger type is: "General Broadcast", and it receives the extras data into the AM variable "param1":

- b4a 2 am trigger general broadcast Screenshot from 2020-03-14 16-16-42.jpg (41.44 KiB) Viewed 17625 times
After it receives a broadcast it pops up a message dialog with the extra info received.
Finally, it sends a broadcast intent with data:

- b4a 3 am send Screenshot from 2020-03-14 16-17-01.jpg (38.99 KiB) Viewed 17621 times
Re: Demo Automagic <-> b4a data exchange
Posted: 14 Mar 2020 21:12
by canadaDry
Part II...
Using the b4a "designer" + IDE I created an app that has buttons to call Automagic Flows (i.e. to run the turn on/off light flows), a slider who's value is sent when the "Send" button is pressed.
When you press "Send" it sends a broadcast intent to Automagic with the value of the slider. The Automagic flow is triggered and a message dialog is displayed with the value of the extras:

- b4a 4 Screenshot from 2020-03-14 16-06-28.jpg (25.11 KiB) Viewed 17618 times
When you dismiss that dialog, the flow then sends a broadcast intent which gets picked up by b4a and is displayed in a msgbox:

- b4a 5 Screenshot from 2020-03-14 16-06-44.jpg (24.3 KiB) Viewed 17618 times
The code for the b4a app can be viewed/downloaded here:
https://pastebin.com/ZFadNCUw

- b4a 6 Screenshot from 2020-03-14 16-18-49.jpg (74.75 KiB) Viewed 17618 times
Hope someone finds this useful!
Re: Demo Automagic <-> b4a data exchange
Posted: 20 Aug 2020 08:54
by BoBo
This is AMAZING :thumbup: Thx for sharing it.
