Closed ChenhangLin closed 3 years ago
Moved the thread here due to IoT Central PG suggestions.
Thanks for filing this issue @ChenhangLin, we'll review and investigate. @dipannita08 can you have a look at this bug?
I have not yet been able to reproduce this issue using Azure IoT explorer or Azure IoT hub. It would be helpful to either repro the issue or look at logs to further investigate.
Please provide the following information:
I can provide more information on what is happening after looking at the logs.
Hi Dipannita,
Customer hasn’t tested on IoT Hub and Explorer. They were only testing on IoT Central and ModSim. PnP bridge logs are also included in the GitHub issue.
Thanks!
Best Regards, Clive Lin
发件人: Dipannita Shaw @.> 发送时间: Friday, April 16, 2021 5:26:48 AM 收件人: Azure/iot-plug-and-play-bridge @.> 抄送: Clive Lin @.>; Mention @.> 主题: Re: [Azure/iot-plug-and-play-bridge] [BUG] Command not working when sending "true" to PnP Bridge (#58)
I have not yet been able to reproduce this issue using Azure IoT explorer or Azure IoT hub. It would be helpful to either repro the issue or look at logs to further investigate.
Please provide the following information:
I can provide more information on what is happening after looking at the logs.
― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fiot-plug-and-play-bridge%2Fissues%2F58%23issuecomment-820741830&data=04%7C01%7CChenhang.Lin%40microsoft.com%7C4ec6d2dc3c824430071a08d900552df3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637541188153969065%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JL1F3pl%2FH%2F0Xy2XKG%2BbbcbO5jyexVRTUoV31GeHb8%2Fo%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOTDTDRZ47OILX5KJISWTH3TI5KZRANCNFSM42ZJEZIA&data=04%7C01%7CChenhang.Lin%40microsoft.com%7C4ec6d2dc3c824430071a08d900552df3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637541188153979062%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vVIsbZ%2F59ijv1K4O3vMRTpU%2BBSA2Q7m74UriPrNVJJ8%3D&reserved=0.
Will also suggest customer to set debug trace to true to see if there’s more information
获取 Outlook for iOShttps://aka.ms/o0ukef
发件人: Clive Lin @.> 发送时间: Friday, April 16, 2021 8:26:26 AM 收件人: Azure/iot-plug-and-play-bridge @.>; Azure/iot-plug-and-play-bridge @.> 抄送: Mention @.> 主题: Re: [Azure/iot-plug-and-play-bridge] [BUG] Command not working when sending "true" to PnP Bridge (#58)
Hi Dipannita,
Customer hasn’t tested on IoT Hub and Explorer. They were only testing on IoT Central and ModSim. PnP bridge logs are also included in the GitHub issue.
Thanks!
Best Regards, Clive Lin
发件人: Dipannita Shaw @.> 发送时间: Friday, April 16, 2021 5:26:48 AM 收件人: Azure/iot-plug-and-play-bridge @.> 抄送: Clive Lin @.>; Mention @.> 主题: Re: [Azure/iot-plug-and-play-bridge] [BUG] Command not working when sending "true" to PnP Bridge (#58)
I have not yet been able to reproduce this issue using Azure IoT explorer or Azure IoT hub. It would be helpful to either repro the issue or look at logs to further investigate.
Please provide the following information:
I can provide more information on what is happening after looking at the logs.
― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fiot-plug-and-play-bridge%2Fissues%2F58%23issuecomment-820741830&data=04%7C01%7CChenhang.Lin%40microsoft.com%7C4ec6d2dc3c824430071a08d900552df3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637541188153969065%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JL1F3pl%2FH%2F0Xy2XKG%2BbbcbO5jyexVRTUoV31GeHb8%2Fo%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOTDTDRZ47OILX5KJISWTH3TI5KZRANCNFSM42ZJEZIA&data=04%7C01%7CChenhang.Lin%40microsoft.com%7C4ec6d2dc3c824430071a08d900552df3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637541188153979062%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vVIsbZ%2F59ijv1K4O3vMRTpU%2BBSA2Q7m74UriPrNVJJ8%3D&reserved=0.
Hi Dipannita,
Customer is using PnP Bridge exe to interact with IoT Central and ModSim. Commands will be sent from IoT Central with contents of “true”/”false”/”1”/”0”, and of string type.
You can use the same component of customer's to reproduce.
We suggested customer to enable debug trace and following are the results:
Command “false” -> successful to change ModSim value
Command “0” -> successful to change ModSim value
Command “true” -> not successful to change ModSim value
Command “1” -> not successful to change ModSim value
Kindly let us know if more information is needed.
Thanks!
From: Clive Lin @.> Sent: Friday, April 16, 2021 8:27 AM To: Azure/iot-plug-and-play-bridge @.>; Azure/iot-plug-and-play-bridge @.> Cc: Mention @.> Subject: Re: [Azure/iot-plug-and-play-bridge] [BUG] Command not working when sending "true" to PnP Bridge (#58)
Will also suggest customer to set debug trace to true to see if there’s more information
获取 Outlook for iOShttps://aka.ms/o0ukef
发件人: Clive Lin @.**@.>> 发送时间: Friday, April 16, 2021 8:26:26 AM 收件人: Azure/iot-plug-and-play-bridge @.**@.>>; Azure/iot-plug-and-play-bridge @.**@.>> 抄送: Mention @.**@.>> 主题: Re: [Azure/iot-plug-and-play-bridge] [BUG] Command not working when sending "true" to PnP Bridge (#58)
Hi Dipannita,
Customer hasn’t tested on IoT Hub and Explorer. They were only testing on IoT Central and ModSim. PnP bridge logs are also included in the GitHub issue.
Thanks!
Best Regards, Clive Lin
发件人: Dipannita Shaw @.**@.>> 发送时间: Friday, April 16, 2021 5:26:48 AM 收件人: Azure/iot-plug-and-play-bridge @.**@.>> 抄送: Clive Lin @.**@.>>; Mention @.**@.>> 主题: Re: [Azure/iot-plug-and-play-bridge] [BUG] Command not working when sending "true" to PnP Bridge (#58)
I have not yet been able to reproduce this issue using Azure IoT explorer or Azure IoT hub. It would be helpful to either repro the issue or look at logs to further investigate.
Please provide the following information:
I can provide more information on what is happening after looking at the logs.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fiot-plug-and-play-bridge%2Fissues%2F58%23issuecomment-820741830&data=04%7C01%7CChenhang.Lin%40microsoft.com%7C4ec6d2dc3c824430071a08d900552df3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637541188153969065%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JL1F3pl%2FH%2F0Xy2XKG%2BbbcbO5jyexVRTUoV31GeHb8%2Fo%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOTDTDRZ47OILX5KJISWTH3TI5KZRANCNFSM42ZJEZIA&data=04%7C01%7CChenhang.Lin%40microsoft.com%7C4ec6d2dc3c824430071a08d900552df3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637541188153979062%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vVIsbZ%2F59ijv1K4O3vMRTpU%2BBSA2Q7m74UriPrNVJJ8%3D&reserved=0.
Thanks for the additional details, we will investigate further and provide an update in the next week or so.
I found a bug in PnpBridge. The one line fix is in this pull request, however, this fix will not fix the issue you are seeing for following reasons:
This does not look like a PnP Bridge issue, rather an issue with a possible mismatch in the config and the device spec. Please also ensure that the "modbus component" is a child of the "pnpbridge root device" and both are modeled correctly with valid DTMIs when interacting with them via Azure IoT Central.
If you would like me to further help with this investigation please attach the following:
Hi @dipannita08 , thanks a lot for looking into this!
Attaching required information:
Customer Notes:
There are two txt files are logged from pnpbridge.exe, collecting telemetry for seconds and issuing command from IoT Central (set false then set true). Environmental Sensor.json is capacity model but I don’t import it as template on IoT Central now, I add component manually instead. So I export the template from IoT Central, WISE-4012.json
Hi Dipannita,
Thanks for the information. Customer would like to record a reproduce video and include related logs later, but would like to clarify something first:
Your pnpbridge config should point to the "root interface model id" not the "component model id". It should be something like the one described here: pnpbridge/docs/schemas/RootPnpBridgeInterfaceModel.jsonhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fiot-plug-and-play-bridge%2Fblob%2Fc0be198cb2cde7aaaf450b03113d861bc6596bad%2Fpnpbridge%2Fdocs%2Fschemas%2FRootPnpBridgeInterfaceModel.json&data=04%7C01%7CEvelyn.Tang%40advantech.com.tw%7C7bc88c641e8f44442e1c08d90a28a410%7Ca77d40d9dcba4ddab5715f18e6da853f%7C1%7C0%7C637551991997611191%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=64tjxRoAHmFQdaItmfzvKbUfInDJBu831FciDhQbHCk%3D&reserved=0. My assumption is that you created components from the IoT Central user interface and imported the WISE-4012.json DTMI for this component. Even if you do it this way, your root level interface model should list this component (DTMI) as one of its own components (as described in the example above) I didn't import any interface model on IoT Central. I add all the component manually. Device templates: Create IoT device -> Create Custom model -> Add component -> Create Custom component interface -> Add capabilities manually WISE-4012 is exported directly from above steps so I don't know how to create root level interface. If it matters, please advise me how to do.
Your modbus component described by dtmi:evelynpnpbridge:WISE4012z9;1 does not define a command response - it only defines a request - for example, look at the dtmi models in the docs folder. Here https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fiot-plug-and-play-bridge%2Fblob%2Fc0be198cb2cde7aaaf450b03113d861bc6596bad%2Fpnpbridge%2Fdocs%2Fschemas%2FCO2Sensor.json&data=04%7C01%7CEvelyn.Tang%40advantech.com.tw%7C7bc88c641e8f44442e1c08d90a28a410%7Ca77d40d9dcba4ddab5715f18e6da853f%7C1%7C0%7C637551991997621182%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=eZeKxzNOwRjM2IyKlPk3h4I6W7z0eftJp2L0GM0cudk%3D&reserved=0 is one for a modbus sensor. After adding response (type: string) manually, I got the same test results. @.***D73CE4.FD6D7CA0]
Could you help clarify might these be the issue customer saw the issue, or customer still has to provide more detailed logs for further investigation.
Thanks!
Best Regards, Clive Lin
Clive Lin | Support Engineer | Azure IoT/AI Support Team | Asia Pacific & Greater China Region Phone: +86 (21) 52638659 Email: @.**@.> Working Hours: Mon-Fri 9:00-17:30 (GMT+8) @.D73CE4.FD6D7CA0] If you have any feedback about my work, please let either me or my manager Lynn Zhang know at @*.**@*.***>
From: Dipannita Shaw @.> Sent: Tuesday, April 27, 2021 5:54 AM To: Azure/iot-plug-and-play-bridge @.> Cc: Clive Lin @.>; Mention @.> Subject: Re: [Azure/iot-plug-and-play-bridge] [BUG] Command not working when sending "true" to PnP Bridge (#58)
- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fiot-plug-and-play-bridge%2Fissues%2F58%23issuecomment-827169711&data=04%7C01%7CChenhang.Lin%40microsoft.com%7Cf4157a987280486981b808d908fddbd1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637550708691722506%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=r6ZPxKNsEJ4HIkuiZXpJCd0psBtOceiDt68%2FV3ol8hk%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOTDTDSH4EJ5A7N7LECA5M3TKXOJDANCNFSM42ZJEZIA&data=04%7C01%7CChenhang.Lin%40microsoft.com%7Cf4157a987280486981b808d908fddbd1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637550708691722506%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=O605moQjGTn9lSrlBXSGqD6Gne4RSwjC5HV%2BHfJLGCk%3D&reserved=0.
Hi Dipannita,
Thanks for the information. Customer would like to record a reproduce video and include related logs later, but would like to clarify something first:
Customer didn’t import any interface model on IoT Central. I add all the component manually. Device templates: Create IoT device -> Create Custom model -> Add component -> Create Custom component interface -> Add capabilities manually WISE-4012 is exported directly from above steps so I don’t know how to create root level interface. If it matters, please advise me how to do.
After adding response (type: string) manually, customer got the same test results.
Could you help clarify will above two points cause the original issue, or customer still has to provide more detailed logs/operational videos for further investigation?
Thanks!
@ChenhangLin apologies for the delay in clarification
The DTMI of the "device with components" and the one you have provisioned in this case "WISE-4012" with a modbus sensor component, is your "top level root interface" and the ID of this should go in your config.json (the one you shared with me does not map root_interface_model_id to the DTMI of this device). In other words your config should have the following under pnp_bridge_connection_parameters: "root_interface_model_id": "dtmi:evelynpnpbridge:WISE40123i5;1". This DTMI as you mentioned before already points to the modbus sensor component DTMI within it, there is no need to put "pnp_bridge_interface_id": "dtmi:com:example:PnpBridgeEnvironmentalSensor;1", under pnp_bridge_interface_components
Once you have fixed the config file as per the device-component modeling you have created, and added the command response payload in your model, please pull the latest from master (unless you have already) and retry this scenario.
If you can reproduce the issue still, please send me the following:
I'll be happy to help you build the DTMI and config correctly if you run into issues with what I described. Also let me know if you have questions, I'll now be more prompt with responses & clarifications.
Hi @dipannita08 , thanks for the information!
Customer came back to try this, and copy the template id and paste in root_interface_model_id in config.json, but still met the same issue: okay to set 0/false, but failed to set 1/true to Modbus
Customer added the component manually instead of importing by template, so not very sure about how to handle the added component in config.json and if needing to export the template before running pnpbridge.exe.
Information attached with more details in debug trace logs. I checked debug logs butthere is still no error message. PnP Bridge always succeeded in receiving the commands in both scenarios, but the issue is that it cannot pass 1/true to Modbus/ModSim
I could reproduce the issue always, and you may also reproduce on your side to confirm. Kindly let me know if any questions in the reproducing steps. Thanks!
@ChenhangLin Looks like the errors you were seeing before are no longer reproducing on your end. IoT hub logs look clean and so do PnP Bridge logs. What exactly are you seeing "not pass"? I have not been able to reproduce this issue since the beginning, and logs show no errors - so I'm curious if I can add more logging to catch whatever you're seeing. You also mentioned some videos capturing the issue - where are these located?
Closing this out since there is no repro at hand, clean logs and we haven't heard back with any new information. Please feel free to reach out if you have a bug repro at hand and need help investigating.
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
Before:
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.