esphome-docs/api/sensor/tsl2561.rst
2018-05-16 20:02:48 +02:00

43 lines
1.2 KiB
ReStructuredText

TSL2561 Ambient Light Sensor
============================
.. warning::
This sensor is experimental has not been tested yet. If you can verify it works (or if it doesn't),
notify me on `discord <https://discord.gg/KhAMKrd>`__.
The TSL2561 sensor allows you to use your TSL2561 i2c-enabled ambient light sensor with
esphomelib (`datasheet <https://cdn-shop.adafruit.com/datasheets/TSL2561.pdf>`__,
`Adafruit <https://www.adafruit.com/product/439>`__). It requires i2c to be setup to work.
Example Usage
-------------
.. code-block:: cpp
// Basic
auto tsl2561 = App.make_tsl2561_sensor("TSL2561 Illuminance Sensor");
// Advanced settings
// set the time the sensor will take for value accumulation, default: 402 ms
tsl2561.tsl2561->set_integration_time(sensor::TSL2561_INTEGRATION_14MS);
// set a higher gain for low light conditions, default: 1x
tsl2561.tsl2561->set_gain(sensor::TSL2561_GAIN_16X);
.. cpp:namespace:: nullptr
See :cpp:func:`Application::make_tsl2561_sensor`.
API Reference
-------------
.. cpp:namespace:: nullptr
.. doxygenclass:: sensor::TSL2561Sensor
:members:
:protected-members:
:undoc-members:
.. doxygenenum:: sensor::TSL2561IntegrationTime
.. doxygenenum:: sensor::TSL2561Gain