0

I've registered my Raspberry Pi device with Cumulocity. Now I just wanted to switch on/off LED which is connected with Pi through Cumulocity.

Is it possible and if so how to proceed?

balaji
  • 1,236
  • 2
  • 18
  • 28

1 Answers1

0

I would propose to use the operation c8y_Relay (http://cumulocity.com/guides/reference/sensor-library/) because it is basically this on(off logic and there are already widgets in the UI to trigger the operation (Can be added to dashboards).

On the device side you would first need to add c8y_Relay to the supportedOperations and then implement an OperationExecutor that will handle the operation and switch the LED (assuming you are using the agent from the example repository)

TyrManuZ
  • 2,039
  • 1
  • 14
  • 23
  • Could you give some hints on how to implement "OperationExecutor" on device? I've installed "cumulocity-rpi-agent-latest.deb" – balaji Nov 16 '16 at 11:31
  • Sure, check this: https://bitbucket.org/m2m/cumulocity-examples/src/559adbe7376eec15077d437b5baaf05ec3bf554f/java-agent/mac-driver/src/main/java/c8y/mac/MacHardwareDriver.java?at=default&fileviewer=file-view-default Check getSupportedOperations() and execute(). You could also try PiFace. No guarantee, but it should be able to switch an LED on the outputs. – André Nov 16 '16 at 11:53
  • So, You mean to say that I need do modify/extend the java client and need to reinstall the package(modified one) on Pi device. – balaji Nov 16 '16 at 12:14