This tutorial will deal with the configuration of a webhook for Smarther – v2.0 API. Webhooks allows you to subscribe to events. You can store your data on the endpoint you defined and, once the webhook triggered, getting notified when an event occurs
To register your webhook URL and subscribe to device events for a specific plant, the application must perform a POST HTTPS request to the following URL:
https://api.developer.legrand.com/smarther/v2.0/plants/{plantId}/subscription
With the following information in the header:
Name | Description |
---|---|
Content-Type | Value is : “Application/json” |
Ocp-Apim-Subscription-Key | Subscription key which provides access to this API. Found in the page My Subscriptions |
Authorization | OAuth2 access_token retrieved from your refresh token flow |
With the following parameters in the body:
{
“EndPointUrl”: “<webhookUrl>”
}
Value | Explanation | C2C notification examples |
---|---|---|
Function | Current thermostat function | { “chronothermostats”: [{ “function”: “HEATING”, “mode”: “MANUAL”, “setPoint”: { “value”: “19.1”, “unit”: “C” }, “programs”: [{ “number”: “1” }], “activationTime”: “2019-11-17T02:00:47Z”, “temperatureFormat”: “C”, “loadState”: “INACTIVE”, “time”: “2019-01-24T15:30:20Z”, “thermometer”: { “measures”: [{ “timeStamp”: “2019-01-24T15:30:19Z”, “value”: “24.6”, “unit”: “C” }] }, “hygrometer”: { “measures”: [{ “timeStamp”: “2019-01-24T15:30:19Z”, “value”: “24.6”, “unit”: “%” }] }, “sender”: { “addressType”: “AddressLocation”, “system”: “thermoregulation”, “plant”: { “id”: “b5e48d6f-cbad-2711-e053-27182d0ad74c”, “module”: { “id”: “1ee68d6f-46b7-8f11-e053-27182d0a846a” } } }, “receiver”: { “oid”: [“a122e653-53fb-450e-b000-d47659807585”] } }] }, |
Mode | Current thermostat working mode | |
Setpoint temperature | Current thermostat setpoint temperature, if working mode is not boost | |
Program number | Current thermostat active program number, if working mode is automatic | |
Activation time | Date and time to which current working mode will be maintained | |
Load state | Current thermostat load state | |
Measured temperature / humidity | Operation used to retrieve the measured temperature and humidity detected by a chronothermostat |