Relay switch to control lamp

Hello,

I’m trying to use a relay to control a lamp.
I’m using this relay:

I followed all instructions of cayenne docs:
https://developers.mydevices.com/cayenne/docs/supported-hardware/#supported-hardware-actuators-relay-relay-switch

But when I create a widget in my dashboard (relay switch) and sucessfully install it, it does not control the lamp. The lamp only stays on or always stays off, even if i press the widget (depending if I connect it to NO or NC of the relay)

Can anyone help?

Thank you in advance!

which pin have you connected your relay to? and have you selected the same pin while adding the relay switch to cayenne dashboard.

I tried out every pin (GPIOs) and not one works

Should I try in a specific pin (GPIO) ? Do I have to configure the system in a certain order?

On your pi terminal run this command to show the logs tail -f /var/log/myDevices/cayenne.log
then, turn ON/OFF the button on your dashboard and see if get the button command populating in the log.

I typed that command in pi terminal.
When I click in the ON/OFF button on dashboard, some code appears on the pi terminal after I typed that code, but the lamp is still on

can you share what was shown in the terminal.

the important things are getting cutoff, can you copy and paste it?

Here is the code it appears on terminal, when I use button of dashboard (of the relay switch):

"
pi@raspberrypi:~ $ tail -f /var/log/myDevices/cayenne.log
2020-02-12 15:26:33 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:Guwpz5w3wEytpLK’, ‘value’: 1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Relay Switch’}]
2020-02-12 15:26:35 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 42.6}, {‘sys:cpu;temp’: 47.774}, {‘sys:ram;usage’: 407969792}, {‘sys:storage:/;usage’: 8737439744}]
2020-02-12 15:26:48 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:Guwpz5w3wEytpLK’, ‘value’: 1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Relay Switch’}]
2020-02-12 15:26:50 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 9.7}, {‘sys:cpu;temp’: 48.312}, {‘sys:ram;usage’: 415506432}, {‘sys:storage:/;usage’: 8737538048}]
2020-02-12 15:27:03 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:Guwpz5w3wEytpLK’, ‘value’: 1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Relay Switch’}]
2020-02-12 15:27:05 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 66.7}, {‘sys:cpu;temp’: 49.388}, {‘sys:ram;usage’: 430272512}, {‘sys:storage:/;usage’: 8737566720}]
2020-02-12 15:27:19 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:Guwpz5w3wEytpLK’, ‘value’: 1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Relay Switch’}]
2020-02-12 15:27:20 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 49.1}, {‘sys:cpu;temp’: 50.464}, {‘sys:ram;usage’: 438038528}, {‘sys:storage:/;usage’: 8743780352}, {‘sys:net;ip’: ‘10.65.13.22’}, {‘dev:Guwpz5w3wEytpLK’: 1}] + sys:gpio
2020-02-12 15:27:34 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:Guwpz5w3wEytpLK’, ‘value’: 1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Relay Switch’}]
2020-02-12 15:27:35 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 67.3}, {‘sys:cpu;temp’: 51.54}, {‘sys:ram;usage’: 468434944}, {‘sys:storage:/;usage’: 8744603648}]
2020-02-12 15:27:48 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:Guwpz5w3wEytpLK’, ‘value’: 1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Relay Switch’}]
2020-02-12 15:27:50 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 1.3}, {‘sys:cpu;temp’: 51.002}, {‘sys:ram;usage’: 472363008}, {‘sys:storage:/;usage’: 8745037824}]
2020-02-12 15:27:59 - myDevices - INFO - OnMessage: {‘cmdId’: ‘2EttJDsM5uv0J5u’, ‘payload’: ‘0’, ‘channel’: ‘dev:Guwpz5w3wEytpLK’}
2020-02-12 15:27:59 - myDevices - INFO - ExecuteMessage: {‘cmdId’: ‘2EttJDsM5uv0J5u’, ‘payload’: ‘0’, ‘channel’: ‘dev:Guwpz5w3wEytpLK’}
2020-02-12 15:27:59 - myDevices - INFO - SensorCommand: value, sensor Guwpz5w3wEytpLK, channel None, value 0
2020-02-12 15:27:59 - myDevices - INFO - Checking for Guwpz5w3wEytpLK in dict_keys()
2020-02-12 15:27:59 - myDevices - INFO - Sensor found: {‘class’: ‘RelaySwitch’, ‘device’: <helper.RelaySwitch object at 0x74b9dd90>, ‘description’: ‘Relay Switch’, ‘args’: {‘gpio’: ‘GPIO’, ‘channel’: 26, ‘invert’: False, ‘last_state’: 1}, ‘type’: [‘DigitalActuator’], ‘status’: 1, ‘functions’: {‘GET’: {}, ‘POST’: {}}, ‘origin’: ‘rest’, ‘install_date’: 1581521037}
2020-02-12 15:27:59 - myDevices - INFO - Saving state 0 for device Guwpz5w3wEytpLK
2020-02-12 15:27:59 - myDevices - INFO - ok,2EttJDsM5uv0J5u
2020-02-12 15:28:03 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:Guwpz5w3wEytpLK’, ‘value’: 0, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Relay Switch’}]
2020-02-12 15:28:05 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 54.5}, {‘sys:cpu;temp’: 52.078}, {‘sys:ram;usage’: 492789760}, {‘sys:storage:/;usage’: 8746221568}, {‘dev:Guwpz5w3wEytpLK’: 0}, {‘sys:gpio:26;value’: 0}]
2020-02-12 15:28:15 - myDevices - INFO - Checking for updates…
2020-02-12 15:28:18 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:Guwpz5w3wEytpLK’, ‘value’: 0, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Relay Switch’}]
2020-02-12 15:28:20 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 87.6}, {‘sys:cpu;temp’: 53.154}, {‘sys:ram;usage’: 520876032}, {‘sys:storage:/;usage’: 8747159552}, {‘sys:net;ip’: ‘10.65.13.22’}, {‘dev:Guwpz5w3wEytpLK’: 0}] + sys:gpio
"

you are getting the value fir the relay pin. so check if your relay connection is correct.

Is this correct way?

which pin have you added the relay button on the cayenne dashboard?

In terms of eletrical/digital connections:

230V wiring as follows:
I connected the live wire to the lamp, then I connected the live wire from the lamp to the NO terminal of the relay switch.
I connected the neutral wire directly to the COM terminal of the relay switch.

5V wiring as follows:
I connected the VCC terminal of relay to the 5V pin of raspberry.
I connected the ground terminal of relay to the ground pin of raspberry.
I connected the IN terminal of relay to the GPIO 26 (PIN 37) of raspberry.

i am referring to button on cayenne dashboard.

can you share a screenshot of your cayenne dashboard.

the relay switch button currently present on your dashboard, you have added it with Pin number?

I installed like this: