0
0

Power Apps から Azure IoT Central 経由 で M5Stack デバイスにメッセージを送信する

Last updated at Posted at 2023-11-09

この記事は、前回のこちらの記事
M5Stack UiFlow x Azure IoT Central で簡単に双方向連携デバイスを作る方法
の続きです。

Azure IoT Central は Microsoft のサービスですから、Power Platform との親和性も高いです。
実際、Power Automate を見てみると、非常に多くのアクションが用意されています。
image.png
※これでも一部

活用すると、こんなことができるようになります!

というわけで、Azure IoT Central で定義したコマンドを Power Apps、Power Automate から実行させ、M5Stack デバイス上に表示させる仕組みを作っていきたいと思います。

1. Power Automate

Power Apps にも、Azure IoT Central があるので、そこからでも飛ばせそうですが、IDを引っ張ったりするのがちょっと大変なので、Power Automate 経由にしたいと思います。

1.1. Power Apps トリガー

  1. Power Apps V2 トリガーを選択する。
    image.png

  2. 入力内容にテキストを追加する。
    image.png

1.2. Azure IoT Central アクション

  1. Azure IoT Central V3 の デバイスでコマンドを実行するを選択する

image.png

  1. アプリケーションとデバイスID、デバイステンプレートを入力する
    image.png

  2. デバイスコマンドを選択する
    image.png

  3. 作成したコマンドの入力値が表示されるので、Power Apps トリガーのテキストを指定する。
    image.png

  4. フローを保存する。

2. Power Apps

作成したフローを Power Apps と連携させます。

  1. テキスト入力とボタンを設置する
    image.png

  2. 作成したフローを取り込む
    image.png

  3. ボタンの OnSelect にて、テキストボックスのテキストを代入する形で関数を記載する
    image.png

3. 完成形

実際に操作したのがこちらです

4. まとめ

一度連携部分を作ってしまえば、Power Apps,Power Automate との連動は非常に簡単でしたね!
これも一つの Fusion Team 開発と言ってよいかと思います😃
ぜひ、いろんなデバイスと組み合わせて、最高なアプリを作ってみてください😃

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0