ESPHome  2024.3.2
sen0321.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 // ref:
8 // https://github.com/DFRobot/DFRobot_OzoneSensor
9 
10 namespace esphome {
11 namespace sen0321_sensor {
12 // Sensor Mode
13 // While passive is supposedly supported, it does not appear to work reliably.
14 static const uint8_t SENSOR_MODE_REGISTER = 0x03;
15 static const uint8_t SENSOR_MODE_AUTO = 0x00;
16 static const uint8_t SENSOR_MODE_PASSIVE = 0x01;
17 static const uint8_t SET_REGISTER = 0x04;
18 
19 // Each register is 2 wide, so 0x07-0x08 for passive, or 0x09-0x0A for auto
20 // First register is high bits, next low.
21 static const uint8_t SENSOR_PASS_READ_REG = 0x07;
22 static const uint8_t SENSOR_AUTO_READ_REG = 0x09;
23 
25  public:
26  void update() override;
27  void dump_config() override;
28  void setup() override;
29 
30  protected:
31  void read_data_();
32 };
33 
34 } // namespace sen0321_sensor
35 } // namespace esphome
This class simplifies creating components that periodically check a state.
Definition: component.h:283
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133