adafruit / adafruit/Adafruit_CircuitPython_AzureIoT
device.on_command_executed is never called, IoT Central methods can't be used
- Dominant language
- Python
- Stars
- 19
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Azure IoT Central documentation example and the device.on_command_executed entry point, then reproduce the issue using the shown IoT Central method log and environment details. Trace why the callback is not reached; done means the speaker command invokes the callback and returns the documented IoTResponse.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100