RuleBuilder: Chaining item commands?

Hi

I have started to look into the new Rule Builder. I am trying to add some basic rules, but now I’m wondering, if it is possible to chain commands to items? I want to do something like this:

//turn on the kitchen light at SUNSET
rules.when().timeOfDay("SUNSET").then().sendOn().toItem("KitchenLight").and().send("OFF").toItem("FrontdoorLamp).build("Sunset Rule","turn on the kitchen light
at SUNSET");

When looking at the code behind the scenes, I can find the method “and(next)” in operation-builder.js, but I can not make it work.

There are a lot of changes and additions happening in openhab-js. Make sure that the version of the library you are using actually has the and methods defined. You might need to install the library using npm instead of relying on the version that comes with the add-on to be sure.

Thanks. But is my approach correct? The syntax.

ons. 19. jan. 2022 kl. 16.48 skrev Rich Koshak via openHAB Community <bot@community.openhab.org>:

I don’t use builder so I don’t know. There are two and functions in that file, one that doesn’t have any arguments and the other one that takes next as the argument. I have no idea which one to use when.

They belong to different classes, so different purposes, but thanks so far, I’ll figure it out.
Biggest problem with coding rules in js is, that if I make too many mistakes, OH kinda dies and needs a restart.

ons. 19. jan. 2022 kl. 17.36 skrev Rich Koshak via openHAB Community <bot@community.openhab.org>: