Is that something that might be incorporated in the binding? I would think that’s not much more than some copy-pasting with some alterations? But that’s of course my layman estimation, and of course with respect to everyone’s time. And not meant as a minimization of any effort that goes into all of this. I might be entirely wrong with my estimation.
I tried looking at the github to found out where exactly the API is “addressed”, but figure it out…
Nothing speaks against it if someone contributes it.
More or less yes, I think. But I haven’t looked into the API implementation, only in the Thing handler implementations. The DTO also needs to be updated, but that shouldn’t be much work.
Either try it yourself or create a new issue and request the addition of the moon data, so we don’t forget it. I will probably have a look when I extend time series support in the binding.
How would I go about trying to contribute to this quest? I’ve never done something like it, and always like to learn something new. And this seems like something I’m capable of…
Run mvn i18n:generate-default-translations -pl :org.openhab.binding.openweathermap to regenerate the default translations (the .properties files in i18n folder)
I want to emphasize this information! Everything is easily available (including moonPhase translations for most languages).
I have the openweathermap-binding and astro-binding running in parallel. With the astro-binding even a triggering of the events (sunrise, sunset…) is possible.
updateCurrentChannel updates the channels with the current data, and looking at the OpenWeatherMap API docs you linked above, there is no moon data for current, only a daily forecast.
In line 663 inside getDailyForecastState is the handling for the daily sun forecast channels.
Once you have set up your local dev environment and cloned the repo and changed the channel-types.xml, you can run this command from the command line from the repo root.
Sure, but OpenWeatherMap provides daily forecast data for those moon data, which might be interesting as well … however I am not sure which data @ErikDB actually wants.
I quoted the wrong function… You directed me to line 629, but I don’t see anything adaptable in function updateDailyForecastTimeSeries.
In Windows command I navigated to C:\Users\[some more foldering until the folder in which I cloned the github]\openhab-addons\bundles. There I executed mvn i18n:generate-default-translations -pl :org.openhab.binding.openweathermap. This led to several minutes of things happening:
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/openhab/openhab-super-pom/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/openhab/openhab-super-pom/maven-metadata.xml (521 B at 547 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/openhab/openhab-super-pom/1.0.6/openhab-super-pom-1.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/openhab/openhab-super-pom/1.0.6/openhab-super-pom-1.0.6.pom (6.6 kB at 205 kB/s)
Downloading from openhab-snapshot: https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/tools/sat/sat-extension/0.15.0/sat-extension-0.15.0.pom
Downloading from central: https://repo1.maven.org/maven2/org/openhab/tools/sat/sat-extension/0.15.0/sat-extension-0.15.0.pom
Downloaded from central: https://repo1.maven.org/maven2/org/openhab/tools/sat/sat-extension/0.15.0/sat-extension-0.15.0.pom (2.8 kB at 17 kB/s)
Downloading from openhab-snapshot: https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/tools/sat/pom/0.15.0/pom-0.15.0.pom
Downloading from central: https://repo1.maven.org/maven2/org/openhab/tools/sat/pom/0.15.0/pom-0.15.0.pom
(etc, but I need to trim down the characters in order to get this message posted...)
But then it ended with:
Downloaded from central: https://repo1.maven.org/maven2/com/thoughtworks/xstream/xstream/1.4.20/xstream-1.4.20.jar (645 kB at 8.3 MB/s)
Downloading from central: https://repo1.maven.org/maven2/io/github/x-stream/mxparser/1.2.2/mxparser-1.2.2.jar
Downloading from central: https://repo1.maven.org/maven2/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar
Downloading from central: https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar
Downloaded from central: https://repo1.maven.org/maven2/io/github/x-stream/mxparser/1.2.2/mxparser-1.2.2.jar (30 kB at 824 kB/s)
Downloaded from central: https://repo1.maven.org/maven2/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar (7.2 kB at 109 kB/s)
Downloaded from central: https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar (258 kB at 2.3 MB/s)
[INFO] Reading: C:\Users\[some more foldering until the folder in which I cloned the github]\openhab-addons\bundles\org.openhab.binding.openweathermap\src\main\resources\OH-INF\addon\addon.xml
[INFO] Reading: C:\Users\[some more foldering until the folder in which I cloned the github]\openhab-addons\bundles\org.openhab.binding.openweathermap\src\main\resources\OH-INF\addon\desktop.ini
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:29 min
[INFO] Finished at: 2024-01-29T20:36:59+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openhab.core.tools:i18n-maven-plugin:4.2.0-SNAPSHOT:generate-default-translations (default-cli) on project org.openhab.binding.openweathermap: Execution default-cli of goal org.openhab.core.tools:i18n-maven-plugin:4.2.0-SNAPSHOT:generate-default-translations failed.: StreamException: ParseError at [row,col]:[1,1]
[ERROR] Message: Content is not allowed in prolog.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
What exactly do you mean with “repo root”?
If I went up one level, this happened:
[INFO] Scanning for projects...
[INFO]
[INFO] ---< org.openhab.addons.bundles:org.openhab.binding.openweathermap >----
[INFO] Building openHAB Add-ons :: Bundles :: OpenWeatherMap Binding 4.2.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- i18n:4.2.0-SNAPSHOT:generate-default-translations (default-cli) @ org.openhab.binding.openweathermap ---
[INFO] Reading: C:\Users\[blabla]\openhab-addons\bundles\org.openhab.binding.openweathermap\src\main\resources\OH-INF\addon\addon.xml
[INFO] Reading: C:\Users\[blabla]\openhab-addons\bundles\org.openhab.binding.openweathermap\src\main\resources\OH-INF\addon\desktop.ini
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.178 s
[INFO] Finished at: 2024-01-29T21:28:15+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openhab.core.tools:i18n-maven-plugin:4.2.0-SNAPSHOT:generate-default-translations (default-cli) on project org.openhab.binding.openweathermap: Execution default-cli of goal org.openhab.core.tools:i18n-maven-plugin:4.2.0-SNAPSHOT:generate-default-translations failed.: StreamException: ParseError at [row,col]:[1,1]
[ERROR] Message: Content is not allowed in prolog.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
One more level up:
[INFO] Scanning for projects...
[ERROR] [ERROR] Could not find the selected project in the reactor: :org.openhab.binding.openweathermap @
[ERROR] Could not find the selected project in the reactor: :org.openhab.binding.openweathermap -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
C:\Users[some more foldering until the folder in which I cloned the github]\openhab-addons
That desktop.ini might be the problem, I wonder where it comes from (blame Windows). Seems that the i18n plugin tries to read it.
Anyway, ignore the i18n plugin for now and continue with the „real“ code changes.
Once you are finished and have opened a PR, I can take care of the translations if it still does not work on your system then.
I had put it all in a Google Drive file. The mvn command now seems to have worked. It did give only some 7 lines of output. Is that possible? (I stupidly closed the window without copying them.)
I’ll figure out what a PR is and how that works tomorrow
@florian-h05, I installed the Github CLI, and read up on the documentation (Creating a pull request - GitHub Docs). Although I don’t quite understand how that CLI knows to which repository I want to send this pull request… But I assumed that’ll become clear during the process.
But this gave me the following error:
Warning: 6 uncommitted changes
must be on a branch named differently than "main"
It did involve a lot of shots in the dark, so I’m not 100 % sure I did everything right. But it looks like I did “enough” to make it work, from where I sit.
I already had the openweathermap binding installed, as it’s used in the semantichomemenu I’ve embraced. So maybe I can integrate this moon information in the widget somehow.
And it looked like a feasible goal for a first try at doing something with Github.
You would just link the same moon Items to the Astro Channels instead of the OWM channels.
Again, I’m not discouraging adding this to OWM. I just wanted to point out that OWM doesn’t provide any information that Astro doesn’t already offer too (after all lunar events are deterministic and not subject to weather conditions and the like).