Thank you all!

Just to avoid confusion, Rules are not written in Java but a specially designed language we call around here the Rules Domain Specific Language (DSL). It is based on Xtend, it runs on the Java Runtime Environment, and it has access to Java classes and Objects, but it is very much unlike Java in all other respects.

If you are more comfortable with Python or JavaScript you might want to look into the JSR223 plugin. I find that those who come to OH Rules with a C/C++ background struggle mightily with the constraints of the Rules DSL.

import java.util.Random

val rnd = new Random(now.millis) // I know, the timestamp is a really bad seed, but it is better than nothing and does it really matter how mathematically provably random these numbers are?

...

    // In a rule
    rnd.nextInt
    

https://docs.oracle.com/javase/7/docs/api/java/util/Random.html

Also, have you see things posting?

Read the whole thread, lots of good ideas there.

I would love to see more specifics on this one. I’ve such a short growing season here that if I could base this on actual soil temp rather than just waiting until mid-May I might get an extra week of outdoors growing. If you are willing this would make an excellent new Thread in Examples and Tutorials.

Did you just bury the sensor in the ground? How deep? Did you include a moisture sensor as well? If I threw in a pH sensor I could maybe grow blueberries. :slight_smile: Did you encounter any unexpected problems?

This is another one I’m sure a lot of people would love to know more about.

1 Like