openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

[REST] How to send forecast states

Open spacemanspiff2007 opened this issue 2 years ago • 4 comments
trafficstars

Now that #3597 is merged I'd like to use this feature through the RestAPI.

Sending historic values can be done through the persistence endpoint. (There was some discussion for rrd4j and mapdb but unfortunately it didn't result in a solution so it doesn't work for these two).

But how can I send future states to an item? Will there be a new forecast endpoint or is this some kind of special state I have to send to an item?

spacemanspiff2007 avatar Nov 08 '23 06:11 spacemanspiff2007

Single values can already be stored using PUT /rest/persistence/items/MyItem?serviceId=influxdb&time=2024-01-01T12%3A00%3A00.000Z&state=OFF. This should work for past and future values. If it does not, that is a bug.

The web socket should probably be extended to process incoming ItemTimeSeriesEvent.

J-N-K avatar Nov 08 '23 20:11 J-N-K

Ah - that's good. Then there is nothing to do from my side.

The item will then automatically change to OFF on 2024-01-01 in your example? Or is this a misunderstanding on my side?

How do I remove a future value?

The web socket should probably be extended to process incoming ItemTimeSeriesEvent.

Imho this should only concern the ItemStateEvent which is not of interest for me anyway. The ItemStateUpdatedEvent will contain the correct state. Correct? It still might make sense to support it though.

spacemanspiff2007 avatar Nov 09 '23 06:11 spacemanspiff2007

@J-N-K Small ping in case you missed my questions

spacemanspiff2007 avatar Nov 23 '23 07:11 spacemanspiff2007

@spacemanspiff2007 Exactly, if you set the forecast strategy on the item.

At the time the state is restored an ItemStateUpdatedEvent is emitted.

J-N-K avatar Nov 25 '23 11:11 J-N-K

Since #3889 websocket support the time series, so I bleibe this can be closed.

J-N-K avatar May 05 '24 16:05 J-N-K

How can I remove a future value from the time series?

spacemanspiff2007 avatar May 06 '24 04:05 spacemanspiff2007