Skip to content

device.on_command_executed is never called, IoT Central methods can't be used #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Grudon opened this issue Apr 17, 2023 · 0 comments

Comments

@Grudon
Copy link

Grudon commented Apr 17, 2023

It seems like device.on_command_executed is never called, even though my device is clearly receiving the method from IoT Central when looking at the log:

1861.44: INFO - C2D: => $iothub/methods/res/200/?$rid=1 with data {"Value": ""} and name => speaker

The code, taken from the docs (https://docs.circuitpython.org/projects/azureiot/en/latest/index.html#azure-iot-central):

def command_executed(command_name: str, payload) -> IoTResponse:
    print("Payload:", payload)
    if command_name == "speaker":
        commandPlaySpeaker(payload)
    print("Command", command_name, "executed with payload", str(payload))
    # return a status code and message to indicate if the command was handled correctly
    return IoTResponse(200, "OK")

device.on_command_executed = command_executed

A similiar problem seems to have been reported on Stackoverflow: https://stackoverflow.com/questions/71110928/unable-to-send-command-from-iot-central-to-pyportal

Using CircuitPython 6.3.0 with Library Bundle 6.x on a Adafruit PyPortal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant