Efficient definition of multiple instances of same thing (thermostat)


openHAB 3.2.0
Build #2535

I have 7x Tado thermostats in my house which I have added to OH.
I’m wondering what is the most efficient way of implementing these with respect to items/sitemap?
Currently, I have the following in my .items file:

Number Tado_HomeGym_Temperature     "HomeGym [%.1f C]"         <temperature> { channel="tado:zone:1234567:1:currentTemperature" }
Number Tado_Kitchen_Temperature     "Kitchen [%.1f C]"         <temperature> { channel="tado:zone:1234567:2:currentTemperature" }
Number Tado_SittingRoom_Temperature "SittingRoom [%.1f C]"     <temperature> { channel="tado:zone:1234567:3:currentTemperature" }
Number Tado_Sunroom_Temperature     "Sunroom [%.1f C]"         <temperature> { channel="tado:zone:1234567:4:currentTemperature" }
Number Tado_Bedroom_Temperature     "Front Bedroom [%.1f C]"   <temperature> { channel="tado:zone:1234567:5:currentTemperature" }
Number Tado_Nursery_Temperature     "Nursery [%.1f C]"         <temperature> { channel="tado:zone:1234567:6:currentTemperature" }
Number Tado_Hall_Temperature        "Hall [%.1f C]"            <temperature> { channel="tado:zone:1234567:7:currentTemperature" }

Number Tado_HomeGym_SetPoint        "SetPoint [%.1f C]"        <temperature> { channel="tado:zone:1234567:1:targetTemperature" }
Number Tado_Kitchen_SetPoint        "SetPoint [%.1f C]"        <temperature> { channel="tado:zone:1234567:2:targetTemperature" }
Number Tado_SittingRoom_SetPoint    "SetPoint [%.1f C]"        <temperature> { channel="tado:zone:1234567:3:targetTemperature" }
Number Tado_Sunroom_SetPoint        "SetPoint [%.1f C]"        <temperature> { channel="tado:zone:1234567:4:targetTemperature" }
Number Tado_Bedroom_SetPoint        "SetPoint [%.1f C]"        <temperature> { channel="tado:zone:1234567:5:targetTemperature" }
Number Tado_Nursery_SetPoint        "SetPoint [%.1f C]"        <temperature> { channel="tado:zone:1234567:6:targetTemperature" }
Number Tado_Hall_SetPoint           "SetPoint [%.1f C]"        <temperature> { channel="tado:zone:1234567:7:targetTemperature" }

I have used currentTemperature & targetTemperature, but wish to use some more of the following:

  • humidity
  • hvacMode
  • overlayExpiry
  • timerDuration
  • operationMode

Do I need to repeat the above definitions in the .items for each parameter above?
Is there any concept of an “instance” where I can define a generic group of items and somehow pass in the zone number as a parameter?

As some background, I use C, python, perl & tcl in my work so sometimes I can get the capabilities of each language mixed up. :slight_smile:
I’m coming from OH2 background so still mainly using text files at this stage - haven’t spent any time looking at the UI updates yet.


Yes. You need an Item linked to the Channels for that information for each Channel on each Thing individually.


In this respect it’s the same as in OH 2. Items must be individually created.

However, in the UI it is possible to create all the Items in one go all at once for a given Thing. From the Thing’s settings menu or from the Model you can choose “Create Equipment from Thing”. This opens a page where you can situate the Equipment in your semantic model (e.g. put it into a room), choose which Channels to create Items for and customize the Items that will be created if the defaults are not what is needed (e.g. changing the semantic tags, category, etc.). The name of the Items will come from the Thing and the Channel so you might not even need to change the Item names.

In this way you can create dozens and dozens of Items in almost no time at all. When I moved to OH 3 I quickly discovered it was far more efficient to create Items in this way than it was to try to shoehorn my existing Items into the semantic model. And since then creation of Items takes just a little more time than it takes to discover a new Thing in the Inbox.

If you use the semantic model, MainUI’s overview page will build itself as well, freeing you from having to create a sitemap at all. You get three different views, locations which presents your devices based on where they are located, Equipment which presents them based on their Equipment type, and Properties which presents them based on what the devices represent/work with (e.g. temperature).

All three of those were built automatically. I’ve since added some customization to them but that’s optional.

In my experience, using the model and create equipment from Thing is the most efficient way to create a lot of Items linked to a Thing and get them on a UI. Once they are on the UI, if you want to customize how they look (e.g. use a custom icon with color changes based on value, combine multiple Items into one widget, etc) the most efficient is to install a widget from the marketplace or create a new custom list item widget for, say temperature setpoints. Then set that installed or custom widget as the “default list item widget” metadata on Items of that type. For example I’ve a humidity widget (I’ve posted it to the Marketplace if you want to use it) that I’ve applied to all my humidity sensor Items. If I decide later that I want to change that, I can modify the custom widget and it will apply everywhere that widget is used.

1 Like

Thanks, @rlkoshak for your detailed response.
I will try this out.