For a “Normally Open” relay, “closing the relay” means energising the relay by providing current to the electromagnet, and that’s usually done by turning something on.
I guess in your case it’s the opposite. Turning the Switch item off is the effect you wanted, which somehow “closes the relay”?
I also agree with you, but OpenHab does not seem to agree with us.
I set the maximum voltage to 367V and now it has reached 368V.
But guess what? Not working
The trigger only executes when the value of Batt_Voltage or Cell_Temp_Max is changing. If you want it to also run as soon as the script you could add extra code to make it do that.
I am now not sure how you’ve created this rule.
Did you create it inside a file and only using the UI to view it?
This rule is meant to be created and saved in a file, not created through the UI.
File-based rules cannot be edited through the UI. You can view it, but it should have a lock icon and doesn’t let you edit it on the UI.
Create a file using a text editor of your choice and paste the rule into it. I see that you’re using .items file - it’s similar. Save the file in conf/automation/ruby/shutdown_charger.rb
If saved correctly, you should be able to see the rule in the Main UI under Settings → Rules. You should see the lock icon and you won’t be able to edit it using the Main UI.
Rules have triggers, optional conditions, and execution
Scripts consist only of the execution code. It does not include / define any triggers/conditions.
In and by itself, a Script doesn’t do anything for you. Something / someone needs to actually execute it for it to run. It’s a more advanced concept where you can execute a 'Script` from inside your rule.
I have been using openhab since 2018 and have never needed to use ‘Scripts’. Everything I do are done through creating ‘rules’.
Here is the “Scripts” section of my actual openhab instance for my home: