SeitaBV / flexmeasures-openweathermap

Integration to the OpenWeatherMap API from FlexMeasures.
Apache License 2.0
4 stars 1 forks source link

Limit lookup for weather stations by account #19

Open nhoening opened 1 year ago

nhoening commented 1 year ago

Currently, all weather stations will be searched and potentially be used to store data (if they are the closest to the location).

While it makes sense conceptually that weather stations are public (to be used by all accounts on a FlexMeasures server), it doesn't have to be like that. Maybe two accounts use different weather services. It can lead to unwanted data situations, in any case.

Sensor.find_closest() already supports adding an account_id argument. We could support this from FM-OWM, by configuring an account_id (as CLI parameter or a setting).

It would also be good to query only public weather stations per default, however, the account_id parameter has no effect when set to None. Maybe we'd need to add our own filter (disregarding non-public) in this case.

Ahmad-Wahid commented 1 year ago

The account_id would be fetched from account table or it would be created while saving forecasts?

nhoening commented 1 year ago

It would be passed in via CLI, checked if a weather station exists in that account, and then only weather stations for this account would be used for sensor lookup.

Is not passed in, we should probably insist on public weather stations, but maybe that is not straightforward with how FlexMeasures is set up currently.

Does this make it clearer?

nhoening commented 1 year ago

The account_id would be fetched from account table or it would be created while saving forecasts?

No we would not create the account in this plugin. This is for existing accounts.