Skip to content
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

[1.2.1] Prognosis based control not working for users outside sweden #5

Open
SgtSeppel opened this issue Sep 28, 2022 · 8 comments
Open

Comments

@SgtSeppel
Copy link

SgtSeppel commented Sep 28, 2022

The prognosis based control is not working if the geographical location is outside sweden.

The issue is caused here

https.get(`https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/${lon}/lat/${lat}/data.json`, (resp) => {

The API call does not return values for areas outside of the boundaries described in the API documentation:
image

(https://opendata.smhi.se/apidocs/metfcst/geographic_area.html?fbclid=IwAR3EvBAmOOpH3ZkHRin23O6VgWr-20Q4zcCVTVhThCfer4cvM4ueF_oNARw)

A possible solution would be to swith to OpenWeatherMap or at least add a config switch to alternatively use this service.
Pros:

  • Would be mostly a drop in replacement since OpenWeatherMap also offers a 1-Call-API
  • Worldwide coverage

Cons:

  • Users must explicitly register to optain an API Key
  • Users must "subscribe" even to use the lowest FREE tier of 1000 calls/day.

I started digging around a bit to implement this, but that will take some time.

@anerdins Can you provide some guidance on how to achieve this within NibePi? I'm really not familiar with NodeRed and how everything is tied together.
What would I need to change? I assume I need to add this to the weather node? But then also the request is in the config_node.js.
And also there needs to be some adaption in the GUI?

If we can give me a few hints I'll try to find time to provide a PR.

@SgtSeppel
Copy link
Author

@anerdins
I think I'm making some progress here on a local patch. But I need a quick hint from you:
Where exactly to I have to work in order to have the changes applied directly? I'm working with a wrapper script right now since all the changes I do in

  • \node_modules\node-red-contrib-nibepi\config_node.js and
  • .node-red\node_modules\node-red-contrib-nibepi\config_node.js

do not seem to have any effect, even after re-deploy. Not even just simple stuff like adding a log entry next to an existing one.

@anerdins
Copy link
Owner

anerdins commented Nov 17, 2022 via email

@SgtSeppel
Copy link
Author

Okay, thanks for the quick hint.
Is there a way to take over the changes without restarting nodered?
So far this was the only way I could manage to have my changes applied.

And every time I do that, all my settings are gone.

@SgtSeppel
Copy link
Author

Hi @anerdins ,

I just created a pull request #6 as a first version to provide world wide weather data based on OpenWeatherMap.

I'd appreciate if you can have a look and merge/test this locally. To compare against your implementation. I see differences, but I can not 100% assess if they are caused by slightly different forecast data or if something is fundamentally wrong.

What's missing:

  • integration into the GUI/Dashboard
  • Documentation
  • Maybe some cleanup and refactoring

I guess the first one should be done by you. Likely also a more sophisticated way to integrate into your code.

If you integrate this properly within your code and the GUI I'll happily do the proper cleanup and documentation.

@SgtSeppel
Copy link
Author

Oh, and let me know if you want to use my API key for testing in the first run.

@JeeKee80
Copy link

Hi @SgtSeppel,

@anerdins pointed me to you to see if I could help implement the forecast feature for users outside Sweden.

First up, nice to see you’re nearly there already!

Just my 2ct, isn’t it easier to use https://github.com/open-meteo/open-meteo instead of openweathermap? It’s free, no key needed and uses data from national weather institutions. Beats all the con’s you mentioned for openweathermap.

If I can be of any help please let me know and I’ll be happy to see what I can do!

@SgtSeppel
Copy link
Author

Might make sense. Never heard of them, but would make things easier for the end user.
I went for OWM since I used it in the past for other systems around smart home.

@Samot89
Copy link

Samot89 commented Dec 10, 2024

Hello, does anyone have a functional weather forecast except of Sweden via the open-meteo website or via Home Assistant mqtt sending to nibepi? Thank you for any advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants