I am facing a challenge with my current project involving an ESP32, multiple sensors, and Home Assistant. I have set up three sensors that monitor the soil moisture of three different plants. The idea is for the ESP32 to read the information from these sensors and send it to Home Assistant, where I have an automation configured to manage irrigation.
The issue arises when multiple sensors trigger the automation simultaneously. Instead of receiving a single notification with a summary of all the plants that need watering, I get a notification for each plant that requires attention. This results in multiple notifications instead of a single, desired consolidated notification.
My goal is to optimize this process to receive a single notification that includes all the plants in need of watering, rather than individual notifications for each plant.
Below, I provide the relevant code used in ESPHome for the sensors and the Home Assistant automation:
That option does not solve my problem either, I have several sensors, in the example code, I have only included two, but I intend to manage some more, four or five.
With your proposal I do not see a way to solve the problem that I raise in the topic, sending a single notification with all the plants that need to be watered at that moment, for example, every hour, as I understand what you propose, I am managing the notification of a sensor reading.
what’s in the script your executing, flash_light_01?
What are you wanting to evaluate from each plant/sensor? Is it just the value 0-100?
What are these? ledplant_01 lights? are these physical LED’s just for visual signs to show that it’s working?
It looks like you are using the state of these lights and using them for multiple triggers. The reason you’re getting multiple notifications is because you’ve made a trigger for each one of the lights turning on, so each one fires the automation…
Personally I would just do it with a Time trigger. Maybe something like twice a day, once in the morning and another in the afternoon. So, your automation triggers twice a day and each time your going to use a condition to check the state of each LED and report which ones are ON/OFF and do the same thing for the afternoon one.
I don’t know what you could be growing that needs a moisture level reading every 100ms, that’s likely way to frequent and you’re just gonna ruin your sensors like doing that. Are you using capacitive soil moisture sensors? If you are, you definately don’t want to be doing ADC measurements very often at all, maybe a couple 2 or 3 times a day at most. I have lots of plants and trees in pots and most get watered once a week or twice a week at the most. You only need a couple readings a day.
IDK what plants you have but, plants have water requirements, like some like it moist and some absolutely don’t like excess water and will get root-rot. For most plants you should allow them to dry out some in-between watering cycles. An automation that for example checks to see if a sensor was < 30 on Monday but got watered and went to 100 the same day. If it’s <= 30 again, then check to see if it was less than 2 days ago. If it was less than 2 days then don’t turn on light(needs watering) for today but, tomorrow it can. Something like that, that helps you keep track of when you water them so you’re not constantly watering them if they dry out a little because that’s actually a good thing for most plants.
depending on the plant, I wouldn’t take moisture readings or trigger watering alerts If there’s less than 2 hours of sunlight. This is if they’re house plants or garden potted plants. Leaving plants with excess water overnight is inviting fungii problems.
These are just some ideas of things to add create a proper watering automation. You don’t want to just use some arbitrary (< 30) number and water every time it dips that low. Plants are more complicated than that.
Ah, I see! Thanks for explaining how this can be done in Home Assistant. Creating a group with all the lights and using it as a trigger seems like a practical and effective solution. I’ll definitely keep that in mind for my project.
Additionally, I really appreciate you sharing the code to retrieve the entities in the group that are turned on. This will be very helpful for me.
Thanks again for your assistance and for sharing your knowledge!
Thank you so much for your response! I’m very new to programming with esphome and also a beginner in caring for my indoor plants. I’ve always struggled to keep them alive for long periods, which has been a bit disheartening. However, since delving into home automation for my house and programming with esphome, I realized that I could potentially find a solution to my dilemma with my home plants.
I really appreciate all the advice and pointers you’ve given me regarding plant care and programming. I’ll make sure to take note of everything and reconsider my project, taking into account your valuable insights. I truly appreciate you sharing your knowledge with me. Thanks for everything!
We were all there at one point or another, just stick with it and you will start making large leaps of progress. I totally get the desire to automate something like this but, if you think about it logically. How do you automate something that you can’t successfully do manually? Meaning, if you can’t keep them alive now, how does automating something you already can’t do successfully make much sense? I don’t mean to discourage you at all. If you want to do it then by all means, go for it. I’m just trying to point out the bigger picture, thats all.
Thanks for the encouragement, buddy! Although I have to say, I don’t quite see eye to eye with your perspective. You know, everyone has their own story and circumstances, right? And in my case, I’m firm on the idea that we should do whatever it takes to overcome the ‘limitations’ that come our way. It’s like that example of running 60 km: if you can’t do it on foot, why not hop on a bike to reach the finish line anyway? Exactly! It’s not about sticking to the traditional path at all costs, but rather adapting and making the most of what we have.
So yeah, I appreciate the positive vibes, but that last comment didn’t quite hit the mark. Everyone finds their own way, and I’m here to do it my way, with the tools I have at my disposal. Let’s keep moving forward with all the energy, buddy! If you need more pep talks or advice, you know where to find me. Let’s go for it!