ha-illuminance icon indicating copy to clipboard operation
ha-illuminance copied to clipboard

Feature request: Support of Buienradar

Open titiviking opened this issue 3 years ago • 2 comments

As Dark Sky seem to be decommissioned, I'm moving towards Buienradar which is fully free (at least forthe time being).

Any possibility to support this? (or recommendation on how to customize the integration?)

titiviking avatar Jan 10 '22 14:01 titiviking

Another free (and also Dutch) provider is the KNMI, which has a custom integration here: https://github.com/golles/ha-knmi
They both already map API conditions to homeassistant.components.weather: knmi / buienradar

So maybe instead of adding buienrader/knmi specifically, this integration could add support for "any sensor which reports weather as a homeassistant.components.weather ATTR_CONDITION"?

rigrig avatar Jan 19 '22 14:01 rigrig

@titiviking sorry it's taken me a while to respond. I took quite a long break from Home Assistant. But I'm back at it. In fact I'm in the process of creating a significant new release of this custom integration, which I should hopefully have out soon.

I did a little digging into the buienradar integration. Unfortunately I couldn't get it to work for me for some reason. It kept timing out trying to retrieve data from the server (even though I could retrieve data using curl from the same machine I'm running HA on.) Anyway, looking at the code I can see all the conditions it can return, and the attribution string, so it should be relatively easy to add support. I'll go ahead and do that anyway, even if you're not interested anymore.

pnbruckner avatar May 19 '22 19:05 pnbruckner

@emansom @titiviking I've created a beta release (3.1.0b0) that should support Buienradar which, unfortunately, I'm not able to test. Could you give it a spin? It should support both a weather entity and a sensor entity (that reports the same conditions as the weather entity.) Let me know if you if you're able to try it, how it works for you, or if you have any questions. Thanks!

pnbruckner avatar Dec 08 '22 21:12 pnbruckner

@emansom @titiviking I've created a beta release (3.1.0b0) that should support Buienradar which, unfortunately, I'm not able to test. Could you give it a spin? It should support both a weather entity and a sensor entity (that reports the same conditions as the weather entity.) Let me know if you if you're able to try it, how it works for you, or if you have any questions. Thanks!

Thanks for working on this! 👍🏻

Gets detected, so far no errors reported. Running on latest and greatest HA.

I'll check in tomorrow to see what chart it plots.

(screenshot taken at night, so 0 lux is valid)

afbeelding

emansom avatar Dec 09 '22 02:12 emansom

Screenshot_20221209-113746~2.png

Functions as expected, reflects the sporadic overcast clouds Buienradar reports. 👍

Screenshot_20221209-114143.png

emansom avatar Dec 09 '22 10:12 emansom

@emansom thanks for trying it and providing feedback. Much appreciated!

Note that there may still be some issues with this type of input. E.g., if the attribution attribute is not set before HA finishes initializing, that may cause it to effectively be rejected (resulting in it constantly using the fallback value.) Or there may be some conditions that were missed in my code potentially resulting in an "unexpected condition" error (and, again, using the fallback value while that condition lasts.) So, by all means, let me know if any of that happens.

Lastly, you gave me a scare. I saw the value of "3.507 lx" and thought, why the heck is the value so small?! Then I remembered the period was a "thousands separator", not a decimal point. (We use the period & comma the opposite way, so I thought the value was about 3 and a half, not 3507.) LOL!

pnbruckner avatar Dec 09 '22 14:12 pnbruckner

I'm giving it it try as of today. I'll keep an eye out the next days to see how it behaves. Thanks for the great effort into adding Buienradar as part of it!

titiviking avatar Dec 10 '22 09:12 titiviking

@rigrig

So maybe instead of adding buienrader/knmi specifically, this integration could add support for "any sensor which reports weather as a homeassistant.components.weather ATTR_CONDITION"?

That's a good idea. I'll try to work on that next. I could get rid of all the custom mapping tables and just implement one (or, at least, for integrations that use those "standard" conditions.) That might change the resulting values for some integrations, but should still be reasonable. I'll probably, though, still need the initial mapping for the Dark Sky icon sensor (that maps to the standard conditions.)

pnbruckner avatar Dec 12 '22 19:12 pnbruckner

Screenshot_2022-12-12-20-25-31-20_c3a231c25ed346e59462e84656a70e50

Been a few days. Seem quite stable for now. Changes follow a good curve... I did have a surge for today though... 23000 lux seems a bit much...

I'll keep an eye out some more to see if it stabalises..

titiviking avatar Dec 12 '22 19:12 titiviking

Note that there may still be some issues with this type of input. E.g., if the attribution attribute is not set before HA finishes initializing, that may cause it to effectively be rejected (resulting in it constantly using the fallback value.) Or there may be some conditions that were missed in my code potentially resulting in an "unexpected condition" error (and, again, using the fallback value while that condition lasts.) So, by all means, let me know if any of that happens.

@pnbruckner Been plenty of HA restarts. No error in the logs, no behavioral bug to report. 🎉

Set it up as source for the brightness value of all lights and desktop monitor, it all works beautifully to emulate biodynamic lighting.

emansom avatar Dec 12 '22 22:12 emansom

@emansom @titiviking Has the Buienradar integration changed by any change? I am not seeing any cloud coverage percentage in the data that I am getting from my buienradar integration. Am I doing something wrong?

Mushoz avatar Jan 20 '24 20:01 Mushoz