ESPHome  2024.11.2
ms8607.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace ms8607 {
9 
15  public:
16  uint8_t get_address() { return address_; }
17 };
18 
35  public:
36  virtual ~MS8607Component() = default;
37  void setup() override;
38  void update() override;
39  void dump_config() override;
40  float get_setup_priority() const override { return setup_priority::DATA; };
41 
42  void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
43  void set_pressure_sensor(sensor::Sensor *pressure_sensor) { pressure_sensor_ = pressure_sensor; }
44  void set_humidity_sensor(sensor::Sensor *humidity_sensor) { humidity_sensor_ = humidity_sensor; }
45  void set_humidity_device(MS8607HumidityDevice *humidity_device) { humidity_device_ = humidity_device; }
46 
47  protected:
52  bool read_calibration_values_from_prom_();
53 
55  void request_read_temperature_();
57  void read_temperature_();
59  void request_read_pressure_(uint32_t raw_temperature);
61  void read_pressure_(uint32_t raw_temperature);
63  void request_read_humidity_(float temperature_float);
65  void read_humidity_(float temperature_float);
67  void calculate_values_(uint32_t raw_temperature, uint32_t raw_pressure);
68 
72 
80 
88  uint16_t pressure_offset;
95  } calibration_values_;
96 
98  enum class ErrorCode;
101 
103  enum class SetupStatus;
106 };
107 
108 } // namespace ms8607
109 } // namespace esphome
void setup()
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
void set_humidity_device(MS8607HumidityDevice *humidity_device)
Definition: ms8607.h:45
uint16_t pressure_sensitivity_temperature_coefficient
Temperature coefficient of pressure sensitivity | TCS. [C3].
Definition: ms8607.h:86
Class for I2CDevice used to communicate with the Humidity sensor on the chip.
Definition: ms8607.h:14
uint16_t temperature_coefficient_of_temperature
Temperature coefficient of the temperature | TEMPSENS. [C6].
Definition: ms8607.h:94
This class simplifies creating components that periodically check a state.
Definition: component.h:283
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: ms8607.h:42
sensor::Sensor * pressure_sensor_
Definition: ms8607.h:70
ErrorCode error_code_
Keep track of the reason why this component failed, to augment the dumped config. ...
Definition: ms8607.h:98
uint16_t reference_temperature
Reference temperature | T-REF. [C5].
Definition: ms8607.h:92
uint16_t pressure_sensitivity
Pressure sensitivity | SENS-T1. [C1].
Definition: ms8607.h:84
This device's pressure & temperature calibration values, read from PROM.
Definition: ms8607.h:82
uint16_t pressure_offset
Pressure offset | OFF-T1. [C2].
Definition: ms8607.h:88
sensor::Sensor * temperature_sensor_
Definition: ms8607.h:69
sensor::Sensor * humidity_sensor_
Definition: ms8607.h:71
float get_setup_priority() const override
Definition: ms8607.h:40
void set_pressure_sensor(sensor::Sensor *pressure_sensor)
Definition: ms8607.h:43
uint8_t address_
store the address of the device on the bus
Definition: i2c.h:269
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
Definition: ms8607.h:44
SetupStatus setup_status_
Current step in the multi-step & possibly delayed setup() process.
Definition: ms8607.h:103
uint16_t pressure_offset_temperature_coefficient
Temperature coefficient of pressure offset | TCO. [C4].
Definition: ms8607.h:90
MS8607HumidityDevice * humidity_device_
I2CDevice object to communicate with secondary I2C address for the humidity sensor.
Definition: ms8607.h:79
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Temperature, pressure, and humidity sensor.
Definition: ms8607.h:34
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