GithubHelp home page GithubHelp logo

mtry / homebridge-smart-irrigation Goto Github PK

View Code? Open in Web Editor NEW
77.0 5.0 3.0 4.25 MB

Turn any electrical irrigation valve into a smart-valve.. or run your pumps on a smart schedule based on your climate! This homebridge plugin exposes a multi-zone irrigation sprinkler dummy control system to Apple's HomeKit. Although a dummy, it brings smarts of an evapotranspiration based climate and plant adaptive irrigation controller with the use of OpenWeatherMap API. The plugin can optionally email you, and/or send you push notifications through Pushover or Pushcut, with the watering schedule it has calculated, or when a watering run is completed, along with the next 7-day weather forecast. Added option to expose system controls to Homekit allowing a user to enable/disable irrigation, rechecks, push and email notifications from within the Home App. Associated WaterLevel Characteristic shows the % of watering cycle remaining.

License: MIT License

JavaScript 100.00%
homebridge-plugin smart-irrigation adaptive-control climate sprinkler-controller evapotranspiration watering-controller valve weather sprinkler

homebridge-smart-irrigation's Introduction

Homebridge Smart Irrigation

verified-by-homebridge
npm github github
JavaScript Style Guide github
Discord Subreddit subscribers

Description

Turn any electrical irrigation valve into a smart-valve.. or run your pumps on a smart schedule based on your climate!

This Homebridge plugin exposes a multi-zone irrigation sprinkler dummy control system to Apple's HomeKit.

Although a dummy, it brings smarts of an evapotranspiration[ETo] based climate/plant adaptive irrigation controller with the use of OpenWeatherMap API. All parameters can be configured from the Homebridge UI and the plugin offers granular control specific to every zone's individual requirements.

The plugin can optionally email you, and/or send you push notifications through Pushover and Pushcut, with the watering schedule it has calculated, or when a watering run is completed, along with the next 7-day weather forecast.

Added option to expose system controls to Homekit allowing a user to enable/disable irrigation, rechecks, push and email notifications from within the Home App. Associated WaterLevel Characteristic shows the % of watering cycle remaining.

Why?

Searching for an irrigation or sprinkler control plugin never showed any suitable option for my needs. The one that came closest, and is the inspiration and basis for this plugin is Tom Rodrigues's homebridge-web-sprinklers. But like many others, I didn't have the http hardware for it to control, or the inclination to rig it! What I did have access to, were some solenoid valves which I could power from a smart socket that was exposed to Homekit. So I stripped the code to just expose the dummy sprinkler accessories, reworked the irrigation logic - and then, one thing led to another.. in my quest to achieve a more granular control and incorporate more irrigation science to create a climate adaptive irrigation controller.

Basic use case..

  1. Configure the plugin to expose the required number sprinkler accessories(zones)
  2. Use the Eve app or another Homekit controller app to configure ANY other smart plug or outlet in your Homekit ecosystem to follow the state of the above exposed sprinklers
  3. The smartplug/outlet/valve in their simplest configuration could be just driving the power of any solenoid valve that controls watering to a zone

Installation

  1. Install Homebridge
  2. Install this plugin:
    • Homebridge Config UI X: Search for homebridge-smart-irrigation plugin and install
    • Manually: Run sudo npm install -g homebridge-smart-irrigation from the terminal
  3. Sign up at the OpenWeatherMap website and retrieve your API key (if you want adaptive control). The free tier allows 1000 API calls a day and this plugin will make no more than a couple on any day!
  4. Gather the mean daily Solar Radiation figures for your location in kWh/day. Please read the settings section for more details
  5. Configure the settings
  6. Use the Eve app or any other Homekit controller app to setup automations for your smartplug or outlet to follow the state of the zones exposed by the plugin

Operating Principle

One of the primary factors affecting the water demand of plants is evapotranspiration, also denoted as ETo and expressed in mm. While the subject of irrigation is one of extensive global research and there is no end to the extent of complication one can end up with, this plugin chooses to focus on three - ETo, local rain and the crop characteristics of each of the zones configured.

ETo is calculated using the Penman-Monteith Evapotranspiration (FAO-56) Method. Those interested in a deeper understanding of the principles may head to this excellent resource of FAO. The factors used include the following (daily):

  1. Min/Max Temperatures
  2. Mean RH
  3. Wind speed
  4. Shortwave Solar Radiation [more on this later..]
  5. Atmospheric Pressure (barometric)
  6. Latitude
  7. Elevation
  8. Julian day

Rain is derived from OpenWeatherMap API along with some of the factors above using the latitude and longitude configured.

Crop characteristics use some of the understanding gained from the website of University of California, Division of Agriculture and Natural Resources and particularly from this document for calculating drip irrigation schedules. Specifically, it utilises the following based on the conditions of the particular zone being irrigated:

  1. Crop coefficients [0.1 - 0.9] based on the type of plants Read here!
  2. Planting Density [0.5 - 1.3]
  3. Exposure Factor [0.5 - 1.4] based on the zone's microclimate

Additionally, information about the number of drip emitters, their discharge rate, area irrigated and efficiency is considered with the above factors.

Operating Logic & Scheduling

If masterDisable is not checked, the plugin will calculate the total watering durartion and check if watering can be completed today before sunrise or by the time as specified in sunriseOffset. If not, it will schedule the irrigation for the next day. Regardless of masterDisable it will gather the weather information and also send a notification email if emailEnable is set.

Forecasted low and high temperature higher than their respective thresholds must be met for the day being scheduled.

If adaptive watering is disabled for a zone, but scheduling remains enabled, the zone will be watered for the number of minutes specified by defDuration and not factor any other calculations.

