MAX44009 Ambient Light Sensor
=============================

.. seo::
    :description: Instructions for setting up MAX44009 ambient light sensors in ESPHome.
    :image: max44009.svg
    :keywords: MAX44009

The ``max44009`` sensor platform allows you to use your MAX44009
(`datasheet <https://datasheets.maximintegrated.com/en/ds/MAX44009.pdf>`__)
ambient light sensor with ESPHome. This sensor features an ultra-wide 22-bit dynamic range 
from 0.045 lux to 188,000 lux. The :ref:`I²C bus <i2c>` is required to be set up in your 
configuration for this sensor to work.

The ``max44009`` sensor can operate in two modes: ``low_power`` (default) and ``continuous``:

- In ``low_power`` mode, the sensor measures lux intensity only once every 800ms regardless of integration time.
  This mode allows the part to operate at its lowest possible supply current.

- In ``continuous`` mode, the sensor continuously measures lux intensity. That is, as soon as one reading is finished, a
  new one begins. If integration time is 6.25ms, readings are taken every 6.25ms. If integration time is 800ms,
  readings are taken every 800ms. In this mode, the part consumes slightly higher power than in the ``low_power``
  mode.

- Additionally mode can be set to ``auto``. In this mode, the mode will be chosen according to the ``update_interval``
  value. If ``update_interval < 800``, ``continuous`` mode will be selected. Otherwise, ``low_power`` mode will be selected.

Configuration variables:
------------------------

- **name** (**Required**, string): The name for the sensor.
- **address** (*Optional*, int): Manually specify the I²C address of the sensor. Defaults to ``0x4A``.
- **mode** (*Optional*, string): Measurement mode. One of ``auto``, ``low_power``, ``continuous``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
  sensor. Defaults to ``60s``.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>`.

See Also
--------

- :ref:`sensor-filters`
- :doc:`bh1750`
- `MAX44009 Library <https://github.com/RobTillaart/Max44009>`__ by `@RobTillaart <https://github.com/RobTillaart>`__
- :ghedit:`Edit`
