I am currently installimg Victron Solarsystem in my RV. The Victron equipment is monitored via Venus OS on an independant Pi and the data is send via MQTT to an other Pi running Openhab.
My goal is to use Openhab together with Grafana to have a nice overview on the Status of my solar, battery weatherforecast and sun set/rise
Now my question. Is there a possibility in openhab to get the actual weather of the currnt position of my RV? In the waether or astro binding binding I can set one position, but there is now possibility to have it dynamically depending on my current position.
I think it can be done but it’s not going to be super easy.
You would need some way to track your current location. If you have a spare old phone you could use OwnTracks to report the current lat/lon.
Using the REST API Docs, query for your Astro Thing. Copy the JSON formatted String to a text file. Replace the lat/lon values with some easily findable string like $LATITUDE$ and $LONGITUDE$.
When the location changes significantly, trigger a Rule.
In the Rule:
load the JSON for your Things into a variable. var astroThing = executeCommandLine("cat /path/to/astro.thing")
replace the place holders with the new latitude and longitude: astroThing = astroThing.replace("$LATITUDE", triggeringItem.state.latitude).repalce("$LONGITUDE", triggeringItem.state.longitude)
update the Things for the Astro and what ever weather binding you are using. This can be done using OH’s REST API which you can access from Rules using sendHttp*Request or by calling curl using executeCommandLine
This will update the location used by those Things.
An alternative would be to use .things files and modify the the fields in the .things file instead using the same over all approach. Only instead of making HTTP calls you will be doing file writing.
If using the REST API to make the change would that still be the case? Do we need to restart the Astro binding when changing a Thing through PaperUI? I’ve not changed my Astro Things in years so I’ve no experience with this, but my recollection is that saving changes to the Thing (mainly applying an offset) caused the recalculation of the day’s events. But perhaps something changed along the way or I’m remembering incorrectly.
I would imagine the behavior is binding dependent.