Are in influxdb saved items faster avaiable as without influxdb?

Hello

I use a oh-repeater to let me Show Covers and Labels, the values are refreshed every hour by a rule.

When I save the items in the influxdb is this faster in requesting the values?

Takes He than the saved values?

Or takes this no matter?

i tried to request the lastest value of a persistent item, but i always get a error

Item_recent_movie_home0_rating : strategy = everyUpdate, everyChange

Item_recent_movie_home0_rating.previousState(true,"influxdb").state

2021-05-08 11:46:00.625 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘test-1’ failed: cannot invoke method public abstract org.openhab.core.types.State org.openhab.core.persistence.HistoricItem.getState() on null in test

Do you have the Persistence service influxDB installed?
Did you check whether values are really persisted ( using the API Explorer)?

1 Like

hello,

of course, i check the values with the putty console, they are there:
but i always get a error when i try to request the cvalues.


1620464049830000000 Item_recent_movie_home0_rating /static/rating3.png
1620465084833000000 Item_recent_movie_home0_rating /static/rating3.png
1620465634743000000 Item_recent_movie_home0_rating /static/rating3.png
1620467064251000000 Item_recent_movie_home0_rating /static/rating3.png
1620467640471000000 Item_recent_movie_home0_rating /static/rating3.png
1620467700468000000 Item_recent_movie_home0_rating /static/rating3.png
1620467760468000000 Item_recent_movie_home0_rating /static/rating3.png
1620467820467000000 Item_recent_movie_home0_rating /static/rating3.png
1620467880469000000 Item_recent_movie_home0_rating /static/rating3.png
1620467940467000000 Item_recent_movie_home0_rating /static/rating3.png
1620468000468000000 Item_recent_movie_home0_rating /static/rating3.png
1620468001468000000 Item_recent_movie_home0_rating /static/rating3.png
1620468060467000000 Item_recent_movie_home0_rating /static/rating3.png
1620468120468000000 Item_recent_movie_home0_rating /static/rating3.png
1620468180468000000 Item_recent_movie_home0_rating /static/rating3.png
1620468240468000000 Item_recent_movie_home0_rating /static/rating3.png
1620468300467000000 Item_recent_movie_home0_rating /static/rating3.png
1620468360467000000 Item_recent_movie_home0_rating /static/rating3.png
1620468420468000000 Item_recent_movie_home0_rating /static/rating3.png
1620468480469000000 Item_recent_movie_home0_rating /static/rating3.png
1620468540468000000 Item_recent_movie_home0_rating /static/rating3.png
1620468600976000000 Item_recent_movie_home0_rating /static/rating3.png
1620468660470000000 Item_recent_movie_home0_rating /static/rating3.png
1620468720469000000 Item_recent_movie_home0_rating /static/rating3.png
1620468780468000000 Item_recent_movie_home0_rating /static/rating3.png
1620468840470000000 Item_recent_movie_home0_rating /static/rating3.png
1620468900470000000 Item_recent_movie_home0_rating /static/rating3.png
1620469597894000000 Item_recent_movie_home0_rating /static/rating3.png
1620469623399000000 Item_recent_movie_home0_rating /static/rating3.png

API EXPLORER RESULT

{
  "name": "Item_recent_movie_home0_rating",
  "datapoints": "29",
  "data": [
    {
      "time": 1620464049830,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620465084833,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620465634743,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620467064251,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620467640471,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620467700468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620467760468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620467820467,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620467880469,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620467940467,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468000468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468001468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468060467,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468120468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468180468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468240468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468300467,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468360467,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468420468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468480469,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468540468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468600976,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468660470,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468720469,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468780468,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468840470,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620468900470,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620469597894,
      "state": "/static/rating3.png"
    },
    {
      "time": 1620469623399,
      "state": "/static/rating3.png"
    }
  ]
}

my call must be wrong

Item_recent_movie_home0_rating.previousState(true,“influxdb”).state

Has this data ever changed? (“the data” here is the text “/static/rating3.png”)
If not, I don’t think that will retrieve anything.
Try the simpler
Item_recent_movie_home0_rating.previousState(“influxdb”).state

1 Like

no in the actually example not.
okay, you are right, that works well :grinning:

I have one more question for you, you seem to be very familiar with openhab.

is it possible to download images using a url and save them on the opehab sd card?

I hope that this will make my widget load faster.

It’s usually best to explain what you are trying to do, before getting bogged down in details.

It seems to be “I want to cache some images for display”?

Have a look at threads about weather icon caching.

2 Likes

you mean this ?

then
    val icon = "/etc/openhab2/icons/classic/g24weather.png" 
    val path = "https://darksky.net/images/weather-icons/"
    executeCommandLine(String.format("wget -O %s %s%s.png", icon, path, Local_Weather_Current_Icon_Id.state.toString), 5000)
end

No answer to your question, but a suggestion.
You are trying to speed up the display of weather icons. The number of those icons is limited, why don’t you download (manually) them all to a useful location (conf/html?) and load the a tually is one from there?

not weather images but poster from movies.they change on every movie.

i tried

val String results = executeCommandLine("wget -P /etc/openhab/html/download/", + test1, 5000)

but i think its the wrong command

If you’re using OH3, that’s the wrong syntax for executeCommandLine(), it has changed.

yes, i usw openhab3, have you a example?

Really?

1 Like

Many Thanks Sry I have a weakness in reading and concentration, which is why I have problems understanding things. But I try to understand everything. So thank you very much for the help

i had a question, is it not possible to request in the widget a influx db value?

i tried it :

 text: =items[props.prefix_homemovies + loop.homewidgetmovies.toString() + '_year'].previousState().state.toString

and i get in the widget a error

TypeError: Cannot read property ‘state’ of undefined

the command (.previousState().state.toString) is fine, when i test it in a rule, i get the value

No, previousState() and the like are only available in rules run on the server, in widget expressions you only have access to the current state of items and a few other things listed here: Building Pages - Components & Widgets | openHAB

1 Like

But that’s more of a shame, then you can’t even access values ​​stored in the DB …

It would be nice if there was some improvement. I think it’s very important to reach DB from anywhere.

Unfortunately I can’t do anything with it like that. I wanted to cache the values.

I don’t want my database exposed to everywhere.

You’ll notice that you can use charts in the UI. These are made from database data, but created on the server side,and just images sent to UI.

I think it depends on what you use the DB for. You can always create different databases and then use those without sensitive data.

I just wanted to get all the values ​​of my json calls that I need from the DB in order to accelerate the widget.
And not having to make a json call every time.