Using of Conditions in JavaScript/ECMAScript 262 Edition 11

Hi,
im searching the documentation and the community for a hint how to specify a condition like a trigger in JavaScript/ECMAScript 262 Edition 11.

How would be the syntax to use the numericState of the Item (victron_output_potential) as condition for the rule?

In more complex examples i would like to spare some if clauses.

Thanks for help

rules.JSRule({
  name: "BatterieUndervoltage",
  description: "Batterie Undervoltage",
  id: "BatterieUndervoltage",
  tags: ["Solar"],
  triggers: [triggers.ItemStateChangeTrigger("victron_output_potential")],
 //conditions: [conditions.ItemStateCondition()],
  execute: (event) => {
       var systemvoltage =items.getItem("victron_output_potential").numericState;
      if (systemvoltage <= 39.0 & items.getItem("dpm_setOutput").state=="ON")
      {
        items.getItem("dpm_setOutput").sendCommand("OFF");
      }
  }
});
  • Platform information:
    • Hardware: Intel i-3-9350KF / x64 /64GB DDR4 ECC/990Evo ZFS Mirror
    • OS: Proxmox 8.3.5
    • Virtual Hardware: 4Cores / x64 / 8GB / 64GB scsi
    • Virtual OS: Debian 12.8
    • Java Runtime Environment: Zulu17.56+15-CA
    • openHAB version: 4.3.3 Release Build

You can add an additional condition (not trigger) to your rule.
Go to your rule and scroll down to

But only if

There you can add your condition

Just have to remember that the But only if are AND conditions and not OR conditions.

Thanks for help, but this not what i am looking for.
I search the syntax for JS/ECMAScript262 to do this.

I don’t believe you can do this with your rule. The RuleConfig object that is passed to JSRule does not have a condition property.

You loose nothing (and gain potential complex conditions) by simply having your conditional logic to the beginning of your script.

Thanks for the answers. I hoped that i missed somthing in the documentation.