Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- globals:
- - id: is_summer
- type: bool
- initial_value: "false"
- restore_value: true
- - id: is_winter_water_day
- type: bool
- initial_value: "false"
- restore_value: true
- - id: weather_factor
- type: float
- initial_value: "1"
- restore_value: true
- - id: sun_low_pm
- type: bool
- restore_value: true
- initial_value: "false"
- - id: odd_day
- type: bool
- restore_value: true
- - id: month_no
- type: int
- initial_value: "99"
- restore_value: true
- - id: week_day_no
- type: int
- initial_value: "99"
- restore_value: true
- time:
- - platform: sntp # Changed from homeassistant to sntp on 1/5/24
- timezone: Australia/Perth
- id: ha_time
- on_time:
- - seconds: 0
- minutes: 0
- hours: 0
- then:
- # Watering restrictions for bores in Busselton.
- # Every day from 1 Sept to 31 May, once per day, before 9am or after 6pm. Summer = months 9, 10, 11, 12, 1, 2, 3, 4, 5.
- # Pressure testing, once a week, for 2 minutes per station. Pref before 9am or after 6pm. Winter = months 6, 7, 8.
- - lambda: |-
- auto time = id(ha_time).now();
- id(month_no) = time.month;
- id(week_day_no) = time.day_of_week;
- id(is_summer) = (time.month > 8 or time.month < 6);
- id(is_winter_water_day) = ((not id(is_summer)) and (time.day_of_week == 5));
- id(odd_day) = (time.day_of_year % 2 != 0);
- - pulse_meter.set_total_pulses:
- id: retic_flow
- value: 0
- - pulse_meter.set_total_pulses:
- id: bore_flow
- value: 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement