Skip to content

Latest commit

 

History

History
100 lines (89 loc) · 5.18 KB

illuminance.md

File metadata and controls

100 lines (89 loc) · 5.18 KB

Illuminance Sensor

OUT OF DATE
See https://github.com/pnbruckner/ha-illuminance for newer versions.

Estimates outdoor illuminance based on current weather conditions and time of day. At night the value is 10. 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. Below is an example of what that might look like over a three day period.

The following sources of weather data are supported:

Installation

See Installing and Updating to use Custom Updater. The name of this "element" is "sensor.illuminance".

Alternatively, place a copy of:

illuminance/__init__.py at <config>/custom_components/illuminance/__init__.py
illuminance/sensor.py at <config>/custom_components/illuminance/sensor.py
illuminance/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.

Then add the desired configuration. Here is an example of a typical configuration:

sensor:
  - platform: illuminance
    entity_id: sensor.yr_symbol

Home Assistant before 0.86

For manual installation, place a copy of:

illuminance/sensor.py at <config>/custom_components/sensor/illuminance.py

Configuration variables

  • api_key: Weather Underground API key. Required when using WU.
  • entity_id: Entity ID of Dark Sky or YR entity. See examples below. Required when using Dark Sky or YR.
  • name (Optional): Name of the sensor. Default is Illuminance.
  • scan_interval (Optional): Polling interval. For non-WU configs only applies during ramp up period around sunrise and ramp down period around sunset. Minimum is 5 minutes. Default is 5 minutes.
  • query: Weather Underground query. See https://www.wunderground.com/weather/api/d/docs?d=data/index. Required when using WU.

Examples

Dark Sky Sensor

sensor:
  - platform: darksky
    api_key: !secret ds_api_key
    monitored_conditions:
      - icon
  - platform: illuminance
    name: DSS Illuminance
    entity_id: sensor.dark_sky_icon

Dark Sky Weather

weather:
  - platform: darksky
    api_key: !secret ds_api_key
sensor:
  - platform: illuminance
    name: DSW Illuminance
    entity_id: weather.dark_sky

YR Sensor

sensor:
  - platform: yr
    monitored_conditions:
      - symbol
  - platform: illuminance
    name: YRS Illuminance
    entity_id: sensor.yr_symbol

Weather Underground

sensor:
  - platform: illuminance
    name: WU Illuminance
    api_key: !secret wu_api_key
    query: !secret wu_query
    scan_interval:
      minutes: 30

Caveats

Weather Underground no long provides free API keys. In fact, as of this writing they have notified that the REST API will be discontinued.

Release Notes

Date Version Notes
20180907 1.0.0 Initial support for Custom Updater.
20181028 2.0.0 Add support for using Dark Sky or YR entity as source of weather conditions. For WU, no longer get sunrise/sunset data from the server, just use HA’s sun data.
20190111 2.0.1 Adapt to change in Dark Sky Sensor in HA 0.85 release (see PR #19492.)
20190307 2.0.2 Adapt to change in Yr Sensor in HA 0.89 release (see PR #21069.)
20190406 2.0.3 Adapt to last pieces of Great Migration in HA 0.91 release.
20190419 2.0.4 Add manifest.json required by 0.92.
20190419 2.0.5 ... and apparently custom_updater needs an __init__.py file, too.