openhab / org.openhab.ui.habmin

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

Cannot save chart #116

Closed tbrandstetter closed 8 years ago

tbrandstetter commented 8 years ago

I'm using Openhab 1.8 with the newest jars of Habmin:

org.openhab.binding.zwave-1.8.0.jar org.openhab.io.habmin-1.7.0-SNAPSHOT.jar org.openhab.ui.habmin_2.0.0.SNAPSHOT-0.0.15.jar

using the mysql persistence with following configuration:

// Persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {

    // If no strategy is specified for an item entry below, the default list will be used.
    default = everyChange 
}

/*
 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).
 */
Items {
    * : strategy = everyChange
}

on an Raspberry PI 2 +.

I have the Habmin and Habmin2 webapps in the webapps Folder (also the newest versions).

I can see the items and can also create charts, but I cannot save them. Habmin (and 2) says that it saved the charts but I cannot see them. In Habmin2 i can see that it is calling the /services/habmin/persistence/charts endpoint and posting a JSON request like:

{id: "1", name: "Test", title: "Test", period: "259200", legend: "false",…}
axis: [{position: "left"}, {position: "right"}]
id: "1"
items: [{item: "Strom_Gesamt", axis: "left", label: "Stromzähler gesamt"},…]
legend: "false"
name: "Test"
period: "259200"
title: "Test"

but afterwards the chart is gone. How can I debug what the problem is? It is not working in Habmin and Habmin2.

cdjackson commented 8 years ago

Maybe it's a permissions issue? If you're running on Linux, make sure that there's sufficient access rights to the OH folders?

cdjackson commented 8 years ago

Is this still an issue? I don't have any problem saving charts here so I suspect it's external to HABmin?

tbrandstetter commented 8 years ago

OH has been installed using the debian packages for it (on an Raspberry PI). If nobody else has this problem I think it has something to do with my setup. I'm going to refresh the whole installation and try it again. Sorry for the late reply.

cdjackson commented 8 years ago

Thanks for the info… It might be (I think) that the folders are slightly different when installed with apt-get. I’ve modified most of the resources to use the standard OH methods to get the folder, in which case this should be ok… I’ll leave this open to remind myself to double check the chart resource class…

mmihalko commented 8 years ago

I can confirm, I have same problem. Also standard debian installation. Where are charts stored? Debian installation runs under user:group habmin:habmin by default. I believe, permissions for this user are only set to directory /var/lib/openhab, which is OPENHAB_HOME_DIR. This is interesting part of openhab.in.sh from installation:

OPENHAB_CONF_DIR="/etc/openhab"
OPENHAB_CONFIGURATIONS_DIR="${OPENHAB_CONF_DIR}/configurations"
OPENHAB_DIR="/usr/share/openhab"
OPENHAB_LOG_DIR="/var/log/openhab"
OPENHAB_HOME_DIR="/var/lib/openhab"
OPENHAB_USER_DATA_DIR="${OPENHAB_HOME_DIR}"
OPENHAB_WORKSPACE_DIR="${OPENHAB_HOME_DIR}/workspace"
JETTY_CONFDIR="${OPENHAB_CONF_DIR}/jetty/etc"

however, most of dirs are owned by root:

[root@raspberrypi:/usr/share/openhab]# ls -la /usr/share/openhab
total 3704
drwxr-xr-x   7 root root    4096 Apr 19 18:59 .
drwxr-xr-x 197 root root    4096 Apr 17 20:13 ..
-rw-r--r--   1 root root   11232 Mar 22 00:31 LICENSE.TXT
-rw-r--r--   1 root root     652 Mar 22 00:31 README.TXT
drwxr-xr-x   2 root root    4096 May 18 21:11 addons
drwxr-xr-x   2 root root    4096 Apr 17 20:14 bin
lrwxrwxrwx   1 root root      27 Mar 22 00:31 configurations -> /etc/openhab/configurations
lrwxrwxrwx   1 root root      27 Mar 22 00:31 contexts -> /etc/openhab/jetty/contexts
lrwxrwxrwx   1 root root      22 Mar 22 00:31 etc -> /etc/openhab/jetty/etc
-rw-r--r--   1 root root 3744052 Jun 20  2014 habmin.zip
drwxr-xr-x   6 root root    4096 May 19 18:42 server
drwxr-xr-x   2 root root    4096 Apr 17 20:14 sounds
drwxr-xr-x   5 root root    4096 Apr 19 18:59 webapps
[root@raspberrypi:/usr/share/openhab]# ls -la /etc/openhab
total 40
drwxr-xr-x   4 root    root     4096 Apr 17 20:14 .
drwxr-xr-x 134 root    root    12288 May 18 21:09 ..
drwxr-xr-x   8 openhab openhab  4096 May 19 18:33 configurations
drwxr-xr-x   4 root    root     4096 Apr 17 20:13 jetty
-rw-r--r--   1 root    root     3111 Apr 27 19:09 logback.xml
-rw-r--r--   1 root    root     2583 Mar 22 00:31 logback_debug.xml
-rw-r--r--   1 root    root      145 Mar 22 00:31 login.conf
-rw-r--r--   1 root    root      302 Mar 22 00:31 quartz.properties
[root@raspberrypi:/usr/share/openhab]# ls -la /var/lib/openhab
total 24
drwxr-xr-x  6 openhab openhab 4096 May 19 20:10 .
drwxr-xr-x 59 root    root    4096 May 19 20:38 ..
drwxr-xr-x  3 openhab openhab 4096 May 19 20:00 .java
drwxr-xr-x  3 openhab openhab 4096 May 19 19:26 persistence
drwxr-xr-x  6 openhab openhab 4096 May 19 20:12 workspace
drwxr-xr-x  2 openhab openhab 4096 May 19 20:21 zwave

Could this be the problem?

miosolHH commented 8 years ago

I'm also having trouble saving charts. It says that the chart has been save successfully. But it doesn't display it under the charts menu. When I go to add a chart widget to a dashboard I the saved chart in the list. But when I select it and hit save, nothing happens and I'm left with an empty widget. Sometimes I get an error message in the top right corner of the screen %%KEY NOT FOUND%%.

I'm using OH2, Habmin2, RPi2 and an rrd4j Persistence

cdjackson commented 8 years ago

It doesn’t sound like you have a problem saving charts - it sounds like there’s another problem? Have you set the default persistence in the user settings?

miosolHH commented 8 years ago

I've tried, but if I go back to the users tab, the setting isn't saved. Changing languages works though.

cdjackson commented 8 years ago

It does save the setting, but it’s not displaying when you go back. To fix this you can use the latest snapshot, but the current version does save the setting.

miosolHH commented 8 years ago

Ah ok, that's good to know. Ok, the charts now appear and are selectable as charts in the Dashboard.

The gauges in the dashboard don't have any selectable attributes though. I guess that is currently being discussed in #164 .

cdjackson commented 8 years ago

I believe that this issue is related to file permissions or something similar with some configurations so will close this. If there's anything concrete that can be suggested to help this in HABmin please reopen, or open a separate issue.

csvadr commented 8 years ago

Got it. OH 1.8.3 (debian packages) on jessie, latest habmin1. Write access for openhab user in /etc/openhab/jetty/etc/ is needed. habmin stores its graphs in /etc/openhab/jetty/etc/habmin/charts.xml