openhab / org.openhab.ui.habmin

HABmin - a graphical user interface for openHAB 2
231 stars 91 forks source link

Odd behaviour when add items to channels #129

Open feens opened 8 years ago

feens commented 8 years ago

This may be a tricky one to reproduce on your end, but it was darn annoying here.

I started with a fresh install of OH2 and HM2, and was in the process of creating items for the channels (and trying to figure out which node was which...it's hard to remember sometimes!). At one point, I think I accidentally tried to add an item that was already created, and that's where things got really weird.

It seems that any time I'd accidentally add that item, it would actually go and add it to other nodes/channels as well. For example, I was trying to link my Dimmer_Sink item. Once I got the fail message, I'd go and add it to the proper node, pop open my sitemap to test (and make sure it controller the proper dimmer), and all of a sudden it was controlling other dimmers as well. I verified this behaviour by removing those items attached to the other nodes and even removing the item from the items section. I then tried to re-add it to the proper node/channel again and had the same problem. To further magnify the issue, the things which we tainted by the extra item I had to completely re-do, and use new item names (i.e. Dimmer_Kitchen_New).

feens commented 8 years ago

I ran in to this behaviour again when I had to redo all of my items. I took some screenshots to better document what was going on. I should also note that before adding the problem item, I verified that it did not already exist using smarthome:items in the console.

screen shot 2016-03-03 at 9 11 11 pm screen shot 2016-03-03 at 9 11 42 pm screen shot 2016-03-13 at 9 31 55 am screen shot 2016-03-13 at 9 32 24 am

cdjackson commented 8 years ago

Thanks, I know what this is…

You verified that the item didn’t exist, but you probably didn’t verify that the channel to item link didn’t exist… There are two things that happen when you save an item - firstly you save the item (of course :) ), but then we re-link the channel to this item. Unfortunately, at the moment when you delete an item, ESH doesn’t remove the link, and this then causes an error.

See https://github.com/eclipse/smarthome/issues/1018 https://github.com/eclipse/smarthome/issues/1018

feens commented 8 years ago

I'm pretty sure I removed all links (via the "Delete" method in HABMin...though maybe that just removes the item?). Anyhow, the weirder/more difficult behaviour of this is that when the error occurs, it actually adds/links an item to other Things. You can see in the last screenshot that I have Island Switch linked to Node 2 (Kitchen Dimmer). If I remember correctly, it attached that item after the failure of the Kitchen Switch item.

It gets pretty frustrating, as once the error occurs, I need to start going through my other Things to see what rogue Items have been linked up and remove them. I should note though, that perhaps it's all related to ESH and not HABMin. I don't know the platform well enough to know where that line is drawn.

cdjackson commented 8 years ago

Looking at the last image doesn't mean much since you can give an item any name... However, it does raise an interesting question of why you're linking multiple items to a channel. I know it's possible - that doesn't make it a good idea though does it? Just wondering what your rational / use case is?

feens commented 8 years ago

Adding multiple items because you told me to :) On a sitemap it's way more useful to have a switch alongside a slider for dimmers, as it's not that useable to have to slide them to turn them on/off. You suggested creating two separate items on the channel to do this.

cdjackson commented 8 years ago

Really? Wow, I don’t remember that at all and I’m surprised, since I certainly don’t do that myself - never have, even on OH1. Maybe there’s some special cases where this might be needed (I don’t remember the context of the discussion) but for most things I can think of, I don’t think it’s needed).

Sorry for the bad advice then - I wouldn’t personally recommend that since now you have to maintain 3 items (in the case of the bottom channel anyway). Just create a single dimmer item, and then in the sitemap, use a switch if you just want to have a switch - that’s what I do...

feens commented 8 years ago

Perhaps I just mis-understood what you said (I may have thought you meant create two Items when you meant to entries in the Sitemap for the same item). Also, that last Channel only has 3 items because of the bug I was describing above: the Island item I never added there...it showed up after a failure from adding an item to a whole other thing/channel.

cdjackson commented 8 years ago

Ok - back to the issue…

Can you clarify what you do to create this - you click the ADD button for a channel, fill in the item name etc, click ok, and you get the error? Then what - do you close the dialog and repeat, or do you close and go to another channel and add an item there (which is subsequently in the wrong place), or?

feens commented 8 years ago

For example, I go to my Kitchen Dimmer Thing, try and add an item with name of Switch_Kitchen. It throws the error. I click cancel. Now if I go down to my Sink Dimmer Thing, the channel for it now has a Switch_Kitchen item linked to it that never existed before. I noticed this because after the error, when I went to test my Kitchen Item, all of a sudden my sink light is toggling.

cdjackson commented 8 years ago

Did you do anything with the sink dimmer before trying to add the switch_kitchen? I’m just wondering why it picked on this channel and not another one - maybe you were editing that before trying to add to the switch_kitchen?

On 15 Mar 2016, at 14:23, feens notifications@github.com wrote:

For example, I go to my Kitchen Dimmer Thing, try and add an item with name of Switch_Kitchen. It throws the error. I click cancel. Now if I go down to my Sink Dimmer Thing, the channel for it now has a Switch_Kitchen item linked to it that never existed before. I noticed this because after the error, when I went to test my Kitchen Item, all of a sudden my sink light is toggling.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/cdjackson/HABmin2/issues/129#issuecomment-196843718 https://github.com/cdjackson/HABmin2/issues/129#issuecomment-196843718

feens commented 8 years ago

I can't say for certain, but that does sound possible knowing what I was doing at the time.