1

I am trying to see the best way to restart the Raspberry PI from Cumulocity, out of the box using PI agent.

This is a use case where the CPU temperature of PI goes up, Cumulocity will trigger a restart. So far the work I have done does the following

  1. Send measurements from PI via MQTT (python paho client). I can see them show up in Cumulocity
  2. Using Shell options in cumulocity UI, I send a manual a manual restart message
  3. Subscribe the restart message in python client and then issue a restart to PI

To summarize I would like to how to read the measurements received in Cumulocity and if it reaches above a certain value, trigger an automatic restart of the PI device. That is skip steps b and c above and make it automatic.

Thanks for your help, JM

Ignacio Alorre
  • 7,307
  • 8
  • 57
  • 94

1 Answers1

3

If you see the measurement in the data point explorer, select "Create Smart Rule" and either "On measurement threshold create alarm" or "On measurement explicit threshold create alarm". Configure the threshold and the alarm type.

When you see the alarm, click on it and again select "Create Smart Rule", using "On alarm execute operation". The template has already restart in it, so you can just click OK.

You can do the same directly by clicking on "Smart Rules", but then you have to enter the measurement names and alarm types manually.

André
  • 668
  • 6
  • 11
  • I think that you have to handle this rule from your agent and after that you can execute script(bash script) - https://stackoverflow.com/questions/13707519/running-a-bash-shell-script-in-java/13707564 to restart your Rasberry – Fortran Oct 16 '19 at 08:43