The plugin schedules asynchronous zone watering - cycling sequentially through all the scheduled zones needing water one at a time and repeats the process the number of times specified by cycles.

Start times will vary daily as a result of changing sunrise times as well as the calculated watering time based on the weather factors.

recheckTime instructs the plugin to reassess the watering times based on the most current forecast available 15, 30 or 60 minutes prior to the scheduled run - if this is of no use to you set it to 0. But for many living in tropical regions where climate modeling is far too complex to give accurate forecasting, this can be helpful as the forecasts change frequently or significantly.

  1. Gather weather forecast for the next 7-day period
  2. Using the above and Solar Radiation data, calculate projected ETo for the next 7 days
  3. If the zone is enabled & adaptive, calculate the total ETo until the next watering day
  4. If rainFactoring is enabled, calculate the total projected rainfall till the zone's next watering day
  5. Calculate the net irrigation requirement of a zone based on total ETo and total rain till the zone's next watering schedule
  6. Calculate zone specific time required based on that zone's irrigation infrastructure and crop profile
  7. Schedule the watering run and send notification email if emailEnable
  8. Reassess recheckTime minutes before the scheduled run

Example config block:

{
            "accessory": "SmartSprinklers",
            "name": "Irrigation",
            "exposeControls": true,
            "verbosed": true,
            "masterDisable": false,
            "recheckTime": 15,
            "latitude": 25.009243,
            "longitude": 77.73491,
            "altitude": 390,
            "keyAPI": "yOuR_OWM_key",
            "cycles": 2,
            "sunriseOffset": 0,
            "lowThreshold": 8,
            "highThreshold": 18,
            "emailEnable": true,
            "senderName": "💦 Irrigation Control",
            "senderEmail": "[email protected]",
            "sendTo": "[email protected]",
            "smtpHost": "smtp.gmail.com",
            "smtpPort": 587,
            "portSecure": false,
            "userID": "[email protected]",
            "userPwd": "password",
            "pushEnable": true,
            "userPO": "your---user---key",
            "tokenPO": "your---app---token",
            "devicePO": "iphone",
            "priorityPO": 0,
            "soundPO": "pushover",
            "pcEnable": true,
            "pcKey": "abcdXXXXabcd",
            "pcDevices": "iPad,iPhone",
            "pcWeatherChecked": "Test Checked",
            "pcWeatherCheckedSound": "system",
            "pcWateringStart": "Test Start",
            "pcWateringStartSound": "system",
            "pcWateringEnd": "Test End",
            "pcWateringEndSound": "jobDone",
            "JanRad": 5.4,
            "FebRad": 6.3,
            "MarRad": 7,
            "AprRad": 7.3,
            "MayRad": 7.2,
            "JunRad": 5.7,
            "JulRad": 5,
            "AugRad": 5.1,
            "SepRad": 5.5,
            "OctRad": 5.7,
            "NovRad": 5.2,
            "DecRad": 5,
            "zones": [
                {
                    "zoneName": "Flowerbed",
                    "enabled": true,
                    "adaptive": true,
                    "rainFactoring": true,
                    "defDuration": 30,
                    "maxDuration": 60,
                    "rainThreshold": 2.5,
                    "tweakFactor": 100,
                    "dripLPH": 8,
                    "dripNos": 23,
                    "dripArea": 2.7,
                    "efficiency": 100,
                    "cropCoef": 0.6,
                    "plantDensity": 1.1,
                    "expFactor": 1,
                    "wateringMonths": [
                        "Jan",
                        "Feb",
                        "Mar",
                        "Apr",
                        "May",
                        "Jun",
                        "Jul",
                        "Aug",
                        "Sep",
                        "Oct",
                        "Nov",
                        "Dec"
                    ],
                    "wateringWeekdays": [
                        "Sunday",
                        "Monday",
                        "Tuesday",
                        "Wednesday",
                        "Thursday",
                        "Friday",
                        "Saturday"
                    ]
                },
                {
                    "zoneName": "Pots",
                    "enabled": true,
                    "adaptive": true,
                    "rainFactoring": true,
                    "defDuration": 10,
                    "maxDuration": 30,
                    "rainThreshold": 2.5,
                    "tweakFactor": 100,
                    "dripLPH": 2,
                    "dripNos": 1,
                    "dripArea": 0.05,
                    "efficiency": 100,
                    "cropCoef": 0.6,
                    "plantDensity": 0.5,
                    "expFactor": 0.9,
                    "wateringMonths": [
                        "Jan",
                        "Feb",
                        "Mar",
                        "Apr",
                        "May",
                        "Jun",
                        "Jul",
                        "Aug",
                        "Sep",
                        "Oct",
                        "Nov",
                        "Dec"
                    ],
                    "wateringWeekdays": [
                        "Sunday",
                        "Tuesday",
                        "Thursday",
                        "Friday"
                    ]
                }
            ]
        }

Primary Setup

Expose Controls - exposeControls - exposes up to 5 additional related switch services allowing a user basic control of the system from within the Home App:

  • Master: If exposed, this switch allows enabling or disabling irrigation. When disabled it will cancel any scheduled watering cycles - although the system will continue routine weather checks(and notifications if enabled). Re-enabling will trigger recalculation and rescheduling.
  • Recheck: This is exposed only if the recheckTime has been set to a non-zero value. When disabled it will cancel any scheduled rechecks - although the system will proceed with the scheduled watering cycles. Re-enabling will trigger recalculation and rescheduling.
  • Email Notify: This is exposed only if emailEnable has been set. Enable/disable email notifications.
  • Pushover Notify: This is exposed only if pushEnable has been set. Enable/disable Pushover notifications.
  • Pushcut Notify: This is exposed only if pcEnable has been set. Enable/disable Pushcut notifications.

These switch settings are persistent across plugin/Homebridge restarts, so you shouldn't have to reset your preferences in the Home App!

Key Description Default
name Name that appears in the Home app N/A
exposeControls Expose controls to Homekit true
verbosed Verbose Calculations and Extended Climate data true
masterDisable Disable scheduling all irrigation false
recheckTime Reassess - minutes before runtime 0
cycles Number of cycles per watering run 2
sunriseOffset Minutes before sunrise that watering should get over by 0
lowThreshold Skip scheduling when forecasted minimum temperature falls below this 5
highThreshold Skip scheduling when forecasted maximum temperature stays below this 10
keyAPI Your OpenWeatherMap API Key N/A
latitude Enter the latitude in decimals including '-' if in the southern hemisphere N/A
longitude Your decimal longitude N/A
altitude Enter the altitude in meters 0

Email Notifications Setup

Currently this supports basic authentication. If using Gmail, you will need to go to the security settings of your account to enable less secure app access. It might be best to create a specific ID for this purpose to avoid security risks to your main account!

Key Description Default
emailEnable Enable Notifications false
senderName Sender Name N/A
senderEmail Sender Email ID N/A
sendTo Receiver Email ID N/A
smtpHost SMTP Host N/A
smtpPort SMTP Port N/A
portSecure Secure Port false
userID SMTP Username N/A
userPwd SMTP Password N/A

Pushover Notifications Setup

Push notifications using Pushover are supported.

Key Description Default
pushEnable Enable Push Notifications false
userPO Your user key N/A
tokenPO Your application token N/A
devicePO Receiving devices all
priorityPO Message Priority 0
soundPO Notification sound pushover

Pushcut Notifications Setup

Push notifications using Pushcut are supported. While HomeKit automations and shortcuts can always be triggered based on service or zone states, this opens up a host of possibilities! Do note that this operates in a slightly different manner compared to Pushover. Notifications are sent for the following events:

  • Weather Check: This is the notification defined by you in the Pushcut App which will receive a weather check notification with one of two input strings [Scheduled / Not Scheduled]. This is a compulsory field if Pushcut is enabled.
  • Watering Start: This is the notification defined by you to receive the watering start notification - if left blank, this notification will be sent to your "Weather Check" notification. The input string attached to this notification is the watering duration in minutes.
  • Watering End: This is the notification defined by you to receive the watering end notification - if left blank, this notification will be sent to your "Weather Check" notification.

This also meaans that on completion of a watering run, 2 notifications Weather Check & Watering End will be sent.

Key Description Default
pcEnable Enable Pushcut Notifications false
pcKey Your API key N/A
pcDevices Device list seperated by comma - WITHOUT SPACE after comma! all
pcWeatherChecked Your "Weather Checked" notification name N/A
pcWeatherCheckedSound Notification sound system
pcWateringStart Your "Watering Start" notification name N/A
pcWateringStartSound Notification sound system
pcWateringEnd Your "Watering End" notification name N/A
pcWateringEndSound Notification sound jobDone

Monthly data of Mean Daily Solar Radiation [kWh/day]

There are several sources but the one that I used is Weatherspark. Search for your location. Scroll to the bottom of the page to the Solar Energy section and note the figures for each month(the months are clickable!) in kWh/day which is the daily mean figure for the month. Feel free to use an alternate source that you trust but keep in mind the unit of measurment - kWh/day!

Going forward, it will be great to extract live daily shortwave radiation data/forecast through an API instead of relying on historical averages.. hopefully will get there soon!

Key Description Default
xxxRad Mean Daily Solar Radiation [kWh/day] for the month xxx 6

Zones setup

This is where multiple zones can be configured - with a limit of 16 zones at the moment.

Crop Coefficient - Read here for reference!
This is based on the crop type or species and their water needs. [0.1 - 0.9]

Planting Density
Low—sparse: 0.5 - 0.9
Average—moderate coverage: 1
High--complete coverage: 1.1 - 1.3

Exposure Factor
The microclimate or exposure factor [0.5 - 1.4]
Average--open field: 1.0
Low--moderate wind, part sun: 0.5 - 0.9
High--stronger winds and greater exposure: 1.1 - 1.4
A protected, shady location would use a lower factor.

Key Description Default
zoneName Friendly zone name N/A
enabled Zone Enabled true
adaptive Climate Adaptive Zone true
rainFactoring Factor rain amount in watering & respect the set threshold to skip irrigation for this zone true
defDuration Default zone duration in minutes when not adaptive [max 180] 20
maxDuration Maximum duration settable in minutes [max 180] 30
rainThreshold Rain Threshold[mm] above which watering skipped for this zone 2.5
tweakFactor The human factor to tweak proposed watering in % [max:200] 100
dripLPH Drip emitter discharge rate in LPH (of a single emitter) 2
dripNos Number of drip emitters used in this zone 1
dripArea Irrigation area in m2 1
efficiency Irrigation system efficiency - usually 90% for drip 90
cropCoef Crop Coefficient [0.1 - 0.9] 0.5
plantDensity Plantation Density [0.5 - 1.3] 1
expFactor Exposure Factor [0.5 - 1.4] 1
wateringWeekdays Weekdays to water - at least 1! ALL
wateringMonths Watering Months - uncheck to skip watering in that month ALL

