Hello! Thanks for your reply. Unfortunately I have already read this but as I wrote, only the items file was modified here to include an LED and a Switch. But instead of a switch I want to write a script to shutdown the Lamp when the status is changed from online.
What status? Are you referring to an openHAB thing?
Use of “loop” in your psuedocode is not the way to go. openHAB rules are event driven , so it will be more like your text description.
When XX changes to A, turn Q on.
When XX changes to B, turn Q off.
Yes exactly, using the SmartMeter binding, I want an LED to turn off when the connection changes from ONLINE to anything else. Do I need to install the GPIO binding or it can be done straight forward with a script.
In openHAB you would normally represent something like a LED as an Item. Probably a Switch type. You would link that Item to a channel of some Thing that would actually control the LED via an appropriate binding. Maybe GPIO for you.
You will find examples of rules responding to Thing status changes in this forum.