Home + Security API Documentation
Product | Data available | Possible action |
---|---|---|
Events (motion detected, alarm detected, known and unknown faces) | Get real time notification of events | |
Events ( known and unknown faces, animal, human) | Get real time notification of events | |
Events | Get real time notification of events | |
Events Product details | Get real time notification of doorbell announcement Retrieve events | |
Events Product details | Get real time notification of doorbell announcements Open the entrance lock** Turn on the staircase light** |
* see scope section for more details
** the status of these two products are not retrievable, only actions can be made
Configuration
Get configuration
Here is the list of configurations that can be retrieved from Security devices.
Configuration | Description | Product Type | Endpoint |
---|---|---|---|
Software version | Software version of a device | All | /homestatus |
VPN URL | Getting the VPN url of a camera | NACamera, NOC, NDB, NPC | |
Persons of a home | Getting all the persons that belong to a home | - (home level) | |
Local mode | Knowing if the camera is reachable locally | NACamera, NOC, NDB | |
Monitoring status | Knowing if a device is currently monitoring | NACamera, NIS, NOC | |
Floodlight status | Getting the floodlight status | NOC | |
Floodlight mode | Getting the floodlight mode | NOC | |
Window/DoorTag category | Getting the category of the door tag (window/gate) | NACamDoorTag |
Modify configuration
Here is the list of the Security device configurations that can be modified.
Configuration | Description | Product Type | Endpoint |
---|---|---|---|
Configuring the floodlight mode | The floodlights can be in on/off/auto mode | NOC |
Diagnostic
There are some parameters that can help to diagnose or anticipate the disfunction of a security device.
Diagnose
Diagnostic | Description | Product Type | Endpoint |
---|---|---|---|
Last setup date | Diagnose the last setup date | All | /homesdata |
Last seen date | Diagnose the last time the device was connected | NIS, NACamDoorTag NCO, NSD, BNCX, BFII | |
Last activity date | Diagnose the last time the sensor was awake | NACamDoorTag | |
Wifi status | Diagnose the wifi strength | NACamera, NOC, NPC NCO, NSD, NDB, BNCX, BFII | |
Radio status | Diagnose the radio strength | NIS, NACamDoorTag | |
Device reachability | Diagnose if a module is reachable | NIS, NACamDoorTag, | |
SD Card Status | Diagnose the SD card status | NACamera, NOC, NDB, NPC | |
Alimentation status | Diagnose the alimentation status | NACamera, NOC, NDB, NPC | |
Battery level | Diagnose the battery level | NIS,NACamDoorTag |
Available data
Security devices state can be retrieved in 2 ways: polling the data or being notified by events.
Data
Informative data
Data | Description | Product Type | Endpoint |
---|---|---|---|
Floodlight status | Getting the current floodlight status (on/off) | NOC | /homestatus |
Siren status | Getting the current siren status (sound/no sound) | NIS | |
Door/Window status | Getting the current door/window status (open/close) | NACamDoorTag | |
30 last events of a home | Getting the 30 last events a home | All | |
30 last events related to a specific gateway | Getting the 30 events of a gateway or one of its modules | NACamera, NOC, NPC NCO, NSD | |
Last events of all persons of a home | Getting the last event of all the persons that belong to a home | NACamera | |
Last detection of a person | Getting the last detection of a specific person | NACamera | |
Getting the events that preceded a specific event | Getting the events that happened before a specific event | All | |
Offload status | Getting the offload status of a device | BNCX, BFII |
Video data
This part concerns the Smart Indoor Cameras (NACamera), the Smart Outdoor Cameras (NOC) and the Doorbell (NDB).
2 types of video are available: live streams and video of past events.
Videos of events are available for those 3 devices whereas video streams are only available for Smart Indoor Cameras and Smart Outdoor Cameras.
Requirements
By default, 3rd party applications do not have access to the video live streaming. Only the app developer has access to the live video streaming.
This access, offered by a specific token is controlled and subject to a few conditions:
Tokens are stored on the device, not in the 3rd party cloud, to mitigate the impact of a leak
Business opportunity is evaluated
The 3rd party architecture is evaluated & validated by Netatmo
A amendment to the contract must be signed by the 3rd party with its architecture attached. In case of leaks, it is hold responsible. Netatmo reserves the right to revoke the access unilaterally.
Once these conditions fulfilled, the application is whitelisted and the app can request access_* scopes that give access to the cameras VPN urls. To request the scope, please reach complete the request scope form.
Product | Video encoding | Scope |
---|---|---|
NOC | HLS | access_presence |
NACamera | HLS | access_welcome |
When requesting the video access, the developer requests an "access_*" scopes. It is then delivered 2 pairs of tokens:
Access Token / Refresh Token
Restricted Access Token / Restricted Refresh Token
The restricted tokens are the tokens without the access_* scopes.
{
"scope": [
"read_camera",
"write_camera",
"access_camera",
"read_presence",
"write_presence",
"access_presence"
],
"access_token": "61929906e0f96809c04ecb4a|4cf61db77df1c319b9796f3cca817c87",
"expires_in": 10800,
"expire_in": 10800,
"refresh_token": "61929906e0f96809c04ecb4a|c820e6d1501c32ea55be6cb80a04929d",
"restricted_access_token": "61929906e0f96809c04ecb4a|64c99fe55fb051b5f3d8c7b8763c50b3",
"restricted_refresh_token": "61929906e0f96809c04ecb4a|62ea5ad5ee38dcb8e6a5be30ec894570"
}
When doing a /homestatus call with the restricted_access_token, no vpn_url address is available whereas when doing the same call with the access_token, the vpn_url s are returned.
Accessing to the video stream/video of an event
Video streams and events can be accessed locally or remotely via the VPN. Hence, the first step is to know if the camera is reachable locally.
Local access test
Step 1: Use the Homestatus method
If "is_local" parameter is set to "true" this means the camera and your application use the same public IP address. However, being on the same IP address might not mean they are on the same local network.
Step 2: Test that the app and the camera are on the same local network
Use command /command/ping in the camera vpn_url.
https://prodvpn-eu-2.netatmo.net/10.255.0.1/d257xxxxxxxxxxxx/MTU4Nr-aMZILLg,,/command/ping
You will receive a JSON with the camera address in parameter local_url
local_url: "http://192.168.128.232/52ced8bccxxxxxx"
product_name: "Smart Indoor Camera"
Step 3: Run the command /command/ping again against the local_url retrieved
http://192.168.128.232/52ced8bcc8149xxxxxxxxxx/command/ping
If local_url retrieved in the new JSON matches with current one, the camera and your application are on the same network.
Access to the video of an event
Step 1: Retrieve the camera URL
Use Homestatus method for the user. In the array "modules", retrieve the vpn_url for the camera you're interested in
Step 2: Retrieve the video_id
Use Getevents to retrieve the video_id of the events array.
Step 3: Call the m3u8 index with the camera_url and the video id
If your app and the camera are on the same local network, add /camera_url/vod/(your_video_id)/index_local.m3u8 to access the video. If not, add /camera_url/vod/(your_video_id)/index.m3u8 to access the video
Access to the live stream
Step 1: Retrieve the camera url
Retrieve the vpn_url of the camera you're interested in using Homestatus request.
Note: The vpn_url expire after 3 hours and if the camera reboots
Step 2: Add /live/index.m3u8 or /live/indexlocal.m3u8 to the vpn_url
If your app is on the local network as the camera, add /live/index_local.m3u8 to access the live stream.
If not, add /live/index.m3u8 to access the live stream.
https://prodvpn-eu-2.netatmo.net/10.255.0.1/d257xxxxxxxxxxxxx/MTU4NDDr-aMZIkmaaLLg,,/live/index.m3u8
To retrieve a live snapshot, add /live/snapshot_720.jpg to the camera url
https://prodvpn-eu-2.netatmo.net/10.255.0.1/d257xxxxxxxxxxxxx/MTU4NDDr-aMZIkmaaLLg,,/live/snapshot_720.jpg
Events
There is a webhook system to keep track of events happening in a user's home. It permits you to build apps that are more reactive as you get notified almost instantly when an event occurs.
Registering
To set up a new webhook, there are two possible solutions:
Automatic subscription : Go to your application settings and add the webhook link. Once saved, every user that will give the ‘read_device’ acces scope to your application will be registered for webhooks. The webhook is only registered when the user has accepted your app. It means that if your app already has existing users that gave access to your app, you will need to go through the manual subscription process.
Manual subscription : By using the manual subscription, you can use a different url for each user. To register a webhook, you will need to use the endpoint /addwebhook. You can always drop a webhook using the endpoint /dropwebhook.
Note that it is necessary to authenticate to activate the webhooks for already existing users.
Ban
For security reasons, we want you to use https links for a production application. Only the creator of the application can receive webhooks with a simple http link. The http code returned by your application shall always be ‘200’. If another code is returned more than five times in a row, your webhook will be deactivated during 24 hours. One valid request resets the failing counter of your application.
You must always respond to webhooks quickly. Once you receive a webhook, you only have 10 seconds to respond. To do so, manage your response and your treatment in different threads.
List of events
Event | Description | Product |
---|---|---|
person | When the Indoor Camera detects a face | NACamera, NPC |
person_away | When geofencing indicates that the person has left the home | NACamera, NPC |
movement | When the Indoor Camera detects motion | NACamera, NPC |
new_module | A new Module has been paired with the Indoor Camera | NACamera, NPC |
module_connect | Module is connected with the Indoor Camera | NACamera, NPC |
module_disconnect | Module lost its connection with the Indoor Camera | NACamera, NPC |
module_low_battery | Module's battery is low | NACamera, NPC |
module_end_update | Module's firmware update is over | NACamera, NPC |
connection | When the Camera connects to Netatmo servers | NACamera, NOC, NPC, NDB |
disconnection | When the Camera loses connection with Netatmo servers | NACamera, NOC, NDB, NPC |
on | When Camera Monitoring is resumed | NACamera, NDB, NOC, NPC |
off | When Camera Monitoring is turned off | NACamera, NOC, NPC, NDB |
boot | When the Camera is booting | NACamera, NOC |
sd | When Camera SD Card status changes | NACamera, NOC, NPC |
alim | When Camera power supply status changes | NACamera, NOC, NPC |
outdoor | When the Outdoor Camera detects a human, a vehicle or an animal | NOC |
cluster | When the indoor Camera advance detects a human, or an animal | NPC |
daily_summary | When the Outdoor Camera video summary of the last 24 hours is available | NOC |
tag_big_move | When a Smart Sensor detects a big move | NACamera, NACamDoorTag |
tag_small_move | When a Smart Sensor detects a small move | NACamera, NACamDoorTag |
tag_uninstalled | When a Smart Sensor was uninstalled | NACamera, NACamDoorTag |
tag_open | When a Smart Sensor detects that a door/window was left open | NACamDoorTag |
hush | When the smoke detection is activated or deactivated | NSD |
smoke | When smoke is detected or smoke is cleared | NSD |
tampered | When smoke detector is ready or tampered | NSD |
wifi_status | When wifi status is updated | NSD |
battery_status | When battery status is too low | NSD |
detection_chamber_status | When the detection chamber is dusty or clean | NSD |
sound_test | Sound test result | NSD |
siren_sounding | When the siren starts or stops ringing | NIS, NOC (with siren) |
siren_tampered | When the siren is tampered | NIS |
incoming_call | When a call is incoming | NSD, BNCX, BFII |
accepted_call | When a call as been answered by a user | NSD, BNCX, BFII |
missed_call | When a call has not been answered by anyone | NSD, BNCX, BFII |
co_detected | When carbon monoxide is detected | NCO |
Events format
Here are the different parameters available for Security products webhooks calls:
Parameter | Description |
---|---|
device_id | Identifier of the Camera that triggered the event |
home_id | Id of the Home where the event happened |
home_name | Name of the Home |
event_id | Identifier of the event |
push_type | Type of the events: "person", "movement", "human"… See Event section for more details. Event Type |
sub_type | Event Subtype |
persons | Array containing information related to the different persons involved in the event: id of the person; if this person is known (is_known) by the camera and the key and id to access the picture of the person. See /homesdata for further details. |
message | User description of the event |
info | User app_security |
NB: sent parameters will depends on the product, eg persons field will only be returned for Indoor Cameras.
Events subtypes
Siren sounding Subtypes
Subtype | Description |
---|---|
0 | the module stopped sounding |
1 | the module is sounding |
Detection chamber status
Subtype | Description |
---|---|
0 | Clean |
1 | Dusty |
Battery status
Subtype | Description |
---|---|
0 | Low |
1 | Very low |
Smoke status
Subtype | Description |
---|---|
0 | Cleared |
1 | Detected |
Alimentation Subtypes
Subtype | Description |
---|---|
1 | incorrect power adapter |
2 | correct power adapter |
Tampered
Subtype | Description |
---|---|
0 | Ready |
1 | Tampered |
Wifi Status
Subtype | Description |
---|---|
0 | Error |
1 | Ok |
CO Detected
Subtype | Description |
---|---|
0 | Ok |
1 | Pre-alarm |
2 | Alarm |
Webhooks examples
Smoke alarm hushed
{
"user_id": "5944xxxxxxxxxxxxxxx6e",
"event_type": "hush",
"device_id": "70:ee:xx:xx:xx:xx",
"home_id": "5943xxxxxxxxxxxxxxxxxxx",
"home_name": "My home",
"camera_id": "70:ee:xx:xx:xx:xx",
"event_id": "5bbdaxxxxxxxxxxxxxx",
"sub_type": 0,
"message": "Daf: Activé",
"push_type": "NSD-hush"
}
Indoor camera set to OFF
{
"user_id": "5944xxxxx6e",
"event_type": "off",
"device_id": "70:ee:xx:xx:xx:xx",
"home_id": "5943xxxxxxxxxxx",
"home_name": "My home",
"camera_id": "70:ee:xx:xx:xx:xx",
"event_id": "5bbcaxxxxxxxxx",
"message": "My home: Welcome-salon : surveillance suspendue",
"push_type": "NACamera-off"
}
Indoor camera set to ON
{
"user_id": "5c81004fd6e33f0b008b45f4",
"event_type": "on",
"device_id": "70:ee:50:1f:dd:6a",
"home_id": "5970c8fb764ff4221d8b4e69",
"home_name": "My home",
"camera_id": "70:ee:50:1f:dd:6a",
"event_id": "5d1a01c68b23458b6a61cb62",
"push_type": "NACamera-on"
}
Indoor camera has detected a movement
{
"user_id": "5c810xxxxxxx45f4",
"snapshot_id": "5d19bxxxxxx6380342",
"snapshot_key": "f0134210ff83fxxxxxxxf770090a423d9a5",
"snapshot_url": "https://netatmocameraimage.blob.core.windows.net/production/5d1xxxa5",
"event_type": "movement",
"camera_id": "70:exxxxxdd:a7",
"device_id": "70:exxxxdd:a7",
"home_id": "5c5d79xxxx08cd594",
"home_name": "Boulogne Billan.",
"event_id": "5d19baae369359e896380341",
"message": "Boulogne Billan: Movement detected by Indoor Camera",
"push_type": "NACamera-movement"
}
Indoor camera is connected
{
"userid": "5c81004fd6e33f0b008b45f4",
"eventtype": "connection",
"cameraid": "70:ee:50:14:ef:0d",
"deviceid": "70:ee:50:14:ef:0d",
"homeid": "5c5d7903de151313008cd594",
"homename": "Boulogne Billan.",
"message": "Boulogne Billan.: Indoor camera connected",
"push_type": "NACamera-connection"
}
Indoor camera has detected a specific person
{
"user_id": "5c81004xxxxxxxxxx45f4",
"persons": [
{
"id": "e2bf7xxxxxxxxxxxxea3",
"face_id": "5d66xxxxxx9b9",
"face_key": "89dxxxxx22",
"is_known": true,
"face_url": "https://netatmocameraimage.blob.core.windows.net/production/5xxx"
}
],
"snapshot_id": "5d19bae867368a59e81cca89",
"snapshot_key": "d3b3ae0229f7xb74cf8",
"snapshot_url": "https://netatmocameraimage.blob.core.windows.net/production/5xxxx",
"event_type": "person",
"camera_id": "70:xxxxxx:a7",
"device_id": "70:xxxxxx:a7",
"home_id": "5c5dxxxxxxxd594",
"home_name": "Boulogne Billan.",
"event_id": "5d19bxxxxxxxxcca88",
"message": "Boulogne Billan.: Benoit has been seen by Indoor Camera ",
"push_type": "NACamera-person"
}
Outdoor camera has detected a human
{
"user_id": "5cxxxxxxxxxxxxxxf4",
"snapshot_id": "5d1xxxxxxxxxxxxx4",
"snapshot_key": "712xxxxxxxxxxxxxxxxxx6c5",
"snapshot_url": "https://netatmocameraimage.blob.core.windows.net/production/5xxxxxx625",
"vignette_id": "5d1xxxxxxx33",
"vignette_key": "120ebxxxxxxxxxxxxxxxxxxxxxxec3577",
"vignette_url": "https://netatmocameraimage.blob.core.windows.net/production/5xxx",
"event_type": "human",
"camera_id": "70xxxxxx:98",
"device_id": "70:xxxxxx:98",
"home_id": "57f3xxxxx905",
"home_name": "My home",
"event_id": "5dxxxxxxxx3",
"subevent_id": "1e9xxxxxxb2",
"message": "My home: Personne détectée",
"push_type": "NOC-human"
}
Someone pressed the Netatmo Smart Doorbell
{
"user_id": "59xxxxxxxxxxxxxxxxx",
"event_type": "incoming_call",
"device_id": "70:ee:xx:xx:xx:xx",
"home_id": "59xxxxxxxxxxxxxxxxxxx",
"home_name": "Ma maison",
"camera_id": "70:ee:xx:xx:xx:xx",
"event_id": "618xxxxxxxxxxxxxxxxxx",
"subevent_id": "a363x-xxxx-xxx-xxxx-xxxxxxxxxxx",
"snapshot_url": "https://netatmocameraimage.blob.core.windows.net/production/6181xxxxxxxxxxxx",
"vignette_url": "https://netatmocameraimage.blob.core.windows.net/production/6181xxxxxxxxxxx",
"session_id": "088xxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
"push_type": "NDB-incoming_call"
}
Someone pressed the BTicino Classe300EOS external unit button
{
"user_id": "59e4a384f5459531b28b50e1",
"session_id": "b34102c5-ef0c-4715-954d-227652c526f8",
"data": {
"type": "offer"
},
"device_id": "00:03:50:c0:00:2f",
"home_id": "5f96ffa54641d545d1554af2",
"module_id": "c0002f-aa6f-c73e6db3f186",
"push_type": "BNCX-rtc"
}
An abnormal CO level has been detected (pre-alarm)
{
"user_id": "59e4a384f5459531b28b50e1",
"event_type": "co_detected",
"device_id": "70:ee:50:71:13:ee",
"home_id": "599ab5152d3e049f0f8b53fa",
"home_name": "Martin office",
"camera_id": "70:ee:50:71:13:ee",
"event_id": "618a5407021a4776227e8d17",
"sub_type": 1,
"push_type": "NCO-co_detected"
}
A dangerous level of CO has been detected (alarm)
{
"user_id": "59e4a384f5459531b28b50e1",
"event_type": "co_detected",
"device_id": "70:ee:50:71:13:ee",
"home_id": "599ab5152d3e049f0f8b53fa",
"home_name": "Martin office",
"camera_id": "70:ee:50:71:13:ee",
"event_id": "618a54ca021a4776227e8d18",
"sub_type": 2,
"push_type": "NCO-co_detected"
}
Possible actions
Action | Description | Product Type | Endpoint |
---|---|---|---|
Floodlight status | Modifying the floodlight status (on/off) | NOC | /setstate |
Staircase light status | Modifying the staircase light status (on/off) | BNSL | |
Setting persons away | Persons of a home can be set as "away" | NACamera | |
setting persons home | Persons of a home can be set as "home" | NACamera |