Update thing configuration from rule

I have learned that house guests can be confused by double-clickable switches, and the switches I have (Inovelli Red) also “pause” before turning on the lights (waiting a few hundred milliseconds for a possible second click). But, those switches can be dumbed down with a configuration change - you can make the pause go away, if you’re willing to lose the double-click feature.

So, I’d like to create a “guest mode” that I can easily turn on and off. I want a rule, triggered by my virtual guest mode switch, that changes all my Inovelli switch configurations to be more “normal”. I have tried several approaches:

  1. There’s a REST API so I can just write a rule that does a POST. But, that means I have to hard-code my username and password in a rule, which isn’t a great plan.
  2. I have read that it’s possible to create a channel for a thing that would let you connect a configuration to an item. But I haven’t seen any examples of how to do this, and I expect it would involve overriding the definition of the thing itself. Is this a realistic way to go? I’m using OH3 and have moved away from providing .thing files, instead using just the GUI, but if there’s a simple way to override the definition to get this functionality, I’m willing to try.
  3. Use the jython rule syntax. I feel like I’m close with this method, but it’s still not doing what I want. I can see the property with this code:
for thing in [thing for thing in things.all if thing.UID.toString() == "zwave:device:deadbeef:node28"]:
    LoggerFactory.getLogger("org.openhab.core.automation.examples").info("prop: {}".format(thing.configuration.get("config_51_1")))
    thing.configuration.put("config_51_1", 0)
    LoggerFactory.getLogger("org.openhab.core.automation.examples").info("prop: {}".format(thing.configuration.get("config_51_1")))

That third technique looks like it should work – when I run that code, I see my change in the log messages, and when I go to the thing configuration, I also see that it has been updated. But, crucially, the change doesn’t actually reach the switch itself. Is there some other step I need to take to push the change out?

I don’t know, as I’m not using any zwave stuff, but I’m pretty sure you can’t configure ZWave modules from openHAB. The only thing is to configure openHAB itself.

Not sure what you mean “can’t configure ZWave modules from openHAB” - you definitely can, using the Thing configuration pages, e.g. http://:8080/settings/things/zwave:device:deadbeef:node28 so I was hoping that if it can be done that way, it could be done from inside a rule as well.

You can create a channel in the Zwave DB (will require write access) to alter a parameter of the device (if that is what you are trying to do). You can then write a rule.

How do I create a channel in the DB? And, that affects every single user of that Thing type, assuming the change gets published, right? Although I selfishly think my channel will be useful, not everyone may agree, and I don’t want to mess anyone’s configuration up. And, is there some reason that there isn’t a channel for every parameter? Is there guidance on what parameters would normally merit a channel? Is there a way to make such changes locally, so I can test this out myself first?

It shouldn’t. you would have to link the channel to an item and then change the item. it would show up in the list of channels though.

Some devices have way too many parameters, and some might not be useful to change.

Not that I’m aware of

I usually do this (test locally first). One way is to checkout the zwave binding using the github desktop or download. Alter the XML for the device in your editor, then recompile the binding locally. There are other ways depending on experience, etc.

Edit: So here is a general guide based on one I did for the ZOOZ zen15

  1. Add channel to configuration CC
  2. This creates this in the XML (possible to add locally for testing)
>       <channel id="config_decimal_param171" typeId="config_decimal">
>         <label>Watt Reporting Interval</label>
>         <properties>
>           <property name="binding:*:DecimalType">COMMAND_CLASS_CONFIGURATION;parameter=171</property>
>         </properties>
>       </channel>
  1. link to item in the UI
    parameter to item
  2. change in rule

Thanks! I’ve got the code, compiled my updated version (3.1.0) and now have a new jar file. I seem to remember, from having done something similar a while back, that I may have to either clear a cache somewhere or (ick) delete and re-add my things. Is that true, or will simply re-installing the binding be enough? And, what’s the right way to update the binding? Should I just copy the jar to the addons folder?

Tried adding the recompiled code to the addons folder, but that didn’t work - the things still have the old definition. What does it take to get that updated?

Delete thing (not exclude) and inbox/zwave/scan to pick up new channels

I was away (It’ not all OH for me :wink:)

Key items, uninstall Zwave from UI (or delete the custom zwave binding from addons), add new .jar to addons. Worst case you might have to restart OH, but try without first. Then as my above post delete thing/scan.

edit: If battery device will need to wake it

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.