Demo Automagic <-> b4a data exchange

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
canadaDry
Posts: 33
Joined: 09 Feb 2018 18:38

Demo Automagic <-> b4a data exchange

Post by canadaDry » 14 Mar 2020 20:29

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
b4a 1 am flow Screenshot from 2020-03-14 16-16-08.jpg (22.59 KiB) Viewed 16900 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
b4a 2 am trigger general broadcast Screenshot from 2020-03-14 16-16-42.jpg (41.44 KiB) Viewed 16904 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
b4a 3 am send Screenshot from 2020-03-14 16-17-01.jpg (38.99 KiB) Viewed 16900 times

canadaDry
Posts: 33
Joined: 09 Feb 2018 18:38

Re: Demo Automagic <-> b4a data exchange

Post by canadaDry » 14 Mar 2020 21:12

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
b4a 4 Screenshot from 2020-03-14 16-06-28.jpg (25.11 KiB) Viewed 16897 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
b4a 5 Screenshot from 2020-03-14 16-06-44.jpg (24.3 KiB) Viewed 16897 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
b4a 6 Screenshot from 2020-03-14 16-18-49.jpg (74.75 KiB) Viewed 16897 times


Hope someone finds this useful!

BoBo
Posts: 129
Joined: 05 May 2014 12:45

Re: Demo Automagic <-> b4a data exchange

Post by BoBo » 20 Aug 2020 08:54

This is AMAZING :thumbup: Thx for sharing it. :)

Post Reply