Notes & Suggestions

  • For any of the smart outlets/sockets you intend to use by following the zone states for driving irrigation valves, do setup an additional automation in Homekit to switch them off after a preset time - this can be a kind of failsafe in case the plugin crashes for any reason and leaves the zone turned on indefinately.

  • The plugin pairs very well with multi-channel devices such as the 4CHPRO from Sonoff which has dry contacts to relay low voltage AC/DC to control solenoid valves and also has a wide operating voltage range. I use 2 of these mounted in an IP65 outdoor enclosure to run a 8-zone 12VDC configuration. The plugin used to expose the 4CHPRO is homebridge-ewelink plugin from Ben, who somehow manages to squeeze more than 24 hours in a day giving support, adding features and fixing bugs!

  • Maximum run time up to 5 hours with each zone upto 3 hours can be set. defDuration & maxDuration can be upto 180 minutes.

  • If you are using a zone to water a set of pots, each with a single drip emitter, a reasonable way to configure would be to set dripArea as the area of a single pot and dripNos to 1. The rest of the zone settings to be configured as per requriement.

  • If you are using a zone to water in a protected space, consider disabling rainFactoring for that zone - since the plants never receive any rainfall, and the reduction in ETo is already factored in calculating the zone timing, you should be good to go!

  • Use tweakFactor to modulate what the system calculates as the requirement for a zone. Do start with 100%, which means no change and then go lower or higher based on whether you feel the system is overestimating or underestimating the zone's water requirement.

  • The Set Duration of the service is set at the total watering duration on every calculation. The individual zones are set at the corresponding zone's single-cycle time. When the watering run starts, the Remaining Duration of the service counts down to 0 through the runtime while the active zone displays the Remaining Duration of that cycle.

Way forward..

  • Use live daily shortwave solar radiation data/forecast through an API instead of relying on having to feed historical averages.. the only service I am aware of which has a free option is Solcast which offers 10 API calls a day. Any suggestions if its worth doing this?

  • Integrate Telegram notifications

  • Integration of FakeGato

  • Prettier HTML email notifications!

Support/Contribution

A ⭐️ star would be great!

I dont have a great deal of programming experience so the biggest help and contribution you can make is helping with the code or "Way forward.." items!

If financial contribution is on your agenda, may I humbly redirect you to Homebridge which makes this community possible. Also consider supporting several fine developers who offer an incredible amount of their time and effort in supporting the community and creating extraordinary plugins.

homebridge-smart-irrigation's People

Contributors

angyalz avatar dependabot[bot] avatar mtry avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

homebridge-smart-irrigation's Issues

Request for new features

Hello Thank you for your job. I think it's very pretty and smart.

Could you add follow features:

  • Web page for resume all watering info
  • A dummy rain stop switch in case of not forecasted rain (this night happened)
  • Possibility to set different number of cycles for each zone

Thank you

“Run Now” button

Hi guys
Sometimes I face an issue right before the watering program starts, it can be an electricity, homebridge, wi-fi disconnection, whatever, and I miss the schedule. I need, then, to trigger every zone manually for the time calculated (and it’s time consuming job when you have multiple zones).
Would be very useful to have a button called “Run Now” where it will start the program of that day any time I activate it.
Happy 2024!
Thanks

[BUG] Not pulling sunrise data from API call, retrying every minute

Describe the bug

The plugin is throwing a warning message to the log, seemingly whenever it hits the OpenWeatherMap API:

WARNING Error getting weather data or Cannot read properties of undefined (reading 'sunrise')

After the error, the plugin waits a minute and then retries, with the same result. So it's hitting the API every minute, which is probably going to cause it to exceed the OpenWeatherMap usage limits.

To Reproduce

Steps or config to reproduce the behaviour:

{
    "accessories": [
        {
            "accessory": "SmartSprinklers",
            "name": "Irrigation",
            "exposeControls": true,
            "recheckTime": "15",
            "latitude": ***,
            "longitude": ***,
            "altitude": 115,
            "keyAPI": "***",
            "cycles": 2,
            "sunriseOffset": 90,
            "lowThreshold": 5,
            "highThreshold": 10,
            "senderName": "***",
            "smtpPort": 587,
            "priorityPO": 0,
            "soundPO": "pushover",
            "pcWeatherCheckedSound": "system",
            "pcWateringStartSound": "system",
            "pcWateringEndSound": "jobDone",
            "JanRad": 3.06,
            "FebRad": 3.89,
            "MarRad": 4.82,
            "AprRad": 5.4,
            "MayRad": 5.91,
            "JunRad": 6.61,
            "JulRad": 6.77,
            "AugRad": 6.28,
            "SepRad": 5.24,
            "OctRad": 4.51,
            "NovRad": 3.34,
            "DecRad": 2.73,
            "zones": [
                {
                    "zoneName": "North",
                    "defDuration": 5,
                    "maxDuration": 20,
                    "rainThreshold": 6,
                    "tweakFactor": 100,
                    "dripLPH": 800,
                    "dripNos": 4,
                    "dripArea": 150,
                    "efficiency": 85,
                    "cropCoef": 0.5,
                    "plantDensity": 1,
                    "expFactor": 0.6,
                    "wateringMonths": [
                        "Jan",
                        "Feb",
                        "Mar",
                        "Apr",
                        "May",
                        "Jun",
                        "Jul",
                        "Aug",
                        "Sep",
                        "Oct",
                        "Nov",
                        "Dec"
                    ],
                    "wateringWeekdays": [
                        "Monday"
                    ],
                    "enabled": true,
                    "adaptive": true,
                    "rainFactoring": true
                },
                {
                    "zoneName": "West",
                    "defDuration": 5,
                    "maxDuration": 20,
                    "rainThreshold": 6,
                    "tweakFactor": 100,
                    "dripLPH": 800,
                    "dripNos": 4,
                    "dripArea": 90,
                    "efficiency": 85,
                    "cropCoef": 0.5,
                    "plantDensity": 1,
                    "expFactor": 0.5,
                    "wateringMonths": [
                        "Jan",
                        "Feb",
                        "Mar",
                        "Apr",
                        "May",
                        "Jun",
                        "Jul",
                        "Aug",
                        "Sep",
                        "Oct",
                        "Nov",
                        "Dec"
                    ],
                    "wateringWeekdays": [
                        "Tuesday"
                    ],
                    "enabled": true,
                    "adaptive": true,
                    "rainFactoring": true
                },
                {
                    "zoneName": "South",
                    "defDuration": 5,
                    "maxDuration": 20,
                    "rainThreshold": 6,
                    "tweakFactor": 100,
                    "dripLPH": 800,
                    "dripNos": 4,
                    "dripArea": 145,
                    "efficiency": 85,
                    "cropCoef": 0.5,
                    "plantDensity": 1,
                    "expFactor": 1,
                    "wateringMonths": [
                        "Jan",
                        "Feb",
                        "Mar",
                        "Apr",
                        "May",
                        "Jun",
                        "Jul",
                        "Aug",
                        "Sep",
                        "Oct",
                        "Nov",
                        "Dec"
                    ],
                    "wateringWeekdays": [
                        "Monday"
                    ],
                    "enabled": true,
                    "adaptive": true,
                    "rainFactoring": true
                },
                {
                    "zoneName": "East",
                    "defDuration": 5,
                    "maxDuration": 20,
                    "rainThreshold": 6,
                    "tweakFactor": 100,
                    "dripLPH": 800,
                    "dripNos": 4,
                    "dripArea": 80,
                    "efficiency": 85,
                    "cropCoef": 0.5,
                    "plantDensity": 1,
                    "expFactor": 0.9,
                    "wateringMonths": [
                        "Jan",
                        "Feb",
                        "Mar",
                        "Apr",
                        "May",
                        "Jun",
                        "Jul",
                        "Aug",
                        "Sep",
                        "Oct",
                        "Nov",
                        "Dec"
                    ],
                    "wateringWeekdays": [
                        "Tuesday"
                    ],
                    "enabled": true,
                    "adaptive": true,
                    "rainFactoring": true
                }
            ],
            "senderEmail": "***",
            "sendTo": "***",
            "smtpHost": "***",
            "portSecure": false,
            "userPwd": "***",
            "userID": "***",
            "emailEnable": true,
            "plugin_map": {
                "plugin_name": "homebridge-smart-irrigation"
            }
        }
    ]
}

Expected behavior

The plugin shouldn't be throwing this warning, or it should at least wait longer than a minute to hit the API again. I'm assuming that, if it can't determine when "sunrise" is, then the "sunriseOffset" feature probably won't work, and if it hits the API too often, the OpenWeatherMap server will cut off access.

**Screenshots or logs **

This is repeating every minute:

5/7/2023, 8:04:52 AMIrrigation BridgeIrrigation-----------------------------------------------------
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationlight rain on Sunday 5/7/2023 with 100% clouds & 76% RH
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationETo:4.96mm|Rain:1.4mm|Min:20.07°C|Max:28.05°C|Wind:8.89m/s
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigation-----------------------------------------------------
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationlight rain on Monday 5/8/2023 with 94% clouds & 81% RH
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationETo:4.40mm|Rain:1.55mm|Min:19.59°C|Max:28.97°C|Wind:5.64m/s
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigation-----------------------------------------------------
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationmoderate rain on Tuesday 5/9/2023 with 97% clouds & 71% RH
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationETo:5.04mm|Rain:7.95mm|Min:19.14°C|Max:27.65°C|Wind:6.21m/s
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigation-----------------------------------------------------
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationmoderate rain on Wednesday 5/10/2023 with 87% clouds & 86% RH
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationETo:3.50mm|Rain:14.75mm|Min:18.18°C|Max:23.08°C|Wind:7.8m/s
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigation-----------------------------------------------------
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationmoderate rain on Thursday 5/11/2023 with 100% clouds & 79% RH
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationETo:4.28mm|Rain:7.68mm|Min:18.48°C|Max:25.74°C|Wind:7.05m/s
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigation-----------------------------------------------------
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationlight rain on Friday 5/12/2023 with 88% clouds & 72% RH
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationETo:4.72mm|Rain:4.3mm|Min:18.02°C|Max:28.35°C|Wind:4.34m/s
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigation-----------------------------------------------------
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationlight rain on Saturday 5/13/2023 with 100% clouds & 72% RH
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationETo:5.07mm|Rain:2.87mm|Min:20.65°C|Max:28.48°C|Wind:5.68m/s
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigation-----------------------------------------------------
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationlight rain on Sunday 5/14/2023 with 100% clouds & 66% RH
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationETo:5.38mm|Rain:2.74mm|Min:20.47°C|Max:27.7°C|Wind:5.54m/s
5/7/2023, 8:04:52 AMIrrigation BridgeIrrigationWARNINGError getting weather data or Cannot read properties of undefined (reading 'sunrise')

Platform (please complete the following information):

  • Platform: HOOBS 4.3.0, Homebridge 1.6.0, Node 16.20.0

Using Telegram for Notifications?

This looks like a very interesting plugin to use with my irrigation valves.

One question: I am using Telegram plugin throughout my homebridge to push notifications. I'd like to stay with that rather than signing up to yet another notification system (Pushcut).

