openhab / org.openhab.ui.habot

A chatbot for openHAB using machine-learning natural language processing from OpenNLP
Eclipse Public License 1.0
65 stars 31 forks source link

Item tags list empty #9

Open NSchnitzler opened 6 years ago

NSchnitzler commented 6 years ago

i have tagged my items file like this: ` Group EG ["location:erdgeschoss"]

Group OG ["location:obergeschoss"]

Group Keller ["location:keller"]

Group OG_Flur "Flur" (OG) ["location:flur"]

Group OG_KZ1 "Kinderzimmer 1" (OG) ["location:kinderzimmer 1"]

Group OG_KZ2 "Kinderzimmer 2" (OG) ["location:kinderzimmer 2"]

Group OG_Schlaf "Schlafzimmer" (OG) ["location:schlafzimmer"]

Group OG_Ankleide "Ankleide" (OG) ["location:ankleide"]

Group OG_Bad "Bad" (OG) ["location:bad"]

Group Aussen "Außenbereich" ["location:garten"]

Group Lichter "Leuchten" ["object:licht", "object:lights", "object:lighting"]`

but the item tags review list is empty. Any suggestions to solve this?

ghys commented 6 years ago

looks good to me... You're not the first with this problem (#6), maybe there's really something wrong :) Try the suggestions in #6, also verify the tags using the smarthome:items list command at the openHAB console, and refresh the HABot page, maybe the problem will go away.

NSchnitzler commented 6 years ago

i played around with some things, smarthome:list items tells me e.g. Light_Cook_Ceil (Type=SwitchItem, State=OFF, Label=LED-Panel, Category=light_led, Tags=[object:lights, object:licht, object:lighting], Groups=[EG_Kueche, Lichter]) but the item tags review list is still empty

ghys commented 6 years ago

Do you have anything suspicious in the developers tools console (refresh the page while it's open first)? Your groups above seem fine but maybe there's another item causing a bug.

NSchnitzler commented 6 years ago

Yes Chrome tells me: TypeError: Cannot read property 'tags' of undefined at addInheritedTags (app.5e30a1dce4cb00b4ba3f.js:1) at addInheritedTags (app.5e30a1dce4cb00b4ba3f.js:1) at app.5e30a1dce4cb00b4ba3f.js:1 at Array.map (<anonymous>) at a.processItems (app.5e30a1dce4cb00b4ba3f.js:1) at show (app.5e30a1dce4cb00b4ba3f.js:1) at a.e (vendor.400e25cce58fbb4ace60.js:1) at a.t.$emit (vendor.400e25cce58fbb4ace60.js:1) at a.e.showPromiseResolve (vendor.400e25cce58fbb4ace60.js:1) at afterEnter (vendor.400e25cce58fbb4ace60.js:1)

but below this message, i can see status updates of some items, but the item tags review list is still empty Could it be a problem, that i also use the Home-Kit tags?

ghys commented 6 years ago

Interesting! Thanks for the logs, it helps. It seems it cannot find a parent group of an item. I added a small check and some logging in https://github.com/ghys/habot/commit/d868d5d33f2c24758d9af0429a9b51763c1f6bf0. There will be a new release including this commit in a couple minutes at https://github.com/ghys/habot/releases. Could you try the newest one out and report back messages like "cannot find (item) parent group: (group)", thanks!

NSchnitzler commented 6 years ago

OK, now i have 395 items in the List, but i think i have to train myself to make habot me understand.

NSchnitzler commented 6 years ago

ok, i tried some 'get status' queries and habot is always switching anything on which could belong to the queried item. The question was `Ist das Theke Licht in dem wohnzimmer an?' Is the ceiling light in the living room turned on? and all (yes really all) lights in my home were switched on

This behavior happened with safari, with the chrome browser it seems to work much better

stritti commented 6 years ago

Maybe you should switch configuration to use Theke for location. Or use one word Thekenlicht for object. I think using two words ( Theke Licht) will confuse the machine learning algo currently.

Could you provide some more German example sentences then I could extend training data. I am German, too and support the project currently by improving German support of the bot.

NSchnitzler commented 6 years ago

I will try to find good object & location combinations, at the moment, the boot seems to have problems to distinguish between questions and actions. After a question, the bot switches everything on, instead of reporting the status:

bildschirmfoto 2018-04-06 um 00 02 01

(i switched of most them already off again)

ghys commented 6 years ago

Here's a tip: you can type log:set DEBUG org.openhab.ui.habot at the openHAB prompt to see the debug messages in the log. When you send a query there will be a report of the confidence score for each intent. For example, for "sind die Lampen im Wohnzimmer eingeschaltet?" I get:

00:15:10.853 [DEBUG] [b.ui.habot.nlp.internal.IntentTrainer] - get-status[0,2174]  activate-object[0,2605]  create-rule[0,0374]  deactivate-object[0,0332]  get-history-daily[0,0270]  get-history-hourly[0,0183]  get-history-last-changes[0,0362]  get-history-monthly[0,2371]  get-history-weekly[0,0451]  set-value[0,0879]                                         
00:15:10.863 [DEBUG] [b.ui.habot.nlp.internal.IntentTrainer] - Intent [name=activate-object, entities={location=wohnzimmer, object=lampen}]

you can see activate-object[0,2605] won over get-status[0,2174] but not by much ;) It's all a matter of training data...