Open ppieczul opened 7 years ago
@aounhaider1 Can you comment on this?
Maybe @htreu instead...?
added to the queue :-)
Is it possible to get the binding that you are using? It will make the debugging much easier.
Attached is a simple test - it includes source code and jar in target subdir.
How to perform the test: 1) switch simple mode to OFF in paper UI 2) install binding and create a thing for it in the paper UI
Of course, such exact situation will not happen in the reality, but similar one happens - when user works on his/her setup and changes remote device configuration, at the same time having browser with paper UI open. The conditions needed to happen here is having browser open when channel type changes. In case of my real binding, this happens, when changing configuration of the remote device, it causes reconfiguration of the thing. If I keep browser open at the same time, I will need to refresh it in order to be able to add items. Since channel changes are perfectly dynamically reflected in the UI, I thought it should also work for channel types.
org.openhab.binding.test1.tar.gz
Thanks Pawel
My binding creates channel types during runtime, after initialize() finishes, but before thing status goes to online, based on the information it obtains from the remote device (which takes some time). It calls editThing and updateThing to make the channel changes. This causes issues with paperui. On the first creation of a thing, binding builds channel types and channels in runtime as stated above, and UI shows the channels correctly as they appear, but it does not allow to add new items for the channels. When I click + to add an item to a channel, there is a JS exception, because it can't find the channel type in $scope. I tried to put breakpoints on where channel types are populated and it never gets updated in runtime, only when thing configuration is changed. It is also possible to force channel type reading, when I go to a page that needs explicitly this information. So, if I just click on "Items" menu and then go back to the thing channels, I will be able to create new items for the channels, because $scope will contain correct channel types. When I looked into paperui source code, the channel types are updated once in ViewThingController. Channels are updated in refreshChannels function. If it is allowed to modify channel types in runtime, shouldn't refreshChannels also update channel types, to have both in sync?