-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
[items] ItemPersistence: Add support for persisting TimeSeries #341
Conversation
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@jlaur Can you please test all six variantions of using the persist method? If you don’t want to mess with NPM, you can download the build artifact https://github.com/openhab/openhab-js/actions/runs/9427272367/artifacts/1581551041, unzip it and copy the openHAB.js file to the node_modules folder (delete the content before). |
@florian-h05 - sure, thanks! Actually I don't mind messing with NPM now that I have WSL running on my development system. However, I now tried the following:
But got the following:
This was before changing anything from the previous test run, i.e. line 37 ( items.Energi_Data_Service_Total_Price.persistence.persist(spotPrice.timestamp, totalPrice); |
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
…heck, Add debug logging Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@jlaur Can you please retry with https://github.com/openhab/openhab-js/actions/runs/9428132260/artifacts/1581671952? |
Much better, previous example now works again. I'll test the others. |
@florian-h05 - I can confirm that all six overloads work as expected. Good job! 👍 |
Great 👍 |
This adds support for persisting a TimeSeries.
It adds a new JS TimeSeries class, which implements the same functionality as the Java TimeSeries, but in pure JS.
When this JS TimeSeries is passed to
ItemPersistence#persist
, a Java TimeSeries is created from it by iterating over the timestamp -> state pairs and usingorg.openhab.core.types.TypeParser
to parse JavaStates
from the JS types.The helpers have been extended with a isInstant and isTimeSeries method and for all isXXX methods, a check whether the passed in type is an object has been added.