Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Items label, state, and category values lost on server restart #2098

Closed
jmichaluk opened this issue Sep 1, 2016 · 9 comments
Closed

Items label, state, and category values lost on server restart #2098

jmichaluk opened this issue Sep 1, 2016 · 9 comments

Comments

@jmichaluk
Copy link

Not all information is surviving a server outage. As shown below, the state, label, and category information is not being restored. The Paper UI also showed only a dimmer and no on/off switch after the restart.
I would have expected all information to be restored.

Before the server went down the Rest call for items returned something similar to the following:

"link": "http://192.168.1.100:8888/rest/items/hue_0100_aaef5a30_1_brightness",
"state": "100",
"type": "Dimmer",
"name": "hue_0100_aaef5a30_1_brightness",
"label": "Brightness",
"category": "DimmableLight",
"tags": [
  "Lighting"
],
"groupNames": []

After the server came back up the Rest call returns:

"link": "http://192.168.1.100:8888/rest/items/hue_0100_efaabf2f_1_brightness",
"state": "NULL",
"type": "Dimmer",
"name": "hue_0100_efaabf2f_1_brightness",
"tags": [
  "Lighting"
],
"groupNames": []

The above was true for other items as well, and this has occurred multiple times.

@maggu2810
Copy link
Contributor

How do you create such items?
Are the item created by the REST interface or do we talk about temporary created items because on item channel link is present?
The label, category, tags etc. should be stored for persistent items.
The state is not stored (if you use persistence and restoreOnStartup it could work but this is another topic) and IMHO it makes no sense to keep the old item state over a power loss (who knows if the state the ESH framework restores is still the state of the real pyhsical device's channel).

@kaikreuzer
Copy link
Contributor

FTR: If the items are not manually defined, but inferred by the channel links, #1550 is likely to be the cause for the labels to disappear.

@jmichaluk
Copy link
Author

This item was added when approving a discovery from the Hue Bridge.

@jmichaluk
Copy link
Author

Steps to reproduce:

docker run \
       --name openhab \
       -v /etc/localtime:/etc/localtime:ro \
       -v /etc/timezone:/etc/timezone:ro \
       -v /home/umbrela/openhab/opt/openhab/conf:/openhab/conf \
       -v /home/umbrela/openhab/opt/openhab/userdata:/openhab/userdata \
       -p 8888:8080 \
       -p 8443:8443 \
       -p 5555:5555 \
       -d \
       --restart=always \
       openhab/openhab:amd64-online
  • Add hue binding through paperUI
  • Add hue bridge through paperUI
  • Add "Front Door" (hue Dimmable Light) through paperUI Inbox.

docker restart openhab

@ruebox
Copy link

ruebox commented Apr 23, 2017

Dear all,

I am familiar in Java programming and also developing of openhab addon. However, I a new to openhab2 core.
I.e. if you provide me some hints and support, I would be happy to contribute in fixing this issue.

@kaikreuzer
Copy link
Contributor

Hi @ruebox, thanks for your interest to help on the core development!
For working on Eclipse SmartHome code, it is best to set up a dedicated IDE as described at https://www.eclipse.org/smarthome/documentation/development/ide.html. Alternatively, you can use the openHAB IDE setup and also select the Eclipse SmartHome / Core option in step 4.

Please note that issue #2098 might not be a good choice to get started with, though, as it is highly complex. The root cause is very likely #1550 and this will probably best be tackled by #1896, where @SJKA is currently trying to implement a solution for. So you might want to go for some other issue for a start :-)

@ruebox
Copy link

ruebox commented Apr 29, 2017

Hi @kaikreuzer thanks for the fast feeback ... I will checkout the currently open issues for smarthome.
However, perhaps the bindings will be a good place for startup first ...
Nevertheless, please keep me in mind if I can contribute to a specific topic.

@triller-telekom
Copy link
Contributor

Since this is a very old issues and a lot of PRs have been merged since that I cannot tell which PR has fixed it but I just started ESH from my IDE, added a Hue bridge and a bulb and requested the state from an Item via the REST api:

http://localhost:8080/rest/items/hue_0210_001788141b41_1_color

led to:

{
link: "http://localhost:8080/rest/items/hue_0210_001788141b41_1_color",
state: "300,79,0",
type: "Color",
name: "hue_0210_001788141b41_1_color",
label: "Color",
category: "ColorLight",
tags: [
"Lighting"
],
groupNames: [ ]
}

after I restarted my ESH instance the same request led to:

{
link: "http://localhost:8080/rest/items/hue_0210_001788141b41_1_color",
state: "NULL",
type: "Color",
name: "hue_0210_001788141b41_1_color",
label: "Color",
category: "ColorLight",
tags: [
"Lighting"
],
groupNames: [ ]
}

So everything was persisted except for the state. Since the state cannot be guessed correctly it is safe to assume NULL as discussed above.

So I think this issue can be closed. @kaikreuzer @SJKA Can you please close it?

@sjsf
Copy link
Contributor

sjsf commented Feb 2, 2018

On a retrospect, this likely got fixed by #3639

@sjsf sjsf closed this as completed Feb 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants