Soil moisture & automated irrigation

Anyone got anything automated with HE?

I will swap my hydrawise irrigation controller for a rachio (HE supported) if something can be triggered with soil moisture levels?

I purchased a plantlink sensor but it’s Bluetooth so won’t work with hubitat...I’m stuck.

I base my watering on previous and expected rainfall.
I use a kind of ‘weighting’ to allocate a value to each figure then do a calculation of the numbers to produce a final figure.
If that figure is below a certain number I’m told by HE to water the garden :slight_smile:

Another user uses then same calculation to turn on his water... :slight_smile:

[RELEASE] - Irrigation Switch App - Turns on a switch if you need to water the garden



hey @bf1 did you found something useful yet? I want to help my wife gardening a bit. Last year's salad was a disaster :joy:

I have the Spruce Moisture Sensors but haven't integrated them yet, i've been trying to run a bare bones hub for a few weeks to work out what was causing it to crash. I'll be adding them soon to a secondary (non-essential devices) hub.

Did you try this stuff from Smartthings?
I personaly am too new to HE so I have no idea how the porting of apps and drivers work but... you know.

Hi guys,

Smartthings is a lot easier as it has built in get weather commands which Hubitat does not. I have written my system using a local temperature device and openweathermap for the forcasting. You will need to get an API key from openweathermap, their basic package is free.

Feel free to use whatever you want from my code.


1 Like

Thanks, but I want to automate the watering of a covered salad beet. If the soil is to dry give water for x seconds.
But I asume your App is great for lawn.

1 Like

Ambient Weather has released a soil moisture probe that works with their API. It works with their ObserverIP unit or with a small display console that uploads the data to Ambient Weather. The existing Ambient Weather app could be updated to provide that sensor data.

Does this code work for controlling a valve? I have an orbit timer, but it is listed as a valve, and not a switch.

Check out this thread..might be some stuff in there.


You will need to change the code slightly. Replace mentions of switch with valve ie input "sprinkler", "capability.switch" should now read input "sprinkler", "capability.valve". The handlers switchOn line 303 and SwitchOff line 311: you should change and sprinkler.on() and to andsprinkler .close().



Can I change the measurements from Celcious to Farenheight, and mm to inches?


The temperature measurement is just a number from your local temepraturemeasurement device, just change the "C" for an "F" in the app.

For the forcast, the temperatures are read in K and converted to C by the lines
def maxToday = weatherNow.main.temp_max - 273.15
def minToday = weatherNow.main.temp_min -273.15

you will need to change that to def maxToday = (weatherNow.main.temp_max - 273.15) × (9/5) + 32

to convert rain from mm to inches the lines before need changing
def Rain24H = "$forcastRain" / 25.4

def Rain1H = weatherForcast.list[0].rain / 25.4
logDebug "rain 1h ${Rain1H}"
if (weatherForcast.list[0].rain != null){
logDebug "rain 1h ${Rain1H.get("3h")}"
Rain1H = Rain1H.get("3h") / 25.4
rain1H = 0

For anyone else converting this to US format, here are a couple of notes:

I converted the preferences and openweathermap call to use zip instead of city and country

(maybe the app could pull lat-lon from the platform and use this by default?)

The temp conversion tips from @mhutchy above, obviously use * instead of x.

change all the C to F, change all the mm to in

set the input type for maxRain24 and rainForcastAllowed to be decimal instead of number to allow entering rainfall amounts like 0.5 inch

Edit: there are a few more changes needed, ill keep tidying it up and will post the US version here


Thanks for the help. I have found a few bugs as well, ill post an updated app (still European version, sorry)

Might be a little off topic due to the Bluetooth range limitations, but the really inexpensive Xiaomi Mi Flora sensor looks interesting. There are Homebridge, Home Assistant and MQTT implementations using the BLE from a Raspberry Pi

this is my current working version: I had a problem last night, the internet must have been a bit flakey and the httpget timed out, as a result the weather forcast information was NULL and the app failed to work. I am working on a retry if httpget fails and after a few attempts just assume all is ok for watering.

Did you ever get the spruce sensors up and running? I’m planning on using hubduino with moisture sensors attached if I can get it stable and waterproof to go outside. It’s too late in the season this year so at least I have time. Lol

Not who you asked, but I happened to get my new v3 Spruce sensor up and running. Just put it out in the garden about a day ago, and it's giving me some readings (graph came from Home Assistant--wish there was an easier way to do this):


The Spruce manual says "generally, soil moisture will range from 10% to 45%, but can be higher during and after watering." The spike in this graph is when I watered, where it reached barely 40% before dropping more or less exponentially and tapering off down to 12% (I think I started around 3% or 4% before watering).

I don't know how to interpret the readings yet. The manual says it depends on your soil type and how well the sensor probe makes contact with the soil. I started with about 5 days with no watering or rain, so we'll see how long it takes to get back to that level if the weather doesn't have other ideas first, I guess, and see if I can really use this as a good gauge of when I might need to water the garden based on my own habits and recent rainfall.

It's still in my list of things to do...