ESPHome 2026.8.0-dev
Loading...
Searching...
No Matches
opt3001.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::opt3001 {
8
10class OPT3001Sensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
11 public:
12 void dump_config() override;
13 void update() override;
14
15 protected:
16 // checks if one-shot is complete before reading the result and returning it
17 void read_result_(const std::function<void(float)> &f);
18 // begins a one-shot measurement
19 void read_lx_(const std::function<void(float)> &f);
20
21 bool updating_{false};
22};
23
24} // namespace esphome::opt3001
This class simplifies creating components that periodically check a state.
Definition component.h:510
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
This class implements support for the i2c-based OPT3001 ambient light sensor.
Definition opt3001.h:10
void read_result_(const std::function< void(float)> &f)
Definition opt3001.cpp:32
void read_lx_(const std::function< void(float)> &f)
Definition opt3001.cpp:63
Base-class for all sensors.
Definition sensor.h:47