Would it be possible to use your plugin with the telegram service?

Many thanks

[BUG]

Thank you for developing an amazing product that integrates weather science and crop science to save water.

Describe the bug
OpenWeatherMap.org has recently migrated from their call API protocol 2.5 to 3.0
The API keys they are now handing out with 1000 free calls per day only work with the API 3.0 protocol and one has to pay for a plan that works with the 2.5 protocol. New keys issues by OpenWeatherMap produce a 401 error when trying to pull weather data as the syntax of the call is incorrect.

To Reproduce

  1. Open a new OpenWeatherMap.org "One Call API 3.0" subscription. Place the key into Homebridge-Smart-Irrigation and a 401 error will be generated on each call due to the use of "2.5" in the call syntax instead of "3.0"

Expected behavior
Successful API call did not occur due to syntax error.

Platform (please complete the following information):

  • Platform: Homebridge v1.5.0
  • Smart Irrigation V1.7.2
  • OpenWeatherMap "One Call API 3.0"

Suggested solution:
Add a menu choice in HomebridgeSmartIrrigation-->Settings-->Primary Setup which toggles between API call syntax version 2.5 and 3.0
This will simply swap the numbers "2.5" and "3.0" in the API call syntax. By default it is set to 2.5 to provide compatibility for those current users who signed up for a key under API v2.5 but allows new users to select 3.0 to work with the new keys.

Help or Questions

Hi!
First of all, great plugin and thanks for your effort in making and maintaining it. One question:
As far as I understand, if not all days are checked for watering or a temperature limit criteria is not met on a watering day, then the watering deficit is summed up and will be compensated on the next possible watering day.

Day 1 --> calculated ET0 3mm, watering 3mm, deficit 0mm
Day 2 --> calculated ET0 4mm, no watering possible or not checked, deficit 4mm
Day 3 --> caclulated ET0 5mm, no watering possible or not checked, deficit 4+5=9mm
Day 4 --> caclulated ET0 6mm, watering 4+9+6=19mm, deficit 0mm
Day 5 --> ....

Is my understanding correct?
What happens when home bridge is re-booted or crashes and needs reboot on day 3? Will the deficit value be stored somewhere or is it reset to 0?

Thanks a lot.
Cheers Christian

New features

Good afternoon. You are completely gone :) When will there be new features?
1 Support rain sensor netatmo or others
2 Possibility to specify watering start time instead of using time before dawn
3 Specify the delay time between waterings, so that the container has time to fill.
4 transfer the setting of the number of cycles from the general to each zone

Thank you!

Exposed switches lack meaningful name

Describe the bug
Set up smart irrigation with two zones. System exposes several switches, however without any name so that they can’t be distinguished. Exposed sprinklers are exposed with name “zone x” with x= 1,2…

To Reproduce
Setup with several zones

Expected behavior
Switches should be exposed with meaningful names relating to given zone names or “master”.
Exposed dummy sprinklers should be exposed with name “master”

Platform (please complete the following information):

  • Rapberry pi 4b
  • Node 20.12.0
  • Homebridge 1.7.0
  • Plugin 1.7.2

Additional context
Add any other context about the problem here.

"Nozzle type" setting etc.

First, this is a fantastic plugin -- what a perfect application of "smart home" capabilities! I really appreciate the care & attention that went into this coding.

I picked up a Sonoff 4CH, loaded HAA onto it, and modified the board slightly to let me control irrigation voltage instead of switching AC line (which is where the 4CHPRO version would have been nicer). I'm using it to control a 4-zone irrigation system that uses pop-up rotary heads to water a grass lawn, and trying to think of things that might make this an easier setup for those of us who aren't irrigation-science-savvy.

It would be handy to have a "nozzle type" selector for each zone. Spray head output is typically measured in liters per minute, and the efficiency depends on whether it's fixed-spray (65-70%) or rotary-spray (80-85%). Maybe have a set of default basic nozzle types that are independently configurable but have sane presets for each different type of nozzle.

https://agfuse.com/article/comparison-between-pivot-and-drip-irrigation-in-corn-cultivation
https://www.sciencedirect.com/topics/agricultural-and-biological-sciences/irrigation-efficiency

Along those same lines, it might be nice to have predefined "zone types" that would preset the crop coefficient, plant density, etc., e.g. "Grass lawn," "Planting bed," "Vegetable Garden," with sane (and configurable) defaults.

I do wish the plugin could gather the mean solar radiation values based on the lat/lon, so add my vote to the Solcast option. It would add to the overall accuracy & efficiency of the system anyway, since it's using actual/forecast data instead of averages.

On the HomeKit side of things, setting up the automation between the plugin and the Sonoff accessories is much more involved than it should be. I had to create a Scene for both states (on/off) of each valve, and an Automation for both states of each zone control in the plugin. And it was all too advanced for the Home app; I had to use a third-party app to create the Automations. The basic problem there is that the Home app doesn't "see" the plugin's zone control switches as discrete accessories, so they're not selectable as Automation triggers. I'm not sure how to fix that, other than maybe having a config option to make the plugin zone controls appear as basic switch accessories rather than irrigation zones. At the very least, it's probably worth mentioning in the "Notes & Suggestions" section.

3 irrigation accessories with two zones

Hi!
First of all good job!
I have a question, I have defined two zones, but on homekit I see three irrigation accessories:

IMG_0443
IMG_0444

What is the first accessory? It have to be ON or OFF?
My zones are "Llimoner" and "Jess".

I have configured the plugin and today I get a message "No Irrigation Scheduled", is for the forecast conditions?

Thanks!!

Help or Questions

