It's very common to use the BOS API to change some values such as setpoints.
You have several options to do so:
Option1: Change the value of a specific setpoint from its unique id
Let's consider we retrieved from a previous query the temperature setpoint of VayanData office with this unique id: "O0SQ3zJ632CG1B5T9nDbf". We will be using the Operate endpoint.
POST {{base-api-url}}/v1/operate/points/:id
We will pass the id in the endpoint and include this body to ask for a change to 28°C:
{ "action": "set", "value": 28 }
This is what it looks like:
If we want to check whether the value was applied, we can use the same query but with a GET this time:
GET {{base-api-url}}/v1/operate/points/:id
Hmm it doesn't seem it worked well... The value is still at 30.0. What happened?
If you have a look at the status field, you will notice "@ 10". It means that in the BOS, something is writing at a higher level than us. We need to override the value by using the "Override" action and by providing a duration (in milliseconds)
{ "action": "override", "value": 28, "duration": 300000 }
Let's see if it worked:
We are writing at a higher level "@ 8".
We could also use the "emergencyOverride" action without providing any duration. (level "@ 2").
So depending on your strategy you will prefer to use a temporary override or an infinite override.
Option2: Change all setpoints matching a query
Let's change all temperature setpoints related to a Fan Coil Unit from VayanData's office. We change the endpoint to /operate/points (with a s) as we will be targeting multiple data points.
POST {{base-api-url}}/v1/operate/points
In the body, we inject a query based on tags from data models. See Linksper data models for more information.
{ "query": "b:pointType='Setpoint' and b:dimension='Temperature' and b:equipmentType='Fan Coil Unit'", "action": "override", "value": 27, "duration": "10000" }
Let's send the query. The returned values are given before the value change.
And if we check now the values using the same query injected as a parameter:
GET {{base-api-url}}/v1/operate/points?query=b:pointType='Setpoint' and b:dimension='Temperature' and b:equipmentType='Fan Coil Unit'&fields=slotPathOrd
All Setpoints were changed
Using queries, there are infinite ways to target datapoints, you can play with the location, the type of equipment, type of data points etc.