Spruce irrigation ver 1 zigbee now working in hubitat (non wifi version)

I finished my port of spruce and now after many changes have it working in hubitat.

There are 3 parts.

  1. the controller device type..
  2. the smartapp scheduler (I found a version available to port)
  3. the optional zigbee moisture sensor device type.

Note when you pair the controller it probably will just come in as a zigbee device you will have to change the device type.

enjoy

https://github.com/lgkahn/hubitat/blob/master/sprucescheduler.groovy


1 Like

adding virtual pushbuttons and status text for my control panel
coudlnt use switches as it would have put it in an endless update loop if they controlled the zone and also tracked the zone changing.. Zone 9 is the master so when you run the program it turns on with all the zones automatically. That is why all are on.


!

i actually rewrote this using just virtual switches .. and i had to add extra if's in the rules to make sure i dont go in an endless loop? The tradeoff is now i need 2 rules for each switch.. but it is a cleaner panel..

ie



All your device handler code worked great for me except for the sensors. The code loads in fine but never reports any temps or moisture. I ended up having to use a different DH for the sensors to get them to show temp/moisture.

https://raw.githubusercontent.com/PlaidSystems/Spruce-Hubitat/master/drivers/Spruce%20sensor.src

ya thanks me neither.. not sure why it didnt work but i have not been using sensors anyway.. thanks for the update.. the sensors seem wildy inconsistant on reporting moisture.. temp was fine.. I gave up using them years ago.

This is awesome, thanks so much for working on this. I worked with Nate early on to fix a number of Spruce bugs for Smartthings. I'm in the process of moving to Hubitat so I was happy to your modifications. A while back he made a beta version of the device drivers for Smartthings that used child devices for each zone so that you could turn them on/off with things like Google Home/Alexa/etc. I never converted to using that version on Smartthings since I didn't want to break it :slight_smile: It looks like he's updated that version more recently and actually removed the original device drivers that you modified from github, so I'm assuming they are more ready for prime time now. I haven't looked to closely at them, but I suspect porting them over shouldn't be too hard and maybe using those would eliminate the need for all of the extra virtual buttons you created for your dashboard.

1 Like

ya unfortunately i've already blown out the sprinkers here so will not be ported right now and testing as weve already had below freezing.. If you want to take a stab at it.. Ifyou want i can try converting but without testing I am hesitant to post the solution as working..

I'll probably give it a whirl since it doesn't look like it's too hard. I had some other changes that I sent Nate for the scheduler that I'm not sure he integrated so I wanted to look at that anyway. My spruce is pretty much the only thing left on Smartthings at the moment. I'll let you know how it goes.

So I made a first pass at the parent/child driver and it seems to work. It would probably make your setup a lot easier since you wouldn't need to make the extra switches for the dashboard. I talked to Nate and he has a few more changes in-flight for the parent/child driver to support the new ST app, but after that he said he's pretty much not going to touch it again. He seemed receptive to integrating my changes for HE, so we'll see.

The schedule is another matter. I know you did some work there, but I grabbed a newer version and started making changes in it. The issue is weather (I'm guessing you're not using it). Without TWC support none of that is going to work. I started looking into how to support OpenWeatherMap instead so that could be used for HE, but I haven't started working on it just yet. You can find my changes for the time being here:

Robert

my port has the secheduler built in.. are you saying the parent child does not

No the parent/child works with the scheduler that I posted to github. What doesn't work in the scheduler is using the weather forecast to adjust watering or not water because of rain, etc. That part I need to sort out with OpenWeatherMap or similar.

ya i looked into that you need to put your api key in and then get data or alternatively just ge tthe attribute from openweather.. im thinking i will add an attribute in the spruce scheduler and write a rule machine rule to copy the attribute rainToday and rainTomarrow attributes .. which is rian in inches and that is what the spruce app is looking for

ok change of plans.. i implemented the weather (it only gets daily precip forecase in inches)
I added an option to select your weather device either darksky or openweather etc and it gets the daily rain forecase from there ie rainToday.. take alook at the new code

here is the bulk of the code

def weatherPage() {
dynamicPage(name: 'weatherPage', title: 'Weather settings') {
section("Location to get weather forecast and conditions:") {
input(name: 'zipcode', type: 'text', title: "Zipcode default location: ${getDefaultLocation()}", required: false, submitOnChange: true)
input "weatherDevice", "capability.relativeHumidityMeasurement", title: "Weather Device (ie darksky or openweather) to get rain forecase from?", required: false

        input 'isRain', 'bool', title: 'Enable Rain check:', metadata: [values: ['true', 'false']]
        input 'rainDelay', 'decimal', title: 'inches of rain that will delay watering, default: 0.2', required: false
        input 'isSeason', 'bool', title: 'Enable Seasonal Weather Adjustment:', metadata: [values: ['true', 'false']]
    }
}

}

//capture today's total rainfall - scheduled for just before midnight each day
def getRainToday() {

log.debug "Current Weather Device to get precip info = $weatherDevice"

if (weatherDevice)
  {
     def rainToday = weatherDevice.currentValue("rainToday")
     log.debug "rainToday = $rainToday"
      float TRain = 0.0
    
        TRain = rainToday.toFloat()
        if (TRain > 25.0) TRain = 25.0
        else if (TRain < 0.0) TRain = 0.0
        log.debug "getRainToday(): ${rainToday} / ${TRain}"
    
    int day = getWeekDay()                        // what day is it today?
    //  log.debug "got day = $day"
    if (day == 7) day = 0                        // adjust: state.Rain order is Su,Mo,Tu,We,Th,Fr,Sa
    state.Rain[day] = TRain as Float            // store today's total rainfall  
}

// def conditionsData = getConditions()
else {
note('warning', "${app.label}: Please select an openweather or darksky weather device that has a daily rain forecase", 'a')
}
}

There's certainly more than one way to skin the cat here. I looked at using the weather devices, but they didn't provide the forecast info that the scheduler uses for doing dynamic adjusting. Since I wanted to keep it generic enough to work on both ST and HE, I just factored out the TWC and OpenWeatherMap bits into their own functions to pull the daily precip and 4 day forecast. With that, everything seems to work just like it did before, but you need to supply the API key to the scheduler itself. My latest updates are in the github repo mentioned above.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.