Configuring Things Automatically Based on Discovery

Hi all,

I have been running into a problem recently where my z-wave devices are appearing online even when they are plugged out Z-wave device Online when plugged out

One solution maybe to configure things based on when they are discovered possibly and I was wondering if anyone had experience with this.

Currently I have two ZW096 Smart Switch 6 configured through a ZW090 Z‐Stick Gen5 USB Controller bridge in my zwave.things file shown below.

    Bridge zwave:serial_zstick:controller "Z-Wave Controller" [port="/dev/ttyACM0", controller_softreset="false", controller_master="true", heal_enable="true", heal_time=3, security_networkkey="0E 21 AB E3 AE 76 44 C3 A1 5C ED 87 44 12 DD C0"  ] {
    //Node 2
    Thing zwave:aeon_zw096_00_000:controller:node2 "ZWave Node 2: aeon_plug"(zwave:serial_zstick:controller) [ node_id=2 ]

    //Node 3
    Thing zwave:aeon_zw096_00_000:controller:node3 "ZWave Node 3: aeon_plug"(zwave:serial_zstick:controller) [ node_id=3 ]
} 

I have configured each of my items for each smart plug in my zwave.items file shown below.

//// Smart plug node 1

Switch Switch_Zwave_Node2 "Power Switch" { channel = "zwave:aeon_zw096_00_000:controller:node2:switch_binary" }

Number Voltage_Zwave_Node2 "Voltage (Volts)" { channel = "zwave:aeon_zw096_00_000:controller:node2:meter_voltage" } 

Number Energy_Zwave_Node2 "Energy (kWh)" { channel = "zwave:aeon_zw096_00_000:controller:node2:meter_kwh" } 

Number Current_Zwave_Node2 "Current (Amps)" { channel = "zwave:aeon_zw096_00_000:controller:node2:meter_current" } 

Number Power_Zwave_Node2 "Power (Watts)" { channel = "zwave:aeon_zw096_00_000:controller:node2:meter_watts" } 

//

//// Smart plug node 2 

Switch Switch_Zwave_Node3 "Power Switch"  { channel = "zwave:aeon_zw096_00_000:controller:node3:switch_binary" } 

Number Voltage_Zwave_Node3 "Voltage (Volts)" { channel = "zwave:aeon_zw096_00_000:controller:node3:meter_voltage" } 

Number Energy_Zwave_Node3 "Energy (kWh)" { channel = "zwave:aeon_zw096_00_000:controller:node3:meter_kwh" } 

Number Current_Zwave_Node3 "Current (Amps)"  { channel = "zwave:aeon_zw096_00_000:controller:node3:meter_current" } 

Number Power_Zwave_Node3 "Power (Watts)"  { channel = "zwave:aeon_zw096_00_000:controller:node3:meter_watts" }

These things and items are configured as soon as openHAB boots which I think could possibly be the problem.

Would a better solution to be just to leave these files blank and only configure things based on the inbox of discovered things in the network? If so has anyone implemented a similar solution to this?
Any input would be helpful :slight_smile:

I don’t use .things files for any devices that are discoverable in PaperUI, since the discovered channels can be directly linked in .items files. I’m only using .things files for non-discoverable devices such as my UPS.

Hope that helps!

Hi Russ,
Thanks for the reply but I am trying to limit the use of the PaperUI as much as possible and go for the more scripted approach instead

That’s fine, but if so then I don’t understand what you were asking before.

I interpreted “inbox of discovered things” to mean the Inbox in PaperUI. Were you referring to something else?

Yes it would be the same inbox but instead of accessing it through the GUI mode in the paper UI, I was thinking of possibly accessing through the REST API openHAB provides to discover and accept devices as they are found. Something probably like this people where the UID is a given device I have found in the inbox using a HTTP GET request.

curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" "http://IP_ADDRESS:8080/rest/inbox/DEVICE_UID/approve"

Gotcha. I won’t be able to help you with that, but perhaps someone else has done it.

Can I ask why you’re trying so hard to avoid PaperUI? I’m just curious, as it’s purpose is to make this process easier for users.

No worries, thanks for the reply though!
I am working on a project which could end up involving multiple openHAB hubs and the GUI mode isn’t that efficient if I had to access it for every hub so I am just trying to automate through scripting as much as possible.

1 Like

Just curious here,

Why would you want multiple hubs?
What advantage are you getting with that and for what purpose?

I cant say too much about the project but it involves multiple homes so an openHAB setup would be required for each home if openHAB is used. If it was just my home setup the paperUI would be fine but imagine configuring multiple devices through the GUI for each home. Automating as much as possible is the way to go :grinning:.

Yeah that makes alot of sense

Thanks for the explanation !