I have several aqara sensors around the house and would like to have a flow to be notified that when it rains to get a notification on Google home (audio) and on the phone which states which doors and windows are open.
Please don’t get me wrong but you are asking others to do the brainwork for you in advance.
I suggest now that you are able to define your requirements and you know which devices you would like to use, you should develop the basic framework from initial flow ideas and ask specific questions about the problems where you are stuck.
Break the requirement down into individual problems:
which kind of rain detection?
how to accumulate open aqara sensors? → Here I can give you a solution based on homeyscript.
sending them to Google home as an audio announcement
sending them as a phone notification
For each of these problems you will already find a solution in this forum.
What I’m struggling with is how to report all sensors with “contact alarm on”.
The only way I see it, would be to create several flows. Though that seems like the long way and I wondered if there was an easier way to get the status from all Aqara’s sensors? Right now I have 15 sensors.
I created a HomeyScript for checking open windows.
You could do something like this in a flow started with a rain sensor.
As rain sensor I use a rain sensor board with a aqara window sensor (cables attached at the reed sensor and connected to the rain board.
Here is an example for a script (sorry, only german )
If you want to check each window sensor individual, you will need a flow for each sensor.
You yould use HomeScript to do the checks and build a text with each window and then make a TTS output. That needs some JavaScript codings, but the script (linked in my answer above) is easy to unterstand. This script can be used in a flow condition (AND part) and the text is returned an flow tag for use in THEN part.
Nice script @RonnyW
But idk if @jpcams is ready for that at this point?
JP, a quite simple approach can be something like this. It only requires adding all of your sensors to the alert message, but it works. Maybe this gets you going to more advanced flows (and scripts)
I finally sat down and looked at your script. Thanks a lot! At first I was a bit resistant to the idea as I thought since I’m not a dev, I would spend an obscene amount of time trying to decipher your hieroglyphics! Glad I was wrong and thanks again for sharing this script.
I will share my version of your script below in case it helps anyone else who is looking for a similar solution:
The variables are created and filled by the script already.
First, make sure to run the script minimal 1 time in HomeyScript editor, so the variables are getting created and become available and findable from the flow editor.
Flow:
You can simply run the script from a AND card (go to Homeyscript in the list, and then select the script), and as action, create a notification card and select the variable [windowText], which is grouped under “Homeyscript”.
Did you test the flow? What is the first condition? Is it true in your case that the flow is processed?
And keep in mind: The script is returning a bool result. So your flow will continue to the Then part only if a window is open. If you would like a message if all windows are closed, you need a push messa in the Else part like “all right, alls is closed”
The first AND is asking if not all the contact alarms are off. So that part is saying that there are contact alarms open. Then it stops at the Homeyscript part.
If I run the script with a debug line, it says that all the windows and doors are closed, but this isn’t true. So the script returns false but it should be outputting true.
Is the opened sensor included in the script?
The script ich checking only steh sensors which are defined in the IF statements (2 in your case). Perhaps another sensor is active and is not checked in the script?
That’s for a filtered check. In most cases you don’t want to check all sensors if they are used inside for other purposes. Inside the IF statement, a “short” name is provides to keep the output in the pushmessage short, because there are all open windows listed.