-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional "volume_entity" to a zone for tracking/controlling based on volume #131
Comments
This is along the lines of issue #101. It would be great to be able use either volume or time as a base. Not sure how to monitor the volume 'ticks' or consumption. Maybe a notification mechanism for each unit of water used much like a water meter. Any thoughts on this? |
I currently track water volume for each zone with the following code. There is one physical meter (sensor.556) that never resets
And automation. Irrigation_unlimited watering uses sequences, hence there is only one watering at a time. Each time a sprinkler is on is resets its corresponding virtual meter, and when the sprinkler goes to off the value of the virtual meter is sent to the input_number of corresponding water circuit.
|
@Kolia56 Thank you for the suggestion, that could definitely work as I already maintain total volume per zone run independently from irrigation_unlimited via pyscripts but I fear with upwards of 12 zones on two independent controllers the solution could become pretty cumbersome and difficult to maintain. @rgc99 One way I could see this managed in irrigation_unlimited would be as followed:
|
Sorry to be a bit tardy. I am travelling across the Kimberley on a spot of vacation. Will follow up on this in due course. |
I would like to gather some sensor sample data in a text file. This would be used feed the data to the test framework. Not exactly sure how to implement this but that is where we need to start. Perhaps this article might help to harvest the data we need. Probably a csv file with datetime stamp and state value on each line. More data the merrier. Also a variety of systems byhyve, taplink and whatever anyone else can provide would be great. Rather than polling I think tracking the entity state change would be the way to go. Don't then have these agonising decisions about polling too much or too little. |
I'm quite ready to volunteer on this matter. However I'm not too sure to understand what is the kind of sensor from which data is needed. Could you elaborate a bit further? Thank you |
The idea is to capture data from the water usage sensor. This will write a file notify:
- name: irrigation_sensor_log
platform: file
filename: irrigation_sensor_log.txt
timestamp: True
automation:
- alias: Write Irrigation Sensor Data
trigger:
- platform: state
entity_id: sensor.556
action:
- service: notify.irrigation_sensor_log
data:
message: "{{ trigger.to_state.state }}" |
Thanks for the code, I had no idea of the existence of notify/platform: file. Code is in place. How may days do you wish? |
Yeah, only learned about file platform a few days ago myself. I think a day would be enough but also the Irrigation Unlimited log file so I can see the on/off events that overlap with the water sensor log. |
We'll have to wait a bit, we had 3 rainy days, so no watering data, HA Smart Irrigation has decided on its own;) I am expecting some data tomorrow. I added the state of the various sprinkler switches in the code in order to get everything in one file. |
This is a first try. Watering was decreased to 17% of the nominal time hence the short watering times. You'll notice that except for the first one, switch on state is not logged. This is due I think to the two events arriving at the same time closing one valve opening the next one. I'm pretty sure if a 1" delay is set, it will be logged. I changed the config for the next run with such a delay. In the meantime you have to consider that each off state is followed by another on state. For instance when switch.562 is set to off switch.564 is set to on. |
Please find some more data |
Thanks, can I also get the current matching configuration. Also was there any adjustment in play? |
Here it is. Sequence 1 / night was indeed adjusted.
|
The timestamp is a bit inconvenient as it is in UTC while the config is in local time. Took a guess local time was GMT+2 and things seemed to line up. It would better to turn off the timestamp in the notify and add it manually in the automation message. notify:
- name: irrigation_sensor_log
platform: file
filename: irrigation_sensor_log.txt
timestamp: False # <=== Change this
automation:
- alias: Write Irrigation Sensor Data
trigger:
- platform: state
entity_id: sensor.556
action:
- service: notify.irrigation_sensor_log
data:
message: "{{ now().isoformat() }}; {{ trigger.to_state.state }}" |
Indeed this is GMT+2. I made the modification. How many days of data do you wish? |
At the moment just a single sequence run would be great. |
There's an initial draft in the repository. It's collecting the sensor information and displaying in a "volume" attribute in the zone i.e. binary_sensor.irrigation_unlimited_c1_z1. Add the following to the configuration: zones:
- name: "Zone 1"
volume:
entity_id: sensor.556
... As you use a common sensor it might be easier to do: all_zones_config:
volume:
entity_id: sensor.556 Please check it out and see if the volumes on the zones tally to what you expect. |
I made a first quick test with zone_id: 8. Volume attribute reports 9 liters which is exactly my figure. Well done! We shall wait until tomorrow morning (GMT+2 as you know) to get a complete cycle.
|
After a complete night cycle I confirm that all volumes data are correct. |
Great, now we have the volume monitoring accurate I would like to lock in a test. I need a new irrigation_sensor_log file with the updated timestamp, expected volume results for each zone, any adjustment in play and config if it has changed. This will help moving forward that changes do not effect these readings. |
ok I will prepare that. To make sure I understand correctly, could you clarify what you are expecting in regards to "expected volume results for each zone". Are you after the watering nominal volume for each zone when there is no adjustment (i.e. 100%)? |
No, as you would have calculated including the adjustment. The idea is to replay that one night sequence run every time there is a code change. |
ok I see, so you want to make sure there is no code regression, when a code change is made. So I wait till you let me know there is a need for a new test. In the meantime I added the adjustment figure in the log file. |
I think the code is fine. Would like to get an updated log file and complete the test unit for the volume metering. Could you also post the data collection automation. I will put all of this in the repository and we can move on. Would it be useful to have a |
I think From the above post I can see that this has been provisionally implemented and tested on all zones/each zone. May I also suggest to add it on controller entity (in a similar way as switch entities are available there too). From an alarm point of view, Use case scenario as you suggest to disable zone/controller if pressure drops below certain threshold parameters that could be part of the irrigation_unlimited yaml configuration. |
Here is the log file Here is te code automation
|
I do have a pressure sensor as well, so integrating this into Irrigation unlimited is certainly nice to have. |
I have taken the sample from 13-Oct 22:00pm through 14-Oct 04:00. These are the volume readings |
Based on the same file I made the computation and confirm all your figures. I coud not check with my water meters because I was unaware that input_numbers that store the various values are not stored in statistics, only sensors and binary sensors are. So if you wish, I may include template sensors that will be feeded by these input_numbers and statistics will be available. I may also send these values to influxDB that is already set-up. Let me know. |
No problem, it's new code and if it is wrong we can fix it, just keep an eye on them. The flow rate changes have been added to the repository. The numbers were very small when expressed as a per second value so they are currently per hour. I feel volume and flow rate need a scale parameter to allow conversion to other units. I find various irrigation products in litres/second or minute or hour, gallons/minute or hour. A sensor that was only available in gph could be converted to lps for example. It might help to harmonise the system. |
Yes I agree a scaler parameter would help in order to cope with various situation. Anyhow, high resolution is needed in case small quantities of water are used especially when using drip lines. I keep both system running in parallel, I’m about to define template sensors based on the volume attribute and will send all this stuff to influxDB. I will update to the last repository shortly. |
I just installed the latest cut with flow_rate. I tested if on one circuite so far. Value seems ok, I need to perform a test on a more heavy consumption circuit to make sure. However when there is no more water consumption, I noticed it never resets . I considered that after 15 seconds of no counter increment (i.e. 1 liter) it can be set to 0. |
A volume limit function has just been added. Bit of journey through some FR's. First stop was #139 to make sequences their own entity. Not quite finished here with more attributes to be exposed but set the foundation for moving forward. Next to 'skip' a sequence zone and #142 which is more of a freeze than a pause but the main thing here was to make runs more flexible from from their immutable status. Now finally returning here with a The new sequence entity shows the entire volume consumed for the last run. Flow rate on the zone is now a moving average from the last 10 readings but still doesn't reset. It means in the off state it shows the last flow rate average. I would like this to be the seed value for the next run.
How are the cows? |
Thank you for all these new additions. My irrigation system is winterized hence I will not able to perform tests before April or beginning of May. I’m wondering whether flow rate reset will be implement or not. It is not a major issue on my side since beside the water meter there is a pressure sensor that will report any leak when all solenoid valves are closed. « I would like this to be the seed value for the next run. » : what do you have in mind? |
Hi Robert, I just got back from vacation and going through your many updates. Thanks for continuing on those. With regards to #142, you say in the above comment that there is a freeze possible. Can you please advise how I can stop/freeze a running sequence (or all) and then continue/unfreeze them? Documentation 7.1 has a toggle but it only enables and disables a zone/sequence/entity etc. On another note, documentation 7.2 also talks about enable/disable/toggle whereas I think it should read suspend instead. It would be amazing to better understand how I can achieve the pause/continue or freeze/unfreeze scenario as explained in #142. Thanks |
Hi Martin, Sequences now have an associated entity i.e. It's more of a freeze because the state remains as is. If it is on it will remain so until another Code is ready for release. Feel free to update from the repository and let me know of any issues. |
Have posted testing results here: |
When your system has woken up from hibernation I would like to test out the volume limit functionality. Add a |
ok I will let you know when it is done |
So it has been tested on one circuit from 14, which is the easiest to woken up from hibernation. Freezing period will be behind us mid May. |
Thanks for the testing and your kind comments. I do want to get some more testing data but will wait until May when your system is unfrozen. |
Thanks for the detailed information.
Could you let me know what kind of testing scenario you'd like? Since the freezing season seems to be behind us, I started to wake up the system, so I may perform tests sonner than expected. Excerpt of irrigation configuration controllers:
- name: "Controleur 1"
all_zones_config:
show:
timeline: true
allow_manual: true
volume:
entity_id: sensor.556
# duration: "0:10:00"
volume_scale: 1000
flow_rate_scale: 60
flow_rate_precision: 1 |
I really can't explain the flow rate results. If you could capture the sensor data it would help a lot. I can then replay it into my test system. |
I did not have time so far experiment what you are looking for. I think it will be around May 10th.
Could you elaborate a bit. I do have a pressure sensor as well and at some point in time I was thinking to drive pump speed depending on the pressure. It turns out that the system that sends the value to HA is not smart enough to send the value when it changes outside a certain window. So I have to poll it very often which is not effective. |
As far as flow rate is concerned, the figure is way out when the consumption is low. In the below case binary_sensor.irrigation_unlimited_c1_z7 reports 8 liters (10 minutes) and flow rate 8.6 liters/min
2024-05-10T17:17:15.194961+02:00;switch.ev_id10 (Vanne un carré); on
2024-05-10T17:17:29.507447+02:00;sensor.556 (Consommation grand puits); 277.214
2024-05-10T17:18:50.123945+02:00;sensor.556 (Consommation grand puits); 277.21500000000003
2024-05-10T17:20:11.065546+02:00;sensor.556 (Consommation grand puits); 277.216
2024-05-10T17:21:32.108511+02:00;sensor.556 (Consommation grand puits); 277.217
2024-05-10T17:22:53.047588+02:00;sensor.556 (Consommation grand puits); 277.218
2024-05-10T17:24:14.365606+02:00;sensor.556 (Consommation grand puits); 277.219
2024-05-10T17:25:35.392383+02:00;sensor.556 (Consommation grand puits); 277.22
2024-05-10T17:26:56.104188+02:00;sensor.556 (Consommation grand puits); 277.221
2024-05-10T17:27:15.437472+02:00;switch.ev_id10 (Vanne un carré); off
I noticed that reported volume is wrong in the following condition: when the cycle ends, if for any reason, physical switch is not in sync with its logical counterpart, volume does not increment anymore whereas it should until physical switch is back to off. I do use check_back option. I will shortly perform the volume limitation test. I'll keep you posted. |
I found a problem with the flow rate calculation. It was using the initial sensor reading as part of the average. This reading would have occurred at some time before the current on state. Only readings taken within the current on state should be used for the flow rate. The initial value will flush out as it passes through the SMA window (10 readings) and the average will correct itself. This means for the first 9 litres it will be skewed. |
Ok that is good to know. As already reported I will install a dedicated flow rate meter. It will add more accuracy to the flow rate measurement. Would you consider adding an option to use such a device in the configuration ? It would need an option in order to set the resolution of the meter which vary depending on devices. Mine for instance is 96 impulses per liter. |
This might be done already. Try this setting for the volume scale: all_zones_config:
volume:
volume_scale: 0.01041667
volume_precision: 8 It's 1 / 96. |
Thank you, I will test that as soon as the new sensor is installed |
Describe the solution you'd like
It would be nice if a zone was able optionally able to track water usage, as many sprinkler controllers or hose end controllers that can integrate with home assistant provide a separate entity that provides either/or 'current flow rate' or 'current volume used'. For an initial implementation I would imagine the data would only be provided as informational and tracked along with historical runtime data. Eventually it would be great to also allow scheduling 'duration' to use water volume instead of time, for example: Run zone1 at 5:00 for 100 gallons, (with optional timeout).
Describe alternatives you've considered
Currently I have custom netdaemon code integrated for managing volume related usage for my sprinklers, if there is interest on this I would be happy to start looking at coming up with a sample PR if you have any suggestions on where/how this would be best handled.
Curious if there is any interest for something like this
The text was updated successfully, but these errors were encountered: