azure / iot-plug-and-play-bridge Goto Github PK
View Code? Open in Web Editor NEWIoT Plug and Play bridge
License: Other
IoT Plug and Play bridge
License: Other
@usivagna, @rido-min
Make the Modbus Properties a Map to setup the configuration
and make the Telemetry to use the "Key" as the filed name
{"VoltAN":123.2}
Note: VoltAN is the name of the field and it is dynamically plugged into the telemetry.
IoT Central will need some flag to understand that this field comes from the configuration, maybe something like this:
{"DKey":"VoltAN", "DValue":123.2}
and the tool understands that it needs to flatten the JSON.
Here is the DTDLv2 model that describes the properties
{
"@context": "dtmi:dtdl:context;2",
"@id": "dtmi:MeshSystems:tXs_modbus;2",
"@type": "Interface",
"displayName": {
"en": "Modbus"
},
"contents": [
{
"@type": "Property",
"displayName": {
"en": "BaudRate"
},
"name": "BaudRate",
"schema": "integer",
"writable": true
},
{
"@type": "Property",
"displayName": {
"en": "Operation"
},
"name": "Operation",
"writable": true,
"schema": {
"@type": "Map",
"mapKey": {
"name": "Key",
"schema": "string"
},
"mapValue": {
"name": "Value",
"schema": "dtmi:MeshSystems:tXs_modbusOperation;1"
}
}
}
],
"schemas": [
{
"@id": "dtmi:MeshSystems:tXs_modbusOperation;1",
"@type": "Object",
"fields": [
{
"name": "UnitId",
"schema": "integer"
},
{
"name": "RegisterType",
"schema": {
"@type": "Enum",
"valueSchema": "integer",
"enumValues": [
{
"@type": "EnumValue",
"enumValue": 1,
"name": "READ_COILS"
},
{
"@type": "EnumValue",
"enumValue": 2,
"name": "READ_DISCRETE_INPUTS"
},
{
"@type": "EnumValue",
"enumValue": 3,
"name": "READ_HOLDING_REGISTERS"
},
{
"@type": "EnumValue",
"enumValue": 4,
"name": "READ_INPUT_REGISTERS"
},
{
"@type": "EnumValue",
"enumValue": 5,
"name": "WRITE_SINGLE_COIL"
},
{
"@type": "EnumValue",
"enumValue": 6,
"name": "WRITE_SINGLE_REGISTER"
},
{
"@type": "EnumValue",
"enumValue": 7,
"name": "READ_EXCEPTION_STATUS"
},
{
"@type": "EnumValue",
"enumValue": 15,
"name": "WRITE_MULTIPLE_COILS"
},
{
"@type": "EnumValue",
"enumValue": 16,
"name": "WRITE_MULTIPLE_REGISTERS"
},
{
"@type": "EnumValue",
"enumValue": 17,
"name": "REPORT_SLAVE_ID"
},
{
"@type": "EnumValue",
"enumValue": 22,
"name": "MASK_WRITE_REGISTER"
},
{
"@type": "EnumValue",
"enumValue": 23,
"name": "WRITE_AND_READ_REGISTERS"
}
]
}
},
{
"name": "PollingIntervalMs",
"schema": "integer"
},
{
"name": "StartAddress",
"schema": "integer"
},
{
"name": "DataType",
"schema": {
"@type": "Enum",
"valueSchema": "integer",
"enumValues": [
{
"@type": "EnumValue",
"enumValue": 1,
"name": "MB_int16"
},
{
"@type": "EnumValue",
"enumValue": 2,
"name": "MB_bcd32"
},
{
"@type": "EnumValue",
"enumValue": 3,
"name": "MB_logBase2"
},
{
"@type": "EnumValue",
"enumValue": 4,
"name": "MB_float32"
},
{
"@type": "EnumValue",
"enumValue": 5,
"name": "MB_float32swap"
},
{
"@type": "EnumValue",
"enumValue": 7,
"name": "MB_int32"
},
{
"@type": "EnumValue",
"enumValue": 11,
"name": "MB_uint16"
},
{
"@type": "EnumValue",
"enumValue": 12,
"name": "MB_bcd16"
},
{
"@type": "EnumValue",
"enumValue": 13,
"name": "MB_int64"
},
{
"@type": "EnumValue",
"enumValue": 15,
"name": "MB_uint64"
},
{
"@type": "EnumValue",
"enumValue": 16,
"name": "MB_double64"
}
]
}
}
]
}
]
}
Describe the bug
Need to edit 3rd debug message at startup.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Pnp Bridge is running as am IoT egde device.
should be;
Pnp Bridge is running as an IoT Edge device.
Screenshots
PS C:\Temp\pnp> .\pnp
Info:
-- Press Ctrl+C to stop PnpBridge
Info: Using default configuration location
Info: Starting Azure PnpBridge
Info: Pnp Bridge is running as am IoT egde device.
Describe the bug
The link to setup az iot pnp is a 404
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Get those instructions :(
Additional context
Ps: How do you run az iot pnp
anyway??
There is no az iot pnp
at https://docs.microsoft.com/en-us/cli/azure/iot?view=azure-cli-latest
[Robert Chung] For DPS with IoT Central preview. By default, it will show “buffer is too small” because “PNP_BRIDGE_STRING_MAX_SIZE” is 512, and it is too small for dps connection setting. So I change to 25532 and it works. Since IoT Central Preview is just supported Telemetry function, so I didn’t try Property and Command in it.
While popular in the home automation space, Zigbee remains a popular wireless protocol.
Are there plans to support ZigBee protocols and/or Discovery of Zigbee gateways or endpoint devices?
Thanks,
~Bryan
I'm looking forward to have the PnP bridge available as a Azure IoT Edge module as already planned. But it would really useful to have the BLE bridge available for linux as it is a very popular scenario, don't you think too? Is there a specific reason why it's not yet planned to support it?
With the pnpbridge as is, the takephoto command takes multiple photos. Moreover, in the Azure CLI, timeout errors and retries attempts can be seen. The PnpBridge might not be handling timeouts gracefully.
Following on from the closed issue Getting Arduino Example to work .. Specifying the COM Port #66
I've created a public repository just for the Arduino Serial sample : djaus2/ArduinoSerialPnPExample
I can't get the modeling to work.
The overall aim there is to implement a PnP component that handles the Grove Beginner Kit for Arduino functionality.
Q What needs to change with the config.json and the Schema files to get this all to work properly when exercised from Azure IoT Explorer?:
Describe the bug
In Azure IoT Explorer on the IoT Plug and Play Components tab, Telemetry doesn't show any results. Telemetry does though work from the menu on left. Properties(Writeable) and Commands both on the IoT Plug and Play components tab do work as well. Using the Arduino Serial Sample.
So the question is how to get the modeled schema for Telemetry working in Azure IoT Explorer?
To Reproduce
Steps to reproduce the behavior:
1.Build or download the PnPBridge_bin app (on Windowsx64)
2. build and deploy the Arduino Serial Sample to an Arduino Uno connected to teh dev machine via USB
3. Get the config.json and set the correct Com Port and Hub-Device connection string.
4.Run the app .\PnPBridge_bin .\config.json.'
5. Run the Azure IoT Explorer and connect the Hub-Device
6. Go to the Telemetry lab (left menu) and run it.
7. Go to the IoT Plug and Play components tab
8. Configure the schema file to be local and point to folder where you have it on the dev machine
9. Choose Default Component, then check the Interface, which should match the schema.
10. Choose Telemetry from that tab, and run it
11. Select Show modeled events
Expected behavior
In 6. should see telemetry
In 10. Should see telemetry similar to 6.
In11. Should see the modeled data.
Screenshots
In 6.:
{
"body": {
"temperature": 12.34
},
"enqueuedTime": "Fri Sep 10 2021 13:27:13 GMT+1000 (Australian Eastern Standard Time)",
"properties": {}
}
Output on bridge app:
Info: Starting Azure PnpBridge
Info: Pnp Bridge is running as an IoT Egde device.
Info: Pnp Bridge creation succeeded.
Info: Connection_type is [connection_string]
Info: Tracing is disabled
Info: IoT Edge Device configuration initialized successfully
Info: Building Pnp Bridge Adapter Manager, Adapters & Components
Info: Pnp Adapter with adapter ID serial-pnp-interface has been created.
Info: Pnp Adapter Manager created successfully.
Info: Opening com port COM4
Info: Pnp components created successfully.
Info: Pnp components built in model successfully.
Info: Sent reset request
Info: Receieved reset response
Info: Sent descriptor request
Info: Connected to Azure IoT Hub
Info: Receieved descriptor response, of length 348
Info: Device Version : 1
Info: Device Name : Example Thermometer
Info: Interface ID : http://contoso.com/thermometer_example
Info: Property type : 3
Info: Name : temperature
Info: Display Name : Ambient Temperature
Info: Description : A sample of the ambient temperature.
Info: Unit : celsius
Info: Property type : 2
Info: Name : sample_rate
Info: Display Name : Sample Rate
Info: Description : Sample Rate of temperature measurements
Info: Unit : ms
Info: Property type : 1
Info: Name : calibrate
Info: Display Name : Calibrate Temperature
Info: Description : Calibrates the thermometer
Info: Property type : 1
Info: Name : toggle_state
Info: Display Name : Toggle State
Info: Description : Pauses/Unpauses the Telemetry
Info: Pnp components started successfully.
Info: Processing property update for the device or module twin
Info: Received PnP property update for component=serialpnp, property=sample_rate
Info: Serial Pnp Adapter: Processed property. PropertyUpdated = 3333
Info: Setting property sample_rate to 3333
Info: Serial Pnp Adapter: Sending device information property to IoTHub. propertyName=sample_rate, propertyValue=3333
Info: Serial Pnp Adapter: Got Property Update Notification. propertyName=sample_rate
Info: temperature: 12.340000
Info: PnpBridge_PnpBridgeStateTelemetryCallback called, result=0, telemetry=PnpBridge configuration complete
Info: SerialDataSendEventCallback called, result=0, telemetry=temperature
Info: temperature: 12.340000
Info: SerialDataSendEventCallback called, result=0, telemetry=temperature
Info: temperature: 12.340000
Info: SerialDataSendEventCallback called, result=0, telemetry=temperature
Info: temperature: 12.340000
Info: SerialDataSendEventCallback called, result=0, telemetry=temperature
Info: temperature: 12.340000
Nb: I am actually using a fork of the the bridge at djaus2/iot-plug-and-play-bridge that has enabled the Property Updates and Commands to work with the Arduino device when exercised from IoT Explorer. But this problem exists as well with the unforked bridge with the Arduino device and teh following config and schema files.
Desktop (please complete the following information):
Additional context
Running built app in iot-plug-and-play-bridge\pnpbridge\cmake\pnpbridge_x86\src\pnpbridge\samples\console\Debug
config.json is location there:
{
"$schema": "../../../../../../../../../iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/src/pnpbridge_config_schema.json",
"pnp_bridge_connection_parameters":
{
"connection_type" : "connection_string",
"connection_string" : "HostName=HubPnP3.azure-devices.net;DeviceId=PnPDev3",
"root_interface_model_id": "dtmi:com:contoso:serialpnp;1",
"auth_parameters":
{
"auth_type": "symmetric_key",
"symmetric_key": "q+6OU6byhvpT9zU3Mbr6KhR8Ur47zEa/EFyM8fEHHMU="
}
},
"pnp_bridge_debug_trace": false,
"pnp_bridge_config_source": "local",
"_comment_devices": "Array of devices for Azure Pnp interface should be published",
"pnp_bridge_interface_components":
[
{
"_comment": "Grove Beginner Kit for Arduino Sensors and Actuators Device Component",
"pnp_bridge_component_name": "serialpnp",
"pnp_bridge_adapter_id": "serial-pnp-interface",
"pnp_bridge_adapter_config":
{
"com_port": "COM4",
"_comment": "NOTE: com_port parameter will NOT be used when use_com_device_interface is set to true. In case of windows iot edition, the COMXX symbolic links are not created. Setting use_com_device_interface to false will pick the first available COM interface.",
"use_com_device_interface": "false",
"baud_rate": "115200"
}
}
],
"pnp_bridge_adapter_global_configs":
{
"serial-pnp-interface": {
"DjAus" : {
"company_id": "0x499",
"endianness": "big",
"telemetry": {
"temperature":
{
"name": "temperature",
"telemetry_name": "temperature",
"displayName":"Temperature",
"data_parse_type": "decimal",
"conversion_bias": 0,
"conversion_coefficient": 1.0
}
},
"properties": {
"sample_rate": {
"name": "sample_rate",
"displayName":"Sample Rate",
"dataType": "integer",
"required": true
}
},
"commands": {
"calibrate": {
"commandType": "synchronous",
"request":
{
"dataType": "integer"
},
"response":
{
"dataType": "integer"
},
"toggle_state": {
"commandType": "synchronous",
"request":
{
"dataType": "integer"
},
"response":
{
"dataType": "integer"
}
}
}
}
}
}
}
}
the schema file **arduino-serial-grove.json locally:
{
"@context": "dtmi:dtdl:context;2",
"@id": "dtmi:com:contoso:serialpnp;1",
"@type": "Interface",
"displayName": "Pnp Bridge Root Interface Model serialpnp",
"description": "Arduino Serial PnP",
"contents": [
{
"@type": "Property",
"displayName": "Sample Rate",
"description": "Rate of temperature readings.",
"name": "sample_rate",
"schema": "integer",
"writable": true
},
{
"@type": [
"Telemetry",
"Temperature"
],
"description": "Current temperature on the device",
"displayName": "Temperature",
"name": "temperature",
"schema": "float",
"unit": "degreeCelsius"
} ,
{
"@type": "Command",
"name": "calibrate",
"description": "Calibrates the thermometer.",
"commandType": "synchronous",
"request": {
"name": "input",
"schema": "integer"
},
"response": {
"name": "calibrateResponse",
"schema": "integer"
}
},
{
"@type": "Command",
"name": "toggle_state",
"description": "Calibrates the thermometer.",
"commandType": "synchronous",
"request": {
"name": "input",
"schema": "integer"
},
"response": {
"name": "calibrateResponse",
"schema": "integer"
}
}
]
}
Post cloning repo, submodule update under pnpbridge fails with "Filename too long" , "index-pack failed" and other errors.
Log attached.
gitclonefail.log
Thank you for your work guys, looks promising! This could be good enabler of mass migration for existing device that cannot be rewritten to support Azure Iot. Keep it up
Hello,
for the last few days I was wondering if I can connect a weather station off the shelf with the Azure IoT-Hub.
I don't really want to hard code the connection.
So is it possible to connect a weather station which is not programmable with a Plug and Play Bridge?
Or is there another way to get the data into the IoT-Hub.
The weather station can be connected via Wi-Fi to the internet.
As you can see I dont really konw much in this area, so some help would be really good.
Thank you very much.
Is your feature request related to a problem? Please describe.
I need a callback function in adapter when a device is power up and gets configuration from IoT hub/central. The configuration is all writable properties (desired property in device twin). Then the device automatically starts its sensor after configuring.
Describe the solution you'd like
When I ran the sample Environmental Sensor, there's a message "Info: PnpBridge_PnpBridgeStateTelemetryCallback called, result=0, telemetry=PnpBridge configuration complete" in the log. It looks like to notify the configuration complete. If it can generate a callback function in adapter, that should work.
For example, there is a callback function code line in function "EnvironmentSensor_CreatePnpComponent" in file environmental_sensor_pnpbridge.c:
PnpComponentHandleSetPropertyUpdateCallback(BridgeComponentHandle, EnvironmentSensor_ProcessPropertyUpdate);
Can we have a callback function like that for "Configuration Complete"?
Additional context
Here is the log:
Info: Using configuration from specified file path: model/config_hub_eddytest01.json
Info: Starting Azure PnpBridge
Info: Pnp Bridge is running as am IoT egde device.
Info: Pnp Bridge creation succeeded.
Info: Connection_type is [connection_string]
Info: Tracing is disabled
Info: WARNING: SharedAccessKey is included in connection string. Ignoring symmetric_key in config file.
Info: IoT Edge Device configuration initialized successfully
Info: Building Pnp Bridge Adapter Manager, Adapters & Components
Info: Adapter with identity impinj-r420-pnp-adapter does not have any associated global parameters. Proceeding with adapter creation.
Info: Pnp Adapter with adapter ID impinj-r420-pnp-adapter has been created.
Info: Pnp Adapter Manager created successfully.
Info: Pnp components created successfully.
Info: Pnp components built in model successfully.
Info: Connected to Azure IoT Hub
Info: Starting Pnp Component
Info: Adapter:: Sending device information property to IoTHub. propertyName=DeviceState, propertyValue="INITIAL"
Info: Pnp components started successfully.
Info: Processing property update for the device or module twin
Info: Received PnP property update for component=ImpinjR420Component, property=ReaderName
Info: Get property:: PropertyName= PropertyValue=
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:Reader01a
Info: Received PnP property update for component=ImpinjR420Component, property=Antenna1
Info: Get property value:1
Info: Get property value:1.000000
Info: Get property value:12.000000
Info: IoTHub client call to _SendReportedState succeeded
Info: Received PnP property update for component=ImpinjR420Component, property=Session
Info: Get property:: PropertyName= PropertyValue=<1.000000>
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:1.000000
Info: Received PnP property update for component=ImpinjR420Component, property=SearchMode
Info: Get property:: PropertyName= PropertyValue=<SINGLE_TARGET>
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:SINGLE_TARGET
Info: Received PnP property update for component=ImpinjR420Component, property=RfMode
Info: Get property:: PropertyName= PropertyValue=<3.000000>
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:3.000000
Info: Received PnP property update for component=ImpinjR420Component, property=ReaderIp
Info: Get property:: PropertyName= PropertyValue=<169.254.1.1>
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:169.254.1.1
Info: Received PnP property update for component=ImpinjR420Component, property=SetClientId
Info: Get property:: PropertyName= PropertyValue=<75.000000>
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:75.000000
Info: Received PnP property update for component=ImpinjR420Component, property=UseKeepAlive
Info: Get property:: PropertyName= PropertyValue=
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:1
Info: Received PnP property update for component=ImpinjR420Component, property=KeepAliveInterval
Info: Get property:: PropertyName= PropertyValue=<3000.000000>
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:3000.000000
Info: Received PnP property update for component=ImpinjR420Component, property=UseGpiDoorControl
Info: Get property:: PropertyName= PropertyValue=
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:1
Info: Received PnP property update for component=ImpinjR420Component, property=GpiPhotoeye
Info: Get property:: PropertyName= PropertyValue=<1.000000>
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:1.000000
Info: PnpBridge_PnpBridgeStateTelemetryCallback called, result=0, telemetry=PnpBridge configuration complete
Info: PropertyCallback called, result=204, property name=DeviceState
Info: PropertyCallback called, result=204, property name=����erName
Info: PropertyCallback called, result=204, property name=����nna1
Info: PropertyCallback called, result=204, property name=����chMode
Info: PropertyCallback called, result=204, property name=H{��ion
Info: PropertyCallback called, result=204, property name=h{��de
Info: PropertyCallback called, result=204, property name=H|��eepAlive
Info: PropertyCallback called, result=204, property name=x{��erIp
Info: PropertyCallback called, result=204, property name|��lientId
Info: PropertyCallback called, result=204, property name=h|��AliveInterval
Info: PropertyCallback called, result=204, property name=�|��piDoorControl
Info: PropertyCallback called, result=204, property name=�{��hotoeye
Info: Processing property update for the device or module twin
Info: Received PnP property update for component=ImpinjR420Component, property=UseGpiDoorControl
Info: Get property:: PropertyName= PropertyValue=
Info: IoTHub client call to _SendReportedState succeeded
Info: Get property value:0
Info: PropertyCallback called, result=204, property name=����
^CError: Time:Tue Feb 9 13:58:20 2021 File:/home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/deps/azure-iot-sdk-c-pnp/c-utility/adapters/threadapi_pthreads.c Func:ThreadAPI_Join Line:97 (result = THREADAPI_INVALID_ARG (2))
Info: Cleaning Pnp Bridge resourcesTerminal will be reused by tasks, press any key to close it.
These headers are important for messages to have because when you use IoT Central's data export feature (as well as IoT Hub routing), the data will look like a binary blob without these headers.
See bullet 2 under "Telemetry" in docs
I tried to run pnpbridge_bin and arduino using serial with IoTC.
Arduino not response when SERIALPNP_PACKET_TYPE_RESET_REQUEST received.
What should I look for?
pnpbridge_bin:
<- 12:11:40 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_LEAST_ONCE = 0x01 | TOPIC_NAME: $dps/registrations/res/200/?$rid=3 | PACKET_ID: 2 | PAYLOAD_LEN: 467
Info: Provisioning callback indicates success. iothubUri=iotc-0289d4d3-9c48-461b-a803-3943e1e85247.azure-devices.net, deviceId=29bc3v3nkdz
-> 12:11:40 DISCONNECT
Info: DPS successfully registered. Continuing on to creation of IoTHub device client handle.
Info: ***** Successfully created device device=<29bc3v3nkdz> via provisioning *****
Info: Connected to Azure IoT Hub
Info: Opening com port COM1
Info: Sent reset request
Enter your question here:
Arduino sample builds and runs OK.. Can see telemetry in in Arduino Serial Monitor.
Have created and conncted to Azure Iot Hub/Device.
Bridge app conncts Ok
My question is how to specify the Serial connection (in my case COM7) in config.json
Is there as list somewhere of that part of config.json.
OK can see for Bluetooth but want to use COM Port..
This part:
"pnp_bridge_config_source": "local",
"_comment_devices": "Array of devices for Azure Pnp interface should be published",
"pnp_bridge_interface_components": [
{
"_comment": "Environment Sensor Device Component",
"pnp_bridge_component_name": "environmentalSensor",
"pnp_bridge_adapter_id": "environment-sensor-sample-pnp-adapter",
"pnp_bridge_adapter_config": {
"sensor_id": "10"
}
}
]```
OPC UA is typically an industrial IoT gateway approach that Microsoft supports via IoT Hub.
Is the IoT Plug and Play Gateway approach a parallel approach?
Any integration layer there?
Can your gateway become an MQTT subscriber for instance to “listen” to other gateways?
Thank you in Advance,
~Bryan
The front page README says:
"Access to this pre-release software is confidential and should not be disclosed or shared with other parties per your NDA with Microsoft."
Does that mean that this repo should not be public? Or, has there been a change to this?
Thanks,
Max
Describe the bug
Customer was testing IoT PnP bridge and trying to send commands with string containing boolean information to Modsim and real Modbus devices via PnP bridge, but only false/0 works, but true/1 does not work.
Customer tested command on real Modbus device and the results are familiar with on Modsim.
To sum up, pnpbridge.exe fails to set Modbus coil type to true, but it’s okay to set to false.
To Reproduce
Please refer to customer's testing process.
**On Real Modbus device:
Set 1 from IoT Central -> Failed**
Error message:
Info: Received PnP command for component=ModbusComponent, command=fan
Error: Time:Wed Apr 7 00:47:34 2021 File:F:\b1\pnpbridge\src\adapters\src\modbus_pnp\ModbusConnection\ModbusConnection.c Func:ValidateModbusResponse Line:42 Modbus exception code: 0x3
Error: Time:Wed Apr 7 00:47:34 2021 File:F:\b1\pnpbridge\src\adapters\src\modbus_pnp\ModbusConnection\ModbusConnection.c Func:ModbusPnp_WriteToCapability Line:598 Invalid response for command "fan".
Set True from IoT Central -> Failed
No error message also no response.
Set 0 from IoT Central -> Successful
Before:
After:
Command was set immediately.
Set false from IoT Central -> Successful
After:
Command was set immediately.
**On Modsim:
Set 1 from IoT Central -> Failed**
No error message also no response.
Set true from IoT Central -> Failed
No error message also no response.
Set 0 from IoT Central -> Successful
Before:
After:
Command was set immediately.
Set false from IoT Central -> Successful
Before:
After:
Command was set immediately.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
Enter your question here:
I was wondering if you could also provide a release build of the bridge ? Since now it looks like a debug build so i will have to install VS C++ , since else it will miss the VCRUNTIME140D.dll
please correct me if i am wrong.
michel
Describe the bug
With the Arduino Serial Sample, the PropertyUpdate and Commands, when exercised from Azure IoTExplorer do not work. There is some code that uses a NULL for the component in both cases which means the Callbacks to the device don't get actioned by the Bridge.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
In AzureIOTHub expect to action Properties and Commands and see messages in Bridge Console saying its happened, and impacted upon the Arduino App. Examples when it works:
PropertyUpdate:
Info: Processing property update for the device or module twin
Info: Received PnP property update for component=serialpnp, property=sample_rate
Info: Serial Pnp Adapter: Processed property. PropertyUpdated = 3000
Info: Setting property sample_rate to 3000
Info: Serial Pnp Adapter: Sending device information property to IoTHub. propertyName=sample_rate, propertyValue=3000
Info: Serial Pnp Adapter: Got Property Update Notification. propertyName=sample_rate
Command
Info: Number of components in model=1. Using first: serialpnp
Info: Received PnP command for component=serialpnp, command=calibrate
Info: Invoking command calibrate to 3
Info: Command was processed.
Outcome with existing code
Both don't happen.
Desktop (please complete the following information):
OS: [Windows (19043.1165]
Copy of the config.json file Both after Additional Comment
Copy of PnP interface json
Additional context
As discussed in More issues with the Arduino Serial example #74
g_PnpBridge->PnpMgr->ComponentsInModel
In both cases the index for the string array ComponentsInModel used,is zero. Zero is "arbitrary" (but a good guess, there should be at least one), particularly with Commands
Also the comment "its not a model the application knows about, this is a property of the model's root component" needs resolution.
config.json
{
"$schema": "../../iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/src/pnpbridge_config_schema.json",
"pnp_bridge_connection_parameters":
{
"connection_type" : "connection_string",
"connection_string" : "HostName=HubPnP2.azure-devices.net;DeviceId=PnPDev2",
"root_interface_model_id": "dtmi:com:contoso:serialpnp;1",
"auth_parameters":
{
"auth_type": "symmetric_key",
"symmetric_key": "Aw6w8ax677Ovgp4FXDaxcEiLJfVsbAjR+cvudt/oKqE="
}
},
"pnp_bridge_debug_trace": false,
"pnp_bridge_config_source": "local",
"_comment_devices": "Array of devices for Azure Pnp interface should be published",
"pnp_bridge_interface_components":
[
{
"_comment": "Grove Beginner Kit for Arduino Sensors and Actuators Device Component",
"pnp_bridge_component_name": "serialpnp",
"pnp_bridge_adapter_id": "serial-pnp-interface",
"pnp_bridge_adapter_config":
{
"com_port": "COM4",
"_comment": "NOTE: com_port parameter will NOT be used when use_com_device_interface is set to true. In case of windows iot edition, the COMXX symbolic links are not created. Setting use_com_device_interface to false will pick the first available COM interface.",
"use_com_device_interface": "false",
"baud_rate": "115200"
}
}
],
"pnp_bridge_adapter_global_configs":
{
"serial-pnp-interface": {
"DjAus" : {
"company_id": "0x499",
"endianness": "big",
"telemetry_descriptor": [
{
"telemetry_name": "temperature",
"displayName":"Temperature",
"data_parse_type": "decimal",
"conversion_bias": 0,
"conversion_coefficient": 1.0
}
],
"properties": {
"sample_rate": {
"name": "sample_rate",
"displayName":"Sample Rate",
"dataType": "integer",
"required": true
}
},
"commands": {
"calibrate": {
"commandType": "synchronous",
"request":
{
"dataType": "integer"
},
"response":
{
"dataType": "integer"
}
},
"toggle_state": {
"commandType": "synchronous",
"request":
{
"dataType": "integer"
},
"response":
{
"dataType": "integer"
}
}
}
}
}
}
}
Schema.json
{
"@context": "dtmi:dtdl:context;2",
"@id": "dtmi:com:contoso:serialpnp;1",
"@type": "Interface",
"displayName": "Pnp Bridge Root Interface Model serialpnp",
"description": "Arduino Serial PnP",
"comment": "Serial PnP for Arduino",
"contents": [
{
"@type": "Property",
"displayName": "Sample Rate",
"description": "Rate of temperature readings.",
"name": "sample_rate",
"schema": "integer",
"writable": true
},
{
"@type": [
"Telemetry",
"Temperature"
],
"description": "Current temperature on the device",
"displayName": "Temperature",
"name": "temperature",
"schema": "float",
"unit": "degreeCelsius"
},
{
"@type": "Command",
"name": "calibrate",
"description": "Calibrates the thermometer.",
"commandType": "synchronous",
"request": {
"name": "input",
"schema": "integer"
},
"response": {
"name": "calibrateResponse",
"schema": "integer"
}
},
{
"@type": "Command",
"name": "toggle_state",
"comment": "Enable-disable sampling.",
"commandType": "synchronous" ,
"request": {
"name": "input",
"schema": "integer"
},
"response": {
"name": "output",
"schema": "integer"
}
}
]
}
Describe the bug
Need to edit 3rd debug message at startup.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Pnp Bridge is running as am IoT egde device.
should be;
Pnp Bridge is running as an IoT Edge device.
Screenshots
PS C:\Temp\pnp> .\pnp
Info:
-- Press Ctrl+C to stop PnpBridge
Info: Using default configuration location
Info: Starting Azure PnpBridge
Info: Pnp Bridge is running as am IoT egde device.
I built the pnp bridge with toolchain for embedded device (RFID reader R420) by running build.sh script. Then I ran it on the device. I got error “certificate verify failed”. I had the same error before when I used Azure IoT SDK C. After I added the flag “-Duse_sample_trusted_cert:BOOL=on” in the build.sh script, it’s fixed. But I even added this flag that won’t fix it.
To Reproduce
Steps to reproduce the behavior:
** Log **
root@SpeedwayR-12-C8-A7:/cust/iot# ./pnpbridge_bin
Info:
-- Press Ctrl+C to stop PnpBridgeInfo: Using default configuration location
Info: Starting Azure PnpBridge
Info: Pnp Bridge is running as am IoT egde device.
Info: Pnp Bridge creation succeeded.
Info: Connection_type is [dps]
Info: Tracing is disabled
Info: IoT Edge Device configuration initialized successfully
Info: Building Pnp Bridge Adapter Manager, Adapters & Components
Info: Adapter with identity environment-sensor-sample-pnp-adapter does not have any associated global parameters. Proceeding with adapter creation.
Info: Pnp Adapter with adapter ID environment-sensor-sample-pnp-adapter has been created.
Info: Pnp Adapter Manager created successfully.
Info: Pnp components created successfully.
Info: Pnp components built in model successfully.
Info: Eddy:PnP_CreateDeviceClientHandle
Info: Initiating DPS client to retrieve IoT Hub connection information
Error: Time:Fri Jan 15 21:19:53 2021 File:/home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/deps/azure-iot-sdk-c-pnp/c-utility/adapters/tlsio_openssl.c Func:send_handshake_bytes Line:674 error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
** Device : Speedyway R420 RFID reader**
Additional question
I have another question. When I set these two flags prov_use_tpm_simulator and use_edge_modules to OFF in build.sh script file and built it, I got error.
** Log from building **
etk@f40df7f55477:~/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/scripts/linux$ ./build_linux32.sh
~/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/cmake/linux32 ~/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/scripts/linux
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file stdbool.h
-- Looking for include file stdbool.h - found
-- target architecture: x86_64
-- Performing Test CXX_FLAG_CXX11
-- Performing Test CXX_FLAG_CXX11 - Success
-- IoT Client SDK Version = 1.3.9
-- Provisioning SDK Version = 1.3.9
CMake Warning (dev) at deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeLists.txt:13 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'use_cppunittest'.
This warning is for project developers. Use -Wno-dev to suppress it.
-- target architecture: x86_64
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'libcurl'
-- Found libcurl, version 7.68.0
-- Found CURL: curl
-- target architecture: x86_64
-- iothub architecture: x86_64
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
run_valgrind
use_32bit
-- Build files have been written to: /home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/cmake/linux32
Initial MAKE_CORES=2
VSPACE=5081628
MAKE_CORES=2
Starting run...
Sat Jan 16 16:38:19 UTC 2021
Scanning dependencies of target parson
Scanning dependencies of target umock_c
[ 0%] Building C object deps/azure-iot-sdk-c-pnp/CMakeFiles/parson.dir/deps/parson/parson.c.o
[ 1%] Linking C static library libparson.a
[ 1%] Built target parson
Scanning dependencies of target aziotsharedutil
[ 2%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umock_c.c.o
[ 2%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umock_c_negative_tests.c.o
[ 2%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umockalloc.c.o
[ 3%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umockcall.c.o
[ 3%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umockcallrecorder.c.o
...
...
[ 92%] Building C object deps/azure-iot-sdk-c-pnp/iothub_client/CMakeFiles/iothub_client.dir/src/iothub_client_ll_uploadtoblob.c.o
[ 92%] Building C object deps/azure-iot-sdk-c-pnp/iothub_client/CMakeFiles/iothub_client.dir/src/blob.c.o
[ 93%] Linking C static library libiothub_client.a
[ 93%] Built target iothub_client
Scanning dependencies of target pnpbridge
[ 93%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/configuration_parser.c.o
[ 93%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/iothub_comms.c.o
[ 94%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/pnpadapter_manager.c.o
[ 94%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/pnpbridge.c.o
[ 94%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/utility.c.o
[ 95%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/pnpadapter_api.c.o
[ 95%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/common/pnp_device_client.c.o
[ 95%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/common/pnp_dps.c.o
/home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/common/pnp_device_client.c: In function 'AllocateModuleClientHandle':
/home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/common/pnp_device_client.c:144:35: error: implicit declaration of function 'IoTHubModuleClient_CreateFromEnvironment'; did you mean 'IoTHubModuleClient_CreateFromConnectionString'? [-Werror=implicit-function-declaration]
144 | if ((moduleClientHandle = IoTHubModuleClient_CreateFromEnvironment(MQTT_Protocol)) == NULL)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| IoTHubModuleClient_CreateFromConnectionString
/home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/common/pnp_device_client.c:144:33: error: assignment to 'IOTHUB_MODULE_CLIENT_HANDLE' {aka 'struct IOTHUB_CLIENT_CORE_INSTANCE_TAG *'} from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
144 | if ((moduleClientHandle = IoTHubModuleClient_CreateFromEnvironment(MQTT_Protocol)) == NULL)
| ^
cc1: all warnings being treated as errors
make[2]: *** [src/pnpbridge/CMakeFiles/pnpbridge.dir/build.make:141: src/pnpbridge/CMakeFiles/pnpbridge.dir/common/pnp_device_client.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:2401: src/pnpbridge/CMakeFiles/pnpbridge.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
etk@f40df7f55477:~/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/scripts/linux$
Describe the bug
Tried DPS but failed with unauthorized. Looks this code doesn't include changes in IoT Central side.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
DPS succeed
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
[Robert Chung] Just tried the Telemetry, Property, and Command function, and there is no problem but Command. When I send the command payload to the Arduino device, the PnP Bridge will receive the request data but has mojibake, like: “\”15\”yyyy~!y”. Here is my request command:
az iot pnp invoke-command --command-name "calibrate" --command-payload ""15"" --interface "http://robert.com/bridgeInterface/1.0.0" --hub-name "RobertTestHub" --device-id "TestDevice"
Describe the bug
When I set the flag "no_logging=ON" in build.sh and I run it, I got the error, see screenshot below.
error in log:
/usr/bin/ld: CMakeFiles/pnpbridge_bin.dir/main.c.o: in function main': main.c:(.text+0x43): undefined reference to
xlogging_get_log_function'
/usr/bin/ld: main.c:(.text+0xe6): undefined reference to xlogging_get_log_function' /usr/bin/ld: main.c:(.text+0x169): undefined reference to
xlogging_get_log_function'
/usr/bin/ld: ../../libpnpbridge.a(pnpbridge.c.o): in function PnpBridge_InitializePnpDeviceConfig': pnpbridge.c:(.text+0x191): undefined reference to
xlogging_get_log_function'
/usr/bin/ld: pnpbridge.c:(.text+0x286): undefined reference to xlogging_get_log_function' /usr/bin/ld: ../../libpnpbridge.a(pnpbridge.c.o):pnpbridge.c:(.text+0x37b): more undefined references to
xlogging_get_log_function' follow
collect2: error: ld returned 1 exit status
make[2]: *** [src/pnpbridge/samples/console/CMakeFiles/pnpbridge_bin.dir/build.make:125: src/pnpbridge/samples/console/pnpbridge_bin] Error 1
make[1]: *** [CMakeFiles/Makefile2:2483: src/pnpbridge/samples/console/CMakeFiles/pnpbridge_bin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: CMakeFiles/pnpbridge_module.dir/main.c.o: in function main': main.c:(.text+0xd): undefined reference to
xlogging_get_log_function'
/usr/bin/ld: CMakeFiles/pnpbridge_module.dir/__/src/configuration_parser.c.o: in function PnpBridgeConfig_GetConnectionDetails': configuration_parser.c:(.text+0x4c): undefined reference to
xlogging_get_log_function'
/usr/bin/ld: configuration_parser.c:(.text+0xc3): undefined reference to xlogging_get_log_function' /usr/bin/ld: configuration_parser.c:(.text+0x1a7): undefined reference to
xlogging_get_log_function'
/usr/bin/ld: configuration_parser.c:(.text+0x20e): undefined reference to xlogging_get_log_function' /usr/bin/ld: CMakeFiles/pnpbridge_module.dir/__/src/configuration_parser.c.o:configuration_parser.c:(.text+0x297): more undefined references to
xlogging_get_log_function' follow
collect2: error: ld returned 1 exit status
make[2]: *** [src/pnpbridge/module/CMakeFiles/pnpbridge_module.dir/build.make:262: src/pnpbridge/module/pnpbridge_module] Error 1
make[1]: *** [CMakeFiles/Makefile2:2532: src/pnpbridge/module/CMakeFiles/pnpbridge_module.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Desktop (please complete the following information):
[Robert Chung]: If I’d like to use my own interface id instead of sample http://windows.com/camera_health_monitor/1.0.0. The CameraIotPnpAPIs.cpp need to change the line 152 to:
interfaceId = json_object_get_string(jobj, "InterfaceId");
Is it expected issue? Or there is another reason to must use the sample interface id?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.