-
-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[blockly] Add historicState option to Persistence blocks #1309
Comments
@digitlength |
As far as I can tell, on 3.4.0 Release Build, this issue is not fixed. If it is, please share a screenshot of the block which mimics the behaviour of the inline script example in the OP. I am trying to retrieve a value from persistence from an arbitrary time in history (not just the previous [unique] state). runtimeInfo:
version: 3.4.0
buildString: Release Build
locale: en-GB
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 11.0.17
javaVendor: Azul Systems, Inc.
javaVendorVersion: Zulu11.60+19-CA
osName: Linux
osVersion: 5.15.64-1-pve
osArchitecture: amd64
availableProcessors: 2
freeMemory: 205030344
totalMemory: 429916160
startLevel: 100
bindings:
- http
- mqtt
- solarforecast |
Ok, so the requirement would be to retrieve a state at a particular point in time which can only be achieved with .historicState(ZonedDateTime) ? I will put it on my list as soon as #1617 is merged. |
Correct. This is all about the
Fantastic! Your work is much appreciated! |
While I had to fix a breaking change in the 4.0 API persistence methods I also added the historic state to it and it will be available as part of #1617 and looks as follows |
@ghys can you explain how I can use this? Or is this only available in unreleased OH4? |
It was literally merged 15 minutes ago, so, yes :) |
The problem
At the moment it is not possible to retrieve a single value from persistence without jumping through a hoop or two (see workarounds below).
In code this would use the
historicState
function.Your suggestion
Add a feature which enables retrieval of a single value from persistence (re)using a single block.
Current workarounds
OH3.2+
For numerical values only, use the
delta
function to get the difference between now and the specific point in the past. Then take this value away from the current state of the item.which generates the following relevant code
OH3.3M1+
The above workaround still works, or use the inline script block to use the
historicState
function directly, which enables getting the state of any type of Item, not just numerical.which contains the following code
Your environment
Additional information
The text was updated successfully, but these errors were encountered: