HABot Walkthrough (2/n): Semantic Tagging & Item Resolving

Oh… Mhhh… Is there a way to restrict the association to the dimming functionality of the Hue-Item only? I.e. by using setpoint or so?

Not sure, but I don’t think so, sorry… currently it will not consider the type of Point (which could be a good idea eventually), only extract the concepts of “light” and “living room” from your query and send a command to all matching items whose type can accept it.

@ysc: Well, I have good news! :slight_smile:
OpenHAB together with its Binding for Hue supports ON/OFF to be handled seperately from brightness 0…100%.
Although both, the “Light Plug” switch item and the “Hue” dimmer items react on the ON/OFF trigger, this trigger is not directly converted to 0 or 100 by the dimmer item. Instead, the dimmer item sends an On/Off command instead of a brightness-value 0…100 to the hue basis. So, when the Light is switched on again, it goes on with the brightness it was switched off with.
It’s OK for me that when telling HabBot to switch on/off the lights in the room, it sends ON/OFF to all items (switches and dimmers).

Having said this, however, I was unfortunately not able to change any state of roller shutters or garage door. And the dimmers react only to certain values.

Group 		EG_WC         		"WC"         				["Room"]
Rollershutter 	Roller_EG_WC		"Rollladen WC"			(EG_WC)		["Blinds"]			{ knx="..." }
Dimmer		HUE_EG_WC_Decke_Dimmer	"WC (Decke) Dimmer [%.0f%%]"	(EG_WC)		["Light"]			{ channel="hue:...:brightness" } 
Group 		gGG 			"Garage" 					["Garage"]
Rollershutter 	Roller_Garagentor	"Garagentor"			(gGG)		["Switch"]			{ knx="...", synonyms="Garagentor" }

Using the above item definition, when trying to change the light to 70, I got the response that OpenHAB/HabBot did not understand the numerical value. However, when telling to change the light to 71, it works.

The rolllershutter in the toilett and the garage door can be found:

However, when trying to open/close them, OpenHAB/HabBot replies that it doesn’t understand my query:

I know this is an old thread, but I just opened HabBot for the first time to play with it and discovered that essentially none of my items have any tags. Almost all of my items have been created via PaperUI, so I don’t have any text files that I can update to add them. Is there an easy way to add tags to many items without the text files? Is the one way one item at a time via the API?

The correct answer is “yes”.

The sneeky answer is there is a way, but in all likelihood, if you are doing everything through PaperUI anyway you will not like it.

  1. Add a tag to an Item through PaperUI so you have an example.
  2. Stop openHAB.
  3. Open /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json.
  4. Find the Item that you added the tag to and find the elements that define that tag.
  5. Edit each Item you want to add a tag to so it looks just like that, only with the proper tags.

Until we have OH 3 that’s about all you can do. Though, adding tags through the REST API isn’t all that much more involved than adding the tags would have been if PaperUI supported it.

Definitely not! You can add tags through rules. If you are using scripted automation, Jython, and the helper libraries, it would look like this…

from core.log import logging, LOG_PREFIX#, log_traceback
LOG = logging.getLogger("{}.TEST_2".format(LOG_PREFIX))

test_item = itemRegistry.getItem("Virtual_Switch_1")
LOG.warn("Before: {}".format(test_item.getTags()))
test_item.addTag("Add tag through rule example")
LOG.warn("After: {}".format(test_item.getTags()))

If you are still holding on to the rules DSL, it would look like…

rule "Test DSL rule"
    System started
    logWarn("Rules", "Before: {}", Virtual_Switch_1.getTags)
    Virtual_Switch_1.addTag("Tag example from DSL")
    logWarn("Rules", "After: {}", Virtual_Switch_1.getTags)

So, just build these out with all of the Items that you want to add tags to.

Well, I definitely wouldn’t have thought of using rules!

I was thinking about using the rest api to get the full list of my items, converting the json to a csv, sorting it and adding my tags with excel, and then making a python script to write my changes back to the API. I want the magical spreadsheet ability to copy and paste and fill. I’m not afraid of the API, but if there was already a tool to do the conversion from the flat spreadsheet back to the database for me, I’d prefer to just use that.

I can’t say I’m a big fan of PaperUI, but it has the massive advantage over the text files of not requiring me to be on a computer and then directly ssh (or samba) to the files to be able to make any changes.

Yes, I keep hearing things “maybe in openHAB 3,” but there seems to be a lot of rumor and almost nothing official about what it will really look like. :roll_eyes:

You can download and run the work in progress. There are dozens of issues open and being worked. The new UI has been posted about on openHAB’s twitter feed. There is a thread to start working on a getting started guide with lots of screen shots.

There is a lot of “official” information out about openHAB 3. For this threads particular case there is even an entire page dedicated to creating the model: Getting Started with OH3: rewriting the tutorial - 6. Model your home with Items & link Channels

I have very clearly been looking in the wrong places! I’ve been looking in the “announcements” and “development” categories, and there’s not much there.

Hi Everyone

