Outdoor illuminance estimated from weather conditions

@pnbruckner ,
HA OS 7.2, supervisor 2022.11.2, HA 2022.2.2, I’m not sure where to check custom integration version.

Here is wearher.home state screen shot

That’s not “weather.home”, it’s “weather.dudo_s_home”

If you click on the little “i” in the circle under that name and click the “related” tab, what does it say? I’m thinking this is a different integration from illuminance since none of those values are light related?

Ahh – okay I finally figured this out – I thought the entity_id ‘weather.home’ was something we were creating here:

- platform: illuminance
    name: Estimated Illuminance
    entity_id: weather.home

This is incorrect – what we are supposed to provide is the value of the entity_id for whatever is already providing HA with the weather data. In my case, instead of “weather.home” I should have entered “weather.ecobee”.

This means @dkovacic just needs to change it to:

- platform: illuminance
    name: Estimated Illuminance
    entity_id: weather.dudo_s_home

In the future, please share the details as text. Pictures, especially this one, are often very difficult to read. Also, please make sure to format YAML text correctly.

@SnakeByte is correct, you’ve specified the wrong entity for the illuminance sensor to use. You told it to look at weather.home, but your weather entity’s ID is actually weather.dodu_s_home (or, at least, I think that’s what it is. It’s very hard to read.)

So try:

  - platform: illuminance
    name: Estimated Illuminance
    entity_id: weather.dudo_s_home

That is just an example.

Close, but it would actually be:

    custom_components.illuminance.sensor: debug

Or even just:

    custom_components.illuminance: debug

Yep, that’s correct. Or, of course, weather.forcast_home (assuming that’s not a typo :wink: ) would work, too.

@dkovacic @SnakeByte just wondering if you got it working. Any issues still?

FYI, I’m in the process of creating a beta release that adds the following features:

  • Use a configurable fallback divider when weather data is not available from input entity.
  • Add support for cloud coverage percentage sensors.
  • Add support for Buienradar integration.
  • Use regular expressions when analyzing attribution attribute.
  • Handle unavailable & unknown states of input entity.

Released beta 3.1.0b0

This should support all the features mentioned above. If anyone gives it a try, please let me know that you have and how it works for you. Also, let me know if you have any questions.

I’ve partially updated the documentation, but to expand a bit on the new fallback option:

This integration basically does two things. First it calculates a “sunny illumination” value based on the time of day or the sun’s elevation, based on the chosen mode. Next, it determines a divisor value based on the input weather entity. This divisor ranges from 1 to 10. So, e.g., if it’s sunny, the divisor is 1, and if it’s really stormy, the divisor is 10, with other values between those based on the current conditions.

If the current weather condition cannot be determined (for any of a number of reasons), then it will use a fallback divisor, which you can configure. The default is 10, which means it assumes the weather is nasty. But you can pick whatever fallback divisor value makes sense for your scenario.

FWIW, the reason I chose 10 as the default is, I would think this integration is mostly used to determine when lights should be turned on. Therefore, if the weather condition isn’t currently available, it’s better to assume it’s nasty (i.e., dark), that way lights will either turn on, or stay on, which is good if it actually is dark, and shouldn’t matter if it isn’t, whereas it’s probably not good for lights to turn off when they shouldn’t.

Also, besides the original implementation of using some weather condition string (sunny, rainy, etc.), it can now use a sensor whose value represents cloud coverage as a percentage. It automatically determines what type of entity it is, so you don’t have to manually configure it. The algorithm I chose to use is divisor = 10 ** (percentage / 100). If anyone has a better idea, I’d be interested to hear it.

1 Like

@pnbruckner, it works now. Thanks!

1 Like

Hello everyone, I have installed ha-illuminance. But unfortunally i geht the same values every day. I also wonder where I must specify the open weathermap api and where I can change the configuration variables sorry I am absolute new in HA. Happy New Year, Michael :slight_smile:

Hi @Casem0d. Welcome to the HA Community!

If you haven’t already, check out HA’s documentation about configuration.yaml.

You need to set up some weather integration independently of the Illuminance custom integration. That should result in a weather related entity. You need to determine that entity’s ID (e.g., weather.home. But that is just an example. You need to determine the actual entity ID of that weather entity in your system. The easiest place to find that is on the STATES page, or at least the Entities page.)

Once you have that, then you can configure the Illuminance integration accordingly.

If you can provide more details about what you know and don’t know, I’m happy to help further.

Oh, and Happy New Year to you, too! :tada:

Released 3.2.0

  • Add unique IDs, which allows entities to be managed on UI Entities page.
  • Support HA versions 2021.12 and newer.
1 Like

Released 3.2.1

  • Improve HACS support.

UPDATE: This release is broken. It has been deleted. A new release (3.2.2) will replace it shortly.

Released 3.2.2

Fixes broken 3.2.1 release.

Released 4.0.0b0

Enhanced to support any entity whose state is from the standard list of conditions, or is a cloud coverage percentage. Note that a few weather integrations (AccuWeather, Dark Sky & ecobee) are slightly non-standard, but are still supported.

This is considered a BREAKING CHANGE since, for the previously supported weather integrations, the resulting illumination values may be slightly different from what they were before.

@pnbruckner Thanks for keeping this going - this is so useful. This really should get considered for mainline integration in the community repo at some point.

1 Like

Any feedback on the 4.0.0b0 release, good or bad? If not, I’ll go ahead and release it as 4.0.0.

1 Like

Released 4.0.0

per above

1 Like

Hey Phil. HA Devs have removed the darksky component from 2023.4.x and this component is now breaking and preventing HA from starting

No error messages at all? Are you using the latest version (4.0.0)?

EDIT: Hmm, I had an import not inside a try statement. I’ll try to get a fix out soon.