Thing configuration from rules

The answer is you send an empty string :slight_smile:

Not really - this will set the parameter to an empty string - it won’t remove it.

Well in any case, sending an empty string removed the values. Which is exactly what I needed.
You’re so literal Chris :smiley:

All good, values/parameters, different but same to a mug like me.

Absolutely. You can assign anything to new_value, not just integers.

      new_value = outside_lux.state

should work just fine.

1 Like

You can also configure Things using jython. This may also work for unmanaged Things, but I haven’t tried it.

try:
    from org.openhab.core.thing import ThingUID
except:
    from org.eclipse.smarthome.core.thing import ThingUID

then from within a rule, for example:

z_thing = things.get(ThingUID("zwave:device:741b4f3b:node10"))
z_thing.getConfiguration().put("config_6_1", someValue)
1 Like

Unmanaged Things are not configurable. BTW, I have a core.things module nearly ready to commit.

Good to know.

Looking forward to it.

Hi @DavidR,

thanks for the code!

Do you have to do something so that the thing is updating (it is a zwave sensor)?
I can set the config but there is no reaction. If I do it via Paper UI it seems that it is reacting.

Whether I do it by rule or PaperUI, it does the same. Have you tried turning on debug logging for Z-Wave? That may give some clues.

Hi Scott,

sorry to pull up such an old thread. Did you ever commit the core.things module? I’m looking for a jython example of how to create a thing and it’s channels. Would this module of yours solve this need?

Not yet, but it’s coming. I merged a number PRs last night, but there is a lot more to go.

OpenHAB Community,

I stumbled upon this thread looking for a “native” OpenHAB solution to being able to configure a Thing configuration parameter as part of a Rule.

The solution that I currently have it to use ZWaveJSUI and Zigbee2MQTT, and then you can literally map the MQTT topic to a channel and then to an Item.

So for example, I have an Inovelli LZW36 light/fan combo zwave switch connected to ZwaveJSUI, with this Generic MQTT Thing configuration:

Thing mqtt:topic:zwave01-nodeID_15 "F1_GuestRoom_Wall_Switch" (mqtt:broker:8fd56e1f3c) 
{
    Channels:
    Type dimmer : light_dimmer 
    [ 
        transformationPattern="JSONPATH:$.value",
        stateTopic="zwave01/nodeID_15/switch_multilevel/endpoint_1/currentValue", 
        commandTopic="zwave01/nodeID_15/switch_multilevel/endpoint_1/targetValue/set", 
        min=0, 
        max=100, 
        step=5 
    ]
    Type dimmer : fan_dimmer
    [ 
        transformationPattern="JSONPATH:$.value",
        stateTopic="zwave01/nodeID_15/switch_multilevel/endpoint_2/currentValue", 
        commandTopic="zwave01/nodeID_15/switch_multilevel/endpoint_2/targetValue/set", 
        min=0, 
        max=100, 
        step=5 
    ]
    Type number : kWh [stateTopic="zwave01/nodeID_15/meter/endpoint_0/value/65537", transformationPattern="JSONPATH:$.value"]
    Type number : watts [stateTopic="zwave01/nodeID_15/meter/endpoint_0/value/66049", transformationPattern="JSONPATH:$.value"]
    Type number : light-led-color 
    [
        stateTopic="zwave01/nodeID_15/configuration/endpoint_0/Light_LED_Indicator_Color", 
        transformationPattern="JSONPATH:$.value",
        commandTopic="zwave01/nodeID_15/configuration/endpoint_0/Light_LED_Indicator_Color/set"
    ]
}

This is my Item configuration:

// F1_GuestRoom
Group          gF1_GuestRoom_Wall_Switch   "Wall Switch"                              <light>         (F1_GuestRoom)                ["Equipment","WallSwitch"]     
Dimmer         F1_GuestRoom_Light          "Guest Room Light [%d]"                    <light>         (gF1_GuestRoom_Wall_Switch)   ["Lighting","Switchable","Point"]   {ga="Light", channel="mqtt:topic:zwave01-nodeID_15:light_dimmer"}                                              
Dimmer         F1_GuestRoom_Fan            "Guest Room Fan [%d]"                      <fan_ceiling>   (gF1_GuestRoom_Wall_Switch)   ["Switchable","Point"]              {ga="Fan" [ speeds="0=off:zero,33=low:one,66=medium:two,99=high:three", lang="en", ordered=true ], channel="mqtt:topic:zwave01-nodeID_15:fan_dimmer"}
Number:Energy  F1_GuestRoom_kWh            "Fan/Light Power Consumption [%.1f kWh]"   <Energy>        (gF1_GuestRoom_Wall_Switch)   ["Energy","Point","Measurement"]    {unit="kWh",channel="mqtt:topic:zwave01-nodeID_15:kWh"}
Number:Power   F1_GuestRoom_watts          "Fan/Light Wattage [%.1f W]"               <Energy>        (gF1_GuestRoom_Wall_Switch)   ["Energy","Point","Measurement"]    {unit="W",channel="mqtt:topic:zwave01-nodeID_15:watts"}
Number         F1_GuestRoom_LightLEDColor  "Guest Room Light Color [%d]"              <light>         (gF1_GuestRoom_Wall_Switch)   ["Point"]                           {channel="mqtt:topic:zwave01-nodeID_15:light-led-color"}

As you can see, you can map configuration endpoints just as easily as switch endpoints.

1 Like