anerdins / node-red-contrib-nibepi

Node-RED plugins for NibePi interface for connecting to Nibe F series heatpump
MIT License
10 stars 14 forks source link

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

Open SgtSeppel opened 1 year ago

SgtSeppel commented 1 year ago

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

The issue is caused here https://github.com/anerdins/node-red-contrib-nibepi/blob/f3cf74d99c43250eb02dfb5533a92e777d50721e/config_node.js#L560

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:

Cons:

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 commented 1 year ago

@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

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 commented 1 year ago

It is the second path and you are in the right file. In the runWeather function. Or what ever the name was. A console.log should show up in the journalctl log. Den 17 nov. 2022 08:35 skrev SgtSeppel @.***>: @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.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

SgtSeppel commented 1 year ago

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 commented 1 year ago

Hi @anerdins ,

I just created a pull request https://github.com/anerdins/node-red-contrib-nibepi/pull/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:

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 commented 1 year ago

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

JeeKee80 commented 1 year ago

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 commented 1 year ago

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.