Estimates outdoor illuminance based on either sun elevation or time of day. In either case, the value is adjusted based on current weather conditions.
Two modes are available: normal & simple. The desired mode is selected via the configuration.
This mode uses an algorithm from the US Naval Observatory1 for estimating sun illuminance based on the sun's elevation (aka altitude.) The maximum value is about 150,000 lx. Below is an example of what that might look like over a three day period.
At night the value is 10 lx. From a little before sunrise to a little after the value is ramped up to whatever the current conditions indicate. The same happens around sunset, except the value is ramped down. The maximum value is 10,000 lx. Below is an example of what that might look like over a three day period.
The following sources of weather data are supported:
- Dark Sky Sensor (icon)
- Dark Sky Weather
- Meteorologisk institutt (Met.no)
- AccuWeather
- ecobee
- OpenWeatherMap
Follow the installation instructions below. Then add the desired configuration. Here is an example of a typical configuration:
sensor:
- platform: illuminance
entity_id: weather.home
Place a copy of:
__init__.py
at <config>/custom_components/illuminance/__init__.py
sensor.py
at <config>/custom_components/illuminance/sensor.py
manifest.json
at <config>/custom_components/illuminance/manifest.json
where <config>
is your Home Assistant configuration directory.
NOTE: Do not download the file by using the link above directly. Rather, click on it, then on the page that comes up use the
Raw
button.
You can use HACS to manage installation and updates by adding this repo as a custom repository and then searching for and installing the "Illuminance" integration.
- entity_id: Entity ID of entity that indicates current weather conditions. See examples below.
- mode (Optional): Mode of operation. Choices are
normal
(default) which uses sun elevation, andsimple
which uses time of day. - name (Optional): Name of the sensor. Default is
Illuminance
. - scan_interval (Optional): Update interval. Minimum is 5 minutes. Default is 5 minutes.
sensor:
- platform: darksky
api_key: !secret ds_api_key
monitored_conditions:
- icon
- platform: illuminance
name: DSS Illuminance
entity_id: sensor.dark_sky_icon
weather:
- platform: darksky
api_key: !secret ds_api_key
sensor:
- platform: illuminance
name: DSW Illuminance
entity_id: weather.dark_sky
sensor:
- platform: illuminance
name: Estimated Illuminance
entity_id: weather.home
sensor:
- platform: illuminance
name: Estimated Illuminance
entity_id: weather.openweathermap
See https://github.com/pnbruckner/homeassistant-config/blob/master/docs/illuminance.md.
Footnotes
-
Janiczek, P. M., and DeYoung, J. A. Computer Programs for Sun and Moon Illuminance With Contingent Tables and Diagrams. Circular No. 171. Washington, D. C.: United States Naval Observatory, 1987 Google Scholar ↩