🎥 Flows 4: Webhooks in Flows

Webhooks give you a way to call external devices and service from a Flow in AVA OS.


Transcript

Opening

Webhooks let you send commands from AVA OS to a device or service using HTTP, the protocol that makes the worldwide web work.

Introduction

This is a bit of an advanced skill.

A webhook is just a URL that a device or service makes available for receiving commands.

You can call such a webhook from a Flow in AVA OS…by adding a Step…for a Webhook.

Shelly Example

The Shelly Plus Plug provides a practical example.

It’s a nice little power control device.

It connects to the network using Wi-Fi to gives you on and off control for an AC outlet.

And it exposes a webhook interface…not all devices do that.

The webhook option means that—even if there weren’t a Shelly driver in AVA OS—you could still automate the Shelly Plus Plug.

Here’s how.

Say you have a powered subwoofer that you want to turn ON only when needed.

In Settings, tap a Flow that needs to turn on power to the subwoofer, and tap Edit Launch.

Add a Step.

Select Call Webhook.

The Shelly webhook uses an HTTP GET, but you can see that AVA OS also supports HTTP POST.

Now the part that requires some precision:

Enter the exact URL required by the Shelly device.

Here’s what it looks like for the Shelley Plus Plug:

HTTP is the protocol.

Here, we use the IP address of the Plus Plug on this network.

Then the resource path to the endpoint.

http://192.168.100.172/relay/0?turn=on

That full URL is exactly according to Shelly’s documentation.

Since this command turns on a component in the system,

I’m going to move it up above the Smart Delay step here.

So what’s the number one cause for a webhook not working?

Typos.

If the step doesn’t work from AVA OS, back up and verify that you have a valid URL.

You can test a webhook using the command line utility “curl.”

Verify that the webhook works from curl, then use that exact URL in your Flow.

And if you can’t make it work with curl, there’s no way the webhook can work from AVA OS.

For the subwoofer example, we would want the Shelly Plus Plug to turn off whenever you turn off the Flow.

So tap the Flow and then tap Edit Power Off.

Add a Step for a webhook to turn off the outlet for that subwoofer…

And now you have used webhooks to manage power to the subwoofer.

All right, here’s another cool example…

…with a couple little tweaks to it.

Home Assistant and Loxone also expose Webhooks.

And this lets you send commands from AVA OS to these other platforms.

Loxone lets you set up Webhooks to command just about everything in a Loxone system.

So a lighting scene called “Core Chill Scene” might have a URL like this.

<http://admin:passwd@192.168.100.77/dev/sps/io/CoreChillScene/on>

And, check this out…Loxone webhooks require a username and password.

And that’s exactly what you put into the Webhook call to activate the Loxone scene.

Remember to test it with curl before you try it from AVA OS.

But this is going to unlock any other webhook that requires authentication.

Summary

So, that’s Webhooks, giving you a whole new frontier for integrating with AVA OS.

30355428524829