Comments (6)
You are right, split the automation into two separate tasks; adjustment and bucket reset. I think history_stats may be your friend here. First create a sensor to count the number of times the system was on yesterday and then an automation to reset the bucket if the system was on:
sensor:
- platform: history_stats
name: Irrigation Unlimited yesterday run count
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: βonβ
type: count
end: "{{ now().replace(hour=0, minute=0, second=0) }}"
duration:
hours: 24
automation:
- alias: HA Smart Irrigation reset bucket
trigger:
- platform: time
at: 04:30
condition:
condition: numeric_state
entity_id: sensor.irrigation_unlimited_yesterday_run_count
above: 0
action:
- service: smart_irrigation.smart_irrigation_reset_bucket
mode: single
Lots of possibilities here but hopefully this will get you going. Let me know how you get on so we share it.
from irrigation_unlimited.
Hey, thanks for your answer.
So the idea is that we count the number of times irrigation unlimited has run in the past 24 hours (yesterday might be a misleading name). If the count is higher than 0, meaning it has run then we reset the bucket.
Good idea.
The question is, when should we call the reset bucket automation?
Ideally it should be called right after the run has finished, but because of variable schedules that's a bit difficult.
The "sensor.smart_irrigation_daily_adjusted_run_time" gets calculated at 23h.
I'm pretty sure that the result of that calculation is very different depending on the value of the bucket.
So would it be best to run the automation at for instance 22h?
from irrigation_unlimited.
Considering if the run was perhaps at sunrise we still loose most of the day of raining or vaporization if we reset only at 22h in the evening.
So still not ideal. In my situation I can schedule the reset perhaps at 9h in the morning, because I will always schedule the automatic runs a bit before sunrise.
The best solution would be some kind of sensor "run finished" that changes from off to on on finish and could thus trigger the reset automation.
Could we not trigger the reset automation on the state attribute "Status" of "binary_sensor.irrigation_unlimited_c1_m" changing from 'on' to 'off'?
from irrigation_unlimited.
Just thinking a bit out loud here:
Could we not trigger the reset automation on the state attribute "Status" of "binary_sensor.irrigation_unlimited_c1_m" changing from 'on' to 'off'?
from irrigation_unlimited.
Rereading the docs; calculations are done at 23:00 and the bucket should be reset after any irrigation so yes let's do that. Here is the complete automation.
automation:
- alias: Smart Irrigation adjustment
description: Adjust watering times based on smart irrigation calculations
trigger:
- platform: time
at: "23:30"
action:
- service: irrigation_unlimited.adjust_time
data:
entity_id: binary_sensor.irrigation_unlimited_c1_z1
actual: >
{% set t = states('sensor.smart_irrigation_daily_adjusted_run_time') | int %}
{{ '{:02d}:{:02d}:{:02d}'.format((t // 3600) % 24, (t % 3600) // 60, (t % 3600) % 60) }}
mode: single
- alias: Smart Irrigation reset bucket
description: Resets the Smart Irrigation bucket after watering
trigger:
- platform: state
entity_id:
# Add Irrigation Unlimited sensors here
- binary_sensor.irrigation_unlimited_c1_m
from: "on"
to: "off"
action:
- service: smart_irrigation.reset_bucket
from irrigation_unlimited.
I've implemented the new automations as suggested.
from irrigation_unlimited.
Related Issues (20)
- Add optional "volume_entity" to a zone for tracking/controlling based on volume HOT 50
- Adjust time with 0 percent does not work HOT 16
- New toggle service for manual run
- irrigation_unlimited_start does not fire the automation HOT 17
- Sequence not firing HOT 3
- Headers & Footers widget support HOT 4
- Updated (automation) example for HASmartIrrigation v2.0 needed HOT 3
- Manual run longer than 60 minutes not working HOT 1
- Make Sequences be entities HOT 6
- After cancelling sequence manual run zones keep that schedule HOT 2
- Do not allow "Controller" Run in Manual Modes HOT 4
- Suspend does not suspend irrigation time/duration: add pause/continue or freeze/unfreeze to zones, sequences, controllers HOT 35
- Zone.more parameters HOT 6
- Typo in 5.9 documentation regarding Clock. HOT 1
- Listen to 'external' switch commands of solenoid valves HOT 3
- Companion card possible error in start times for repeat sequences HOT 2
- `from`/`until` field handling does not match documentation HOT 2
- Documentation: More object shall be replaced by User object HOT 2
- Templating error in service call manual_run HOT 6
- Adjustment properties remain empty HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from irrigation_unlimited.