jeroenterheerdt / HAsmartirrigation

Smart Irrigation custom component for Home Assistant
MIT License
308 stars 48 forks source link

[REQ] Beta14 - Give the possibility to input precip mm/h directly #257

Closed Detmud closed 8 months ago

Detmud commented 8 months ago

Interfaces asks for Liter/h and m^2 but in Beta12 i saw that you just use it to calculate the Precip Rate. Most People using Rainbird or other Brands have that information easier at hand then the m^2 and Liter/h

Solution: Let People choose what to input.

jeroenterheerdt commented 8 months ago

Ehhm, no. We need total precip not precip rate. If you only have precip rate, you need to convert to total precip. Total precip should be in mm or inch.

jeroenterheerdt commented 8 months ago

won't fix

Detmud commented 8 months ago

Hello, I know you closed it and I respect that, but I dont understand your answer. You ask me to input 2 Values

In your code you then calculate the precipitation rate

    # calculate precipitation rate (mm / hour)
    self.precipitation_rate = (self.throughput*60) / self.area

(I know thats not the 2.0 calculation but i cant find it fastly, you really rewrote the whole code. Cudos for that)

I just ask you to not do that, but ask for the precipitation_rate of the Zone as Input.

Because $1mm = 1l/m^2$ therefore §1\frac{mm}{h} = 1 \frac[{l/m^2}{h}$. The Area just doesn´t matter if a person is able to input the preciptate_rate you dont need the rest.

See: https://www.rainbird.com/sites/default/files/media/documents/2022-02/d37200t_2022_dom_turf_catalog_v6_0.pdf as reference what people have as information easily on hand.

jeroenterheerdt commented 8 months ago

wait, so you are saying we should ask people to do math while they have a piece of software that can do the math for them? I mean, I think our users know the area and likely the throughput of their irrigation system (if they don't know that they can look it up easily). Why then asking them to do the math first? Just do the math for them. I doubt your premise that people have the precip rate at hand is true. They will have some notion of the m2 / sq ft they are watering and the output of the sprinklers they can look up easily. (And first I was confused and I thought you were talking about total precipitation for the day (rain), but this is about the output of the irrigation system.)

Detmud commented 8 months ago

wait, so you are saying we should ask people to do math while they have a piece of software that can do the math for them?

No, because its written in the Spec of the Sprinkler mm/h is a common value for a lot of brands.

I mean, I think our users know the area and likely the throughput of their irrigation system (if they don't know that they can look it up easily).

I agree with area, i mean at least roughly right ?. I dont know about the the throughput. Have a look at the Sheets of TORO: https://cdn2.toro.com/en/-/media/Files/Toro/professional-contractor/Spray-Head-Nozzles/MPR-Plus-Nozzles/mpr_plus_cat_pg.ashx Hunter: https://www.hunterindustries.com/print/pdf/node/884 Rainbird: https://www.rainbird.com/sites/default/files/media/documents/2022-02/d37200t_2022_dom_turf_catalog_v6_0.pdf

Those are the biggest Player in that Market and they all give you the Precip Rate, some the Flowrate. Therefore i would not assume people know the real throughput. Maybe they know the maximal throuhput.

Why then asking them to do the math first?

I didnt do that, i ask to give the possibilit to alternative input the precip rate directly, otherwise people like me need to do the math.

Just do the math for them. I doubt your premise that people have the precip rate at hand is true.

Agree to disagree on that one.

They will have some notion of the m2 / sq ft they are watering and the output of the sprinklers they can look up easily.

Once again agree with the area. but with regard to output this one i doubt. I give you an example. I have a Rainbird HE-VAN 15 which has a flowrate of 14l/m at 360°. Those things are arc adjustable, so at 180degree its 7l/min 90degree its 3,5l/min. I would now need to calclulate each Springer for alle degrees to get the whole x l/min pro zone. (I know i can calculate it also prom the precip rate, its just an example) So no its not easy to look up in certain cases, I think your notion of a sprinkler is different then mine.

(And first I was confused and I thought you were talking about total precipitation for the day (rain), but this is about the output of the irrigation system.)

Ahhh no sorry that would make no sense totally agree.

Btw, i dont want to attack you or your work, i just want to help to improve the product. So please lets keep those comments friendly. Your last comment was a little rude.

jeroenterheerdt commented 8 months ago

I didn't mean to come off as rude, so my apologies for that. I didn't mean it. Now, to the topic, are we talking about the same thing? I mean, to determine the throughput of a zone you'd take the rate in lpm or gpm of each sprinkler in the zone and add it. That's the throughput the component expects. Add in the size and we have everything we need. Throughput = sum of lpm/gpm of all sprinklers in zone.

My hunter / rainbird sprinklers do not have a defined rate in mm/ hour or inch / hour but do have a nozzle that has a defined output Ipm / gpm. That is the number I use.

Now if someone wanted to provide rate in mm/h or in/h we would have to rethink the calculations which could be sizable operation. Maybe you are into something though. But how do I use the rate to calculate how long to run the sprinklers given the area? Not sure I am seeing the math (I am probably just confused). Ideally we should provide both options so the user can fill in either depending on the info they have. I happen to have flow rate in gpm and used that and am happy with the result. Looking at the links you provided it looks like most sprinklers either have a flow rate in gpm (I called it throughput in the integration or the precipitation rate in mm/h or in/h. One reason to stick with flow rate / throughput is the confusion we had in this thread originally: there is precipitation rate of spinklers and precipitation rate of rain :)

Detmud commented 8 months ago

My hunter / rainbird sprinklers do not have a defined rate in mm/ hour or inch / hour but do have a nozzle that has a defined output Ipm / gpm. That is the number I use.

First sorry bad english, in my comment i was talking about the nozzle not the spray heads. And I will stay for this comment in the metric system because calculations are easier that way.

With regard to

Maybe you are into something though. But how do I use the rate to calculate how long to run the sprinklers given the area?

Well that question got me also when i was planing my irrigation system. if you have the flowrate in mm/h thats indepent of the area. have a look at the speccheats from my earlier comment You will see that if you adjust the arc of the Nozzles the flowrate (water through nozzle) goes down, because the area you put water on gets smaller. But the preciprate of the nozzle is not changing.

Why is this the case? Because the preciprate already is flowrate/area or in other Terms $1\frac{mm}{h} = 1 \frac{l/m^2}{h}$. Maybe in other words. if you lose water in the ground you can assume you lose the same amount no matter the area. So lets say you lose 10mm water trough evaporation. Then i need to run a Zone with 5mm/h preciprate (through nozzle) for 2h. $2h \cdot 5\frac{mm}{h} = 10mm$ You see no area needed 👍

If you have multiple Nozzles in the same Zone with different preciprates (which you shouldnt do, very very bad design, except you know what you are doing) you can input it as weighted average (10 + 10 + 5 +5 /4 = 7.5)

You just dont need the area, for that calculation. You need it to calculate the preciprate of the nozzle if you just have the throughput of the nozzle.

jeroenterheerdt commented 8 months ago

that makes sense, thanks for explaining this. So if we would change to flow rate then we don't need area any more. Interesting. I do happen to have multiple nozzles in the same zone though. Right now, I just sum them using flow rate in lpm/gpm, but you're saying that if you take precip rate in mm/h or in/h you should take the weighted average? However, here's the problem. I use a mix of sprinklers and drip systems it just so happens that I don't have a rate in mm/h at all. Drip systems only provide a lpm/gpm for as far as I can find. My Rainbird 32SA are not mentioned in the links above. The only thing I can find about these is a flowrate in lpm/gpm. Hence, my case: we cannot assume you have precip rate. The reverse seems true: If you have a precip rate chances are you have a flow rate as well.

So, the options: a) switch to precip rate (mm/h / in/h) exclusively. Wouldn't work for drip systems and people that have sprinklers without defined flow rate. Also needs big change in system and chance of new bugs. b) stick with flow rate (lpm / gpm) exclusively. Works for drip systems and sprinklers because seems to be defined always AFAIK. Current implementation, no need to change anything. c) provide both. Complicates set up a and confuses people. Also needs big change in system and chance of new bugs.

My conclusion: Unless we can proof you can always have a precip rate we should not go for A. C is great, but it involves work and has the risk of extra confusion.

Detmud commented 8 months ago

Didnt thought about dripsystems. Good Point.

Totally agree with you, maybe a compromise: Writing a Documenation that if you have the precip rate of you nozzles you can set area to 1 and calculate the flowrate from that

so 10mm/h precip rate equals Area 1m^2 and flowrate 10l/h (you are asking for l/min) soo 10/60 its 0,1667 l/min.

I dont think think that c would introduce big changes, becaue you could just to what i did and not touch the rest of the code. I But I agree it might be confusing.

just out of couriosity. For drip irrigation what do you use as Area ?

jeroenterheerdt commented 8 months ago

that makes sense. have you tried setting the area to 1 and put in precip rate? Did that work? If so, we can document that and no code changes are required. Now, for the drip irrigation I used the approximate area that the drip irrigation reaches: X inch around each emitter + a bit more because of that part being on a slope and water dripping down to lower plants as well. Basically, empirical observation.

Detmud commented 8 months ago

Yes area 1 works flowlessly, but because of h to min conversion I need some calculations there

jeroenterheerdt commented 8 months ago

Yes area 1 works flowlessly, but because of h to min conversion I need some calculations there

Right. My priority is to finish this integration, not add new features at this time. We can document this (we should) and in the future maybe add this as an option. @gatonero something for docs.

gatonero commented 8 months ago

I'm confused. What should be documented now?

jeroenterheerdt commented 8 months ago

That if you have a flow rate for your irrigation systen in mm/h or in/h you need to convert to mm/min or in/min and set the area to 1. Right @Detmud?

gatonero commented 8 months ago

It's allready documented in README.md. So this issue should get closed.

**When entering any values in the configuration of this integration, keep in mind that the integration will expect inches, sq ft, gallons, gallons per minute, or mm, m2, liters, liters per minute respectively depending on the settings in Home Assistant (imperial vs metric system).

Nevertheles I added: Note that these are values per minute.