Send Text Messages through cayenne

Hello, I explain what I would like to do in a few words:
On my raspberry pi: when the motion detector detect a moviment, I want to wait 30 seconds and if the program in the meantime has not been stopped, a motion notification message is sent to the phone.

The 30 seconds give the time to a person, if enters the house, to stop the program to avoid unnecessary notification.

How can I do this?

P.s: adding the sensor to the mydevices dashboard and set a notification when the motion detector output is high, isn’t good because every time a person enters home, it generate a notification.

Good idea is to maintain just the state in Cayenne and make your logic in background of Raspberry. What if a thief cut your internet connection? I think you have to use additional shield :slight_smile:

I do not know how to send sms through raspberry, but here is a very good article: Send and Receive SMS Messages Using Raspberry Pi and Python – My Blog

1 Like

…or assuming a thief doesn’t have easy access, use the timer library to call a function after 30 seconds. The first thing the function checks is if a defeat switch has been pressed and if not, flips a virtual out.

Then you use Cayenne to send a text when that virtual is tripped.

Cheers,

1 Like

I understand, but I don’t know how to to send a digital data of 1 when the sensor detect a motion.
I use python and I found this cayenne-mqtt · PyPI , but I can’t find the function to send only a digital data; in the examples there is only
client.celsiusWrite(1, i) client.luxWrite(2, i*10) client.hectoPascalWrite(3, i+800)
and the documentation doesn’t exists: if I try with pydoc cayenne.client i get this message: no python documentation found for ‘cayenne.client’

Thank you!!

You can send data to some virtual pin using client.virtualWrite(1, 123456)

where the one is Virtual Pin and 123456 is the value :slight_smile:

Cayenne.virtualWrite(vPin, value)

2 Likes

Thank you very much.
I added this to my code: client.virtualWrite(2, 1)
To send on channel 2 the value of 1, but I don’t know how to set the trigger.
In my code there is something like that:
if sensor detect motion → client.virtualWrite(2, 1)

But I don’t know how to set the trigger so that if the value on the channel 2 is 1, it starts.
How to set “min” “step” “value” “max” and “sensor above” or “sensor below”?