Using Flic Buttons with CDS – Managing Fire Evacuations

I was asked to create a tech demo in work recently that could show off some of the capabilities of Power Apps and Power Automate, and I figured this would be a perfect opportunity to use the Flic button I got from Matt Beard of Data8 when I attended the User Group Summit in Amsterdam earlier this year .

The Scenario

Anyone who’s worked in an office will undoubtedly have experienced the fun of a fire drill (usually on a day where it is cold and miserable). I thought it would be a great demonstration of the Power Platform if we could create a system to record when a fire evacuation has occurred in one of our offices so we could notify the other offices, and to send notifications when the evacuation was over.

The Setup

The first thing to do was create a new Evacuations entity in CDS where I wanted to record the following:

  1. Evacuation Start Date/Time
  2. Evacuation End Date/Time
  3. Office being evacuated
  4. Any comments/notes about the evacuation

It would be really simple to manually record the evacuations in here, but where’s the fun in that? I had the Flic buttons at my disposal, and I was going to use them!

Using a Flic Button

For those of you who are not aware, Flic buttons have three trigger events:

  1. Click
  2. Double Click
  3. Hold

Each of these triggers can be mapped to a specific action, but the exciting part for us #PowerAddicts is that you can use them to trigger a Flow.

The Flows

For the purposes of this tech demo, I wanted to have two flows:

  1. Create an Evacuation Record
  2. Close the Evacuation Record

Create an Evacuation Record

I created an Instant Flow that is triggered “When a Flic is Pressed”:

As you can see from the screenshot above, there are two options on this trigger. First you select the Flic Button you’ll be associating with the Flow, then you select one of the available Events; I’m going to be using a “Click” event for this Flow.

When you use a Flic trigger, it returns the Click Time in the following format:

2019-11-12T19:19:43Z

This isn’t particularly presentable, so I’ve added a Compose step to format the Date using the following expression:

formatDateTime(triggerBody()?['clicked_at'], 'dd MMMM yyyy')

This compose step formats the Click Time above as “12 November 2019“, and I’m going to use this when I create the record in CDS

The last step in the Flow is to use the Send an Email (V2) action to send an email to everyone in my organisation to let them know our office has been evacuated

And that’s it, we have a simple Flow configured run on clicking a Flic button to create a record in CDS when an evacuation is happening and to notify all employees in our organisation. The next step is to create a Flow to close the evacuation record when everyone returns to the office

Close the Evacuation Record

For this Flow, I’m using the Same “When a Flic is Pressed” trigger as above, but this time I’m going to use the Double Click event. For this Flow I want to retrieve the Active Evacuation records for this office and set them to Inactive, recording the time that the Evacuation was ended.

If you want to find out an easy way to generate OData queries to use in the List Records step, then I’d recommend reading Sara Lagerquist’s recent blog on this topic

Once the Evacuation records are closed, I use the Send an Email (V2) action again to send an update email to all employees to tell them that the Evacuation of the office is now over.

Conclusions

This is a relatively simple use case for using Flic buttons but it shows the power of combining IoT devices with the Power Platform and it reinforces my belief that “no UI is the best UI”. Through two actions we have a complete record in our database, and it’s required no input from the User other than a Click and a Double Click

In part 2 of this blog, I’ll show how I created a canvas app for reviewing and monitoring Evacuations, and how to use the location data so the button knows which office has been evacuated.

Published by

4 thoughts on “Using Flic Buttons with CDS – Managing Fire Evacuations

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s