GithubHelp home page GithubHelp logo

Comments (16)

ChenhangLin avatar ChenhangLin commented on June 9, 2024

Moved the thread here due to IoT Central PG suggestions.

from iot-plug-and-play-bridge.

usivagna avatar usivagna commented on June 9, 2024

Thanks for filing this issue @ChenhangLin, we'll review and investigate. @dipannita08 can you have a look at this bug?

from iot-plug-and-play-bridge.

dipannita08 avatar dipannita08 commented on June 9, 2024

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:

  1. PnpBridge logs
  2. IoT Hub logs (set pnp_bridge_debug_trace to true)
  3. Command response status
  4. Does this issue reproduce on Azure IoT Explorer or Azure IoT Hub?

I can provide more information on what is happening after looking at the logs.

from iot-plug-and-play-bridge.

ChenhangLin avatar ChenhangLin commented on June 9, 2024

from iot-plug-and-play-bridge.

ChenhangLin avatar ChenhangLin commented on June 9, 2024

from iot-plug-and-play-bridge.

ChenhangLin avatar ChenhangLin commented on June 9, 2024

from iot-plug-and-play-bridge.

usivagna avatar usivagna commented on June 9, 2024

Thanks for the additional details, we will investigate further and provide an update in the next week or so.

from iot-plug-and-play-bridge.

dipannita08 avatar dipannita08 commented on June 9, 2024

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:

  1. From the few lines of logs I'm seeing in the images you uploaded here is what is happening
  • The command update callback method calls ModbusPnp_WriteToCapability before writing the response
  • ModbusPnp_WriteToCapability sets and send the "write request" to the device successfully
  • ModbusPnp_WriteToCapability receives the "response to the request" and tries to validate it but fails.
  • The reason validation fails for the response is because response received at header size does not match the request's, rather (response[HEADER_SIZE] == request[HEADER_SIZE] + 0x80)
  1. I was able to validate command request and response with a real modbus sensor from Azure IoT central (config and dtml can be found in the PR with the bug fix above)

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:

  1. The PnP Bridge logs with debug trace disabled ("pnp_bridge_debug_trace": false). (Please attach a text file with all the logs preceding the error messages and not images of isolated error messages)
  2. The PnP Bridge logs with debug trace enabled ("pnp_bridge_debug_trace": true) (Please attach a text file with all the logs preceding the error messages and not images of isolated error messages)
  3. The json config file you are using for the device.
  4. The device capability model, or the DTMI json.

from iot-plug-and-play-bridge.

ChenhangLin avatar ChenhangLin commented on June 9, 2024

Hi @dipannita08 , thanks a lot for looking into this!

Attaching required information:

LogsAndModel.zip

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

from iot-plug-and-play-bridge.

dipannita08 avatar dipannita08 commented on June 9, 2024
  1. 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.json. 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)
  2. 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 is one for a modbus sensor.
  3. Neither of the logs in the attached compressed folder you shared show the problem reproduced. Please upload full logs (with and without hub tracing enabled) including the bug repro condition.

from iot-plug-and-play-bridge.

ChenhangLin avatar ChenhangLin commented on June 9, 2024

from iot-plug-and-play-bridge.

ChenhangLin avatar ChenhangLin commented on June 9, 2024

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:

  1. 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.json. 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)

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.

  1. 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 is one for a modbus sensor.

After adding response (type: string) manually, customer got the same test results.

image

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!

from iot-plug-and-play-bridge.

dipannita08 avatar dipannita08 commented on June 9, 2024

@ChenhangLin apologies for the delay in clarification

  1. 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

  2. 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.

  3. If you can reproduce the issue still, please send me the following:

    1. The PnP Bridge logs with debug trace disabled ("pnp_bridge_debug_trace": false). (Please attach a text file with all the logs preceding the error messages and not images of isolated error messages)
    1. The PnP Bridge logs with debug trace enabled ("pnp_bridge_debug_trace": true) (Please attach a text file with all the logs preceding the error messages and not images of isolated error messages)
    1. The json config file you are using for the device.
    1. The device capability model, or the DTMI json.

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.

from iot-plug-and-play-bridge.

ChenhangLin avatar ChenhangLin commented on June 9, 2024

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

image

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!

info.zip

from iot-plug-and-play-bridge.

dipannita08 avatar dipannita08 commented on June 9, 2024

@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?

from iot-plug-and-play-bridge.

dipannita08 avatar dipannita08 commented on June 9, 2024

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.

from iot-plug-and-play-bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.