From 0ac4c055de90030d35d9fab704db06ee473da30c Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 15 Sep 2022 11:53:22 +1200 Subject: [PATCH] Initialize all child sensors to nullptr (#3808) --- esphome/components/aht10/aht10.h | 4 ++-- esphome/components/am2320/am2320.h | 4 ++-- esphome/components/as3935/as3935.h | 6 +++--- esphome/components/bl0939/bl0939.h | 16 ++++++++-------- esphome/components/bl0940/bl0940.h | 12 ++++++------ esphome/components/bl0942/bl0942.h | 10 +++++----- esphome/components/bme280/bme280.h | 6 +++--- esphome/components/bme680/bme680.h | 8 ++++---- esphome/components/bme680_bsec/bme680_bsec.h | 18 +++++++++--------- esphome/components/bmp280/bmp280.h | 4 ++-- esphome/components/bmp3xx/bmp3xx.h | 4 ++-- esphome/components/dht12/dht12.h | 4 ++-- esphome/components/dps310/dps310.h | 4 ++-- esphome/components/ens210/ens210.h | 4 ++-- esphome/components/hdc1080/hdc1080.h | 4 ++-- esphome/components/hmc5883l/hmc5883l.h | 8 ++++---- esphome/components/honeywellabp/honeywellabp.h | 4 ++-- esphome/components/ms5611/ms5611.h | 4 ++-- esphome/components/pzem004t/pzem004t.h | 8 ++++---- esphome/components/pzemac/pzemac.h | 12 ++++++------ esphome/components/pzemdc/pzemdc.h | 10 +++++----- esphome/components/qmc5883l/qmc5883l.h | 8 ++++---- esphome/components/qmp6988/qmp6988.h | 4 ++-- esphome/components/sht3xd/sht3xd.h | 4 ++-- esphome/components/shtcx/shtcx.h | 4 ++-- esphome/components/tsl2591/tsl2591.h | 8 ++++---- esphome/components/tx20/tx20.h | 4 ++-- 27 files changed, 93 insertions(+), 93 deletions(-) diff --git a/esphome/components/aht10/aht10.h b/esphome/components/aht10/aht10.h index bfb6b07a7a..4d0eaa5919 100644 --- a/esphome/components/aht10/aht10.h +++ b/esphome/components/aht10/aht10.h @@ -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 diff --git a/esphome/components/am2320/am2320.h b/esphome/components/am2320/am2320.h index 33e1d30aa0..da1e87cf65 100644 --- a/esphome/components/am2320/am2320.h +++ b/esphome/components/am2320/am2320.h @@ -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 diff --git a/esphome/components/as3935/as3935.h b/esphome/components/as3935/as3935.h index 2e65aab4d1..2cba9b11a0 100644 --- a/esphome/components/as3935/as3935.h +++ b/esphome/components/as3935/as3935.h @@ -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_; diff --git a/esphome/components/bl0939/bl0939.h b/esphome/components/bl0939/bl0939.h index d3dab67cc1..673d4ff351 100644 --- a/esphome/components/bl0939/bl0939.h +++ b/esphome/components/bl0939/bl0939.h @@ -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; diff --git a/esphome/components/bl0940/bl0940.h b/esphome/components/bl0940/bl0940.h index 49c8e50595..2d4e7ccaac 100644 --- a/esphome/components/bl0940/bl0940.h +++ b/esphome/components/bl0940/bl0940.h @@ -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}; diff --git a/esphome/components/bl0942/bl0942.h b/esphome/components/bl0942/bl0942.h index 8149b7493b..12489915e1 100644 --- a/esphome/components/bl0942/bl0942.h +++ b/esphome/components/bl0942/bl0942.h @@ -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; diff --git a/esphome/components/bme280/bme280.h b/esphome/components/bme280/bme280.h index 8511f73382..50d398c40f 100644 --- a/esphome/components/bme280/bme280.h +++ b/esphome/components/bme280/bme280.h @@ -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, diff --git a/esphome/components/bme680/bme680.h b/esphome/components/bme680/bme680.h index 0671cd990e..6446449742 100644 --- a/esphome/components/bme680/bme680.h +++ b/esphome/components/bme680/bme680.h @@ -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 diff --git a/esphome/components/bme680_bsec/bme680_bsec.h b/esphome/components/bme680_bsec/bme680_bsec.h index 650b4d2413..6fe8f8fef7 100644 --- a/esphome/components/bme680_bsec/bme680_bsec.h +++ b/esphome/components/bme680_bsec/bme680_bsec.h @@ -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 diff --git a/esphome/components/bmp280/bmp280.h b/esphome/components/bmp280/bmp280.h index f8646fb547..96eb470155 100644 --- a/esphome/components/bmp280/bmp280.h +++ b/esphome/components/bmp280/bmp280.h @@ -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, diff --git a/esphome/components/bmp3xx/bmp3xx.h b/esphome/components/bmp3xx/bmp3xx.h index ab20abfe9b..d3b15f601d 100644 --- a/esphome/components/bmp3xx/bmp3xx.h +++ b/esphome/components/bmp3xx/bmp3xx.h @@ -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, diff --git a/esphome/components/dht12/dht12.h b/esphome/components/dht12/dht12.h index ae4d4fd607..2a706039ba 100644 --- a/esphome/components/dht12/dht12.h +++ b/esphome/components/dht12/dht12.h @@ -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 diff --git a/esphome/components/dps310/dps310.h b/esphome/components/dps310/dps310.h index 7aca2c3d10..50e7d93c8a 100644 --- a/esphome/components/dps310/dps310.h +++ b/esphome/components/dps310/dps310.h @@ -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_; diff --git a/esphome/components/ens210/ens210.h b/esphome/components/ens210/ens210.h index 342be04799..0fb6ff634d 100644 --- a/esphome/components/ens210/ens210.h +++ b/esphome/components/ens210/ens210.h @@ -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 diff --git a/esphome/components/hdc1080/hdc1080.h b/esphome/components/hdc1080/hdc1080.h index 9cb87cdb8b..2ff7b6dc33 100644 --- a/esphome/components/hdc1080/hdc1080.h +++ b/esphome/components/hdc1080/hdc1080.h @@ -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 diff --git a/esphome/components/hmc5883l/hmc5883l.h b/esphome/components/hmc5883l/hmc5883l.h index 41d41baa22..3481f45dc8 100644 --- a/esphome/components/hmc5883l/hmc5883l.h +++ b/esphome/components/hmc5883l/hmc5883l.h @@ -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, diff --git a/esphome/components/honeywellabp/honeywellabp.h b/esphome/components/honeywellabp/honeywellabp.h index 44d5952ca6..98f6f08c4a 100644 --- a/esphome/components/honeywellabp/honeywellabp.h +++ b/esphome/components/honeywellabp/honeywellabp.h @@ -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_(); diff --git a/esphome/components/ms5611/ms5611.h b/esphome/components/ms5611/ms5611.h index b5663ad736..476db79612 100644 --- a/esphome/components/ms5611/ms5611.h +++ b/esphome/components/ms5611/ms5611.h @@ -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]; }; diff --git a/esphome/components/pzem004t/pzem004t.h b/esphome/components/pzem004t/pzem004t.h index f4f9f29b4d..e18413f35c 100644 --- a/esphome/components/pzem004t/pzem004t.h +++ b/esphome/components/pzem004t/pzem004t.h @@ -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, diff --git a/esphome/components/pzemac/pzemac.h b/esphome/components/pzemac/pzemac.h index e9f76972a3..8f2cf1460d 100644 --- a/esphome/components/pzemac/pzemac.h +++ b/esphome/components/pzemac/pzemac.h @@ -27,12 +27,12 @@ class PZEMAC : public PollingComponent, public modbus::ModbusDevice { protected: template 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_(); }; diff --git a/esphome/components/pzemdc/pzemdc.h b/esphome/components/pzemdc/pzemdc.h index d838eb4167..a78a48a6fb 100644 --- a/esphome/components/pzemdc/pzemdc.h +++ b/esphome/components/pzemdc/pzemdc.h @@ -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 diff --git a/esphome/components/qmc5883l/qmc5883l.h b/esphome/components/qmc5883l/qmc5883l.h index 01697ecbd0..15ef435ce5 100644 --- a/esphome/components/qmc5883l/qmc5883l.h +++ b/esphome/components/qmc5883l/qmc5883l.h @@ -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, diff --git a/esphome/components/qmp6988/qmp6988.h b/esphome/components/qmp6988/qmp6988.h index ef944ba4ff..f0c11adf43 100644 --- a/esphome/components/qmp6988/qmp6988.h +++ b/esphome/components/qmp6988/qmp6988.h @@ -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}; diff --git a/esphome/components/sht3xd/sht3xd.h b/esphome/components/sht3xd/sht3xd.h index 3164aa0687..41ca3c5d6e 100644 --- a/esphome/components/sht3xd/sht3xd.h +++ b/esphome/components/sht3xd/sht3xd.h @@ -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 diff --git a/esphome/components/shtcx/shtcx.h b/esphome/components/shtcx/shtcx.h index c44fb9d9c1..084d3bfc35 100644 --- a/esphome/components/shtcx/shtcx.h +++ b/esphome/components/shtcx/shtcx.h @@ -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 diff --git a/esphome/components/tsl2591/tsl2591.h b/esphome/components/tsl2591/tsl2591.h index d82dbc395f..5b7eea35ec 100644 --- a/esphome/components/tsl2591/tsl2591.h +++ b/esphome/components/tsl2591/tsl2591.h @@ -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_; diff --git a/esphome/components/tx20/tx20.h b/esphome/components/tx20/tx20.h index 1c617d0674..95a9517227 100644 --- a/esphome/components/tx20/tx20.h +++ b/esphome/components/tx20/tx20.h @@ -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_; };