iotagent-json icon indicating copy to clipboard operation
iotagent-json copied to clipboard

device configuration retrieval via mqtt

Open SBlechmann opened this issue 3 years ago • 1 comments

Hey there,

in the user manual it says that a device can retrieve its configuration from the iotagent (which is then passed to the context broker).

The way of the device actively querying for its configuration via topic: /json/apikey/deviceid/configuration/commands payload something like: {"type": "configuration","fields": ["attr1", "attr2"]} works perfectly fine, that's already pretty nice!

Then I discovered that the device can register itself at the iot-agent so it gets a notification whenever one of the given attributes changes via subscriptions. So I did pretty much the same and but this time with topic: /json/apikey/deviceid/configuration/commands payload something like: {"type": "subscription","fields": ["attr1", "attr2"]} I checked in orion and the subscription was indeed created.

When I now patch one of the attributes attr1 or attr2 orion sends a subscription (checked on orion's subscription path -> lastSuccess and lastSuccessCode). According to the IoT Agent DEBUG logs it also received that notification from orion but apparently doesn't know what to do with it. The data wasn't really processed.

Maybe I'm just missing a piece.. but I guess there is a bug. Thanks for your help! :)

SBlechmann avatar Apr 16 '21 18:04 SBlechmann

I have created a highly insecure debug branch on my personal fork - try building it and checking what comes out in the log?

docker build -t iot-agent . \
    --build-arg GITHUB_ACCOUNT=jason-fox \
    --build-arg GITHUB_REPOSITORY=iotagent-json \
    --build-arg SOURCE_BRANCH=debug \
    --target=distroless|pm2|slim

jason-fox avatar Apr 19 '21 13:04 jason-fox