I have just been reading through trying to get my item attributes sorted for HABot but I must be missing something here.
I am going through my /var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json.
Where should these Semantic tags be deployed, am I barking up the wrong tree?
Here is a current item I have in my above json should I be inserting here, and if so where?

  "HallBulbsSwitch": {
    "class": >"org.eclipse.smarthome.core.items.ManagedItemProvider$PersistedItem",

    "value": {
      "groupNames": [],
      "itemType": "Switch",
      "tags": [
      "label": "Hall Bulbs",
      "category": "Lightbulb"

Thanks in advance and I’m sure I’ve missed some core info.

They are right there :slight_smile:

But do not edit the JSON file by hand, use the item API instead.

Hi Dan
Thanks for the the response.
OK, so, yes thats what i thought “they are right there” but when I stopped the hab edited the file (by hand which I have done before to bring things into google) and restarted, the “tags” were not in the HABot > Item attributes review window. Which API are you referring to, paper?

Yes, those files are not meant to be edited by hand.

See https://www.openhab.org/docs/configuration/restdocs.html

We also have an awesome swagger generated UI for accessing the API using your browser, make sure the rest docs are installed:

then go to http://your-openhab/doc/index.html and you can play with all the API’s there, specifically to add a tag, you can use this:

WOW, OK Dan, thank you for that pointer mate, great stuff. I am pretty new to all this so really appreciate the help. I shall give this a play.

Hi Dan, as for editing via the swagger generated GUI my eyes are now open so thank you for that!

Now that my newly added item tags have been made I still can’t see them in the HABot Items attributes Review. I HAVE:

Added the new tag/s via http://myhab:8080/rest/swagger.json
Checked the file

“HallBulbsSwitch”: {
“class”: “org.eclipse.smarthome.core.items.ManagedItemProvider$PersistedItem”,
“value”: {
“groupNames”: ,
“itemType”: “Switch”,
“tags”: [
“label”: “Hall Bulbs”,
“category”: “Lightbulb”

“lightbulb” tag is there! (I don’t think it has to be uppercase?)

I have rebooted the server,

sudo reboot

cleared the app cache

But still, HABot can not see the attributes, hmmmm

I feel like I am missing something fundamental.
Thanks in advance


“lightbulb” tag is there! (I don’t think it has to be uppercase?)

YES it must be 1st letter uppercase in tags “Lightbulb”

Hi everyone,

I was trying to adapt my existing setup to HABot by adding all relevant tags to the existing groups, but for some reason HABot is unable to find any Locations that I pass. Given the Example below, I get a positive response for entering e.g. “Temperatur” with a card containing all the temperature relevant items, but a negative one for “Wohnzimmer” (Living Room) complaining that no Tag related to wohnzimmer was found. Trying combinations of both tag types, such as “What is the Temperature in the Living Room” (and its german counterpart), are also unsuccessful.

// Location Groups
Group	gAll		"All"
Group	gIndoor		"Indoor"				(gAll)			["Indoor"]		{synonyms="Im Haus"}
Group	gEG		"Erdgeschoss"		<groundfloor>	(gIndoor)		["GroundFloor"]		{synonyms="Erdgeschoss"}
Group	gLivingRoom	"Wohnzimmer"		<sofa>		(gEG)			["LivingRoom"]		{synonyms="Wohnzimmer"}
// Device Groups
Group	gActor		"Aktoren"				(gAll)
Group	gSensor		"Sensoren"				(gAll)
Group	gTemperature	"Temperatur"		<temperature>				["RadiatorControl", "Temperature"]
Group	gTempSensor	"Temperaturmessung"			(gTemperature, gSensor)	["Measurement"]
Group	gTempSetpoint	"Temperatureinstellung"			(gTemperature, gActor)	["Setpoint"]
// Devices
Number	LivingRoomWTHIsTemperature	"Temperatur (ist) [%.1f °C]"	(gLivingRoom, gTempSensor)	{channel="homematic:...#ACTUAL_TEMPERATURE"}
Number	LivingRoomWTHSetTemperature	"Temperatur (soll) [%.1f °C]"	(gLivingRoom, gTempSetpoint)	{channel="homematic:...#SET_POINT_TEMPERATURE"}

Any idea what I am missing here? I was wondering if locaton tags are inherited at all from any parent groups (and if so, if the tags are fetched recursively, i.e. is “Wohnzimmer” only location-tagged as [“LivingRoom”}, or [“Indoor”, “GroundFloor”, “LivingRoom”]).

I’ve already tried to investigate the issue by myself and activated logging for HABot by setting the log level for org.openhab.ui.habot to ALL, but this resulted in yet another strange behavior:

  • Whenever a text input leads to a positive response (e.g. “Temperatur”), there is no log entry at all.
  • However, for each negative one (e.g. “Wohnzimmer”), I only get the following entries:
03-Aug-2020 20:50:54.655 [DEBUG] [org.openhab.ui.habot.nlp.internal.IntentTrainer   ] - get-status[0.0897]  activate-object[0.0983]  create-rule[0.0535]  deactivate-object[0.1720]  get-history-daily[0.0535]  get-history-hourly[0.0535]  get-history-last-changes[0.0782]  get-history-monthly[0.2584]  get-history-weekly[0.0557]  set-value[0.0873]
03-Aug-2020 20:50:54.655 [DEBUG] [org.openhab.ui.habot.nlp.internal.IntentTrainer   ] - Intent [name=get-history-monthly, entities={location=wohnzimmer}]

Are there further plugins in which verbose logging would help me to pinpoint the issue?

I appreciate any help you can provide!



I think it might be related to your use of “device groups”, to work best with HABot the semantic model should normally be something like:

Group Location [<LocationTag>]
 Group SubLocation [<LocationTag>]
  Group Equipment [<EquipmentTag>]  // represents a single equipment
   Non-Group Point [<PointTag>, <PropertyTag>]


  • You shouldn’t give groups Point or Property tags;
  • You can’t give both an Equipment and a Property tag to the same item (if you attach a Property tag it implies that the item is a Point, and it can’t be both an Equipment and a Point);
  • In your example the last 2 non-group items (LivingRoomWTHIsTemperature, LivingRoomWTHSetTemperature) should have Point & Property tags (["Measurement", "Temperature"] & ["Setpoint", "Temperature"]) and be direct members of either an Equipment group or a Location group.

The second diagram here: [wiki] Getting Started with OH3: rewriting the tutorial - 6. Model your home with Items & link Channels is an example of a properly designed model.