Hello, I am currently using SmartMeter binding and all I want to do for now is setup a GPIO-connected LED to light up whenever the binding is online and shutdown whenever the binding isn’t online.
I have seen that there’s a GPIO Binding but I don’t understand how can I use scripts and rules with that.
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.
So for the script you’ve written, I believe, when I write:
When
“Thingxxxx” changes from ONLINE
Then
Turn LED OFF // how can I here indetify the LED in the 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.