Complete watering system based on openHAB

It is not a big project but few rules and items. Simply it works :slight_smile:
Michal

Hi @Michal_Szymanski,

first of all, thank you for posting your project.
I was wondering if you have current version for OH 2.5 which you want to share with us?
Would like to use your code for my garden project.

Regards

Patrick

Hi bellow, most current version.
Sorry but comments are in Polish, without problem you can use google translate to translate to your native language. This version works without problem with 2.5. If you have question to code let me know.

Hi @Michal_Szymanski,

cool thanks for sharing. It drops niw far less errors;)
I have indeed a couple of questions:

  • MinimumReqRainfallCfg -> is this related to the rain sensor? It throws a lot of error messages.
  • sendPushOverMessage & pushoverBuilder -> is there a certain binding needed as it throws errors?
  • Hunter Rain sensor - did you connect it directly to the raspy?

I have no rain sensor at the moment, can i use it without it as well?

Regards

Patrick

Hi @Michal_Szymanski,

cool thanks for sharing. It drops niw far less errors;)

No problem, BTW in source code you will find key to weather forecast service, please do not use it , because it is for my account :slight_smile:

I have indeed a couple of questions:

  • MinimumReqRainfallCfg → is this related to the rain sensor? It throws a lot of error messages.

I use weather forecast service, simply everyday I make REST call to external service and get rainfall forecast for next 24h. If forecast rainfall is greater than MinimumReqRainfollCfg simply I will not start watering. Value of MinimumReqRainfallCfg is set in GUI, below watering configuration:

  • sendPushOverMessage & pushoverBuilder → is there a certain binding needed as it throws errors?

exactly it is Action for sending info to smartphone:

  • Hunter Rain sensor - did you connect it directly to the raspy?

no I do not, I’m using MCP2307 input / output extender. You can connect to Rpi directly buy for Rpi safety it is good idea to use something between Rpi and sensor.

I have no rain sensor at the moment, can i use it without it as well?

Of course, rain sensor is only used in two ways, if it is wet it does not start watering if will wet during watering it stops current watering. Simply you can remove lines where I use WtrRainSensor

BTW where are you from ?

Hi @Michal_Szymanski,

thank you for your reply. I’m getting there slowly but steady…
I disabled all relevant rain sensor linesand it looks good for the moment. However the
MinimumReqRainfallCfg is confusing me. It still throws errors.
Please see screenshot

Could you please also share your sitemap file?
I created the rain amount inpout based on your screenshot, but it doesnt look right.

And where is the pushover function sending the messages to? To the OH app on your mobile or
do you need to configure a device accordingly?

Don’t worry, i have deleted the API KEY;)

I’m from Germany.

Regards

Patrick

This problem is solved, i deleted for some reason the MinimumReqRainfallCfg item in the itmes file.

But it is a message from your IDE, have you seen such message in openHab?

I use pushover to send message to my smartphone (you need to install pushover software on your mobilephoine).

