UI Simple Rule Example Needed :)

Hello Guys.
Been reading around and can’t find a simple script example written in the UI with the ECMA language - so maybe someone could post a small one here :slight_smile:

A example that does this correctly would be awesome :slight_smile: - that would help me a lot further :slight_smile:

If OutsideLux< OutsideSetpoint AND OutsideLight = OFF Then
OutsideLight = ON

Else
OutsideLight = OFF

EndIF

Are those OutsideX things Items?

If so this Rule really doesn’t need to be coded in scripts anyway. The if statement can be handled with conditions (But only if…).

In JavaScript it’s look something like:

if(items["OutsideLux"] < items["OutsideSetpoint"] && items["OutsideLight"] == "OFF") {
  events.sendCommand("OutsideLight", "ON");
}
else {
  events.sendCommand("OutsideLight", "OFF");
}

Make sure you review some of the basics of openHAB Rules. And then also review the basics of JavaScript.

Thanks - exactly what I needed - thought it was more complex :slight_smile: