8000 device.on_command_executed is never called, IoT Central methods can't be used · Issue #58 · adafruit/Adafruit_CircuitPython_AzureIoT · GitHub
[go: up one dir, main page]

Skip to content
device.on_command_executed is never called, IoT Central methods can't be used #58
Open
@Grudon

Description

@Grudon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0