Editing Setting up the HTTP API connection with the manager - openremote/or-objectdetection GitHub Wiki
The following example explains step by step how to connect the Objectdetection module's HTTP API to the Open Remote Manager UI.
-
The Objectdetection is running and the API is available on the IP address.
-
Login to the manager UI
-
Select the Assets tab and click Create asset at the top of the Asset list on the left
-
Set the following:
- Asset name: HTTP API Objectdetection
- Parent asset: Smart Building -> Smart Building and select 'OK'
- Asset Type: Agent
-
Click Create asset at bottom of screen
-
Click Edit asset and add a new attribute:
- Name: ObjectdetectionApi
- Type: Http Client
-
Click Add attribute and then expand the new attribute (using button on the right of the attribute) then configure the Attribute configuration by setting/adding configuration items as follows:
- HTTP base URI: https://"THE IP OF THE MACHINE WHERE Objectdetection IS RUNNING":3000
Make sure you click Add item when creating new attribute configuration items.
- Click Save asset at the bottom of the screen
You now have a basic HTTP API protocol ready to be linked to by asset attributes. If everything ios working the attribute will turn green if not it will go red
NOTE: The protocol configuration status will show as UNKNOWN until an attribute is linked and a request is made; or the HTTP Ping attribute configuration items are configured.
-
Select the Smart Building -> Smart Building asset in the asset list
-
Click Edit asset in the top right
-
Add a new attribute:
- Name: NumberOfPeople
- Type: number
- Click Add attribute and then expand the new attribute (using button on the right of the attribute) then add the following configuration items:
- Agent protocol link: HTTP API Objectdetection -> ObjectdetectionApi
- HTTP path: ObjectdetectionApi
- Polling interval (ms): 10000
NOTE: At this point you have enough to pull back the entire response of the Objectdetection API request but this is a JSON payload so we need to extract the number of people value from this using a filter
- Add the following additional configuration item:
- Value filters: { "path": "$.people", "type": "jsonPath", "returnFirst": true }
For adding more attributes like (Speed of objects or direction of moving) you can repeat the steps after step 10. One thing to keep in mind is to change the Value filters to the correct name for the "path"
- Value filters: { "path": "$."NAME OF VALUE"", "type": "jsonPath", "returnFirst": true }