Getting the hang of this, still getting stuck on variables


#1

I want a mailbox monitor to do this. Please point to why I can’t find the option.

If
mailbox contact
changes to open
then using
Samsung R1 office, Samsung R1 Den
Speak text
Your Mail Has Arrived!

Now the next two things i was not able to find.

If the above conditions are met send push notification, “Your Mail Has arrived”

"now I have that part, I think. But the next part I am not sure where I do this."
wait
5 minutes
resume Piston

Now my thoughts for the wait 5 minutes is that after the postman delivers the mail and closes the box, the box if opened within that 5 minutes will not allow the text to be spoken. If I go get the mail within 5 minutes. After the five minutes opening the box will again announce “My Mail Has arrived!”

Is the logic available, and is my thinking sound?


#2

You could add a condition like this one :

“If contact has not changed in the last 5 minutes”

This way you could get rid of the wait and everything else.

Result would be if contact open AND contact has not changed in the last 5… THEN …


#3

That won’t work, as after the mai is delivered the postman closes the door to the mailbox, so the contact changes to closed.


#4

I might not fully understand what you are trying to achieve then.

What I think you wanted is to be notified when mails arrive and not be notified again if you get your mail within 5 minutes.


#5

OK.

  1. When the mailbox is opened and mail is delivered and mailbox closed. Send text and speak text. Then wait 5 minutes where no push of text is spoken, allowing me to open the mailbox get the mail close it.

#6

I’m afraid I’ll have to stand with my suggestion then. Maybe you can give it a try? Also, I’d personally use contact changes to close instead of open as trigger.


#7

OK, I am willing an able to try. But I need assistance on where to find the options for the wait, push notifications.


#8

How about something like this.
I’ve never tried it so I don’t know if it works.
If contact changes to closed. (Mailman has closed mailbox).
DO the stuff you want.
Pause piston.
Wait 5 minutes.
Resume piston.


#9

You won’t need wait. Try this:

(Execute)
If
Devicename contact changes to close
AND
Devicename Contact has not changed in the last 5 minutes

Then
Speak…
Push…
(End execute)

This way, when the mailman closes the contact (which has been closed for more than 5 minutes, unless you opened it before he comes) the condition block will eveluate true. During the next 5 minutes, if you close the contact again (meaning you took your mail), the condition block will evaluate false because contact has changed in the last 5.

That being said, you will be notified again if you take your mail after the 5 minutes threshold. One way to work around that would be to add a Boolean that resets everyday at desired time.

I can help you with that last part if you are interested :slight_smile:

Edit : Are you trying to be notified every 5 minutes until you do go get your mail?


#10

OK nothing happens, no Push no speaking text. Below is the Piston. I think the problem is with this If

Devicename contact changes to close

AND

Devicename Contact has not changed in the last 5 minutes

Then


#11

Your second condition is wrong, making the block evaluate false every time.

Use DeviceName contact (and not $status) did not change in the last 5 minutes.


#12

That will never work.
You have a changes and a not changed in the same evaluation.


#13

Yes I caught that, but still no push or speaking text. Take a look I changed it.


#14

I changed it to this.!


#15

Not sure that will work either.
Personally I would follow the suggestion of using a Boolean variable.
IF
Contact sensor changed to closed.
AND
Variable contact is not true.

THEN
WITH
Samsung speaker.

DO
Speak text.
Send notification…
Set variable contact to true.
Wait 5 minutes.
Set variable contact to false.

Edit. Do you want one posted to copy?


#16

Very true! @joelw135 I misguided you and I’m sorry for this. I’ll think of an alternative… Boolean would be the way to go I think.


#17

Import this if you wish.
EDIT. CHANGED TCP.


#18

Oh yes that would be fantastic. This is my 15th try at this. I had it in CoRE using Boolean, but a flaw in CoRE made it disappear after a week or so.


#19

Posted above.


#20

OK here is what I did, but It isn’t working. As when I open the mailbox it should send a PUSH and Speak Text which it isn’t. Please check my work.