Need help with webhook/web api

Im writing an app for the aqara fp2 sensor. In order to receive device events i need to configure the following in the aqara developer dashboard:

As you can see i need a public endpoint where i can alter the response. I need to return { code: 0 } as the body response.

What i’ve tried:

  • Webhooks can’t return a response (only receive them).
  • Web API is a thing, but how do i get the public http address that points to my homey api endpoint? ofcourse the route is set to public because Aqara doesnt grant a proper bearer token

Might be relevant, there’s an app for the FP2 already:

When you just like to build an app for it anyways, please ignore my reply :wink:

Also, Adrian tried the way you seems to want to go already:

I know about the HomeKit controller app. I’m trying to make something similar as it’s buggy as hell and i’d like a challenge to make one myself.

I know Adrian has tried it before, but gave up. Their cloud API may be a mess, but with a public endpoint it can still be feasible. I just need to know if it’s possible with Homey to have something like a webhook where you can reply with a custom response; in my case a code 0 json response.

No, that’s the roadblock that @Adrian_Rockall ran into as well AFAIK.

But it should be possible to use a Web API endpoint that’s marked as public, and from what I remember those won’t require a token or anything.

The external hostname would be https://CLOUDID.connect.athom.com, and the cloud id can be retrieved using this.homey.cloud.getHomeyId()

1 Like

If that’s the case i’m wondering how the HomeKit Controller app tries to achieve this then. Unless they have a separate rabbit mq server hosted somewhere and route traffic to the respective Homey’s i dont see this working.

I suppose i’ll have to contact Athom about this.

It uses the HomeKit protocol to communicate with the FP2, not the Aqara cloud API.

Homekit is all local.

I didnt realize HomeKit could be used to communicate with Homey as its not an iOS device like an iphone, ipad or a mac. How does that work? Im asking because i added my fp2 using the HomeKit Controller app, but i didnt have to specify an apple id or anything; only a code that’s on the fp2 itself.

HomeKit is a fairly open protocol so if you implement the controller part of it you can communicate with devices that support HomeKit. Those devices basically think they are talking to an iDevice.

Since it’s all 100% local, there is no need to use an Apple ID. In fact, you don’t need any Apple devices for it to work.