Configuration

	/* Konfiguracja systemu  */
	Text label="Konfiguracja" icon="settings" {
		
		Text label="Systemu podlewania" icon="water" {
		
 			Frame label="Czas podlewania" {
	 			Setpoint item=WtrDurationFront  label="Przed domnem" minValue=1 maxValue=40 step=1
	 			Setpoint item=WtrDurationBack   label="Za domem" minValue=1 maxValue=40 step=1
	 			Setpoint item=WtrDurationLine   label="Linia kroplujaca" minValue=1 maxValue=40 step=5
	 			Setpoint item=WtrScaleFactor    label="Korekta" minValue=1 maxValue=100 step=1
	 			
 			}
			
		
 			Frame label="Pozostale parametry" {
	 			Setpoint item=MinimumReqRainfallCfg     label="Min.wymagana ilość opadow"	minValue=1 maxValue=20 step=1
			 	Selection item=WtrStartTime mappings=["00:00"="00:00", "01:00"="01:00", "02:00"="02:00",
 				                                  "03:00"="03:00", "04:00"="04:00", "05:00"="05:00", 
 				                                  "06:00"="06:00", "07:00"="07:00", "08:00"="08:00",
 				                                  "09:00"="09:00", "10:00"="10:00", "11:00"="11:00", 
 				                                  "12:00"="12:00", "13:00"="13:00", "14:00"="14:00",
 				                                  "15:00"="15:00", "16:00"="16:00", "17:00"="17:00",
 				                                  "18:00"="18:00", "19:00"="19:00", "20:00"="20:00", 
 				                                  "21:00"="21:00", "22:00"="22:00", "23:00"="23:00"
 			]
 			}
			
		}

and

   Text label="Podlewanie" icon="water" {
		Frame label="Podlewanie sekcji" {
			Switch item=WtrValveFront label="Przod"   mappings=[OFF="Wł", ON="Wył"] 
			Switch item=WtrValveBack  label="Tyl"     mappings=[OFF="Wł", ON="Wył"] 
			Switch item=WtrValveLine  label="Linia"   mappings=[OFF="Wł", ON="Wył"] 
		}
		
		Frame label="Status" {
			Text item=WtrRainSensor 
			
			// czy wlaczona automatyka
			Text item=WtrAuto 
			
			// prognoza ilosci opadow
			Text item=WtrRainfallForecast
			
			// data kiedy byla pozyskana prognoza
			Text item=WtrRainfallForecastDate
			
			// data podlania / sprawdzania czy bylo 'mokro'
			Text item=WtrLastDate
	
		}	
	}

Hi Michal,

thanks for your reply, i have managed to tweak the rules with “virtual switches” as i have no IO input. For the time being it looks like it 's working somehow.

I have three questions:

  • why are you using var OnOffType ON_R & var OnOffType OFF_R. I think this avoids my system to manually stop the irrigation system.

  • Is t normal that the irrigation rule is starting the watering every hour? I thought it is supposed to do it only once a day?

  • The item “WtrStartBtn”, is it in connect to a physical switch or a button. I mean here how the signal is created. Is the state either closed or open, or do you just close the circuit when hitting it?

BTW: i have changed the code for Telegram as push service, as i use the app on a daily basis.

Regards

Patrick

Hi Michał,
Bellow? You mean where? I can find only new sitemap.
Pozdrawiam
Marcin

Ok once again rules and item files GardenWateringSystem.items.txt (2.0 KB) GardenWateringSystem.rules.txt (22.8 KB)

1 Like

why are you using var OnOffType ON_R & var OnOffType OFF_R . I think this avoids my system to manually stop the irrigation system.

becuase sometimes sensor genere 1 for off and 0 for on I make artificial variable to compare state of sensor to kind of constant

Is t normal that the irrigation rule is starting the watering every hour? I thought it is supposed to do it only once a day?

No, it only check every hour if hour of watering defined by user == with current hour :slight_smile: Watering is executed only once a day.

The item “WtrStartBtn”, is it in connect to a physical switch or a button. I mean here how the signal is created. Is the state either closed or open, or do you just close the circuit when hitting it?

Exactly it is a physical button, button is bistable.

BTW Some time ago I’ve started to write article about my watering system…but is not finished. Sorry but article is in Polish https://openhabwdomu.wordpress.com/2020/07/02/system-automatycznego-podlewania-cz-1-inprogress/ but using Google Translate you translate it to English

1 Like

In Polish… hm I can live with that :joy:
Dziękuje

Hi Michal,

nice one! I’ll try to get it up and running and let you know the outcome.
Still struggling with the waetherforcast section.

Regards

Patrick

Hi @Michal_Szymanski,

i’dlike to ask you once more for support if i may.
So far i have configured the system, replaced the start button with a virtual one and removed the rain sensor. However, it never made it to the weather forcast section of the algorythm. Please see log:

Any ideas why this occures?

Answer is simple :slight_smile: This log is from 12:00 but watering time is 8:00 …be patient or change userStartTime.
This rules check watering condition every hour but start only once during the day in your situation 8:00

I know! I Set it initially to 8:00 Last night. But it didnt start at all. I also tried any other date. Nothing. Could it be the checkuserdate - which I also set to true and false and vice versa ?

I’ll set it to 16:00 and post again the outcome.

It should look like this

2020-06-10 05:00:00.134 [INFO ] [.eclipse.smarthome.model.script.FILE] -  ======= Wheather algorithm  =======
2020-06-10 05:00:00.146 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: now                       [2020-06-10T05:00:00.142+02:00]
2020-06-10 05:00:00.157 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: userStartTime             [2020-06-10T05:00:00.000+02:00]
2020-06-10 05:00:00.169 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: checkUserStartTime        [true]
2020-06-10 05:00:00.183 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: isWatering                [false]
2020-06-10 05:00:00.197 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: WtrAuto.state             [CLOSED]
2020-06-10 05:00:00.242 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: WtrRainSensor.state       [CLOSED]
2020-06-10 05:00:00.255 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: lastWtrDate               [2020-06-09T05:00:00.932+02:00]
2020-06-10 05:00:00.266 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: maxNoWtrDays              [2]
2020-06-10 05:00:00.277 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: checkWtrRainSensor        [true]
2020-06-10 05:00:00.288 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: checkUserStartTime        [true]
2020-06-10 05:00:00.302 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: MinimumReqRainfallCfg     [4]
2020-06-10 05:00:00.326 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: Getting wheather forecast [http://api.openweathermap.org/data/2.5/forecast?id=3092909&APPID=ff5&units=metric&cnt=8]
2020-06-10 05:00:00.541 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: forecastJson[{"cod":"200","message":0,"cnt":8,"list":[{"dt":1591768800,"main":{"temp":13.03,"feels_like":10.64,"temp_min":13.03,"temp_max":13.58,"pressure":1014,"sea_level":1015,"grnd_level":1007,"humidity":91,"temp_kf":-0.55},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":4.13,"deg":5},"sys":{"pod":"d"},"dt_txt":"2020-06-10 06:00:00"},{"dt":1591779600,"main":{"temp":14.12,"feels_like":11.27,"temp_min":14.12,"temp_max":14.56,"pressure":1015,"sea_level":1015,"grnd_level":1007,"humidity":87,"temp_kf":-0.44},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":98},"wind":{"speed":4.95,"deg":24},"sys":{"pod":"d"},"dt_txt":"2020-06-10 09:00:00"},{"dt":1591790400,"main":{"temp":17.47,"feels_like":14.7,"temp_min":17.47,"temp_max":17.81,"pressure":1014,"sea_level":1014,"grnd_level":1006,"humidity":75,"temp_kf":-0.34},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":5.28,"deg":26},"sys":{"pod":"d"},"dt_txt":"2020-06-10 12:00:00"},{"dt":1591801200,"main":{"temp":16.63,"feels_like":13.97,"temp_min":16.63,"temp_max":16.66,"pressure":1013,"sea_level":1013,"grnd_level":1005,"humidity":81,"temp_kf":-0.03},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":3},"wind":{"speed":5.3,"deg":26},"sys":{"pod":"d"},"dt_txt":"2020-06-10 15:00:00"},{"dt":1591812000,"main":{"temp":14.49,"feels_like":12.23,"temp_min":14.49,"temp_max":14.49,"pressure":1012,"sea_level":1012,"grnd_level":1005,"humidity":88,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":2},"wind":{"speed":4.34,"deg":15},"sys":{"pod":"d"},"dt_txt":"2020-06-10 18:00:00"},{"dt":1591822800,"main":{"temp":12.12,"feels_like":10.38,"temp_min":12.12,"temp_max":12.12,"pressure":1013,"sea_level":1013,"grnd_level":1005,"humidity":94,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.03,"deg":349},"sys":{"pod":"n"},"dt_txt":"2020-06-10 21:00:00"},{"dt":1591833600,"main":{"temp":12.61,"feels_like":10.74,"temp_min":12.61,"temp_max":12.61,"pressure":1012,"sea_level":1012,"grnd_level":1004,"humidity":94,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.42,"deg":344},"sys":{"pod":"n"},"dt_txt":"2020-06-11 00:00:00"},{"dt":1591844400,"main":{"temp":14.16,"feels_like":12.15,"temp_min":14.16,"temp_max":14.16,"pressure":1012,"sea_level":1012,"grnd_level":1004,"humidity":97,"temp_kf":0},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":37},"wind":{"speed":4.53,"deg":9},"sys":{"pod":"d"},"dt_txt":"2020-06-11 03:00:00"}],"city":{"id":3092909,"name":"Lublewo","coord":{"lat":54.2846,"lon":18.5039},"country":"PL","timezone":7200,"sunrise":1591755165,"sunset":1591816707}}]
2020-06-10 05:00:00.875 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: Cannot find rain section - rainfallMm is 0mm
2020-06-10 05:00:00.901 [INFO ] [.eclipse.smarthome.model.script.FILE] -  ======= Wheather forecast =======
2020-06-10 05:00:00.928 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: rainfallMm         [0.0]
2020-06-10 05:00:00.938 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: minimumReqRainfall [4]
2020-06-10 05:00:00.950 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: RainSensor is dry, check other conditions
2020-06-10 05:00:00.972 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_algorithm: Missing [4.0] mm rainfall
2020-06-10 05:00:00.988 [INFO ] [.eclipse.smarthome.model.script.FILE] -  ======= End of Watering algorithm  =======
2020-06-10 05:00:01.023 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping:============== Watering starting/stoping ==========
2020-06-10 05:00:01.031 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: Stoping watering if already started
2020-06-10 05:00:01.039 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: msg [START]
2020-06-10 05:00:01.043 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: WtrTimers
2020-06-10 05:00:01.093 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: starting watering
2020-06-10 05:00:01.121 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: NowTime[10.06.2020 05:00]
2020-06-10 05:00:01.165 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: durationFront[15]
2020-06-10 05:00:01.174 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: durationBack [10]
2020-06-10 05:00:01.183 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: durationLine [1]
2020-06-10 05:00:01.193 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: scaleFactor  [100.0]
2020-06-10 05:00:01.202 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: wtrFrontTime [15]
2020-06-10 05:00:01.212 [INFO ] [.eclipse.smarthome.model.script.FILE] - Wtr_starting_stoping: wtrBackTime  [10]

So same thing.

I changed to 16:00