-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[openweathermap] Add support for persisting OneCall API forecasts #15963
Conversation
@jlaur I guess I need to use update instructions here to make those new channel groups available for "old" Things. Can you probably provide some help here since I have never worked with update instructions before? |
You could have a look at https://www.openhab.org/docs/developer/bindings/thing-xml.html#updating-thing-types and: Lines 12 to 20 in a4da986
|
Thanks. Is there a way to add a whole channel group in one step? Or do I have to add each individual channel? |
@jlaur I got the Thing update instructions working, so from my POV this is ready for merging. |
...n/java/org/openhab/binding/openweathermap/internal/handler/OpenWeatherMapOneCallHandler.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing time series support! LGTM, although I didn't go into full depth - I assume you already tested this as usual. 🙂 Only a few minor comments/questions.
Also, can you regenerate the I18N properties file?
bundles/org.openhab.binding.openweathermap/src/main/resources/OH-INF/thing/channel-types.xml
Outdated
Show resolved
Hide resolved
...n/java/org/openhab/binding/openweathermap/internal/handler/OpenWeatherMapOneCallHandler.java
Outdated
Show resolved
Hide resolved
I am a little off topic in this message. In Main UI, the only way to show these values in future will then be to look at the chart ? We have still no way with sitemap UIs ? I believe at a certain time @J-N-K mentioned the need for a way to request chart period in the future for charts built by server. Is the chart servlet already compatible with these new time series ? |
Yes.
Sitemaps are actually still my primary way of interacting with openHAB from the Android app, but it's configured only for my production system which is still 4.0. I don't remember if I tried to configure a sitemap with a chart to inspect in BasicUI. If you want to try it out you can simply install Energi Data Service binding. It doesn't require any authentication, and only one required parameter: Price area. Set that to one of the suggested values (e.g. DK1), and you'll get future prices for channel |
@lolodomo - seems not supported, this is how it looks from BasicUI, only options for looking back in time: |
@jlaur Thanks for the review.
Yes, I have tested this on my dev system. I haven't tested all channels, but at least one minutely, one hourly and one daily to make sure the new code for creating time series works properly (the code to get the state is the same as before, just moved to a new private method - GitHub diff view is really bad a moved code ...). The update instructions also work fine.
Done. For the other changes I've done, please have a look at my answers to your comments. |
Yes. Unfortunately, there it is not possible (yet) to set a chart to a future time range as default, you always have to manually go to the future.
BasicUI would need to provide options for selecting future time ranges, but the chart servlet would also need to support future time ranges. Not sure if it does, but this should be easy to find out. Just open the browser dev tools when viewing BasicUI and find the request to the chart servlet. I would guess time range is passed as query param, so you should be able to adjust the URL and try to request a a future chart. |
The chart servlet calls the default chart provider with two dates, the start time and the end time. Here is the method in the chart provider Thr chart servlet already supports with its calling parameters the request of a chart in future. You just have to set "begin" parameter to now and the "period" parameter as usual. So nothing to change here. Sitemap UIs need a new input to choose between past and future. Then it is just a small change of the chart URL to be done by each UI. |
In fact, UIs should always set either begin param or end param with the current date & time. |
As a quick fix in Basic UI, I can add a new switch in the header row to switch between past and future. But the user will still not be able to request directly a chart in future until we change the sitemap syntax. The parameter to add could be named "inFuture" ? Another option that is more a workaround would be to use a negative period for charts in future like for example -D for the day in future. |
@lolodomo - maybe a new issue should be created for adding support for future states in sitemap charts? |
...n/java/org/openhab/binding/openweathermap/internal/handler/OpenWeatherMapOneCallHandler.java
Outdated
Show resolved
Hide resolved
Implement time series support introduced by openhab/openhab-core#3597. Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
…urly and daily channels Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
…efault Signed-off-by: Florian Hotze <[email protected]>
…vement Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
9c29720
to
79ddbea
Compare
@jlaur I have addressed your review and fixed DCO (Sign-Off was missing because one of my commits this morning was from GitHub web), therefore the force push. |
Just to be clear, does this PR break something ? If a user simply upgrades OH without changing anything, will he loose some features or not ? |
With the current implementation, this does not break anything and there will be no loss of functionality. The README just suggests/encourages to use the time series channels instead of the current channels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…enhab#15963) Implement time series support introduced by openhab/openhab-core#3597. Signed-off-by: Florian Hotze <[email protected]> Signed-off-by: Jørgen Austvik <[email protected]>
…enhab#15963) Implement time series support introduced by openhab/openhab-core#3597. Signed-off-by: Florian Hotze <[email protected]>
Implement time series support introduced by openhab/openhab-core#3597 for all forecast channels of the OneCall API weather and forecast Thing.
Also change the behaviour of the handler, so that setting
forecastMinutes
,forecastHours
andforecastDays
to 0 does not exclude the respective data from the API response. So these config parameters can be used to disable the individual channel groups for each time-step.