Coffee Watcher solution uses Canvas App to capture images and sends them to Power Automate flow for further processing. I decided to detect objects in Power Automate flow, since I could fine tune the solution to use WiFi camera as the pictures source instead of Power Apps and wanted to process notifications and images in background instead of the front.

Process Picture and Inform Others Power Automate flow

I choose to split the flow architecture into child flows because errors and also it is good to have multiple flows calling each other instead of in mega flow. The main flow has three parameters presented below. I also initialize the IsFull variable as boolean.

Trigger and variable initialization
Trigger and variable initialization

Then I setup the nullcheck for the image. If it is null, it is better to terminate the flow. This actually lacks the response for the Power Apps action before the termination – which is causing the flow run going to error state in Power Apps.

Nullcheck for image parameter in flow
Nullcheck for image parameter in flow

Then I pass the picture to flow, that analyzes the picture and call the AI hub object detection

Call child flow
Call child flow

Then I call the child flow which informs the Teams chat that there is new coffee with customized message

Child flow call for Teams chat notification
Child flow call for Teams chat notification

Finally I send the picture to a child flow that creates or updates adaptive card into a Teams chat or channel for current picture of the coffee pot and respond to the Power Apps with information was the coffee pot full and the adaptive card message id.

Call child flow and respond the parameters to Power Apps
Call child flow and respond the parameters to Power Apps

Analyze picture Power Automate flow

Child flow that uses fun-only permissions for the AI hub connection. It takes the file content as parameter and then passes it to the object detection model in AI hub. Then initialize the variable whether the coffee pot was full or not.

Call object detection in AI hub in Power Automate
Call object detection in AI hub in Power Automate

When getting the response, it has multiple results. Loop them trough in each loop and update the variable if any of the detected objects finds a full coffee pot.

Loop detected objects and mark when coffee pot is full
Loop detected objects and mark when coffee pot is full

Finally reply the outcome to the parent Power Automate flow

Message group chat Power Automate flow

Child flow with run-only permissions for Teams connection reference. It will pass the message from parent flow to predefined group chat containing people who wants to have ad-hoc notification when there is fresh coffee in the pot.

Child flow content for notifying group chat in Teams
Child flow content for notifying group chat in Teams

Then you need anymore setup the SharePoint folder and create child flow for posting the adaptive card.

Other posts in this solution

Please stay tuned once I will write the rest of the blog posts

  1. Solution presentation “Is there and coffee left”
  2. Teaching custom AI model for object detection
  3. Power Apps Canvas to capture picture every minute
  4. Solution architecture and trigger errors
  5. Flows to use Object Detection and informing of fresh Coffee
  6. Adaptive card updating every minute with thumbnail picture