# Sensor Integration ## Initialize Sensor Integration - [POST /sensors/integrations](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/post_sensors_integration.md): Initialize an integration. If integrations_enable is true, an account is created in the 3rd Reality Cloud and App Cloud is returned a userThingName which is necessary for HUB bluetooth initialization. This API can be called with intergrations_enabled: false, and then no userThingName will be returned. Setting integrations_enabled to false will not remove or make any changes to an existing integration. ## Obtain Sensor Integration - [GET /sensors/integrations](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/get_sensors_integration.md): Get Integration configuration. ## Update Sensor Integration - [PATCH /sensors/integrations](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/patch_sensors_integration.md): Mutate fields of an initialized integration. ## Delete Sensor Integration - [DELETE /sensors/integrations](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/delete_sensors_integration.md): Deletes an integration, cascades the deletion to any added devices from the devices table, and purges the sensor detection history for the given network. Propagates an IntegrationDeletedEvent containing the userThingName. Deletes the account and hardware association in ThirdReality. ## Initialize Hub Pairing Mode - [POST /sensors/pair/{HUB_THING_NAME}](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/post_sensors_pair.md): Initializes the HUB into Sensor Pairing Mode by the thingName of the hub. The HUB's LED colour will change to a flashing green during Pairing Mode, and will return to a steady blue when no longer in Pairing Mode. A longer timeout can be short circuited to a shorter one by making a subsequent call with a shorter timeout. ## Obtain Configuration for All Devices - [GET /sensors/devices](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/get_sensors_devices.md): Once sensors are paired, this API retrieves the list of all devices (hubs and sensors) associated to the WiFi Motion™ network. Calling this API synchronizes and updates sensor and hub states from the ThirdReality cloud. ## Obtain Configuration for a Device by ThingName - [GET /sensors/devices/{THING_NAME}](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/get_sensors_devices_id.md): Once sensors are paired to a HUB, this API synchronizes state from the ThirdReality cloud for a single device. Any new devices will ## Update Sensor or Hub Configuration - [PATCH /sensors/devices/{THING_NAME}](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/patch_sensors_devices.md): Updates the configuration of a sensor or hub. IMPORTANT: The app must set notify: true. The cloud cannot do this on the occurrence of the DeviceAddedEvent because of a ThirdReality and App Cloud race condition. (3R propogates the device added faster than the device record in their cloud). Propagates an IntegrationsConfigChangedEvent containing the payload of the configuration change. ## Delete Sensor or Hub - [DELETE /sensors/devices/{THING_NAME}](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/delete_sensors_devices.md): Removes a sensor or hub. Deleting a Hub also includes the removal and deletion of associated child sensors. This deletion propagates to the Third Reality Cloud and will dispatch DeviceRemoved events for each sensor which will remove the sensors from App Cloud's Devices list. Sensors that are deleted need to be re-paired by being placed into pairing mode using the physical reset button. Removed Hubs will need to also be physically reset and provided userThingName and WiFi ssid / password via Bluetooth. ## Obtain Detections for All Sensors - [GET /sensors/history](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/get_sensors_history.md): Generic API to query sensor detections for the network without any filters or selected time ranges. ## Obtain detections for a single Sensor - [GET /sensors/history/{THING_NAME}](https://docs.cognitivesystems.com/assets/specs/api/app_cloud/sensor-integration/get_sensors_history_id.md): Generic API to query sensor detections by thingName without any filters or selected time ranges.