Raspberry pi Trigger with a GPIO

Hi, I’ m a bit new with Cayenne in general. Therefore my question might be trivial.

I want to create a notification service for a python script. So far, my approach was this

My python scrip do a bunch of things and set a GPIO to 1 and then a few seconds later back to 0.

Physically, the GPIO will be looped back to another GPIO that will read that bit (with a 1k resistor in between to prevent any short circuit)

I was able to monitor the state of a GPIO using Cayenne with ease. However, I can’t put the GPIO as a trigger source. IE if GPIO 2 == 1 then notify via text message.

Is this currently possible? If so, how can I do it?

Simon

Hi @simon.marcoux, thanks for your interest in Cayenne.

You should be able to accomplish this by using a Generic Digital Input widget (From Add New > Sensors > Generic) to monitor the state of the GPIO in question. Cayenne will allow you to monitor that with a 2-state widget, which can then be added to the ‘IF’ part of a trigger statement.

Hello @rsiegel,

Thank you for the update.

I was able to create a Generic Digital Input widget. I can see it on the main dashboard of my device. However, it is not listed on the left device list bar. Therefore, I’m unable to drag it to the if box nor to find a way to actually select that new widget. The widget is visible on my dashboard. Is there something that I did wrong?

You should be able to drag the parent Pi device into the Trigger creation 'IF" box, then select the Generic Digital Input widget from the dropdown menu that appears there. Although even in this case I’d still expect it to display in the left sidebar, so something more may be up here.

I have one guess, I’m going to test something on my side really quick, be right back…

Ok, thanks for your patience. I think I see what’s up.

This sounds like your Pi might be running the 4.9 Linux kernel, with which webiopi (a component of the Cayenne Pi agent software) is currently incompatible. Could you run the command uname -a to check your kernel version?

If it is showing 4.9, you can switch to the 4.4 kernel with just one command (and a reboot afterwards):
sudo rpi-update 52241088c1da59a359110d39c1875cda56496764

We have an update to the Pi agent in our QA now which should resolve this issue and allow Cayenne to work on both 4.4 and 4.9 in the near future.

If uname -a shows you are already running 4.4, let me know and I’ll continue to help troubleshoot.

My Pi was indeed running the 4.9 Linux kernel. After following your instructions, I was able to set up the trigger without any difficulty at all.

Thank you for the help! Do you have a vague timeline for 4.9 support? I don’t think I use any of the 4.9 kernel features, but I’m still curious.

1 Like

We’re hoping for this week, very soon in any case.

@simon.marcoux

Not exactly “this week”, but:

I just wanted to bump this thread to note that we’ve now updated our Pi agent to support the 4.9 kernel (it still supports 4.4 as well). The update was automatic in the background so there is nothing you need to do on your end. Feel free to use rpi-update to move forward to the 4.9 kernel at this point if you’d like!

Thank you @rsiegel

It’s a funny thing. I just started once again to tinker with that project! Life got in the way of my hobby.
Tried it with the 4.9 kernel and it works like a charm!

1 Like