Homey Community Forum

Homey Developer: how handling Webhooks

Dear All,

As the Netatmo App isn’t suporting the module “Smart Door and Window Sensors” (product type: NACamDoorTag, product ID: DTG-01) which are connected to the Netatmo indoor camera “Welcome” through an internal radio signal, I would like to receive the state of each tag (windows and doors: I’ve installed 24 tag in 2 Welcome camera (2x 12)) via the Netatmo webhook process.

I’ve created a developer account on Netatmo (https://dev.netatmo.com/) in order to create a Netatmo app in which I set the webhook url (https://webhooks.athom.com/webhook/<webhook_id>) of the Homey Webhooks in the developer section (Homey Developer).

I would like to know how I can parse in the code of the webhook the data I’ll receive from Netatmo and copy some data into some variables that I can re-use in flow or script, or better, directly update some virtual devices (I can create a virtual device (sensor) for each door and window tag in order to have its state and battery state).

By default, webhook code is

function( homey_data, webhook_data ){
/*
webhook_data: {
query: { … },
body: { … },
headers: { … }
}

homey_data: {
// the data object as provided in new Homey.CloudWebhook(id, secret, data);
homey_data.data = webhook_data.body;
}

return true; // Send to any Homey
*/
}

Thanks in advance for any tips.

Kind regards

Hello, I’m looking to do the same thing as @Alexandre_Lechenne .

The Netatmo Presence does not allow as standard control over activation/inactivation of monitoring.

My use cases through webhooks:

  1. Turn on monitoring/detection when I leave home
  2. Turn off monitoring/detection when return back home
  3. Turn on monitoring/detection after I go to bed

etc.

I’m a newbie with webhooks and am struggling on how to set this all up.

I’ve created a webhook in Homey Dev space
I’ve created an app in Netatmo dev space and inserted the webhook URL

Don’t really understand where to go from there…

Anyone? :slight_smile:

Hello @Timos,

As I solved this question in another manner, I’ll reply to you. I use webhookrelay to trap the webhook from Netatmo devices for example. Depending of number of webhooks you’ve to treat par day / month, may be you can use for free or to pay a fee.

It works fine for me and I forget to deal with the Homey webhook as I never find a post to explain how to deal with it.

Hope it will help you. Kind regards

The documentation for Homey webhooks is here Webhooks - Homey Apps SDK

You will need to create a Homey app to handle the webhook. As far as I know, the Homey webhook can only handle JSON data so if your webhook is not firing then it could be the data being received is in the wrong format.

Webhooks are not the easiest of things to get working.