Relay stops working after reboot

Thank you for taking the time to submit your bug/issue! Please use the points below as a guide when submitting.

  • Device & model you are using (Ex: Pi 2 Model B or Arduino Uno with W5100 ethernet shield)

  • What dashboard are you using? (Web, iOS, Android)

  • Please describe the bug / issue as detailed as possible. Attaching the code and any relevant screenshots would be very helpful!

Raspberry Pi Zero W
Web Dashboard

I am using a Raspberry Pi Zero W to control a relay that opens and closes a water valve. When I create the device it works great. If I shutdown or reboot the Pi it no longer works and I have to recreate the device.

Thanks
Mike

I have done some testing. This only seems to be problem with the RPi Zero. I setup a 3b RPi and the relay works fine after reboots and shutdown. I then installed a fresh OS on the RPi Zero and tried again getting the same results, the relay stops functioning after reboot or shutdown.

Are you using the Pi Agent or some other method for connection?

I’m not familiar with pi agent.

Have you installed cayenne on your pi? If yes, have you used the command from the cayenne dashboard for installation?

Yes. As I said it is all installed and working fine until I reboot the Pi zero.

once you reboot can you share the log files -
tail -f /var/log/myDevices/cayenne.log

Yes. When I get back in today.

2021-06-15 19:00:41 - myDevices - INFO - ExecuteMessage: {‘cmdId’: ‘Lr0FxsxDKnJztnz’, ‘payload’: ‘0’, ‘channel’: ‘dev:LI88swpIxz02yxL’}

2021-06-15 19:00:41 - myDevices - INFO - SensorCommand: value, sensor LI88swpIxz02yxL, channel None, value 0

2021-06-15 19:00:41 - myDevices - INFO - Checking for LI88swpIxz02yxL in dict_keys()

2021-06-15 19:00:41 - myDevices - INFO - Sensor found: {‘class’: ‘ValveSwitch’, ‘device’: <helper.ValveSwitch object at 0xb5937fb0>, ‘description’: ‘Valve Switch’, ‘args’: {‘gpio’: ‘GPIO’, ‘channel’: 13, ‘invert’: False, ‘last_state’: 1}, ‘type’: [‘DigitalActuator’], ‘status’: 1, ‘functions’: {‘GET’: {}, ‘POST’: {}}, ‘origin’: ‘rest’}

2021-06-15 19:00:41 - myDevices - INFO - Saving state 0 for device LI88swpIxz02yxL

2021-06-15 19:00:41 - myDevices - INFO - ok,Lr0FxsxDKnJztnz

2021-06-15 19:00:50 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:LI88swpIxz02yxL’, ‘value’: -1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Valve Switch’}]

2021-06-15 19:00:52 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 2.0}, {‘sys:cpu;temp’: 36.856}, {‘sys:ram;usage’: 100081664}, {‘sys:storage:/;usage’: 1453780992}, {‘dev:LI88swpIxz02yxL’: -1}, {‘sys:gpio:13;value’: -1}]

2021-06-15 19:01:05 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:LI88swpIxz02yxL’, ‘value’: -1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Valve Switch’}]

2021-06-15 19:01:07 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 54.5}, {‘sys:cpu;temp’: 37.932}, {‘sys:ram;usage’: 104026112}, {‘sys:storage:/;usage’: 1453789184}]

2021-06-15 19:01:20 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:LI88swpIxz02yxL’, ‘value’: -1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Valve Switch’}]

2021-06-15 19:01:22 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 0.0}, {‘sys:cpu;temp’: 36.856}, {‘sys:ram;usage’: 104407040}, {‘sys:storage:/;usage’: 1453793280}, {‘sys:net;ip’: ‘10.0.0.159’}, {‘sys:net;speedtest’: 2.7831759795213915}, {‘dev:LI88swpIxz02yxL’: -1}] + sys:gpio

2021-06-15 19:01:35 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:LI88swpIxz02yxL’, ‘value’: -1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Valve Switch’}]

2021-06-15 19:01:37 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 9.8}, {‘sys:cpu;temp’: 35.78}, {‘sys:ram;usage’: 104390656}]

2021-06-15 19:01:47 - myDevices - INFO - OnMessage: {‘cmdId’: ‘nxwqw2LqsFIzJww’, ‘payload’: ‘0’, ‘channel’: ‘dev:LI88swpIxz02yxL’}

2021-06-15 19:01:47 - myDevices - INFO - ExecuteMessage: {‘cmdId’: ‘nxwqw2LqsFIzJww’, ‘payload’: ‘0’, ‘channel’: ‘dev:LI88swpIxz02yxL’}

2021-06-15 19:01:47 - myDevices - INFO - SensorCommand: value, sensor LI88swpIxz02yxL, channel None, value 0

2021-06-15 19:01:47 - myDevices - INFO - Checking for LI88swpIxz02yxL in dict_keys()

2021-06-15 19:01:47 - myDevices - INFO - Sensor found: {‘class’: ‘ValveSwitch’, ‘device’: <helper.ValveSwitch object at 0xb5937fb0>, ‘description’: ‘Valve Switch’, ‘args’: {‘gpio’: ‘GPIO’, ‘channel’: 13, ‘invert’: False, ‘last_state’: 0}, ‘type’: [‘DigitalActuator’], ‘status’: 1, ‘functions’: {‘GET’: {}, ‘POST’: {}}, ‘origin’: ‘rest’}

2021-06-15 19:01:47 - myDevices - INFO - ok,nxwqw2LqsFIzJww

2021-06-15 19:01:50 - myDevices - INFO - Sensors info: [{‘channel’: ‘dev:LI88swpIxz02yxL’, ‘value’: -1, ‘type’: ‘digital_actuator’, ‘unit’: ‘d’, ‘name’: ‘Valve Switch’}]

2021-06-15 19:01:52 - myDevices - INFO - Send changed data: [{‘sys:cpu;load’: 29.8}, {‘sys:cpu;temp’: 36.318}, {‘sys:ram;usage’: 104501248}, {‘sys:storage:/;usage’: 1453801472}]

2021-06-15 19:01:47 - myDevices - INFO - OnMessage: {‘cmdId’: ‘nxwqw2LqsFIzJww’, ‘payload’: ‘0’, ‘channel’: ‘dev:LI88swpIxz02yxL’}

2021-06-15 19:01:47 - myDevices - INFO - ExecuteMessage: {‘cmdId’: ‘nxwqw2LqsFIzJww’, ‘payload’: ‘0’, ‘channel’: ‘dev:LI88swpIxz02yxL’}

2021-06-15 19:01:47 - myDevices - INFO - SensorCommand: value, sensor LI88swpIxz02yxL, channel None, value 0

2021-06-15 19:01:47 - myDevices - INFO - Checking for LI88swpIxz02yxL in dict_keys()

2021-06-15 19:01:47 - myDevices - INFO - Sensor found: {‘class’: ‘ValveSwitch’, ‘device’: <helper.ValveSwitch object at 0xb5937fb0>, ‘description’: ‘Valve Switch’, ‘args’: {‘gpio’: ‘GPIO’, ‘channel’: 13, ‘invert’: False, ‘last_state’: 0}, ‘type’: [‘DigitalActuator’], ‘status’: 1, ‘functions’: {‘GET’: {}, ‘POST’: {}}, ‘origin’: ‘rest’}

2021-06-15 19:01:47 - myDevices - INFO - ok,nxwqw2LqsFIzJww

this logs show that the data is received from the dashboard. not sure what else can be issue.
Could you check for that VavleSwitch in /etc/myDevices/devices.json and see if it’s still there after reboot.

[ { “name” : “LI88swpIxz02yxL” , “description” : “Valve Switch” , “device” : “ValveSwitch” , “type” : [ “DigitalActuator” ] , “status” : 1 , “args” : { “gpio” : “GPIO” , “channel” : 13 , “invert” : false , “last_state” : 0 }, “origin” : “rest” , “install_date” : 0 } ]

I have also tried this with the relay device and Generic. I get the same results, it works when first installed and after reboot stops working. They all work fine even after reboot on a RPi 3b.

it might some issue with the power supply. are you powering relay from raspberry pi?

Only on the 5v side. The 12v side has it’s own external power for the valve.

can you try powering the 5V from an external source.

I can. I will try and get that setup asap and let you know.

I have a 5v power supply coming today that I can use to power the relay separately.

1 Like