Hello, does somebody have a working rule to enable or disable a thing?
Cannot be done through Rules DSL except through the REST API and the sendHttpXRequest actions.
Cannot be done in Blockly except through the REST API and the HTTP block or the “inline script” block using the JS below.
In JS Scripting: things.getThing('UID:OF:THE:THING').setEnabled(false);
jRuby has a similarly simple one liner I’m sure.
Thank you, this works perfect!!!
Gesendet von Mail für Windows
Jruby
things["uid:of:the:thing"].disable
things["uid:of:the:thing"].enable
do you have an example how I can use this in a rule to enable and disable the thing?
I am not the expert and every example helps to furher improve.
Thanks
What should the rule be triggered by?
In other words, describe what you actually need to do or need to happen?
One use case is to disable and enable a thing if the binding lost connection and is not reconnecting it’s things properly.
So I use it in connection with @rlkoshak 's “Thing Status Reporting” rule-template from the marketplace.
I would like to enable and disable the thing for my car in the Connected Car binding.
This only works for a Skoday Enyak when triggered the first time.
By enabling/disabling I can simulate this and so update the data from my car.
This might be one of those cases where this workaround could be useful.
But first thing should be to search for the root course (e.g. put binding in trace or debug logging mode). With that information you can try to contact the binding developer and search for a stable solution (which helps all the others too).
Here is my rule in javascript to disable polling of my solar inverter after sunset:
var ThingUID = Java.type('org.openhab.core.thing.ThingUID');
thingMgr.setEnabled(new ThingUID('modbus:tcp:solcelle'), false);
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.