Outdoor illuminance estimated from weather conditions

That’s a shame.

What weather platform would you like to use with this? FYI, based on some other input I’ve received I’m currently working on adding support for AccuWeather & ecobee (which is pretty much done.)

Released 2.3.0 which adds support for AccuWeather & ecobee.

BOM - there is a new custom component. https://github.com/bremor/bureau_of_meteorology
Dunno if you can add it?

Is there an algorithm I could use to calculate this via template sensors?

Funny you should ask…

2 Likes

This is exactly what I was about to look into for my next HA enhancement. Thank you for saving me hours of scripting/testing/failing/repeating!

Would you consider making the brightness and color temp sensors a separate thread. Like Outdoor illuminance template sensor? I would follow that diligently and hopefully add to it when I’m done deciphering your jinja :slight_smile:

Sorry just seen this. I’ll do a write up of my dynamic lighting control soon and post a link to the topic here. Thanks for the interest.

There is a HACS addon called adaptive lighting that may be of interest to you and others. It seems to do everything my templates and automations do, although I haven’t looked too deeply into myself.

1 Like

Released 2.3.1

Adds version and issue_tracker to manifest.json per new custom integration requirements.

Released 2.4.0

Add support for OpenWeatherMap

I am using this now for a few days (with OpenWeatherMap in onecall_daily mode). However, it just ramps up to 1000 (not 10000 as your example), stays there the whole day and then down to 10, no matter what the weather was.
I don’t think this is the right behaviour, can you confirm this?

What has your weather.home been reporting as the state? It is working as expected with met.no. What is onecall_daily mode?

Currently it reports as cloudy.
You can see the onecall_daily mode over here: https://www.home-assistant.io/integrations/openweathermap/

I currently also set one with the weather.home, but it shows a different value (2500). I will check how this works…

That, of course, is your problem. You’re only getting the current weather once a day. How do you expect it to change throughout the day if the day’s forecast is static through the entire day?

I’ve tested it with OpenWeatherMap in onecall_hourly mode and it works for me as expected.

I’m testing out OWM at the moment, and came across this thread. Thought I could offer at least a different set of data points.

@pnbruckner -
I have got both onecall_hourly and onecall_daily at the moment, and turns out both feeds would get you the same graph over time.
This is what I have over last 60 hours. Same plot for both OWM feeds:
image

image
From what I can tell, onecall_daily is not something that updates only once a day, but something that offers you a different data set (specifically, forecast over next few days, versus forecast over next few hours you would get via onecall_hourly.)

So, what I’m trying to say is that the issue @rednas is seeing might be something else.

Released 3.0.0

  • Use an algorithm from the US Naval Observatory for estimating sun illuminance based on the sun’s elevation (aka altitude.)
  • Add a new configuration item - mode - that selects this new algorithm (normal, default), or the previous one (simple.)
  • Remove support for Weather Underground & YR.

Breaking Change

The new algorithm will be used by default. To use the previous algorithm, add the mode option to your configuration. E.g.:

sensor:
  - platform: illuminance
    entity_id: weather.home
    mode: simple

I installed this via HACS and added the sensor on the configuration.yaml but i get unknow as state from the sensor. I only added this to config because i use met.no:

  • platform: illuminance
    name: Outside Illuminance
    entity_id: weather.home

Do you see any error messages in the log? Can you search home-assistant.log for any messages containing “illuminance” (besides error messages there should also be some info messages that might help)? What is the state of weather.home? (I.e., go to the STATES tab on the Developer Tools page and click on weather.home; what do you see at the top of the page for its state & attributes?

update: Hmm, I just tried it myself and got this error:

2022-06-14 12:40:22 ERROR (MainThread) [custom_components.illuminance.sensor] Illuminance - Met.no: Unsupported sensor: weather.home, attribution: Weather forecast from met.no, delivered by the Norwegian Meteorological Institute.

Let me figure out what’s wrong. Could be the attribution has changed or something…

Ok, I think I remember now why this is happening…

The illuminance integration tries to import the attribution strings from the various weather integrations it supports. However, those imports will fail if those integrations haven’t been used yet, since they depend on pypi.org packages that aren’t installed until the integration is used. So, e.g., if you haven’t used Met.no yet, pyMetno will not have been installed, which will cause the import of Met.no’s attribution string to fail.

Bottom line, restart HA and all should be good.

I have restarted a few times an doesnt change the status

Have you checked weather.home on the STATES tab of the Developer Tools page? Is it there? Is the entity ID extactly weather.home? Do you see any errors in the log, or any other illuminance messages in home-assistant.log?

OMG you are right, my entity id for weather home has different name, such a stupid mistake. Thanks for helping with my blindless.

1 Like