Cumulocity-IoT / cumulocity-devicemanagement-agent

Cumulocity Reference Agent written in Python to demonstrate most of the Device Management Capabilities of Cumulocity IoT
Apache License 2.0
26 stars 20 forks source link

Required Interval is not updated on Cloud Device #60

Closed ButKor closed 1 year ago

ButKor commented 2 years ago

I've tried to change the required interval via Cumulocity Text-baed Configuration, which did succeed only partly. Reproduction steps:

  1. Start and register agent in Cumulocity with default configuration
  2. Go to the Device in Devicemanagement, note that the required Interval in Info Tab is 10
  3. Go to Configuration > Text-Based Configuration and change field agent.requiredinterval to e.g. 13. Send the configuration to the device
  4. Agent picks it up, operation succeeds
  5. With "getting snapshot from device" you can see the new configuration got transferred to Cumulocity
  6. However: The required interval in Info Tab is still at 10 Minutes, also the ManagedObject field is at 10 Minutes => seems the update of the MO has an issue.

The logs dont tell anything specific, this is the received operation:

2022-07-21 18:50:21,977 ListenerThread-ConfigurationManager INFO c8ydm.core.configuration Configuration Operation received: ['3bc64215ffe1', '"mqtt.url=mqtt.eu-latest.cumulocity.com\nmqtt.port=8883\nmqtt.tls=true\nmqtt.cert_auth=false\nmqtt.client_cert=/root/.cumulocity/certs/chain-cert.pem\nmqtt.client_key=/root/.cumulocity/certs/device-cert-private-key.pem\nmqtt.cacert=/etc/ssl/certs/ca-certificates.crt\nmqtt.ping.interval.seconds=60\nagent.name=dm-example-device\nagent.type=c8y_dm_example_device\nagent.main.loop.interval.seconds=10\nagent.requiredinterval=13\nagent.loglevel=INFO"']
ButKor commented 2 years ago

Note that I just read in https://cumulocity.com/guides/10.11.0/reference/smartrest-two/#set-required-availability-117: This will only set the value if it does not exist. Values entered, e.g. through the UI, are not overwritten.

So could fairly be that the expected behaviour this is blocked by the smart rest template itself.

switschel commented 1 year ago

Hi @ButKor

actually it is not implemented to handle single property changes in txt config updates. It will just update the local config file and that's it. No update of MO properties so far implemented (except updating c8y_Config). Workaround: Change the required interval. Restart the agent :-)