Rain sensor and a window left open reminder


#1

1) Give a description of the problem
I would like to make a Piston so that when detecting water in a sensor that would be on the outside of the house, check which windows are open and give me a warning that it is raining and that windows X and Y are open and that they need to be closed

2) What is the expected behaviour?
I would like to make a Piston so that when detecting water in a sensor that would be on the outside of the house, check which windows are open and give me a warning that it is raining and that windows X and Y are open and that they need to be closed

3) What is happening/not happening?
It´s not working
**4) Post a Green Snapshot of the piston![image|45x37]


(UPLOAD YOUR IMAGE HERE)

5) Attach logs after turning logging level to Full


#2

I would start the piston by triggering on the water sensor first…

IF Water Sensor 3 changes to wet
Then
check for open windows
send notification to Music Player 4
send your PUSH and SMS
END IF

Then, if you are having problems, post a green shot and logs with TRACE turned on.


#3

The ‘No such Property’ error you are receiving is related to the variable ContactsOpen, you did not define. You are effectively trying to save your open devices to a non-existent variable.

But I agree with @Pantheon, your initial trigger should be the rain


#4

Thank you very much for your quick response. I made the modification you suggested, unfortunately I can’t test it now because I’m at work. Was the modification done correctly?
Another thing, I don’t know how to this green shot and logs with TRACE turned on


#5

Here is a link to the Log & Trace article on the Wiki.


#6

I don’t think it’s going to work. A couple of things, you still did not define the variable.

Also you can change the While to only Contactstocheck is open.

You can put your delays in the while loop before it starts to execute the messages. As soon as it closes then the while is no longer true and it exits.


#7

One other observation… A trigger inside of a trigger will rarely work.

Usually, we use triggers to kick off the piston, and conditions to control the flow afterwards.


#8

Agree with @Terminal. You want to get down to only the one trigger which is the rain. Then your while should be a condition (‘is open’) that once false will end the piston execution. Also, you can put the push and SMS notifications in the same ‘with’ block with the music player. Then add a wait for how soon you ant the messages to repeat.


#9


I would like to thank everyone for their collaboration. I made some changes according to what I understood from the suggestions


#10
  1. You need to define your variable ContactsOpen in the define area as a device.
  2. I would make my first IF the only trigger by doing…

IF Water Sensor 3 changes to wet
Then
Do Stuff

If you have a condition ContactsToCheck contact changes to open, then every time you open a window(s), this piston might execute.


#11

There are many ways to accomplish what you are trying to do. I have not tested this, but I would try…

IF Water Sensor 3 changes to wet   <-Trigger
  Then
    Do
      IF ContactsToCheck's contact is open
         Save matching devices to ContactsOpen
      While ContactsOpen contact is open
        Do Stuff
      END While
END IF

Tip : Remember that you are only allowed 50 SMS messages a day. So doing them every 5 seconds could be quite irritating and will use your 50 up quickly.


#12

Thank you very much, I managed to identify the error, really that way it was impossible to run.
I made the modification and ran the webCORE test. When I get home I will test Piston


image


#13

I tried three different Pistons but none of them managed to identify which window is open so that in the warning he would only warn me of this open window.


#14

In your define section, define a variable ‘contactsOpen’ but do not assign a value. Then add back in your ‘save matching devices to contactsOpen’. Finally, change your while loop to look at ‘contactsOpen’.