行业资讯
📅 2026/8/11 21:58:55
device-bacnet-c v4.0.2 配置说明文档
device-bacnet-c 配置说明文档一、配置文件类型与格式文件类型格式目录说明主配置configuration.yamlYAMLres/服务主配置唯一格式设备 ProfileJSON或YAMLProfilesDir两种格式均支持SDK 优先扫描.yaml再扫描.json设备实例JSONDevicesDir仅支持 JSONProvision WatcherJSONProvisionWatchersDir仅支持 JSON二、主配置文件configuration.yaml完整配置模板Writable:LogLevel:INFOInsecureSecrets:{}Telemetry:Interval:30sPublishTopicPrefix:edgex/telemetryMetrics:EventsSent:falseReadingsSent:falseReadCommandsExecuted:falseSecuritySecretsRequested:falseSecuritySecretsStored:falseService:Host:127.0.0.1Port:59980RequestTimeout:5sStartupMsg:BACnet device service startedHealthCheckInterval:10sServerBindAddr:MaxRequestSize:0CORSConfiguration:EnableCORS:falseCORSAllowCredentials:falseCORSAllowedOrigin:https://localhostCORSAllowedMethods:GET, POST, PUT, PATCH, DELETECORSAllowedHeaders:Authorization, Accept, Accept-Language, Content-Language, Content-Type, X-Correlation-IDCORSExposeHeaders:Cache-Control, Content-Language, Content-Length, Content-Type, Expires, Last-Modified, Pragma, X-Correlation-IDCORSMaxAge:3600Device:DataTransform:trueDiscovery:Enabled:trueInterval:0MaxCmdOps:0MaxEventSize:0Labels:[]ProfilesDir:./res/profilesDevicesDir:./res/devicesProvisionWatchersDir:./res/provision_watchersEventQLength:0AllowedFails:0DeviceDownTimeout:0UpdateLastConnected:falseClients:core-metadata:Host:127.0.0.1Port:59881core-command:Host:127.0.0.1Port:59882MessageBus:Disabled:falseType:mqttProtocol:tcpHost:127.0.0.1Port:1883BaseTopicPrefix:edgexAuthMode:noneSecretName:Optional:ClientId:device-bacnetQos:0KeepAlive:60Retained:falseCertFile:KeyFile:SkipCertVerify:falseRegistry:Type:keeperHost:127.0.0.1Port:59890SecretStore:Type:vaultHost:127.0.0.1Port:8200Protocol:httpPath:device-bacnet/RootCaCertPath:ServerName:TokenFile:/tmp/edgex/secrets/device-bacnet/secrets-token.jsonAuthentication:AuthType:X-Vault-TokenSecretsFile:DisableScrubSecretsFile:falseDriver:# BACnet/IPBBMD_ADDRESS:BBMD_PORT:# BACnet/MSTPDefaultDevicePath:/dev/ttyUSB0配置项说明Writable — 运行时可动态修改路径类型默认值Writable/LogLevelstringINFOWritable/InsecureSecretsmap{}Writable/Telemetry/Intervalstring30sWritable/Telemetry/PublishTopicPrefixstringedgex/telemetryWritable/Telemetry/Metrics/EventsSentboolfalseWritable/Telemetry/Metrics/ReadingsSentboolfalseWritable/Telemetry/Metrics/ReadCommandsExecutedboolfalseWritable/Telemetry/Metrics/SecuritySecretsRequestedboolfalseWritable/Telemetry/Metrics/SecuritySecretsStoredboolfalseService — 服务基本配置路径类型默认值Service/Hoststring主机名Service/Portint59999Service/RequestTimeoutstring5sService/StartupMsgstringService/HealthCheckIntervalstringService/ServerBindAddrstringService/MaxRequestSizeint0Service/CORSConfiguration/EnableCORSboolfalseService/CORSConfiguration/CORSAllowCredentialsboolfalseService/CORSConfiguration/CORSAllowedOriginstringhttps://localhostService/CORSConfiguration/CORSAllowedMethodsstringGET, POST, PUT, PATCH, DELETEService/CORSConfiguration/CORSAllowedHeadersstringAuthorization, Accept, Accept-Language, Content-Language, Content-Type, X-Correlation-IDService/CORSConfiguration/CORSExposeHeadersstringCache-Control, Content-Language, Content-Length, Content-Type, Expires, Last-Modified, Pragma, X-Correlation-IDService/CORSConfiguration/CORSMaxAgeint3600Device — 设备管理配置路径类型默认值Device/DataTransformbooltrueDevice/Discovery/EnabledbooltrueDevice/Discovery/Intervalint0Device/MaxCmdOpsint0Device/MaxEventSizeint0Device/Labels[]string[]Device/ProfilesDirstringDevice/DevicesDirstringDevice/ProvisionWatchersDirstringDevice/EventQLengthint0Device/AllowedFailsint0Device/DeviceDownTimeoutint0Device/UpdateLastConnectedboolfalseClients — 依赖服务地址路径类型默认值Clients/core-metadata/Hoststring—Clients/core-metadata/Portint0Clients/core-command/Hoststring—Clients/core-command/Portint0环境变量覆盖CLIENTS_CORE_METADATA_HOST、CLIENTS_CORE_METADATA_PORT、CLIENTS_CORE_COMMAND_HOST、CLIENTS_CORE_COMMAND_PORTMessageBus — 消息总线路径类型默认值MessageBus/DisabledboolfalseMessageBus/TypestringmqttMessageBus/ProtocolstringMessageBus/HoststringlocalhostMessageBus/Portint0MessageBus/BaseTopicPrefixstringedgexMessageBus/AuthModestringnoneMessageBus/SecretNamestringMessageBus/Optional/ClientIdstringMessageBus/Optional/Qosint0MessageBus/Optional/KeepAliveint60MessageBus/Optional/RetainedboolfalseMessageBus/Optional/CertFilestringMessageBus/Optional/KeyFilestringMessageBus/Optional/SkipCertVerifyboolfalseRegistry — 注册中心路径类型默认值Registry/Typestring—Registry/Hoststring—Registry/Portint—SecretStore — 密钥存储路径类型默认值SecretStore/TypestringvaultSecretStore/HoststringlocalhostSecretStore/Portint8200SecretStore/ProtocolstringhttpSecretStore/Pathstringsvcname/SecretStore/RootCaCertPathstringSecretStore/ServerNamestringSecretStore/TokenFilestring/tmp/edgex/secrets/svcname/secrets-token.jsonSecretStore/Authentication/AuthTypestringX-Vault-TokenSecretStore/SecretsFilestringSecretStore/DisableScrubSecretsFileboolfalseDriver — 设备驱动BACnet专用路径适用模式类型默认值Driver/BBMD_ADDRESSBACnet/IPstringDriver/BBMD_PORTBACnet/IPstringDriver/DefaultDevicePathBACnet/MSTPstring/dev/ttyUSB0三、设备 ProfileJSON / YAML支持两种格式存放在Device/ProfilesDir目录。SDK 先扫描.yaml再扫描.json。{name:BAC-5901CE,manufacturer:KMC,model:BAC-5901CE,labels:[B-AAC],description:KMC BAC-5901 BACnet General Purpose Controller,apiVersion:v3,deviceResources:[{name:Temperature,description:Get the current temperature,attributes:{type:analog-input,instance:1,property:present-value,index:4294967295},properties:{valueType:Float32,readWrite:R,units:Degrees Fahrenheit,defaultValue:0,minimum:,maximum:,mask:0,shift:0,scale:1,offset:0,base:0,assertion:,mediaType:},tags:{}}],deviceCommands:[{name:ActiveSetpoints,readWrite:RW,resourceOperations:[{deviceResource:ActiveCoolingSetpoint,defaultValue:,mappings:{}}],tags:{}}]}deviceResource 字段字段类型必填说明namestring是资源名称descriptionstring否资源描述attributesmap是BACnet 特定属性attributes/typestring | int是BACnet 对象类型attributes/instanceint是BACnet 对象实例号attributes/propertystring | int否默认present-valueBACnet 属性attributes/indexint否默认无索引数组属性索引properties/valueTypestring是数据类型properties/readWritestring是R/RW/Wproperties/unitsstring否单位properties/defaultValuestring否默认值properties/minimumstring否最小值properties/maximumstring否最大值properties/maskstring否位掩码默认0表示不启用properties/shiftstring否位移properties/scalestring否缩放因子默认1properties/offsetstring否偏移量默认0properties/basestring否基数默认0properties/assertionstring否断言表达式properties/mediaTypestring否二进制媒体类型tagsmap否资源标签BACnet type 字符串映射analog-input/analog-output/analog-value/binary-input/binary-output/binary-value/device。其他类型用数字。BACnet property 字符串映射present-value/object-name。其他属性用数字。valueType 支持Bool/String/Uint8/Uint16/Uint32/Int8/Int16/Int32/Float32/Float64。不支持 Uint64、Int64、Enum、OctetString、Date、Time。deviceCommands 字段字段类型必填说明namestring是命令名称readWritestring是R/RW/WresourceOperations[]object是操作的资源列表resourceOperations[]/deviceResourcestring是引用的 deviceResource 名称resourceOperations[]/defaultValuestring否默认值resourceOperations[]/mappingsmap否值映射表tagsmap否命令标签四、设备实例JSON存放在Device/DevicesDir目录。仅支持 JSON。支持单个对象或对象数组。{name:KMC-BAC-5901CE,profileName:BAC-5901CE,serviceName:device-bacnet,description:KMC BAC-5901CE Device,adminState:UNLOCKED,operatingState:UP,labels:[KMC BAC 5901CE Device],tags:{},protocols:{BACnet-IP:{DeviceInstance:52,Port:0xBAC0}},autoEvents:[{sourceName:Temperature,interval:30s,onChange:false,onChangeThreshold:0.0}]}字段说明字段类型必填说明namestring是设备名称profileNamestring是关联的 Profile 名称serviceNamestring否所属服务名非必填服务自动填充descriptionstring否设备描述adminStatestring否LOCKED/UNLOCKEDoperatingStatestring否UP/DOWNlabels[]string否设备标签tagsmap否设备标签protocolsmap是协议配置autoEvents[]object否自动事件配置protocols — BACnet/IP字段类型必填默认值BACnet-IP/DeviceInstancestring是—BACnet-IP/Portstring否0xBAC0(47808)protocols — BACnet/MSTP字段类型必填默认值BACnet-MSTP/DeviceInstancestring是—BACnet-MSTP/Pathstring否服务默认路径autoEvents字段类型必填说明sourceNamestring是deviceResource 或 deviceCommand 名称intervalstring是采集间隔如30s、1m、1honChangebool否默认false仅在值变化时上报onChangeThresholdfloat否默认0.0变化阈值浮点类型五、Provision WatcherJSON存放在Device/ProvisionWatchersDir目录。仅支持 JSON。{name:BACnet-Watcher,adminState:UNLOCKED,identifiers:{Protocol:BACnet.*},blockingIdentifiers:{},discoveredDevice:{profileName:SimpleServer,adminState:UNLOCKED,autoEvents:[{sourceName:analog-output-0,interval:10s,onChange:false}]}}字段说明字段类型必填说明namestring是Watcher 名称adminStatestring否Watcher 自身状态identifiersmap是匹配规则key 为属性名value 为正则表达式blockingIdentifiersmap否阻止匹配的标识符列表discoveredDevice/profileNamestring是匹配到的设备使用的 ProfilediscoveredDevice/adminStatestring否设备初始 adminStatediscoveredDevice/autoEvents[]object否自动配置的 AutoEvent六、命令行参数参数说明-cd, --configDir dir配置文件目录-p, --profile name配置文件名-r, --registry启用注册中心-i, --instance name服务实例名后缀-h, --help帮助信息Docker 默认启动参数/device-bacnet-ip/device-bacnet-c\-cpkeeper://127.0.0.1:59890\--registry\--confdir/res七、配置优先级配置合并顺序高优先级覆盖低优先级C SDK 代码默认值config.c→edgex_common_config_defaultsedgex_private_config_defaults本项目main.c中 Driver 默认值BBMD_ADDRESS、BBMD_PORT、DefaultDevicePathconfiguration.yaml文件环境变量覆盖格式key 中/替换为_全大写。如Service/Host→SERVICE_HOSTClients 专用环境变量CLIENTS_CORE_METADATA_HOST等注册中心配置--registry时configuration.yaml仅作为 fallback八、Docker Host 网络模式最小配置Writable:LogLevel:INFOService:Host:127.0.0.1Port:59980Device:ProfilesDir:./res/profilesDevicesDir:./res/devicesClients:core-metadata:Host:127.0.0.1Port:59881core-command:Host:127.0.0.1Port:59882MessageBus:Type:mqttProtocol:tcpHost:127.0.0.1Port:1883Optional:ClientId:device-bacnetDriver:{}