Hi guys,
In another life I used to do customized programs for forms and databases within an Oracle environment, including some Java and xml. This was many many years ago but I have felt the urge to learn Groovy and do some programming of my own controlling things in Hubitat.
-
I found the 'Developers Documentation' which I will read, but is there a development kit for Hubitat or tutorial videos of the Hubitat specific things I imagine I have to learn sooner or later?
-
What would be you advise to some one who sets out to do there first Groovy script for Hubitat?
Cheers,
Magnus
What I did was open up some of the community apps and drivers and study the code. Then I built a couple of stubs, one for drivers and one for apps, that were essentially skeletons of the minimum required code to compile. After that it was a matter of finding something small to start working on to get in the groove, and looking on here for answers when I got stuck.
Just a warning small efforts over time tend to grow, so develop a coding structure that you can maintain with minimal effort - I have one effort that started as about 15 lines of code but has grown to almost to 1000 over the course of a year.
6 Likes
Some of these you may want to do early, some not so quickly:
- It is very difficult / almost impossible to test the drivers / apps outside of a HE hub, so if you can afford it at some point, a second development / test hub would be a good investment, depending on how much development you intend to do.
- Set up a GitHub account
- Once you have something you want to release, get it into Hubitat Package Manager, a Community developed app that greatly assists in getting code more easily accessible by all
- Like @thebearmay said, look at existing apps / drivers, get to know some of the common approaches to stuff like logging, (asynchronous) HTTP calls, error handling (don't look at my code
), scheduling, etc
Learn the ropes on something small and manageable, a platform you have access to in your own setup. Get someone here to review your code and offer advice. Post questions here on the Community, there are plenty of people here willing to help.
There's probably a million other pieces of advice I and others could offer, so just take your time and keep at it.
Simon
3 Likes
Hubitat has a Github repo of the few samples of code at:
There's a Community repo too with 43 individual repos:
One of those will be able to become your future Template, I believe.
4 Likes
This is a very good tutorial that I found...
Hubitat Programming
1 Like