Dear All, I use the Plugin for a while now. But since last weeks I get errors from wheather api that there are too many requests. Analysing the log file showed that the Plugin tries to capture data every 5s. Is there a possibility to request for example every 30 min? Thank you for your efforts.
BR fab

Not an Issue, but a question ...

Good morning,
by pure chance I stumbled over your smart irrigation project and I like it. I have a garden and up to now I just start irrigation "by hand", checking if the soil seems to be too dry or not. That is of course not very smart ;-)
The additional proble I am faced with is that because of old pipes the water pressure is poor. So I had to split up into eight different irrigation zones, which I have to irrigate one by one. So I start with zone 1, irrigate for - say 30 minutes -, stop it, then start irrigation on zone 2, run it for - say 25 minutes - stop it and so on.
How would I achieve this with your smart irrigation ? I have not found a hint to a sequential operation of irrigation of the zones.
Any help in this would be appreciated very much.

Thank you in advance.
Cheers
Martin

[BUG] Pushover stops sending push notification since the latest update.

Describe the bug
Since the latest update that happened few days ago, pushover stops sending smart irrigation system notification. I have rechecked and all the setting is still there in the plugin config.

To Reproduce
Update to the latest version and use Pushover as the way of sending notification.

Expected behavior
Pushover should send notification every morning for the watering schedule as it used to.

**Screenshots or logs **
N/A

Platform (please complete the following information):

  • Platform: Homebridge
  • Version: 1.3.4

Additional context
N/A

When in Manuell Mode, Zones do not switch ooff after set time

I noticed something else.

I have three zones, for each I set the standard time to 5mins. When I active irrigation in any zone, I noticed that it does not switch off after 5 minutes. I then noticed, this is probably because the "Master" counts down from 300 minutes!

I guess that might be a bug?

IMG_0359

Timer Not Working

When I start the Sprinkler in the Home App, there are no timers counting down. Also I have the default timers set in the homebridge config but when I check the accessory they aren’t set. Trying to set them doesn’t save on the accessory itself.

[FEATURE REQUEST] - Delay Between Zones and Cycles

At first,
thank you for all the hard work you put into the plugin.

Is your feature request related to a problem? Please describe.
I am running a setup, where I have only one valve and a mechanical auto-switch device behind this valve.
This mechanical switch is automatically starting at the first zone of my watering setup. As soon as the water pressure lowers, it automatically switches to the second, third, fourth "zone".
But like I said, the water pressure actually needs to lower (recommended by the manufacturer is for one minute), so it can switch to the next zone.

This is currently not possible because the Plugin starts the zones directly after another one has ended
image

Describe the solution you'd like
Adding a delay between the watering cycles (and / or zones) would solve the problem.

And as the minimum runtime for one cycle would also be 1 Minute (For the Pressure inside the thing to build up), it would also require a minimum runtime...
But it would also make some scheduling situations impossible (i.e. not watering a zone for one day because the mechanic wouldn't skip a zone. It would just water the next, presumably wrong one (when the next zone starts)).

Maybe this is just kind out of focus for this Plugin?

Issue With Setup

Hi I am using HOOBS and I added the plugin as I have a water pump hooked up to a smart plug that controls my drip irrigation system. I wanted a sprinkler icon to show me the status when its on. I added your plugin and added it to homekit but the accessory doesn't appear just the bridge any help is appreciated!

[BUG]

Hello
I have email notification issue using GMAIL.

I use GMAIL for sender and receiver.
Configuration seems very simple.
But any email starts from my account neither arrive to other account

Could I have a possible configuration please? Maybe I'm doing something wrong

Thankyou

Help or Questions

Hi,

Just wondering:

  • is it normal I receive pushover notification every 2 minutes days and night? - see attach. How to limit that to only get that when relevant information like once a day on the forecast planning + when irrigation start and stop.

image

  • I dont received email notification despite correct configuration in that sense?

  • Do I currently setup the irrigation trigger? (See picture)
    image

API Error - 401 Unauthorised

Hi there,

I just discovered this plugin today, and also created an OpenWeatherMap account at the same time, but it looks like my API key is being rejected:

[30/11/2022, 10:55:44] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:56:45] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:57:46] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized) [30/11/2022, 10:58:46] [Sprinklers] Error getting weather data or Response code 401 (Unauthorized)

From what I've read in here, it appears there's a difference between v2.5 and v3.0 of the API - is there a setting I need to change in the config to get this working?

Thank you!

Choosing hour of irrigation

Hi,

I read some scientist documentation recommending to irrigate at evening in place of morning.

  • What do you think?
  • How to choose that in the Smart Irrigation plugin?

Thank you !

Docker related - Standing reboot - Fixed v1.7.1

Describe the bug
Error: EACCES: permission denied, mkdir '/run/s6/services/homebridge-config-ui-x/homebridge-smart-irrigation'

reboot standing

Platform (please complete the following information):
ОС | Ubuntu Bionic Beaver (18.04.6 LTS)
raspberrypi
v16.14.2
v8.5.5
root
/homebridge
/homebridge/config.json
/homebridge/node_modules
docker: Yes

Additional context
Add any other context about the problem here.

Doubt

Hi @MTry
Didn’t figure out how to setup my water valve (sprinkler) to work with the sprinklers created for each zone.
Could you give me a hint?
(I’m using Eve, HomeKit Controller or the default app).
Thanks!

soil moisture sensors and watering interrupting

Hello
I have 2 suggestions to improve smart-irrigation.
First: soil moisture sensors have become popular nowadays - could it be used to stop watering from a certain value regardless of the weather? 60 or 70% soil moisture is usually a sufficient level...
Second: I have a problem with the efficiency of the water source - a deep well. It would be useful to have a function that would allow watering to be interrupted for, say, an hour every hour so that the water source could be replenished.

