GithubHelp home page GithubHelp logo

DeviceExplorer returns error when using Call Method On Device form when using latest API version 2016-11-14 about azure-iot-sdk-csharp HOT 11 CLOSED

azure avatar azure commented on May 29, 2024
DeviceExplorer returns error when using Call Method On Device form when using latest API version 2016-11-14

from azure-iot-sdk-csharp.

Comments (11)

damonbarry avatar damonbarry commented on May 29, 2024

It looks like the device isn't connected (ErrorCode:DeviceNotOnline). Are you sure the device is connected, and is it connected via MQTT? Cloud-to-device methods are only supported currently for devices connected over MQTT.

from azure-iot-sdk-csharp.

tedvanderveen avatar tedvanderveen commented on May 29, 2024

@damonbarry yes the device is connected via MQTT. Also what is strange is that the error says Timed out waiting for device, but the error response is returned in less than a second while timeout is set to 60 secs as you can see.
Any help is very much appreciated.

from azure-iot-sdk-csharp.

tedvanderveen avatar tedvanderveen commented on May 29, 2024

I searched for the Tracking ID in the IoT Hub instance diagnostic logs, but cannot find that record. Maybe someone in the IoT Hub team can look it up for more details about this error?

from azure-iot-sdk-csharp.

tedvanderveen avatar tedvanderveen commented on May 29, 2024

Is there a working end to end sample/test code available so we can see Direct Methods in action?

from azure-iot-sdk-csharp.

jasmineymlo avatar jasmineymlo commented on May 29, 2024

Below is the sample code for Methods on mqtt
https://github.com/Azure/azure-iot-sdk-csharp/blob/master/device/samples/DeviceClientMethodMqttSample/Program.cs

from azure-iot-sdk-csharp.

tedvanderveen avatar tedvanderveen commented on May 29, 2024

@jasmineymlo that sample is not applicable to this use case as it uses Devices Client and in our case we need to call the method from the Cloud.

from azure-iot-sdk-csharp.

olivierbloch avatar olivierbloch commented on May 29, 2024

Hi @tedvanderveen
You can find a sample here: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-csharp-node-direct-methods
We will need to update this doc to replace the device side code with the new C# samples that Jasmine was pointing to. In this doc you will find the service side of the sample in C#.

from azure-iot-sdk-csharp.

tedvanderveen avatar tedvanderveen commented on May 29, 2024

Thanks @olivierbloch but I tried it, still exactly same error. Did you try it and got successful results?

from azure-iot-sdk-csharp.

olivierbloch avatar olivierbloch commented on May 29, 2024

Hi @tedvanderveen.
I was indeed successful with both a device using the node sdk and also using the C# direct method sample.
Here is how I proceeded:

  • For Node

    • I cloned the https://github.com/azure/azure-iot-sdk-node
    • navigated in a prompt to the folder device/samples
    • Ran the following commands
      npm install
      node device_method.js mydeviceconnectionsting
      (using an actual connection string)
    • then I used the Device Explorer tool (just installed from latest release of this repo) to invoke the method "getDeviceLog"
    • Got response in Device Explorer
  • For the C# sample:

    • Cloned the current repo
    • Opened the solution device/iothub_client_deviceclient.sln
      - In the project Samples/DeviceClientMethodMqttSample, I edited the connection string, then built and ran (only this project, not the full solution)
    • Then I used the Device Explorer tool to invoke the method "GetDeviceName"
        - Got response in Device Explorer.

Are you able to see telemetry data from the device in Device Explorer when running the sample DeviceClientMqttSample with the same connection string as the one you use for testing Methods?

from azure-iot-sdk-csharp.

tameraw avatar tameraw commented on May 29, 2024

@tedvanderveen - Closing. Please reopen if you're still having an issue.

from azure-iot-sdk-csharp.

epaulson avatar epaulson commented on May 29, 2024

Sorry for posting on an old topic, but for what it's worth, I hit this error when I connected directly via MQTT with mosquitto, but forgot to include the API version in the -user .azure-devices.net//api-version=2016-11-14.

If you leave off the /api-version bit, you can connect via mosquitto and get data on the /devices//messages/devicebound topic just fine, but the device twin and direct methods don't work.

from azure-iot-sdk-csharp.

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.