Relay control widgets not working for relays in raspberry pi

Relay control widgets not working for relays in raspberry pi.

Product/components used and version/fix level:

Detailed explanation of the problem:

I am using raspberry pi with sensors and relays. I am able to control the relays using shell command in cumulocity’s ‘Device Management’ platform. But when I am using ‘relay control’ widget in custom built application then I am getting a message ‘Operation not supported by this device’. Please help to solve this issue. I want to control relays using ‘RELAY CONTROL’ widget.
Thanks in advance.

Error messages / full error message screenshot / log file:

Capture relay

Question related to a free trial, or to a production (customer) instance?

Hi Lall,

your device needs to support the c8y_Relay operation: Sensor library - Cumulocity IoT Guides
In order for the Cumulocity UI to know that this operation is supported by your device, you will need to also list it within the c8y_SupportedOperations: Device management library - Cumulocity IoT Guides

Regards,
Tristan

1 Like

I am able to get the ‘Relay Control’ buttons. And also in the control tab of device I am getting ‘close relay’ and ‘open relay’ commands. But the actual relays of the device is not responding.
relay control
Please help.

Your device/agent needs to support the c8y_Relay operation.
As you are using thin-edge, you need something on your device that receives the relay operation (SmartREST 2.0 - Cumulocity IoT Guides) processes it and updates it status. You would need to connect to the respective thin-edge mqtt topics on your local mqtt broker.

Regards,
Tristan

1 Like

I am able to send relay command to switch on the relay in raspberry pi. First I sent “relayState” : “OPEN” through postman to this path ‘/inventory/managedObjects’ then I have created a file named ‘c8y_Relay’ in operations folder in raspberry pi. After that I used java program to receive relay command and send acknowledgement to cumulocity. I am able to see the relay operation ‘successful’ in control tab of 'device management. But when I am reloading the page the state of relay is not changing even after successful relay operation. Also When I am checking the state of c8y_Relay in config it is not changing.

I am sending acknowledgement in java as " client.publish(“c8y/s/us”, “503,c8y_Relay,relayState:OPEN”.getBytes(), 2, false)". This is updating the status of relay in real time but status is not getting updated in cumulocity database. Please help in updating relay status in cumulocity database.


database status not changing

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.