mirror of
https://github.com/esphome/esphome.git
synced 2024-12-26 15:34:53 +01:00
Initialize all child sensors to nullptr (#3808)
This commit is contained in:
parent
78b55d86e9
commit
0ac4c055de
27 changed files with 93 additions and 93 deletions
|
@ -18,8 +18,8 @@ class AHT10Component : public PollingComponent, public i2c::I2CDevice {
|
|||
void set_humidity_sensor(sensor::Sensor *humidity_sensor) { humidity_sensor_ = humidity_sensor; }
|
||||
|
||||
protected:
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace aht10
|
||||
|
|
|
@ -21,8 +21,8 @@ class AM2320Component : public PollingComponent, public i2c::I2CDevice {
|
|||
bool read_data_(uint8_t *data);
|
||||
bool read_bytes_(uint8_t a_register, uint8_t *data, uint8_t len, uint32_t conversion = 0);
|
||||
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace am2320
|
||||
|
|
|
@ -92,9 +92,9 @@ class AS3935Component : public Component {
|
|||
|
||||
virtual void write_register(uint8_t reg, uint8_t mask, uint8_t bits, uint8_t start_position) = 0;
|
||||
|
||||
sensor::Sensor *distance_sensor_;
|
||||
sensor::Sensor *energy_sensor_;
|
||||
binary_sensor::BinarySensor *thunder_alert_binary_sensor_;
|
||||
sensor::Sensor *distance_sensor_{nullptr};
|
||||
sensor::Sensor *energy_sensor_{nullptr};
|
||||
binary_sensor::BinarySensor *thunder_alert_binary_sensor_{nullptr};
|
||||
GPIOPin *irq_pin_;
|
||||
|
||||
bool indoor_;
|
||||
|
|
|
@ -75,16 +75,16 @@ class BL0939 : public PollingComponent, public uart::UARTDevice {
|
|||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_1_;
|
||||
sensor::Sensor *current_sensor_2_;
|
||||
sensor::Sensor *voltage_sensor_{nullptr};
|
||||
sensor::Sensor *current_sensor_1_{nullptr};
|
||||
sensor::Sensor *current_sensor_2_{nullptr};
|
||||
// NB This may be negative as the circuits is seemingly able to measure
|
||||
// power in both directions
|
||||
sensor::Sensor *power_sensor_1_;
|
||||
sensor::Sensor *power_sensor_2_;
|
||||
sensor::Sensor *energy_sensor_1_;
|
||||
sensor::Sensor *energy_sensor_2_;
|
||||
sensor::Sensor *energy_sensor_sum_;
|
||||
sensor::Sensor *power_sensor_1_{nullptr};
|
||||
sensor::Sensor *power_sensor_2_{nullptr};
|
||||
sensor::Sensor *energy_sensor_1_{nullptr};
|
||||
sensor::Sensor *energy_sensor_2_{nullptr};
|
||||
sensor::Sensor *energy_sensor_sum_{nullptr};
|
||||
|
||||
// Divide by this to turn into Watt
|
||||
float power_reference_ = BL0939_PREF;
|
||||
|
|
|
@ -75,14 +75,14 @@ class BL0940 : public PollingComponent, public uart::UARTDevice {
|
|||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_;
|
||||
sensor::Sensor *voltage_sensor_{nullptr};
|
||||
sensor::Sensor *current_sensor_{nullptr};
|
||||
// NB This may be negative as the circuits is seemingly able to measure
|
||||
// power in both directions
|
||||
sensor::Sensor *power_sensor_;
|
||||
sensor::Sensor *energy_sensor_;
|
||||
sensor::Sensor *internal_temperature_sensor_;
|
||||
sensor::Sensor *external_temperature_sensor_;
|
||||
sensor::Sensor *power_sensor_{nullptr};
|
||||
sensor::Sensor *energy_sensor_{nullptr};
|
||||
sensor::Sensor *internal_temperature_sensor_{nullptr};
|
||||
sensor::Sensor *external_temperature_sensor_{nullptr};
|
||||
|
||||
// Max difference between two measurements of the temperature. Used to avoid noise.
|
||||
float max_temperature_diff_{0};
|
||||
|
|
|
@ -43,13 +43,13 @@ class BL0942 : public PollingComponent, public uart::UARTDevice {
|
|||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_;
|
||||
sensor::Sensor *voltage_sensor_{nullptr};
|
||||
sensor::Sensor *current_sensor_{nullptr};
|
||||
// NB This may be negative as the circuits is seemingly able to measure
|
||||
// power in both directions
|
||||
sensor::Sensor *power_sensor_;
|
||||
sensor::Sensor *energy_sensor_;
|
||||
sensor::Sensor *frequency_sensor_;
|
||||
sensor::Sensor *power_sensor_{nullptr};
|
||||
sensor::Sensor *energy_sensor_{nullptr};
|
||||
sensor::Sensor *frequency_sensor_{nullptr};
|
||||
|
||||
// Divide by this to turn into Watt
|
||||
float power_reference_ = BL0942_PREF;
|
||||
|
|
|
@ -96,9 +96,9 @@ class BME280Component : public PollingComponent, public i2c::I2CDevice {
|
|||
BME280Oversampling pressure_oversampling_{BME280_OVERSAMPLING_16X};
|
||||
BME280Oversampling humidity_oversampling_{BME280_OVERSAMPLING_16X};
|
||||
BME280IIRFilter iir_filter_{BME280_IIR_FILTER_OFF};
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
enum ErrorCode {
|
||||
NONE = 0,
|
||||
COMMUNICATION_FAILED,
|
||||
|
|
|
@ -129,10 +129,10 @@ class BME680Component : public PollingComponent, public i2c::I2CDevice {
|
|||
uint16_t heater_temperature_{320};
|
||||
uint16_t heater_duration_{150};
|
||||
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *gas_resistance_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
sensor::Sensor *gas_resistance_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace bme680
|
||||
|
|
|
@ -100,15 +100,15 @@ class BME680BSECComponent : public Component, public i2c::I2CDevice {
|
|||
SampleRate pressure_sample_rate_{SAMPLE_RATE_DEFAULT};
|
||||
SampleRate humidity_sample_rate_{SAMPLE_RATE_DEFAULT};
|
||||
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *gas_resistance_sensor_;
|
||||
sensor::Sensor *iaq_sensor_;
|
||||
text_sensor::TextSensor *iaq_accuracy_text_sensor_;
|
||||
sensor::Sensor *iaq_accuracy_sensor_;
|
||||
sensor::Sensor *co2_equivalent_sensor_;
|
||||
sensor::Sensor *breath_voc_equivalent_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
sensor::Sensor *gas_resistance_sensor_{nullptr};
|
||||
sensor::Sensor *iaq_sensor_{nullptr};
|
||||
text_sensor::TextSensor *iaq_accuracy_text_sensor_{nullptr};
|
||||
sensor::Sensor *iaq_accuracy_sensor_{nullptr};
|
||||
sensor::Sensor *co2_equivalent_sensor_{nullptr};
|
||||
sensor::Sensor *breath_voc_equivalent_sensor_{nullptr};
|
||||
};
|
||||
#endif
|
||||
} // namespace bme680_bsec
|
||||
|
|
|
@ -81,8 +81,8 @@ class BMP280Component : public PollingComponent, public i2c::I2CDevice {
|
|||
BMP280Oversampling temperature_oversampling_{BMP280_OVERSAMPLING_16X};
|
||||
BMP280Oversampling pressure_oversampling_{BMP280_OVERSAMPLING_16X};
|
||||
BMP280IIRFilter iir_filter_{BMP280_IIR_FILTER_OFF};
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
enum ErrorCode {
|
||||
NONE = 0,
|
||||
COMMUNICATION_FAILED,
|
||||
|
|
|
@ -125,8 +125,8 @@ class BMP3XXComponent : public PollingComponent, public i2c::I2CDevice {
|
|||
Oversampling pressure_oversampling_{OVERSAMPLING_X16};
|
||||
IIRFilter iir_filter_{IIR_FILTER_OFF};
|
||||
OperationMode operation_mode_{FORCED_MODE};
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
enum ErrorCode {
|
||||
NONE = 0,
|
||||
ERROR_COMMUNICATION_FAILED,
|
||||
|
|
|
@ -20,8 +20,8 @@ class DHT12Component : public PollingComponent, public i2c::I2CDevice {
|
|||
protected:
|
||||
bool read_data_(uint8_t *data);
|
||||
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace dht12
|
||||
|
|
|
@ -53,8 +53,8 @@ class DPS310Component : public PollingComponent, public i2c::I2CDevice {
|
|||
void calculate_values_(int32_t raw_temperature, int32_t raw_pressure);
|
||||
static int32_t twos_complement(int32_t val, uint8_t bits);
|
||||
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
int32_t raw_pressure_, raw_temperature_, c00_, c10_;
|
||||
int16_t c0_, c1_, c01_, c11_, c20_, c21_, c30_;
|
||||
uint8_t prod_rev_id_;
|
||||
|
|
|
@ -31,8 +31,8 @@ class ENS210Component : public PollingComponent, public i2c::I2CDevice {
|
|||
bool set_low_power_(bool enable);
|
||||
void extract_measurement_(uint32_t val, int *data, int *status);
|
||||
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace ens210
|
||||
|
|
|
@ -21,8 +21,8 @@ class HDC1080Component : public PollingComponent, public i2c::I2CDevice {
|
|||
float get_setup_priority() const override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *temperature_;
|
||||
sensor::Sensor *humidity_;
|
||||
sensor::Sensor *temperature_{nullptr};
|
||||
sensor::Sensor *humidity_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace hdc1080
|
||||
|
|
|
@ -54,10 +54,10 @@ class HMC5883LComponent : public PollingComponent, public i2c::I2CDevice {
|
|||
HMC5883LOversampling oversampling_{HMC5883L_OVERSAMPLING_1};
|
||||
HMC5883LDatarate datarate_{HMC5883L_DATARATE_15_0_HZ};
|
||||
HMC5883LRange range_{HMC5883L_RANGE_130_UT};
|
||||
sensor::Sensor *x_sensor_;
|
||||
sensor::Sensor *y_sensor_;
|
||||
sensor::Sensor *z_sensor_;
|
||||
sensor::Sensor *heading_sensor_;
|
||||
sensor::Sensor *x_sensor_{nullptr};
|
||||
sensor::Sensor *y_sensor_{nullptr};
|
||||
sensor::Sensor *z_sensor_{nullptr};
|
||||
sensor::Sensor *heading_sensor_{nullptr};
|
||||
enum ErrorCode {
|
||||
NONE = 0,
|
||||
COMMUNICATION_FAILED,
|
||||
|
|
|
@ -29,8 +29,8 @@ class HONEYWELLABPSensor : public PollingComponent,
|
|||
uint8_t status_ = 0; // byte to hold status information.
|
||||
int pressure_count_ = 0; // hold raw pressure data (14 - bit, 0 - 16384)
|
||||
int temperature_count_ = 0; // hold raw temperature data (11 - bit, 0 - 2048)
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
uint8_t readsensor_();
|
||||
uint8_t readstatus_();
|
||||
int rawpressure_();
|
||||
|
|
|
@ -22,8 +22,8 @@ class MS5611Component : public PollingComponent, public i2c::I2CDevice {
|
|||
void read_pressure_(uint32_t raw_temperature);
|
||||
void calculate_values_(uint32_t raw_temperature, uint32_t raw_pressure);
|
||||
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
uint16_t prom_[6];
|
||||
};
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ class PZEM004T : public PollingComponent, public uart::UARTDevice {
|
|||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_;
|
||||
sensor::Sensor *power_sensor_;
|
||||
sensor::Sensor *energy_sensor_;
|
||||
sensor::Sensor *voltage_sensor_{nullptr};
|
||||
sensor::Sensor *current_sensor_{nullptr};
|
||||
sensor::Sensor *power_sensor_{nullptr};
|
||||
sensor::Sensor *energy_sensor_{nullptr};
|
||||
|
||||
enum PZEM004TReadState {
|
||||
SET_ADDRESS = 0xB4,
|
||||
|
|
|
@ -27,12 +27,12 @@ class PZEMAC : public PollingComponent, public modbus::ModbusDevice {
|
|||
|
||||
protected:
|
||||
template<typename... Ts> friend class ResetEnergyAction;
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_;
|
||||
sensor::Sensor *power_sensor_;
|
||||
sensor::Sensor *energy_sensor_;
|
||||
sensor::Sensor *frequency_sensor_;
|
||||
sensor::Sensor *power_factor_sensor_;
|
||||
sensor::Sensor *voltage_sensor_{nullptr};
|
||||
sensor::Sensor *current_sensor_{nullptr};
|
||||
sensor::Sensor *power_sensor_{nullptr};
|
||||
sensor::Sensor *energy_sensor_{nullptr};
|
||||
sensor::Sensor *frequency_sensor_{nullptr};
|
||||
sensor::Sensor *power_factor_sensor_{nullptr};
|
||||
|
||||
void reset_energy_();
|
||||
};
|
||||
|
|
|
@ -22,11 +22,11 @@ class PZEMDC : public PollingComponent, public modbus::ModbusDevice {
|
|||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_;
|
||||
sensor::Sensor *power_sensor_;
|
||||
sensor::Sensor *frequency_sensor_;
|
||||
sensor::Sensor *power_factor_sensor_;
|
||||
sensor::Sensor *voltage_sensor_{nullptr};
|
||||
sensor::Sensor *current_sensor_{nullptr};
|
||||
sensor::Sensor *power_sensor_{nullptr};
|
||||
sensor::Sensor *frequency_sensor_{nullptr};
|
||||
sensor::Sensor *power_factor_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace pzemdc
|
||||
|
|
|
@ -45,10 +45,10 @@ class QMC5883LComponent : public PollingComponent, public i2c::I2CDevice {
|
|||
QMC5883LDatarate datarate_{QMC5883L_DATARATE_10_HZ};
|
||||
QMC5883LRange range_{QMC5883L_RANGE_200_UT};
|
||||
QMC5883LOversampling oversampling_{QMC5883L_SAMPLING_512};
|
||||
sensor::Sensor *x_sensor_;
|
||||
sensor::Sensor *y_sensor_;
|
||||
sensor::Sensor *z_sensor_;
|
||||
sensor::Sensor *heading_sensor_;
|
||||
sensor::Sensor *x_sensor_{nullptr};
|
||||
sensor::Sensor *y_sensor_{nullptr};
|
||||
sensor::Sensor *z_sensor_{nullptr};
|
||||
sensor::Sensor *heading_sensor_{nullptr};
|
||||
enum ErrorCode {
|
||||
NONE = 0,
|
||||
COMMUNICATION_FAILED,
|
||||
|
|
|
@ -91,8 +91,8 @@ class QMP6988Component : public PollingComponent, public i2c::I2CDevice {
|
|||
|
||||
protected:
|
||||
qmp6988_data_t qmp6988_data_;
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *pressure_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *pressure_sensor_{nullptr};
|
||||
|
||||
QMP6988Oversampling temperature_oversampling_{QMP6988_OVERSAMPLING_16X};
|
||||
QMP6988Oversampling pressure_oversampling_{QMP6988_OVERSAMPLING_16X};
|
||||
|
|
|
@ -19,8 +19,8 @@ class SHT3XDComponent : public PollingComponent, public sensirion_common::Sensir
|
|||
void update() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace sht3xd
|
||||
|
|
|
@ -26,8 +26,8 @@ class SHTCXComponent : public PollingComponent, public sensirion_common::Sensiri
|
|||
protected:
|
||||
SHTCXType type_;
|
||||
uint16_t sensor_id_;
|
||||
sensor::Sensor *temperature_sensor_;
|
||||
sensor::Sensor *humidity_sensor_;
|
||||
sensor::Sensor *temperature_sensor_{nullptr};
|
||||
sensor::Sensor *humidity_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace shtcx
|
||||
|
|
|
@ -245,10 +245,10 @@ class TSL2591Component : public PollingComponent, public i2c::I2CDevice {
|
|||
|
||||
protected:
|
||||
const char *name_;
|
||||
sensor::Sensor *full_spectrum_sensor_;
|
||||
sensor::Sensor *infrared_sensor_;
|
||||
sensor::Sensor *visible_sensor_;
|
||||
sensor::Sensor *calculated_lux_sensor_;
|
||||
sensor::Sensor *full_spectrum_sensor_{nullptr};
|
||||
sensor::Sensor *infrared_sensor_{nullptr};
|
||||
sensor::Sensor *visible_sensor_{nullptr};
|
||||
sensor::Sensor *calculated_lux_sensor_{nullptr};
|
||||
TSL2591IntegrationTime integration_time_;
|
||||
TSL2591ComponentGain component_gain_;
|
||||
TSL2591Gain gain_;
|
||||
|
|
|
@ -43,8 +43,8 @@ class Tx20Component : public Component {
|
|||
|
||||
std::string wind_cardinal_direction_;
|
||||
InternalGPIOPin *pin_;
|
||||
sensor::Sensor *wind_speed_sensor_;
|
||||
sensor::Sensor *wind_direction_degrees_sensor_;
|
||||
sensor::Sensor *wind_speed_sensor_{nullptr};
|
||||
sensor::Sensor *wind_direction_degrees_sensor_{nullptr};
|
||||
Tx20ComponentStore store_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue