NubeIO / driver-bacnet

0 stars 2 forks source link

Support 2 APIs for object list discovery #92

Closed shomaglasang closed 1 month ago

shomaglasang commented 5 months ago

Related to https://github.com/NubeIO/rubix-os/issues/646.

add 2x new APIs API to a object list discovery In driver-bacnet first try and get the object-list in on command if fail then get the count and for loop to build and return the object list back over MQTT API to build points list of a known object list So over MQTT we would send you an array [AI-1, AI-2] as an example And you would send back

{
"AI1": {"name":"point"},
"AI2": {"error": "not found"}
}
shomaglasang commented 4 months ago

@NubeDev mate the API to get the object-list. topic:

bacnet/cmd/point_discovery

Example payload:

{"deviceInstance":"5678","mac":"10.104.0.11:47900"}

Response topic:

bacnet/cmd_result/point_discovery

Example payload:

{"deviceInstance" : "5678", "mac" : "10.104.0.11:47900", "value" : {"objects" : ["ai-1","ai-2","ao-1","ao-2","av-1","av-2","av-3","av-4","av-5","av-6","bi-1","bi-2","bi-3","bi-4","bo-1","bo-2","bv-1","bv-2","bv-3","bv-4","bv-5","msi-1","msi-2","msi-3","msi-4","mso-1","mso-2","mso-3","mso-4","msv-1","msv-2","msv-3","msv-4"], "count" : "33"}}

"value" contains 2 fields. "objects", an array of points. "count" the number of points

shomaglasang commented 4 months ago

mate @NubeDev , the API to build the point list of know object list. topic

bacnet/cmd/points_info

Example payload:

{"deviceInstance":"5678","mac":"10.104.0.11:47900", "points" : ["ai-1", "ai-2", "ao-1", "bv-10"]}

Response topic:

bacnet/cmd_result/points_info

Example payload:

{"deviceInstance" : "5678", "mac" : "10.104.0.11:47900", "value" : {"ai-1" : {"name" : "AI_1_SPARE"},"ai-2" : {"name" : "AI_2_SPARE"},"ao-1" : {"name" : "AO_1_SPARE"},"bv-10" : {"error" : "Unknown object"}}}
shomaglasang commented 4 months ago

hey @NubeDev there's a problem with the point_discovery API when the device doesn't support segmentation. The result is empty. request:

mosquitto_pub -p 1883 -t bacnet/cmd/point_discovery -m '{"deviceInstance":"17","mac":"192.168.15.17:47808"}'

response json:

bacnet/cmd_result/point_discovery {"deviceInstance" : "17", "mac" : "192.168.15.17:47808", "value" : {"objects" : [], "count" : "0"}}
./bacrp 1116 8 1116 76
BACnet Abort: Segmentation Not Supported

I will fix this.

The points_info API is fine though. request:

mosquitto_pub -p 1883 -t bacnet/cmd/points_info -m '{"deviceInstance":"17","mac":"192.168.15.17:47808", "points": ["ai-1", "bi-1", "bi-2"]}'

response json:

{"deviceInstance" : "17", "mac" : "192.168.15.17:47808", "value" : {"ai-1" : {"name" : "AI_1_SPARE"},"bi-1" : {"name" : "BI_1_SPARE"},"bi-2" : {"name" : "BI_2_SPARE"}}}
shomaglasang commented 1 month ago

Supported already. Closing this issue.