I'm just starting to use the program and I'm impressed :)

[FEATURE REQUEST] A scheduling 2 times of watering per day

Is your feature request related to a problem? Please describe.

First of all, thank you very much for this awesome plugin! It serves the purpose very well! However, I'm in a tropical area and it's required to water the plant 2 times a day. The the current function, the plugin only calculate the watering schedule in the morning of each day and decide whether to water the plant or not for the whole day. Will it be possible if it could calculate the watering 2 times a day both in the morning and in the evening so that it could actually help automating the watering schedule in tropical area.

Moreover, the rain factor is too tricky for the tropical area like in my country. Someday, the rain could be only the morning and then it's dam hot for the whole day and never rain again. When this occurs, the plugin would skip the watering for the whole day and it could lead to the dehydration of the plants since the weather is super hot after few hours of raining. If the plugin can calculate the rain factor 2 times a day, once in the morning and start again after 2 - 3 pm, I think it could prevent the dehydration problem from happening.

Describe the solution you'd like
Plugin could calculate the watering schedule 2 times a day, once in a morning and again around 2 - 3pm. to see if it's gonna rain in the evening of the day. If not, and the watering schedule is not done in the morning, then the plugin could kick in and schedule the watering in the evening instead.

Additional context
Not sure if it's too complicated in term of scripting but if it could work this way, this plugin would be perfect! Anyway, I'm already thankful of what you have done and cheer you up all the way.

Thank you.

How to set a cycle in the morning and one in the evening?

I am irrigating my plants once in the morning and once in the evening as required. I thought I might be able to this with the cycles setting, but see that serves a different purpose.

Is there a way to set the plugin to water once on sunrise and once an hour or two ahead of sunset?

Assistance in setting up

Describe in more detail how to set up the relationship with a sonoff or other relay to turn on the valve

Error send email

Set Email notifications to: Enable
(node:26880) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir '/run/s6/services/homebridge-config-ui-x/homebridge-smart-irrigation'
(node:26880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

Node.js - v14.15.4
NPM - v6.14.10

Docker

[BUG]

Hi,

I use Hoobs v 4.0.110 and installed this plugin. Looks like this is exactly what I looking for. I configured it but after restart I saw in log the next message:

Error loading plugin "homebridge-smart-irrigation"

I tried reinstall it but I have same issue.

Can you help me, please?

[BUG]

Describe the bug
Error after installation and restart

To Reproduce
Install latest version of Home Bridge on Raspberry Pi 3B.
Install this plugin.
Do basic configuration of Geo co-ordinates, OPW key
Restart HB serveices

Expected behavior
No errors

**Screenshots or logs **
[10/01/2022, 09:56:20] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[10/01/2022, 09:56:25] [HB Supervisor] Restarting Homebridge...
[10/01/2022, 09:56:25] [HB Supervisor] Starting Homebridge with extra flags: -I
[10/01/2022, 09:56:25] [HB Supervisor] Started Homebridge v1.3.9 with PID: 5641
[10/01/2022, 09:56:27] Loaded config.json with 1 accessories and 2 platforms.
[10/01/2022, 09:56:27] Loaded 8 cached accessories from cachedAccessories.
[10/01/2022, 09:56:27] ---
[10/01/2022, 09:56:29] Loaded plugin: [email protected]
[10/01/2022, 09:56:29] Registering platform 'homebridge-config-ui-x.config'
[10/01/2022, 09:56:29] ---
[10/01/2022, 09:56:30] Loaded plugin: [email protected]
[10/01/2022, 09:56:30] Registering platform 'homebridge-ewelink.eWeLink'
[10/01/2022, 09:56:30] ---
[10/01/2022, 09:56:30] ====================
[10/01/2022, 09:56:30] ERROR LOADING PLUGIN homebridge-smart-irrigation:
[10/01/2022, 09:56:30] Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/local/lib/node_modules/homebridge-smart-irrigation/node_modules/got/dist/source/index.js from /usr/local/lib/node_modules/homebridge-smart-irrigation/index.js not supported.
Instead change the require of /usr/local/lib/node_modules/homebridge-smart-irrigation/node_modules/got/dist/source/index.js in /usr/local/lib/node_modules/homebridge-smart-irrigation/index.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/usr/local/lib/node_modules/homebridge-smart-irrigation/index.js:9:13)
at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:132:77)
at PluginManager.initializeInstalledPlugins (/usr/local/lib/node_modules/homebridge/lib/pluginManager.js:64:30)
at async Server.start (/usr/local/lib/node_modules/homebridge/lib/server.js:106:9)
[10/01/2022, 09:56:30] ====================
[10/01/2022, 09:56:30] Loading 2 platforms...
[10/01/2022, 09:56:30] [Config] Initializing config platform...
[10/01/2022, 09:56:30] [Config] Running in Service Mode
[10/01/2022, 09:56:30] [eWeLink] Initializing eWeLink platform...
[10/01/2022, 09:56:30] [eWeLink] Initialising plugin v8.9.1 | Node v16.13.1 | HB v1.3.9 | HAPNodeJS v0.9.8...
[10/01/2022, 09:56:30] Loading 1 accessories...
[10/01/2022, 09:56:30] No plugin was found for the accessory "SmartSprinklers" in your config.json. Please make sure the corresponding plugin is installed correctly.

Platform (please complete the following information):

  • Platform: Homebridge
  • Version: v1.3.9 (HAP v0.9.8)

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.