From 501f88ca8645ef0e7ca3e537e2e69688636e6e90 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 10 Jun 2021 22:19:44 +0200 Subject: [PATCH] Avoid non-const globals and enable clang-tidy check (#1892) --- .clang-tidy | 1 - esphome/components/a4988/a4988.cpp | 2 +- esphome/components/ac_dimmer/ac_dimmer.cpp | 6 +- .../adalight/adalight_light_effect.cpp | 2 +- esphome/components/adc/adc_sensor.cpp | 2 +- .../addressable_light_display.cpp | 2 +- esphome/components/ade7953/ade7953.cpp | 2 +- esphome/components/ads1115/ads1115.cpp | 2 +- esphome/components/aht10/aht10.cpp | 2 +- esphome/components/am2320/am2320.cpp | 2 +- esphome/components/apds9960/apds9960.cpp | 2 +- esphome/components/api/api_connection.cpp | 2 +- esphome/components/api/api_pb2_service.cpp | 2 +- esphome/components/api/api_server.cpp | 4 +- esphome/components/api/api_server.h | 2 +- esphome/components/api/proto.cpp | 2 +- esphome/components/as3935/as3935.cpp | 2 +- esphome/components/as3935_i2c/as3935_i2c.cpp | 2 +- esphome/components/as3935_spi/as3935_spi.cpp | 2 +- .../atc_mithermometer/atc_mithermometer.cpp | 2 +- esphome/components/atm90e32/atm90e32.cpp | 2 +- esphome/components/b_parasite/b_parasite.cpp | 2 +- .../bang_bang/bang_bang_climate.cpp | 2 +- esphome/components/bh1750/bh1750.cpp | 2 +- esphome/components/binary/fan/binary_fan.cpp | 2 +- .../components/binary_sensor/automation.cpp | 2 +- .../binary_sensor/binary_sensor.cpp | 2 +- esphome/components/binary_sensor/filter.cpp | 2 +- .../binary_sensor_map/binary_sensor_map.cpp | 2 +- esphome/components/ble_client/ble_client.cpp | 2 +- .../ble_client/sensor/ble_sensor.cpp | 2 +- .../ble_client/switch/ble_switch.cpp | 2 +- .../ble_presence/ble_presence_device.cpp | 2 +- .../components/ble_rssi/ble_rssi_sensor.cpp | 2 +- .../components/ble_scanner/ble_scanner.cpp | 2 +- esphome/components/bme280/bme280.cpp | 2 +- esphome/components/bme680/bme680.cpp | 2 +- .../components/bme680_bsec/bme680_bsec.cpp | 2 +- esphome/components/bmp085/bmp085.cpp | 2 +- esphome/components/bmp280/bmp280.cpp | 2 +- esphome/components/canbus/canbus.cpp | 2 +- .../captive_portal/captive_portal.cpp | 4 +- .../captive_portal/captive_portal.h | 2 +- esphome/components/ccs811/ccs811.cpp | 2 +- esphome/components/climate/climate.cpp | 2 +- esphome/components/climate_ir/climate_ir.cpp | 2 +- .../climate_ir_lg/climate_ir_lg.cpp | 2 +- esphome/components/coolix/coolix.cpp | 2 +- esphome/components/cover/cover.cpp | 2 +- esphome/components/cs5460a/cs5460a.cpp | 2 +- esphome/components/cse7766/cse7766.cpp | 2 +- .../components/ct_clamp/ct_clamp_sensor.cpp | 2 +- .../binary_sensor/custom_binary_sensor.cpp | 2 +- .../custom/sensor/custom_sensor.cpp | 2 +- .../custom/switch/custom_switch.cpp | 2 +- .../custom/text_sensor/custom_text_sensor.cpp | 2 +- esphome/components/daikin/daikin.cpp | 2 +- .../components/dallas/dallas_component.cpp | 2 +- esphome/components/dallas/esp_one_wire.cpp | 2 +- esphome/components/debug/debug_component.cpp | 2 +- .../deep_sleep/deep_sleep_component.cpp | 4 +- .../deep_sleep/deep_sleep_component.h | 2 +- esphome/components/dfplayer/dfplayer.cpp | 2 +- esphome/components/dht/dht.cpp | 2 +- esphome/components/dht12/dht12.cpp | 2 +- esphome/components/display/display_buffer.cpp | 2 +- esphome/components/ds1307/ds1307.cpp | 2 +- .../duty_cycle/duty_cycle_sensor.cpp | 2 +- esphome/components/e131/e131.cpp | 2 +- .../e131/e131_addressable_light_effect.cpp | 2 +- esphome/components/e131/e131_packet.cpp | 2 +- esphome/components/endstop/endstop_cover.cpp | 2 +- esphome/components/esp32_ble/ble.cpp | 2 +- .../esp32_ble/ble_characteristic.cpp | 2 +- .../components/esp32_ble/ble_descriptor.cpp | 2 +- esphome/components/esp32_ble/ble_server.cpp | 2 +- esphome/components/esp32_ble/ble_service.cpp | 2 +- .../esp32_ble_beacon/esp32_ble_beacon.cpp | 2 +- .../esp32_ble_tracker/esp32_ble_tracker.cpp | 2 +- .../components/esp32_camera/esp32_camera.cpp | 2 +- esphome/components/esp32_dac/esp32_dac.cpp | 2 +- esphome/components/esp32_hall/esp32_hall.cpp | 2 +- .../esp32_improv/esp32_improv_component.cpp | 2 +- .../components/esp32_touch/esp32_touch.cpp | 2 +- .../components/esp8266_pwm/esp8266_pwm.cpp | 2 +- .../ethernet/ethernet_component.cpp | 2 +- .../exposure_notifications.cpp | 2 +- esphome/components/ezo/ezo.cpp | 2 +- esphome/components/fan/automation.cpp | 2 +- esphome/components/fan/fan_state.cpp | 2 +- .../components/fastled_base/fastled_light.cpp | 2 +- .../fingerprint_grow/fingerprint_grow.cpp | 2 +- .../fujitsu_general/fujitsu_general.cpp | 2 +- .../gpio/binary_sensor/gpio_binary_sensor.cpp | 2 +- .../gpio/output/gpio_binary_output.cpp | 2 +- .../components/gpio/switch/gpio_switch.cpp | 2 +- esphome/components/gps/gps.cpp | 2 +- esphome/components/gps/time/gps_time.cpp | 2 +- esphome/components/hdc1080/hdc1080.cpp | 2 +- .../hitachi_ac344/hitachi_ac344.cpp | 2 +- esphome/components/hlw8012/hlw8012.cpp | 2 +- esphome/components/hm3301/hm3301.cpp | 2 +- esphome/components/hmc5883l/hmc5883l.cpp | 2 +- .../homeassistant_binary_sensor.cpp | 2 +- .../sensor/homeassistant_sensor.cpp | 2 +- .../text_sensor/homeassistant_text_sensor.cpp | 2 +- .../homeassistant/time/homeassistant_time.cpp | 4 +- .../homeassistant/time/homeassistant_time.h | 2 +- .../components/http_request/http_request.cpp | 2 +- esphome/components/htu21d/htu21d.cpp | 2 +- esphome/components/hx711/hx711.cpp | 2 +- esphome/components/i2c/i2c.cpp | 2 +- .../components/ili9341/ili9341_display.cpp | 2 +- esphome/components/improv/improv.h | 12 ++-- esphome/components/ina219/ina219.cpp | 2 +- esphome/components/ina226/ina226.cpp | 2 +- esphome/components/ina3221/ina3221.cpp | 2 +- .../inkbird_ibsth1_mini.cpp | 2 +- esphome/components/inkplate6/inkplate.cpp | 2 +- .../integration/integration_sensor.cpp | 2 +- esphome/components/json/json_util.cpp | 8 +-- esphome/components/json/json_util.h | 2 +- esphome/components/lcd_base/lcd_display.cpp | 2 +- .../components/lcd_gpio/gpio_lcd_display.cpp | 2 +- .../lcd_pcf8574/pcf8574_display.cpp | 2 +- esphome/components/ledc/ledc_output.cpp | 2 +- .../components/light/addressable_light.cpp | 2 +- esphome/components/light/light_state.cpp | 2 +- esphome/components/logger/logger.cpp | 14 ++-- esphome/components/logger/logger.h | 2 +- esphome/components/max31855/max31855.cpp | 2 +- esphome/components/max31856/max31856.cpp | 2 +- esphome/components/max31865/max31865.cpp | 2 +- esphome/components/max6675/max6675.cpp | 2 +- esphome/components/max7219/max7219.cpp | 2 +- .../components/max7219digit/max7219digit.cpp | 2 +- esphome/components/mcp23008/mcp23008.cpp | 2 +- esphome/components/mcp23016/mcp23016.cpp | 2 +- esphome/components/mcp23017/mcp23017.cpp | 2 +- esphome/components/mcp23s08/mcp23s08.cpp | 2 +- esphome/components/mcp23s17/mcp23s17.cpp | 2 +- .../mcp23x08_base/mcp23x08_base.cpp | 2 +- .../mcp23x17_base/mcp23x17_base.cpp | 2 +- esphome/components/mcp2515/mcp2515.cpp | 2 +- esphome/components/mcp3008/mcp3008.cpp | 2 +- esphome/components/mcp4725/mcp4725.cpp | 2 +- esphome/components/mcp9808/mcp9808.cpp | 2 +- esphome/components/mhz19/mhz19.cpp | 2 +- esphome/components/midea_ac/midea_climate.cpp | 2 +- esphome/components/midea_ac/midea_frame.cpp | 2 +- .../components/midea_dongle/midea_dongle.cpp | 2 +- esphome/components/mitsubishi/mitsubishi.cpp | 2 +- esphome/components/modbus/modbus.cpp | 2 +- esphome/components/mpr121/mpr121.cpp | 2 +- esphome/components/mpu6050/mpu6050.cpp | 2 +- .../components/mqtt/custom_mqtt_device.cpp | 2 +- .../components/mqtt/mqtt_binary_sensor.cpp | 2 +- esphome/components/mqtt/mqtt_client.cpp | 4 +- esphome/components/mqtt/mqtt_client.h | 2 +- esphome/components/mqtt/mqtt_climate.cpp | 2 +- esphome/components/mqtt/mqtt_component.cpp | 2 +- esphome/components/mqtt/mqtt_cover.cpp | 2 +- esphome/components/mqtt/mqtt_fan.cpp | 2 +- esphome/components/mqtt/mqtt_light.cpp | 2 +- esphome/components/mqtt/mqtt_sensor.cpp | 2 +- esphome/components/mqtt/mqtt_switch.cpp | 2 +- esphome/components/mqtt/mqtt_text_sensor.cpp | 2 +- .../sensor/mqtt_subscribe_sensor.cpp | 2 +- .../mqtt_subscribe_text_sensor.cpp | 2 +- esphome/components/ms5611/ms5611.cpp | 2 +- esphome/components/my9231/my9231.cpp | 2 +- esphome/components/nextion/nextion.cpp | 2 +- esphome/components/nfc/ndef_message.cpp | 2 +- esphome/components/nfc/ndef_record.cpp | 2 +- esphome/components/nfc/ndef_record.h | 72 +++++++++---------- esphome/components/nfc/nfc.cpp | 2 +- esphome/components/nfc/nfc.h | 6 +- esphome/components/nfc/nfc_tag.cpp | 2 +- esphome/components/ntc/ntc.cpp | 2 +- esphome/components/ota/ota_component.cpp | 4 +- esphome/components/output/automation.cpp | 2 +- esphome/components/output/float_output.cpp | 2 +- .../output/switch/output_switch.cpp | 2 +- .../components/partition/light_partition.cpp | 2 +- esphome/components/pca9685/pca9685_output.cpp | 2 +- esphome/components/pcd8544/pcd_8544.cpp | 2 +- esphome/components/pcf8574/pcf8574.cpp | 2 +- esphome/components/pid/pid_autotuner.cpp | 2 +- esphome/components/pid/pid_climate.cpp | 2 +- .../pid/sensor/pid_climate_sensor.cpp | 2 +- esphome/components/pmsx003/pmsx003.cpp | 2 +- esphome/components/pn532/pn532.cpp | 2 +- .../components/pn532/pn532_mifare_classic.cpp | 2 +- .../pn532/pn532_mifare_ultralight.cpp | 2 +- esphome/components/pn532_i2c/pn532_i2c.cpp | 2 +- esphome/components/pn532_spi/pn532_spi.cpp | 2 +- .../components/power_supply/power_supply.cpp | 2 +- .../pulse_counter/pulse_counter_sensor.cpp | 4 +- .../pulse_meter/pulse_meter_sensor.cpp | 2 +- .../components/pulse_width/pulse_width.cpp | 2 +- esphome/components/pzem004t/pzem004t.cpp | 2 +- esphome/components/pzemac/pzemac.cpp | 2 +- esphome/components/pzemdc/pzemdc.cpp | 2 +- esphome/components/qmc5883l/qmc5883l.cpp | 2 +- esphome/components/rc522/rc522.cpp | 2 +- esphome/components/rc522_i2c/rc522_i2c.cpp | 2 +- esphome/components/rc522_spi/rc522_spi.cpp | 2 +- esphome/components/rdm6300/rdm6300.cpp | 2 +- esphome/components/remote_base/__init__.py | 2 +- .../components/remote_base/jvc_protocol.cpp | 2 +- .../components/remote_base/lg_protocol.cpp | 2 +- .../components/remote_base/nec_protocol.cpp | 2 +- .../remote_base/panasonic_protocol.cpp | 2 +- .../remote_base/pioneer_protocol.cpp | 2 +- .../components/remote_base/raw_protocol.cpp | 2 +- .../components/remote_base/rc5_protocol.cpp | 2 +- .../remote_base/rc_switch_protocol.cpp | 24 +++---- .../remote_base/rc_switch_protocol.h | 2 +- .../components/remote_base/remote_base.cpp | 2 +- .../remote_base/samsung36_protocol.cpp | 2 +- .../remote_base/samsung_protocol.cpp | 2 +- .../components/remote_base/sony_protocol.cpp | 2 +- .../remote_receiver/remote_receiver_esp32.cpp | 2 +- .../remote_receiver_esp8266.cpp | 2 +- .../remote_transmitter/remote_transmitter.cpp | 2 +- .../remote_transmitter_esp32.cpp | 2 +- .../remote_transmitter_esp8266.cpp | 2 +- .../resistance/resistance_sensor.cpp | 2 +- esphome/components/restart/restart_switch.cpp | 2 +- esphome/components/rf_bridge/rf_bridge.cpp | 2 +- .../rotary_encoder/rotary_encoder.cpp | 2 +- esphome/components/rtttl/rtttl.cpp | 2 +- esphome/components/rtttl/rtttl.h | 2 - esphome/components/ruuvi_ble/ruuvi_ble.cpp | 2 +- esphome/components/ruuvitag/ruuvitag.cpp | 2 +- esphome/components/scd30/scd30.cpp | 2 +- esphome/components/script/script.cpp | 2 +- esphome/components/sdm_meter/sdm_meter.cpp | 2 +- esphome/components/sds011/sds011.cpp | 2 +- esphome/components/senseair/senseair.cpp | 2 +- esphome/components/sensor/automation.cpp | 2 +- esphome/components/sensor/filter.cpp | 2 +- esphome/components/sensor/sensor.cpp | 2 +- esphome/components/servo/servo.cpp | 4 +- esphome/components/servo/servo.h | 2 +- esphome/components/sgp30/sgp30.cpp | 2 +- esphome/components/sgp40/sgp40.cpp | 2 +- esphome/components/sht3xd/sht3xd.cpp | 2 +- esphome/components/sht4x/sht4x.cpp | 2 +- esphome/components/shtcx/shtcx.cpp | 2 +- .../components/shutdown/shutdown_switch.cpp | 2 +- esphome/components/sim800l/sim800l.cpp | 2 +- .../components/slow_pwm/slow_pwm_output.cpp | 2 +- esphome/components/sm16716/sm16716.cpp | 2 +- esphome/components/sm2135/sm2135.cpp | 2 +- esphome/components/sm300d2/sm300d2.cpp | 2 +- esphome/components/sn74hc595/sn74hc595.cpp | 2 +- esphome/components/sntp/sntp_component.cpp | 2 +- esphome/components/speed/fan/speed_fan.cpp | 2 +- esphome/components/spi/spi.cpp | 2 +- esphome/components/sps30/sps30.cpp | 2 +- .../components/ssd1306_base/ssd1306_base.cpp | 2 +- .../components/ssd1306_i2c/ssd1306_i2c.cpp | 2 +- .../components/ssd1306_spi/ssd1306_spi.cpp | 2 +- .../components/ssd1322_base/ssd1322_base.cpp | 2 +- .../components/ssd1322_spi/ssd1322_spi.cpp | 2 +- .../components/ssd1325_base/ssd1325_base.cpp | 2 +- .../components/ssd1325_spi/ssd1325_spi.cpp | 2 +- .../components/ssd1327_base/ssd1327_base.cpp | 2 +- .../components/ssd1327_i2c/ssd1327_i2c.cpp | 2 +- .../components/ssd1327_spi/ssd1327_spi.cpp | 2 +- .../components/ssd1331_base/ssd1331_base.cpp | 2 +- .../components/ssd1331_spi/ssd1331_spi.cpp | 2 +- .../components/ssd1351_base/ssd1351_base.cpp | 2 +- .../components/ssd1351_spi/ssd1351_spi.cpp | 2 +- esphome/components/st7735/st7735.cpp | 2 +- esphome/components/st7789v/st7789v.cpp | 2 +- .../status/status_binary_sensor.cpp | 2 +- esphome/components/status_led/status_led.cpp | 4 +- esphome/components/status_led/status_led.h | 2 +- esphome/components/stepper/stepper.cpp | 2 +- esphome/components/sts3x/sts3x.cpp | 2 +- esphome/components/sun/sensor/sun_sensor.cpp | 2 +- esphome/components/sun/sun.cpp | 2 +- .../sun/text_sensor/sun_text_sensor.cpp | 2 +- esphome/components/switch/automation.cpp | 2 +- esphome/components/switch/switch.cpp | 2 +- .../sx1509/output/sx1509_float_output.cpp | 2 +- esphome/components/sx1509/sx1509.cpp | 2 +- esphome/components/sx1509/sx1509_gpio_pin.cpp | 2 +- esphome/components/tca9548a/tca9548a.cpp | 2 +- esphome/components/tcl112/tcl112.cpp | 2 +- esphome/components/tcs34725/tcs34725.cpp | 2 +- .../teleinfo/sensor/teleinfo_sensor.cpp | 2 +- esphome/components/teleinfo/teleinfo.cpp | 2 +- .../text_sensor/teleinfo_text_sensor.cpp | 2 +- .../binary_sensor/template_binary_sensor.cpp | 2 +- .../template/cover/template_cover.cpp | 2 +- .../template/sensor/template_sensor.cpp | 2 +- .../template/switch/template_switch.cpp | 2 +- .../text_sensor/template_text_sensor.cpp | 2 +- .../components/text_sensor/text_sensor.cpp | 2 +- .../thermostat/thermostat_climate.cpp | 2 +- esphome/components/time/automation.cpp | 2 +- esphome/components/time/real_time_clock.cpp | 2 +- .../time_based/time_based_cover.cpp | 2 +- .../components/tlc59208f/tlc59208f_output.cpp | 2 +- esphome/components/tm1637/tm1637.cpp | 2 +- esphome/components/tm1651/tm1651.cpp | 2 +- esphome/components/tmp102/tmp102.cpp | 2 +- esphome/components/tmp117/tmp117.cpp | 2 +- .../components/tof10120/tof10120_sensor.cpp | 2 +- esphome/components/toshiba/toshiba.cpp | 2 +- .../total_daily_energy/total_daily_energy.cpp | 2 +- esphome/components/tsl2561/tsl2561.cpp | 2 +- esphome/components/ttp229_bsf/ttp229_bsf.cpp | 2 +- esphome/components/ttp229_lsf/ttp229_lsf.cpp | 2 +- .../tuya/binary_sensor/tuya_binary_sensor.cpp | 2 +- .../components/tuya/climate/tuya_climate.cpp | 2 +- esphome/components/tuya/fan/tuya_fan.cpp | 2 +- esphome/components/tuya/light/tuya_light.cpp | 2 +- .../components/tuya/sensor/tuya_sensor.cpp | 2 +- .../components/tuya/switch/tuya_switch.cpp | 2 +- esphome/components/tuya/tuya.cpp | 2 +- esphome/components/tx20/tx20.cpp | 6 +- .../components/uart/switch/uart_switch.cpp | 2 +- esphome/components/uart/uart.cpp | 2 +- esphome/components/uart/uart_esp32.cpp | 2 +- esphome/components/uart/uart_esp8266.cpp | 2 +- esphome/components/uln2003/uln2003.cpp | 2 +- .../ultrasonic/ultrasonic_sensor.cpp | 2 +- esphome/components/uptime/uptime_sensor.cpp | 2 +- .../version/version_text_sensor.cpp | 2 +- esphome/components/vl53l0x/vl53l0x_sensor.cpp | 7 +- esphome/components/vl53l0x/vl53l0x_sensor.h | 4 +- .../waveshare_epaper/waveshare_epaper.cpp | 2 +- esphome/components/web_server/web_server.cpp | 2 +- .../web_server_base/web_server_base.cpp | 2 +- esphome/components/whirlpool/whirlpool.cpp | 2 +- esphome/components/wifi/wifi_component.cpp | 4 +- esphome/components/wifi/wifi_component.h | 2 +- .../components/wifi/wifi_component_esp32.cpp | 2 +- .../wifi/wifi_component_esp8266.cpp | 2 +- .../wifi_info/wifi_info_text_sensor.cpp | 2 +- .../wifi_signal/wifi_signal_sensor.cpp | 2 +- esphome/components/wled/wled_light_effect.cpp | 2 +- esphome/components/xiaomi_ble/xiaomi_ble.cpp | 2 +- .../components/xiaomi_cgd1/xiaomi_cgd1.cpp | 2 +- .../components/xiaomi_cgdk2/xiaomi_cgdk2.cpp | 2 +- .../components/xiaomi_cgg1/xiaomi_cgg1.cpp | 2 +- .../xiaomi_gcls002/xiaomi_gcls002.cpp | 2 +- .../xiaomi_hhccjcy01/xiaomi_hhccjcy01.cpp | 2 +- .../xiaomi_hhccpot002/xiaomi_hhccpot002.cpp | 2 +- .../xiaomi_jqjcy01ym/xiaomi_jqjcy01ym.cpp | 2 +- .../xiaomi_lywsd02/xiaomi_lywsd02.cpp | 2 +- .../xiaomi_lywsd03mmc/xiaomi_lywsd03mmc.cpp | 2 +- .../xiaomi_lywsdcgq/xiaomi_lywsdcgq.cpp | 2 +- .../xiaomi_mhoc401/xiaomi_mhoc401.cpp | 2 +- .../xiaomi_miscale/xiaomi_miscale.cpp | 2 +- .../xiaomi_miscale2/xiaomi_miscale2.cpp | 2 +- .../xiaomi_mjyd02yla/xiaomi_mjyd02yla.cpp | 2 +- .../xiaomi_mue4094rt/xiaomi_mue4094rt.cpp | 2 +- .../xiaomi_wx08zm/xiaomi_wx08zm.cpp | 2 +- esphome/components/xpt2046/xpt2046.cpp | 2 +- esphome/components/yashima/yashima.cpp | 2 +- esphome/components/zyaura/zyaura.cpp | 2 +- esphome/core/application.cpp | 4 +- esphome/core/application.h | 2 +- esphome/core/component.cpp | 4 +- esphome/core/esphal.cpp | 2 +- esphome/core/helpers.cpp | 12 ++-- esphome/core/helpers.h | 2 +- esphome/core/preferences.cpp | 6 +- esphome/core/preferences.h | 8 +-- esphome/core/scheduler.cpp | 2 +- esphome/core/util.cpp | 2 +- 376 files changed, 466 insertions(+), 468 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index dc59dbe1a0..fc5ce854f1 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -18,7 +18,6 @@ Checks: >- -cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-magic-numbers, - -cppcoreguidelines-avoid-non-const-global-variables, -cppcoreguidelines-init-variables, -cppcoreguidelines-macro-usage, -cppcoreguidelines-narrowing-conversions, diff --git a/esphome/components/a4988/a4988.cpp b/esphome/components/a4988/a4988.cpp index 4100563412..429fa25648 100644 --- a/esphome/components/a4988/a4988.cpp +++ b/esphome/components/a4988/a4988.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace a4988 { -static const char *TAG = "a4988.stepper"; +static const char *const TAG = "a4988.stepper"; void A4988::setup() { ESP_LOGCONFIG(TAG, "Setting up A4988..."); diff --git a/esphome/components/ac_dimmer/ac_dimmer.cpp b/esphome/components/ac_dimmer/ac_dimmer.cpp index a60cc9e29a..ad6018268e 100644 --- a/esphome/components/ac_dimmer/ac_dimmer.cpp +++ b/esphome/components/ac_dimmer/ac_dimmer.cpp @@ -9,15 +9,15 @@ namespace esphome { namespace ac_dimmer { -static const char *TAG = "ac_dimmer"; +static const char *const TAG = "ac_dimmer"; // Global array to store dimmer objects -static AcDimmerDataStore *all_dimmers[32]; +static AcDimmerDataStore *all_dimmers[32]; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) /// Time in microseconds the gate should be held high /// 10µs should be long enough for most triacs /// For reference: BT136 datasheet says 2µs nominal (page 7) -static uint32_t GATE_ENABLE_TIME = 10; +static const uint32_t GATE_ENABLE_TIME = 10; /// Function called from timer interrupt /// Input is current time in microseconds (micros()) diff --git a/esphome/components/adalight/adalight_light_effect.cpp b/esphome/components/adalight/adalight_light_effect.cpp index d162c90721..63fd7c60cc 100644 --- a/esphome/components/adalight/adalight_light_effect.cpp +++ b/esphome/components/adalight/adalight_light_effect.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace adalight { -static const char *TAG = "adalight_light_effect"; +static const char *const TAG = "adalight_light_effect"; static const uint32_t ADALIGHT_ACK_INTERVAL = 1000; static const uint32_t ADALIGHT_RECEIVE_TIMEOUT = 1000; diff --git a/esphome/components/adc/adc_sensor.cpp b/esphome/components/adc/adc_sensor.cpp index c6e2141725..960d9ed8e2 100644 --- a/esphome/components/adc/adc_sensor.cpp +++ b/esphome/components/adc/adc_sensor.cpp @@ -8,7 +8,7 @@ ADC_MODE(ADC_VCC) namespace esphome { namespace adc { -static const char *TAG = "adc"; +static const char *const TAG = "adc"; #ifdef ARDUINO_ARCH_ESP32 void ADCSensor::set_attenuation(adc_attenuation_t attenuation) { this->attenuation_ = attenuation; } diff --git a/esphome/components/addressable_light/addressable_light_display.cpp b/esphome/components/addressable_light/addressable_light_display.cpp index 8469bc98af..16fab15b17 100644 --- a/esphome/components/addressable_light/addressable_light_display.cpp +++ b/esphome/components/addressable_light/addressable_light_display.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace addressable_light { -static const char *TAG = "addressable_light.display"; +static const char *const TAG = "addressable_light.display"; int AddressableLightDisplay::get_width_internal() { return this->width_; } int AddressableLightDisplay::get_height_internal() { return this->height_; } diff --git a/esphome/components/ade7953/ade7953.cpp b/esphome/components/ade7953/ade7953.cpp index 01afdeef36..0e6d5624c1 100644 --- a/esphome/components/ade7953/ade7953.cpp +++ b/esphome/components/ade7953/ade7953.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ade7953 { -static const char *TAG = "ade7953"; +static const char *const TAG = "ade7953"; void ADE7953::dump_config() { ESP_LOGCONFIG(TAG, "ADE7953:"); diff --git a/esphome/components/ads1115/ads1115.cpp b/esphome/components/ads1115/ads1115.cpp index 0899571a47..d33ac83813 100644 --- a/esphome/components/ads1115/ads1115.cpp +++ b/esphome/components/ads1115/ads1115.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ads1115 { -static const char *TAG = "ads1115"; +static const char *const TAG = "ads1115"; static const uint8_t ADS1115_REGISTER_CONVERSION = 0x00; static const uint8_t ADS1115_REGISTER_CONFIG = 0x01; diff --git a/esphome/components/aht10/aht10.cpp b/esphome/components/aht10/aht10.cpp index d3a77fee5f..4688440d80 100644 --- a/esphome/components/aht10/aht10.cpp +++ b/esphome/components/aht10/aht10.cpp @@ -18,7 +18,7 @@ namespace esphome { namespace aht10 { -static const char *TAG = "aht10"; +static const char *const TAG = "aht10"; static const uint8_t AHT10_CALIBRATE_CMD[] = {0xE1}; static const uint8_t AHT10_MEASURE_CMD[] = {0xAC, 0x33, 0x00}; static const uint8_t AHT10_DEFAULT_DELAY = 5; // ms, for calibration and temperature measurement diff --git a/esphome/components/am2320/am2320.cpp b/esphome/components/am2320/am2320.cpp index 59cb977fe8..7e8795dd30 100644 --- a/esphome/components/am2320/am2320.cpp +++ b/esphome/components/am2320/am2320.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace am2320 { -static const char *TAG = "am2320"; +static const char *const TAG = "am2320"; // ---=== Calc CRC16 ===--- uint16_t crc_16(uint8_t *ptr, uint8_t length) { diff --git a/esphome/components/apds9960/apds9960.cpp b/esphome/components/apds9960/apds9960.cpp index 6612326e5e..15b0cb39f8 100644 --- a/esphome/components/apds9960/apds9960.cpp +++ b/esphome/components/apds9960/apds9960.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace apds9960 { -static const char *TAG = "apds9960"; +static const char *const TAG = "apds9960"; #define APDS9960_ERROR_CHECK(func) \ if (!(func)) { \ diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 175c3c4487..5576ace33b 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -16,7 +16,7 @@ namespace esphome { namespace api { -static const char *TAG = "api.connection"; +static const char *const TAG = "api.connection"; APIConnection::APIConnection(AsyncClient *client, APIServer *parent) : client_(client), parent_(parent), initial_state_iterator_(parent, this), list_entities_iterator_(parent, this) { diff --git a/esphome/components/api/api_pb2_service.cpp b/esphome/components/api/api_pb2_service.cpp index 06345296a7..4fade19787 100644 --- a/esphome/components/api/api_pb2_service.cpp +++ b/esphome/components/api/api_pb2_service.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace api { -static const char *TAG = "api.service"; +static const char *const TAG = "api.service"; bool APIServerConnectionBase::send_hello_response(const HelloResponse &msg) { ESP_LOGVV(TAG, "send_hello_response: %s", msg.dump().c_str()); diff --git a/esphome/components/api/api_server.cpp b/esphome/components/api/api_server.cpp index 1a3aa6e2f4..1373533ae2 100644 --- a/esphome/components/api/api_server.cpp +++ b/esphome/components/api/api_server.cpp @@ -15,7 +15,7 @@ namespace esphome { namespace api { -static const char *TAG = "api"; +static const char *const TAG = "api"; // APIServer void APIServer::setup() { @@ -199,7 +199,7 @@ void APIServer::on_climate_update(climate::Climate *obj) { float APIServer::get_setup_priority() const { return setup_priority::AFTER_WIFI; } void APIServer::set_port(uint16_t port) { this->port_ = port; } -APIServer *global_api_server = nullptr; +APIServer *global_api_server = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) void APIServer::set_password(const std::string &password) { this->password_ = password; } void APIServer::send_homeassistant_service_call(const HomeassistantServiceResponse &call) { diff --git a/esphome/components/api/api_server.h b/esphome/components/api/api_server.h index ec89cdf18e..eb6c91d01c 100644 --- a/esphome/components/api/api_server.h +++ b/esphome/components/api/api_server.h @@ -91,7 +91,7 @@ class APIServer : public Component, public Controller { std::vector user_services_; }; -extern APIServer *global_api_server; +extern APIServer *global_api_server; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) template class APIConnectedCondition : public Condition { public: diff --git a/esphome/components/api/proto.cpp b/esphome/components/api/proto.cpp index 4bd22af769..0d2eb2d279 100644 --- a/esphome/components/api/proto.cpp +++ b/esphome/components/api/proto.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace api { -static const char *TAG = "api.proto"; +static const char *const TAG = "api.proto"; void ProtoMessage::decode(const uint8_t *buffer, size_t length) { uint32_t i = 0; diff --git a/esphome/components/as3935/as3935.cpp b/esphome/components/as3935/as3935.cpp index 9446a2fdd6..1cc400bb7b 100644 --- a/esphome/components/as3935/as3935.cpp +++ b/esphome/components/as3935/as3935.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace as3935 { -static const char *TAG = "as3935"; +static const char *const TAG = "as3935"; void AS3935Component::setup() { ESP_LOGCONFIG(TAG, "Setting up AS3935..."); diff --git a/esphome/components/as3935_i2c/as3935_i2c.cpp b/esphome/components/as3935_i2c/as3935_i2c.cpp index a522116815..1a1cd8fe82 100644 --- a/esphome/components/as3935_i2c/as3935_i2c.cpp +++ b/esphome/components/as3935_i2c/as3935_i2c.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace as3935_i2c { -static const char *TAG = "as3935_i2c"; +static const char *const TAG = "as3935_i2c"; void I2CAS3935Component::write_register(uint8_t reg, uint8_t mask, uint8_t bits, uint8_t start_pos) { uint8_t write_reg; diff --git a/esphome/components/as3935_spi/as3935_spi.cpp b/esphome/components/as3935_spi/as3935_spi.cpp index 54b52b2fd0..3a517df56d 100644 --- a/esphome/components/as3935_spi/as3935_spi.cpp +++ b/esphome/components/as3935_spi/as3935_spi.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace as3935_spi { -static const char *TAG = "as3935_spi"; +static const char *const TAG = "as3935_spi"; void SPIAS3935Component::setup() { ESP_LOGI(TAG, "SPIAS3935Component setup started!"); diff --git a/esphome/components/atc_mithermometer/atc_mithermometer.cpp b/esphome/components/atc_mithermometer/atc_mithermometer.cpp index 1a555cfa83..5656cdf430 100644 --- a/esphome/components/atc_mithermometer/atc_mithermometer.cpp +++ b/esphome/components/atc_mithermometer/atc_mithermometer.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace atc_mithermometer { -static const char *TAG = "atc_mithermometer"; +static const char *const TAG = "atc_mithermometer"; void ATCMiThermometer::dump_config() { ESP_LOGCONFIG(TAG, "ATC MiThermometer"); diff --git a/esphome/components/atm90e32/atm90e32.cpp b/esphome/components/atm90e32/atm90e32.cpp index d732212cdd..ebceaa817c 100644 --- a/esphome/components/atm90e32/atm90e32.cpp +++ b/esphome/components/atm90e32/atm90e32.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace atm90e32 { -static const char *TAG = "atm90e32"; +static const char *const TAG = "atm90e32"; void ATM90E32Component::update() { if (this->read16_(ATM90E32_REGISTER_METEREN) != 1) { diff --git a/esphome/components/b_parasite/b_parasite.cpp b/esphome/components/b_parasite/b_parasite.cpp index 9f9ab214c0..81c9243bdb 100644 --- a/esphome/components/b_parasite/b_parasite.cpp +++ b/esphome/components/b_parasite/b_parasite.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace b_parasite { -static const char *TAG = "b_parasite"; +static const char *const TAG = "b_parasite"; void BParasite::dump_config() { ESP_LOGCONFIG(TAG, "b_parasite"); diff --git a/esphome/components/bang_bang/bang_bang_climate.cpp b/esphome/components/bang_bang/bang_bang_climate.cpp index 45d5174390..ca361c7012 100644 --- a/esphome/components/bang_bang/bang_bang_climate.cpp +++ b/esphome/components/bang_bang/bang_bang_climate.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace bang_bang { -static const char *TAG = "bang_bang.climate"; +static const char *const TAG = "bang_bang.climate"; void BangBangClimate::setup() { this->sensor_->add_on_state_callback([this](float state) { diff --git a/esphome/components/bh1750/bh1750.cpp b/esphome/components/bh1750/bh1750.cpp index 799440fdfc..43af116c9e 100644 --- a/esphome/components/bh1750/bh1750.cpp +++ b/esphome/components/bh1750/bh1750.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace bh1750 { -static const char *TAG = "bh1750.sensor"; +static const char *const TAG = "bh1750.sensor"; static const uint8_t BH1750_COMMAND_POWER_ON = 0b00000001; static const uint8_t BH1750_COMMAND_MT_REG_HI = 0b01000000; // last 3 bits diff --git a/esphome/components/binary/fan/binary_fan.cpp b/esphome/components/binary/fan/binary_fan.cpp index fa6ddc249f..eaf41829bb 100644 --- a/esphome/components/binary/fan/binary_fan.cpp +++ b/esphome/components/binary/fan/binary_fan.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace binary { -static const char *TAG = "binary.fan"; +static const char *const TAG = "binary.fan"; void binary::BinaryFan::dump_config() { ESP_LOGCONFIG(TAG, "Fan '%s':", this->fan_->get_name().c_str()); diff --git a/esphome/components/binary_sensor/automation.cpp b/esphome/components/binary_sensor/automation.cpp index b8be2d1b1f..a333b33397 100644 --- a/esphome/components/binary_sensor/automation.cpp +++ b/esphome/components/binary_sensor/automation.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace binary_sensor { -static const char *TAG = "binary_sensor.automation"; +static const char *const TAG = "binary_sensor.automation"; void binary_sensor::MultiClickTrigger::on_state_(bool state) { // Handle duplicate events diff --git a/esphome/components/binary_sensor/binary_sensor.cpp b/esphome/components/binary_sensor/binary_sensor.cpp index 9878f06380..2e1f228be6 100644 --- a/esphome/components/binary_sensor/binary_sensor.cpp +++ b/esphome/components/binary_sensor/binary_sensor.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace binary_sensor { -static const char *TAG = "binary_sensor"; +static const char *const TAG = "binary_sensor"; void BinarySensor::add_on_state_callback(std::function &&callback) { this->state_callback_.add(std::move(callback)); diff --git a/esphome/components/binary_sensor/filter.cpp b/esphome/components/binary_sensor/filter.cpp index 3aef73c893..53c2daf42d 100644 --- a/esphome/components/binary_sensor/filter.cpp +++ b/esphome/components/binary_sensor/filter.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace binary_sensor { -static const char *TAG = "sensor.filter"; +static const char *const TAG = "sensor.filter"; void Filter::output(bool value, bool is_initial) { if (!this->dedup_.next(value)) diff --git a/esphome/components/binary_sensor_map/binary_sensor_map.cpp b/esphome/components/binary_sensor_map/binary_sensor_map.cpp index 7a2eb66cf8..d1123ddff0 100644 --- a/esphome/components/binary_sensor_map/binary_sensor_map.cpp +++ b/esphome/components/binary_sensor_map/binary_sensor_map.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace binary_sensor_map { -static const char *TAG = "binary_sensor_map"; +static const char *const TAG = "binary_sensor_map"; void BinarySensorMap::dump_config() { LOG_SENSOR(" ", "binary_sensor_map", this); } diff --git a/esphome/components/ble_client/ble_client.cpp b/esphome/components/ble_client/ble_client.cpp index f12d3a21c9..956848b73d 100644 --- a/esphome/components/ble_client/ble_client.cpp +++ b/esphome/components/ble_client/ble_client.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace ble_client { -static const char *TAG = "ble_client"; +static const char *const TAG = "ble_client"; void BLEClient::setup() { auto ret = esp_ble_gattc_app_register(this->app_id); diff --git a/esphome/components/ble_client/sensor/ble_sensor.cpp b/esphome/components/ble_client/sensor/ble_sensor.cpp index 69a4b23313..270822be9d 100644 --- a/esphome/components/ble_client/sensor/ble_sensor.cpp +++ b/esphome/components/ble_client/sensor/ble_sensor.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace ble_client { -static const char *TAG = "ble_sensor"; +static const char *const TAG = "ble_sensor"; uint32_t BLESensor::hash_base() { return 343459825UL; } diff --git a/esphome/components/ble_client/switch/ble_switch.cpp b/esphome/components/ble_client/switch/ble_switch.cpp index ef7b64be66..669984d705 100644 --- a/esphome/components/ble_client/switch/ble_switch.cpp +++ b/esphome/components/ble_client/switch/ble_switch.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace ble_client { -static const char *TAG = "ble_switch"; +static const char *const TAG = "ble_switch"; void BLEClientSwitch::write_state(bool state) { this->parent_->set_enabled(state); diff --git a/esphome/components/ble_presence/ble_presence_device.cpp b/esphome/components/ble_presence/ble_presence_device.cpp index ad6b5ece88..1355c2bcc3 100644 --- a/esphome/components/ble_presence/ble_presence_device.cpp +++ b/esphome/components/ble_presence/ble_presence_device.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace ble_presence { -static const char *TAG = "ble_presence"; +static const char *const TAG = "ble_presence"; void BLEPresenceDevice::dump_config() { LOG_BINARY_SENSOR("", "BLE Presence", this); } diff --git a/esphome/components/ble_rssi/ble_rssi_sensor.cpp b/esphome/components/ble_rssi/ble_rssi_sensor.cpp index 6424837770..096259d8d1 100644 --- a/esphome/components/ble_rssi/ble_rssi_sensor.cpp +++ b/esphome/components/ble_rssi/ble_rssi_sensor.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace ble_rssi { -static const char *TAG = "ble_rssi"; +static const char *const TAG = "ble_rssi"; void BLERSSISensor::dump_config() { LOG_SENSOR("", "BLE RSSI Sensor", this); } diff --git a/esphome/components/ble_scanner/ble_scanner.cpp b/esphome/components/ble_scanner/ble_scanner.cpp index 6735599850..798824bb4e 100644 --- a/esphome/components/ble_scanner/ble_scanner.cpp +++ b/esphome/components/ble_scanner/ble_scanner.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace ble_scanner { -static const char *TAG = "ble_scanner"; +static const char *const TAG = "ble_scanner"; void BLEScanner::dump_config() { LOG_TEXT_SENSOR("", "BLE Scanner", this); } diff --git a/esphome/components/bme280/bme280.cpp b/esphome/components/bme280/bme280.cpp index 6bb5ac9800..097974da7a 100644 --- a/esphome/components/bme280/bme280.cpp +++ b/esphome/components/bme280/bme280.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace bme280 { -static const char *TAG = "bme280.sensor"; +static const char *const TAG = "bme280.sensor"; static const uint8_t BME280_REGISTER_DIG_T1 = 0x88; static const uint8_t BME280_REGISTER_DIG_T2 = 0x8A; diff --git a/esphome/components/bme680/bme680.cpp b/esphome/components/bme680/bme680.cpp index 77f381664b..ee7db3c65f 100644 --- a/esphome/components/bme680/bme680.cpp +++ b/esphome/components/bme680/bme680.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace bme680 { -static const char *TAG = "bme680.sensor"; +static const char *const TAG = "bme680.sensor"; static const uint8_t BME680_REGISTER_COEFF1 = 0x89; static const uint8_t BME680_REGISTER_COEFF2 = 0xE1; diff --git a/esphome/components/bme680_bsec/bme680_bsec.cpp b/esphome/components/bme680_bsec/bme680_bsec.cpp index 756629383c..8f53180296 100644 --- a/esphome/components/bme680_bsec/bme680_bsec.cpp +++ b/esphome/components/bme680_bsec/bme680_bsec.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace bme680_bsec { #ifdef USE_BSEC -static const char *TAG = "bme680_bsec.sensor"; +static const char *const TAG = "bme680_bsec.sensor"; static const std::string IAQ_ACCURACY_STATES[4] = {"Stabilizing", "Uncertain", "Calibrating", "Calibrated"}; diff --git a/esphome/components/bmp085/bmp085.cpp b/esphome/components/bmp085/bmp085.cpp index 88c5313df5..44e686fe1a 100644 --- a/esphome/components/bmp085/bmp085.cpp +++ b/esphome/components/bmp085/bmp085.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace bmp085 { -static const char *TAG = "bmp085.sensor"; +static const char *const TAG = "bmp085.sensor"; static const uint8_t BMP085_ADDRESS = 0x77; static const uint8_t BMP085_REGISTER_AC1_H = 0xAA; diff --git a/esphome/components/bmp280/bmp280.cpp b/esphome/components/bmp280/bmp280.cpp index aed9f3e515..4048e40077 100644 --- a/esphome/components/bmp280/bmp280.cpp +++ b/esphome/components/bmp280/bmp280.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace bmp280 { -static const char *TAG = "bmp280.sensor"; +static const char *const TAG = "bmp280.sensor"; static const uint8_t BMP280_REGISTER_STATUS = 0xF3; static const uint8_t BMP280_REGISTER_CONTROL = 0xF4; diff --git a/esphome/components/canbus/canbus.cpp b/esphome/components/canbus/canbus.cpp index 20afd4b296..b8b6b9e65f 100644 --- a/esphome/components/canbus/canbus.cpp +++ b/esphome/components/canbus/canbus.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace canbus { -static const char *TAG = "canbus"; +static const char *const TAG = "canbus"; void Canbus::setup() { ESP_LOGCONFIG(TAG, "Setting up Canbus..."); diff --git a/esphome/components/captive_portal/captive_portal.cpp b/esphome/components/captive_portal/captive_portal.cpp index 0e0e08fdea..746029e011 100644 --- a/esphome/components/captive_portal/captive_portal.cpp +++ b/esphome/components/captive_portal/captive_portal.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace captive_portal { -static const char *TAG = "captive_portal"; +static const char *const TAG = "captive_portal"; void CaptivePortal::handle_index(AsyncWebServerRequest *request) { AsyncResponseStream *stream = request->beginResponseStream("text/html"); @@ -147,7 +147,7 @@ float CaptivePortal::get_setup_priority() const { } void CaptivePortal::dump_config() { ESP_LOGCONFIG(TAG, "Captive Portal:"); } -CaptivePortal *global_captive_portal = nullptr; +CaptivePortal *global_captive_portal = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace captive_portal } // namespace esphome diff --git a/esphome/components/captive_portal/captive_portal.h b/esphome/components/captive_portal/captive_portal.h index afd4ff9dc5..44b1050f45 100644 --- a/esphome/components/captive_portal/captive_portal.h +++ b/esphome/components/captive_portal/captive_portal.h @@ -68,7 +68,7 @@ class CaptivePortal : public AsyncWebHandler, public Component { DNSServer *dns_server_{nullptr}; }; -extern CaptivePortal *global_captive_portal; +extern CaptivePortal *global_captive_portal; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace captive_portal } // namespace esphome diff --git a/esphome/components/ccs811/ccs811.cpp b/esphome/components/ccs811/ccs811.cpp index e7928d4d8b..dec070a9b2 100644 --- a/esphome/components/ccs811/ccs811.cpp +++ b/esphome/components/ccs811/ccs811.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ccs811 { -static const char *TAG = "ccs811"; +static const char *const TAG = "ccs811"; // based on // - https://cdn.sparkfun.com/datasheets/BreakoutBoards/CCS811_Programming_Guide.pdf diff --git a/esphome/components/climate/climate.cpp b/esphome/components/climate/climate.cpp index c047d96cdb..49ed8d922c 100644 --- a/esphome/components/climate/climate.cpp +++ b/esphome/components/climate/climate.cpp @@ -3,7 +3,7 @@ namespace esphome { namespace climate { -static const char *TAG = "climate"; +static const char *const TAG = "climate"; void ClimateCall::perform() { ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str()); diff --git a/esphome/components/climate_ir/climate_ir.cpp b/esphome/components/climate_ir/climate_ir.cpp index 8f06ff2214..3c9d118736 100644 --- a/esphome/components/climate_ir/climate_ir.cpp +++ b/esphome/components/climate_ir/climate_ir.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace climate_ir { -static const char *TAG = "climate_ir"; +static const char *const TAG = "climate_ir"; climate::ClimateTraits ClimateIR::traits() { auto traits = climate::ClimateTraits(); diff --git a/esphome/components/climate_ir_lg/climate_ir_lg.cpp b/esphome/components/climate_ir_lg/climate_ir_lg.cpp index 983d33c0b1..892560db8d 100644 --- a/esphome/components/climate_ir_lg/climate_ir_lg.cpp +++ b/esphome/components/climate_ir_lg/climate_ir_lg.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace climate_ir_lg { -static const char *TAG = "climate.climate_ir_lg"; +static const char *const TAG = "climate.climate_ir_lg"; const uint32_t COMMAND_ON = 0x00000; const uint32_t COMMAND_ON_AI = 0x03000; diff --git a/esphome/components/coolix/coolix.cpp b/esphome/components/coolix/coolix.cpp index e50521a348..b28cee9245 100644 --- a/esphome/components/coolix/coolix.cpp +++ b/esphome/components/coolix/coolix.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace coolix { -static const char *TAG = "coolix.climate"; +static const char *const TAG = "coolix.climate"; const uint32_t COOLIX_OFF = 0xB27BE0; const uint32_t COOLIX_SWING = 0xB26BE0; diff --git a/esphome/components/cover/cover.cpp b/esphome/components/cover/cover.cpp index 8d87ecfd1a..2b4452f5b7 100644 --- a/esphome/components/cover/cover.cpp +++ b/esphome/components/cover/cover.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace cover { -static const char *TAG = "cover"; +static const char *const TAG = "cover"; const float COVER_OPEN = 1.0f; const float COVER_CLOSED = 0.0f; diff --git a/esphome/components/cs5460a/cs5460a.cpp b/esphome/components/cs5460a/cs5460a.cpp index 03cbd83513..a172bcdf56 100644 --- a/esphome/components/cs5460a/cs5460a.cpp +++ b/esphome/components/cs5460a/cs5460a.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace cs5460a { -static const char *TAG = "cs5460a"; +static const char *const TAG = "cs5460a"; void CS5460AComponent::write_register_(enum CS5460ARegister addr, uint32_t value) { this->write_byte(CMD_WRITE | (addr << 1)); diff --git a/esphome/components/cse7766/cse7766.cpp b/esphome/components/cse7766/cse7766.cpp index 6c014138fd..87bc4c4bdf 100644 --- a/esphome/components/cse7766/cse7766.cpp +++ b/esphome/components/cse7766/cse7766.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace cse7766 { -static const char *TAG = "cse7766"; +static const char *const TAG = "cse7766"; void CSE7766Component::loop() { const uint32_t now = millis(); diff --git a/esphome/components/ct_clamp/ct_clamp_sensor.cpp b/esphome/components/ct_clamp/ct_clamp_sensor.cpp index c1e3bec486..c27134d6ac 100644 --- a/esphome/components/ct_clamp/ct_clamp_sensor.cpp +++ b/esphome/components/ct_clamp/ct_clamp_sensor.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace ct_clamp { -static const char *TAG = "ct_clamp"; +static const char *const TAG = "ct_clamp"; void CTClampSensor::setup() { this->is_calibrating_offset_ = true; diff --git a/esphome/components/custom/binary_sensor/custom_binary_sensor.cpp b/esphome/components/custom/binary_sensor/custom_binary_sensor.cpp index cfd85e6f2a..ea83198568 100644 --- a/esphome/components/custom/binary_sensor/custom_binary_sensor.cpp +++ b/esphome/components/custom/binary_sensor/custom_binary_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace custom { -static const char *TAG = "custom.binary_sensor"; +static const char *const TAG = "custom.binary_sensor"; void CustomBinarySensorConstructor::dump_config() { for (auto *child : this->binary_sensors_) { diff --git a/esphome/components/custom/sensor/custom_sensor.cpp b/esphome/components/custom/sensor/custom_sensor.cpp index 736a9110dd..e670f09530 100644 --- a/esphome/components/custom/sensor/custom_sensor.cpp +++ b/esphome/components/custom/sensor/custom_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace custom { -static const char *TAG = "custom.sensor"; +static const char *const TAG = "custom.sensor"; void CustomSensorConstructor::dump_config() { for (auto *child : this->sensors_) { diff --git a/esphome/components/custom/switch/custom_switch.cpp b/esphome/components/custom/switch/custom_switch.cpp index cc7f6b3640..6d0a8fa621 100644 --- a/esphome/components/custom/switch/custom_switch.cpp +++ b/esphome/components/custom/switch/custom_switch.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace custom { -static const char *TAG = "custom.switch"; +static const char *const TAG = "custom.switch"; void CustomSwitchConstructor::dump_config() { for (auto *child : this->switches_) { diff --git a/esphome/components/custom/text_sensor/custom_text_sensor.cpp b/esphome/components/custom/text_sensor/custom_text_sensor.cpp index dec96387e7..618ba832a5 100644 --- a/esphome/components/custom/text_sensor/custom_text_sensor.cpp +++ b/esphome/components/custom/text_sensor/custom_text_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace custom { -static const char *TAG = "custom.text_sensor"; +static const char *const TAG = "custom.text_sensor"; void CustomTextSensorConstructor::dump_config() { for (auto *child : this->text_sensors_) { diff --git a/esphome/components/daikin/daikin.cpp b/esphome/components/daikin/daikin.cpp index e0ffd46387..b426b85183 100644 --- a/esphome/components/daikin/daikin.cpp +++ b/esphome/components/daikin/daikin.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace daikin { -static const char *TAG = "daikin.climate"; +static const char *const TAG = "daikin.climate"; void DaikinClimate::transmit_state() { uint8_t remote_state[35] = {0x11, 0xDA, 0x27, 0x00, 0xC5, 0x00, 0x00, 0xD7, 0x11, 0xDA, 0x27, 0x00, diff --git a/esphome/components/dallas/dallas_component.cpp b/esphome/components/dallas/dallas_component.cpp index aa839e7331..7fc5e424f0 100644 --- a/esphome/components/dallas/dallas_component.cpp +++ b/esphome/components/dallas/dallas_component.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace dallas { -static const char *TAG = "dallas.sensor"; +static const char *const TAG = "dallas.sensor"; static const uint8_t DALLAS_MODEL_DS18S20 = 0x10; static const uint8_t DALLAS_MODEL_DS1822 = 0x22; diff --git a/esphome/components/dallas/esp_one_wire.cpp b/esphome/components/dallas/esp_one_wire.cpp index 92b7317f7c..702d1eddc2 100644 --- a/esphome/components/dallas/esp_one_wire.cpp +++ b/esphome/components/dallas/esp_one_wire.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace dallas { -static const char *TAG = "dallas.one_wire"; +static const char *const TAG = "dallas.one_wire"; const uint8_t ONE_WIRE_ROM_SELECT = 0x55; const int ONE_WIRE_ROM_SEARCH = 0xF0; diff --git a/esphome/components/debug/debug_component.cpp b/esphome/components/debug/debug_component.cpp index 4ffc034d50..668792c7b1 100644 --- a/esphome/components/debug/debug_component.cpp +++ b/esphome/components/debug/debug_component.cpp @@ -11,7 +11,7 @@ namespace esphome { namespace debug { -static const char *TAG = "debug"; +static const char *const TAG = "debug"; void DebugComponent::dump_config() { #ifndef ESPHOME_LOG_HAS_DEBUG diff --git a/esphome/components/deep_sleep/deep_sleep_component.cpp b/esphome/components/deep_sleep/deep_sleep_component.cpp index 684d7e12bf..de5672759a 100644 --- a/esphome/components/deep_sleep/deep_sleep_component.cpp +++ b/esphome/components/deep_sleep/deep_sleep_component.cpp @@ -5,9 +5,9 @@ namespace esphome { namespace deep_sleep { -static const char *TAG = "deep_sleep"; +static const char *const TAG = "deep_sleep"; -bool global_has_deep_sleep = false; +bool global_has_deep_sleep = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) void DeepSleepComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up Deep Sleep..."); diff --git a/esphome/components/deep_sleep/deep_sleep_component.h b/esphome/components/deep_sleep/deep_sleep_component.h index 09212d7d17..e163cf7709 100644 --- a/esphome/components/deep_sleep/deep_sleep_component.h +++ b/esphome/components/deep_sleep/deep_sleep_component.h @@ -79,7 +79,7 @@ class DeepSleepComponent : public Component { bool prevent_{false}; }; -extern bool global_has_deep_sleep; +extern bool global_has_deep_sleep; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) template class EnterDeepSleepAction : public Action { public: diff --git a/esphome/components/dfplayer/dfplayer.cpp b/esphome/components/dfplayer/dfplayer.cpp index cee407280b..7df551f5d2 100644 --- a/esphome/components/dfplayer/dfplayer.cpp +++ b/esphome/components/dfplayer/dfplayer.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace dfplayer { -static const char *TAG = "dfplayer"; +static const char *const TAG = "dfplayer"; void DFPlayer::play_folder(uint16_t folder, uint16_t file) { if (folder < 100 && file < 256) { diff --git a/esphome/components/dht/dht.cpp b/esphome/components/dht/dht.cpp index 9626260cf2..fd51a976b7 100644 --- a/esphome/components/dht/dht.cpp +++ b/esphome/components/dht/dht.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace dht { -static const char *TAG = "dht"; +static const char *const TAG = "dht"; void DHT::setup() { ESP_LOGCONFIG(TAG, "Setting up DHT..."); diff --git a/esphome/components/dht12/dht12.cpp b/esphome/components/dht12/dht12.cpp index 3c18f8055d..a5e1886918 100644 --- a/esphome/components/dht12/dht12.cpp +++ b/esphome/components/dht12/dht12.cpp @@ -8,7 +8,7 @@ namespace esphome { namespace dht12 { -static const char *TAG = "dht12"; +static const char *const TAG = "dht12"; void DHT12Component::update() { uint8_t data[5]; diff --git a/esphome/components/display/display_buffer.cpp b/esphome/components/display/display_buffer.cpp index f88636d7f5..08050b2078 100644 --- a/esphome/components/display/display_buffer.cpp +++ b/esphome/components/display/display_buffer.cpp @@ -8,7 +8,7 @@ namespace esphome { namespace display { -static const char *TAG = "display"; +static const char *const TAG = "display"; const Color COLOR_OFF(0, 0, 0, 0); const Color COLOR_ON(255, 255, 255, 255); diff --git a/esphome/components/ds1307/ds1307.cpp b/esphome/components/ds1307/ds1307.cpp index 2f33768132..d249e9743a 100644 --- a/esphome/components/ds1307/ds1307.cpp +++ b/esphome/components/ds1307/ds1307.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace ds1307 { -static const char *TAG = "ds1307"; +static const char *const TAG = "ds1307"; void DS1307Component::setup() { ESP_LOGCONFIG(TAG, "Setting up DS1307..."); diff --git a/esphome/components/duty_cycle/duty_cycle_sensor.cpp b/esphome/components/duty_cycle/duty_cycle_sensor.cpp index 36147d0b63..8b7446b681 100644 --- a/esphome/components/duty_cycle/duty_cycle_sensor.cpp +++ b/esphome/components/duty_cycle/duty_cycle_sensor.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace duty_cycle { -static const char *TAG = "duty_cycle"; +static const char *const TAG = "duty_cycle"; void DutyCycleSensor::setup() { ESP_LOGCONFIG(TAG, "Setting up Duty Cycle Sensor '%s'...", this->get_name().c_str()); diff --git a/esphome/components/e131/e131.cpp b/esphome/components/e131/e131.cpp index 8a293e9067..fb72e5b470 100644 --- a/esphome/components/e131/e131.cpp +++ b/esphome/components/e131/e131.cpp @@ -14,7 +14,7 @@ namespace esphome { namespace e131 { -static const char *TAG = "e131"; +static const char *const TAG = "e131"; static const int PORT = 5568; E131Component::E131Component() {} diff --git a/esphome/components/e131/e131_addressable_light_effect.cpp b/esphome/components/e131/e131_addressable_light_effect.cpp index 5bf28f0f11..f280b5bc94 100644 --- a/esphome/components/e131/e131_addressable_light_effect.cpp +++ b/esphome/components/e131/e131_addressable_light_effect.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace e131 { -static const char *TAG = "e131_addressable_light_effect"; +static const char *const TAG = "e131_addressable_light_effect"; static const int MAX_DATA_SIZE = (sizeof(E131Packet::values) - 1); E131AddressableLightEffect::E131AddressableLightEffect(const std::string &name) : AddressableLightEffect(name) {} diff --git a/esphome/components/e131/e131_packet.cpp b/esphome/components/e131/e131_packet.cpp index 7edc8b129a..14fdc084a6 100644 --- a/esphome/components/e131/e131_packet.cpp +++ b/esphome/components/e131/e131_packet.cpp @@ -8,7 +8,7 @@ namespace esphome { namespace e131 { -static const char *TAG = "e131"; +static const char *const TAG = "e131"; static const uint8_t ACN_ID[12] = {0x41, 0x53, 0x43, 0x2d, 0x45, 0x31, 0x2e, 0x31, 0x37, 0x00, 0x00, 0x00}; static const uint32_t VECTOR_ROOT = 4; diff --git a/esphome/components/endstop/endstop_cover.cpp b/esphome/components/endstop/endstop_cover.cpp index 8e20cb6a29..cbc4b334d9 100644 --- a/esphome/components/endstop/endstop_cover.cpp +++ b/esphome/components/endstop/endstop_cover.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace endstop { -static const char *TAG = "endstop.cover"; +static const char *const TAG = "endstop.cover"; using namespace esphome::cover; diff --git a/esphome/components/esp32_ble/ble.cpp b/esphome/components/esp32_ble/ble.cpp index 889c793017..3da2d265bf 100644 --- a/esphome/components/esp32_ble/ble.cpp +++ b/esphome/components/esp32_ble/ble.cpp @@ -14,7 +14,7 @@ namespace esphome { namespace esp32_ble { -static const char *TAG = "esp32_ble"; +static const char *const TAG = "esp32_ble"; void ESP32BLE::setup() { global_ble = this; diff --git a/esphome/components/esp32_ble/ble_characteristic.cpp b/esphome/components/esp32_ble/ble_characteristic.cpp index 127f973146..92a62a2c23 100644 --- a/esphome/components/esp32_ble/ble_characteristic.cpp +++ b/esphome/components/esp32_ble/ble_characteristic.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace esp32_ble { -static const char *TAG = "esp32_ble.characteristic"; +static const char *const TAG = "esp32_ble.characteristic"; BLECharacteristic::BLECharacteristic(const ESPBTUUID uuid, uint32_t properties) : uuid_(uuid) { this->set_value_lock_ = xSemaphoreCreateBinary(); diff --git a/esphome/components/esp32_ble/ble_descriptor.cpp b/esphome/components/esp32_ble/ble_descriptor.cpp index 9738cc2fe7..b66b1fc086 100644 --- a/esphome/components/esp32_ble/ble_descriptor.cpp +++ b/esphome/components/esp32_ble/ble_descriptor.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace esp32_ble { -static const char *TAG = "esp32_ble.descriptor"; +static const char *const TAG = "esp32_ble.descriptor"; BLEDescriptor::BLEDescriptor(ESPBTUUID uuid, uint16_t max_len) { this->uuid_ = uuid; diff --git a/esphome/components/esp32_ble/ble_server.cpp b/esphome/components/esp32_ble/ble_server.cpp index 9d5be46113..f751a8bfe7 100644 --- a/esphome/components/esp32_ble/ble_server.cpp +++ b/esphome/components/esp32_ble/ble_server.cpp @@ -16,7 +16,7 @@ namespace esphome { namespace esp32_ble { -static const char *TAG = "esp32_ble.server"; +static const char *const TAG = "esp32_ble.server"; static const uint16_t device_information_service__UUID = 0x180A; static const uint16_t MODEL_UUID = 0x2A24; diff --git a/esphome/components/esp32_ble/ble_service.cpp b/esphome/components/esp32_ble/ble_service.cpp index 4b85182696..2a47032f8f 100644 --- a/esphome/components/esp32_ble/ble_service.cpp +++ b/esphome/components/esp32_ble/ble_service.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace esp32_ble { -static const char *TAG = "esp32_ble.service"; +static const char *const TAG = "esp32_ble.service"; BLEService::BLEService(ESPBTUUID uuid, uint16_t num_handles, uint8_t inst_id) : uuid_(uuid), num_handles_(num_handles), inst_id_(inst_id) {} diff --git a/esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp b/esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp index b7810bd056..1b06fd787e 100644 --- a/esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +++ b/esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp @@ -13,7 +13,7 @@ namespace esphome { namespace esp32_ble_beacon { -static const char *TAG = "esp32_ble_beacon"; +static const char *const TAG = "esp32_ble_beacon"; static esp_ble_adv_params_t ble_adv_params = { .adv_int_min = 0x20, diff --git a/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp b/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp index 7a5b023387..2a3403f88d 100644 --- a/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +++ b/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp @@ -19,7 +19,7 @@ namespace esphome { namespace esp32_ble_tracker { -static const char *TAG = "esp32_ble_tracker"; +static const char *const TAG = "esp32_ble_tracker"; ESP32BLETracker *global_esp32_ble_tracker = nullptr; diff --git a/esphome/components/esp32_camera/esp32_camera.cpp b/esphome/components/esp32_camera/esp32_camera.cpp index 6bb57a8304..500ddd67c9 100644 --- a/esphome/components/esp32_camera/esp32_camera.cpp +++ b/esphome/components/esp32_camera/esp32_camera.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace esp32_camera { -static const char *TAG = "esp32_camera"; +static const char *const TAG = "esp32_camera"; void ESP32Camera::setup() { global_esp32_camera = this; diff --git a/esphome/components/esp32_dac/esp32_dac.cpp b/esphome/components/esp32_dac/esp32_dac.cpp index cd0696b1ad..20a047f0ba 100644 --- a/esphome/components/esp32_dac/esp32_dac.cpp +++ b/esphome/components/esp32_dac/esp32_dac.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace esp32_dac { -static const char *TAG = "esp32_dac"; +static const char *const TAG = "esp32_dac"; void ESP32DAC::setup() { ESP_LOGCONFIG(TAG, "Setting up ESP32 DAC Output..."); diff --git a/esphome/components/esp32_hall/esp32_hall.cpp b/esphome/components/esp32_hall/esp32_hall.cpp index d7964bcaa6..4bbf65e048 100644 --- a/esphome/components/esp32_hall/esp32_hall.cpp +++ b/esphome/components/esp32_hall/esp32_hall.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace esp32_hall { -static const char *TAG = "esp32_hall"; +static const char *const TAG = "esp32_hall"; void ESP32HallSensor::update() { float value = (hallRead() / 4095.0f) * 10000.0f; diff --git a/esphome/components/esp32_improv/esp32_improv_component.cpp b/esphome/components/esp32_improv/esp32_improv_component.cpp index 491f26f46e..6921c9115b 100644 --- a/esphome/components/esp32_improv/esp32_improv_component.cpp +++ b/esphome/components/esp32_improv/esp32_improv_component.cpp @@ -8,7 +8,7 @@ namespace esphome { namespace esp32_improv { -static const char *TAG = "esp32_improv.component"; +static const char *const TAG = "esp32_improv.component"; ESP32ImprovComponent::ESP32ImprovComponent() { global_improv_component = this; } diff --git a/esphome/components/esp32_touch/esp32_touch.cpp b/esphome/components/esp32_touch/esp32_touch.cpp index ce0028159e..a990e632af 100644 --- a/esphome/components/esp32_touch/esp32_touch.cpp +++ b/esphome/components/esp32_touch/esp32_touch.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace esp32_touch { -static const char *TAG = "esp32_touch"; +static const char *const TAG = "esp32_touch"; void ESP32TouchComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up ESP32 Touch Hub..."); diff --git a/esphome/components/esp8266_pwm/esp8266_pwm.cpp b/esphome/components/esp8266_pwm/esp8266_pwm.cpp index b3fd2398f3..37a9f3efbf 100644 --- a/esphome/components/esp8266_pwm/esp8266_pwm.cpp +++ b/esphome/components/esp8266_pwm/esp8266_pwm.cpp @@ -11,7 +11,7 @@ namespace esphome { namespace esp8266_pwm { -static const char *TAG = "esp8266_pwm"; +static const char *const TAG = "esp8266_pwm"; void ESP8266PWM::setup() { ESP_LOGCONFIG(TAG, "Setting up ESP8266 PWM Output..."); diff --git a/esphome/components/ethernet/ethernet_component.cpp b/esphome/components/ethernet/ethernet_component.cpp index c5dc9bdc93..22007caafa 100644 --- a/esphome/components/ethernet/ethernet_component.cpp +++ b/esphome/components/ethernet/ethernet_component.cpp @@ -21,7 +21,7 @@ extern void tcpipInit(); namespace esphome { namespace ethernet { -static const char *TAG = "ethernet"; +static const char *const TAG = "ethernet"; EthernetComponent *global_eth_component; diff --git a/esphome/components/exposure_notifications/exposure_notifications.cpp b/esphome/components/exposure_notifications/exposure_notifications.cpp index 1d8cf83a0e..9db181fbee 100644 --- a/esphome/components/exposure_notifications/exposure_notifications.cpp +++ b/esphome/components/exposure_notifications/exposure_notifications.cpp @@ -9,7 +9,7 @@ namespace exposure_notifications { using namespace esp32_ble_tracker; -static const char *TAG = "exposure_notifications"; +static const char *const TAG = "exposure_notifications"; bool ExposureNotificationTrigger::parse_device(const ESPBTDevice &device) { // See also https://blog.google/documents/70/Exposure_Notification_-_Bluetooth_Specification_v1.2.2.pdf diff --git a/esphome/components/ezo/ezo.cpp b/esphome/components/ezo/ezo.cpp index 97caa1495b..90b1e4ace9 100644 --- a/esphome/components/ezo/ezo.cpp +++ b/esphome/components/ezo/ezo.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ezo { -static const char *TAG = "ezo.sensor"; +static const char *const TAG = "ezo.sensor"; static const uint16_t EZO_STATE_WAIT = 1; static const uint16_t EZO_STATE_SEND_TEMP = 2; diff --git a/esphome/components/fan/automation.cpp b/esphome/components/fan/automation.cpp index 3c9ca9b6ed..79e583fc57 100644 --- a/esphome/components/fan/automation.cpp +++ b/esphome/components/fan/automation.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace fan { -static const char *TAG = "fan.automation"; +static const char *const TAG = "fan.automation"; } // namespace fan } // namespace esphome diff --git a/esphome/components/fan/fan_state.cpp b/esphome/components/fan/fan_state.cpp index 5a3a7ecebc..7cfe3afef7 100644 --- a/esphome/components/fan/fan_state.cpp +++ b/esphome/components/fan/fan_state.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace fan { -static const char *TAG = "fan"; +static const char *const TAG = "fan"; const FanTraits &FanState::get_traits() const { return this->traits_; } void FanState::set_traits(const FanTraits &traits) { this->traits_ = traits; } diff --git a/esphome/components/fastled_base/fastled_light.cpp b/esphome/components/fastled_base/fastled_light.cpp index 8420748dd5..4d791f5709 100644 --- a/esphome/components/fastled_base/fastled_light.cpp +++ b/esphome/components/fastled_base/fastled_light.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace fastled_base { -static const char *TAG = "fastled"; +static const char *const TAG = "fastled"; void FastLEDLightOutput::setup() { ESP_LOGCONFIG(TAG, "Setting up FastLED light..."); diff --git a/esphome/components/fingerprint_grow/fingerprint_grow.cpp b/esphome/components/fingerprint_grow/fingerprint_grow.cpp index 3d15531c77..b0c0be59af 100644 --- a/esphome/components/fingerprint_grow/fingerprint_grow.cpp +++ b/esphome/components/fingerprint_grow/fingerprint_grow.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace fingerprint_grow { -static const char *TAG = "fingerprint_grow"; +static const char *const TAG = "fingerprint_grow"; // Based on Adafruit's library: https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library diff --git a/esphome/components/fujitsu_general/fujitsu_general.cpp b/esphome/components/fujitsu_general/fujitsu_general.cpp index 5bf4710e58..892f9cd726 100644 --- a/esphome/components/fujitsu_general/fujitsu_general.cpp +++ b/esphome/components/fujitsu_general/fujitsu_general.cpp @@ -9,7 +9,7 @@ namespace fujitsu_general { ((message)[(nibble) / 2] |= ((value) &0b00001111) << (((nibble) % 2) ? 0 : 4)) #define GET_NIBBLE(message, nibble) (((message)[(nibble) / 2] >> (((nibble) % 2) ? 0 : 4)) & 0b00001111) -static const char *TAG = "fujitsu_general.climate"; +static const char *const TAG = "fujitsu_general.climate"; // Common header const uint8_t FUJITSU_GENERAL_COMMON_LENGTH = 6; diff --git a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp index f95778af4c..cf4b088580 100644 --- a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp +++ b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace gpio { -static const char *TAG = "gpio.binary_sensor"; +static const char *const TAG = "gpio.binary_sensor"; void GPIOBinarySensor::setup() { this->pin_->setup(); diff --git a/esphome/components/gpio/output/gpio_binary_output.cpp b/esphome/components/gpio/output/gpio_binary_output.cpp index b64492f497..a7dd9ab188 100644 --- a/esphome/components/gpio/output/gpio_binary_output.cpp +++ b/esphome/components/gpio/output/gpio_binary_output.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace gpio { -static const char *TAG = "gpio.output"; +static const char *const TAG = "gpio.output"; void GPIOBinaryOutput::dump_config() { ESP_LOGCONFIG(TAG, "GPIO Binary Output:"); diff --git a/esphome/components/gpio/switch/gpio_switch.cpp b/esphome/components/gpio/switch/gpio_switch.cpp index 2475d43e93..410a3818d6 100644 --- a/esphome/components/gpio/switch/gpio_switch.cpp +++ b/esphome/components/gpio/switch/gpio_switch.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace gpio { -static const char *TAG = "switch.gpio"; +static const char *const TAG = "switch.gpio"; float GPIOSwitch::get_setup_priority() const { return setup_priority::HARDWARE; } void GPIOSwitch::setup() { diff --git a/esphome/components/gps/gps.cpp b/esphome/components/gps/gps.cpp index ba0afdf7cc..1e8ca94e9e 100644 --- a/esphome/components/gps/gps.cpp +++ b/esphome/components/gps/gps.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace gps { -static const char *TAG = "gps"; +static const char *const TAG = "gps"; TinyGPSPlus &GPSListener::get_tiny_gps() { return this->parent_->get_tiny_gps(); } diff --git a/esphome/components/gps/time/gps_time.cpp b/esphome/components/gps/time/gps_time.cpp index 468ad09bac..5352c7e059 100644 --- a/esphome/components/gps/time/gps_time.cpp +++ b/esphome/components/gps/time/gps_time.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace gps { -static const char *TAG = "gps.time"; +static const char *const TAG = "gps.time"; void GPSTime::from_tiny_gps_(TinyGPSPlus &tiny_gps) { if (!tiny_gps.time.isValid() || !tiny_gps.date.isValid()) diff --git a/esphome/components/hdc1080/hdc1080.cpp b/esphome/components/hdc1080/hdc1080.cpp index 915c44b155..507ac77a28 100644 --- a/esphome/components/hdc1080/hdc1080.cpp +++ b/esphome/components/hdc1080/hdc1080.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace hdc1080 { -static const char *TAG = "hdc1080"; +static const char *const TAG = "hdc1080"; static const uint8_t HDC1080_ADDRESS = 0x40; // 0b1000000 from datasheet static const uint8_t HDC1080_CMD_CONFIGURATION = 0x02; diff --git a/esphome/components/hitachi_ac344/hitachi_ac344.cpp b/esphome/components/hitachi_ac344/hitachi_ac344.cpp index b2798b608a..35b3d17358 100644 --- a/esphome/components/hitachi_ac344/hitachi_ac344.cpp +++ b/esphome/components/hitachi_ac344/hitachi_ac344.cpp @@ -3,7 +3,7 @@ namespace esphome { namespace hitachi_ac344 { -static const char *TAG = "climate.hitachi_ac344"; +static const char *const TAG = "climate.hitachi_ac344"; void set_bits(uint8_t *const dst, const uint8_t offset, const uint8_t nbits, const uint8_t data) { if (offset >= 8 || !nbits) diff --git a/esphome/components/hlw8012/hlw8012.cpp b/esphome/components/hlw8012/hlw8012.cpp index 379dbe578e..356dbd0bf4 100644 --- a/esphome/components/hlw8012/hlw8012.cpp +++ b/esphome/components/hlw8012/hlw8012.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace hlw8012 { -static const char *TAG = "hlw8012"; +static const char *const TAG = "hlw8012"; static const uint32_t HLW8012_CLOCK_FREQUENCY = 3579000; static const float HLW8012_REFERENCE_VOLTAGE = 2.43f; diff --git a/esphome/components/hm3301/hm3301.cpp b/esphome/components/hm3301/hm3301.cpp index cbce714012..5612867d1b 100644 --- a/esphome/components/hm3301/hm3301.cpp +++ b/esphome/components/hm3301/hm3301.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace hm3301 { -static const char *TAG = "hm3301.sensor"; +static const char *const TAG = "hm3301.sensor"; static const uint8_t PM_1_0_VALUE_INDEX = 5; static const uint8_t PM_2_5_VALUE_INDEX = 6; diff --git a/esphome/components/hmc5883l/hmc5883l.cpp b/esphome/components/hmc5883l/hmc5883l.cpp index 9094548bb3..de3903d7e2 100644 --- a/esphome/components/hmc5883l/hmc5883l.cpp +++ b/esphome/components/hmc5883l/hmc5883l.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace hmc5883l { -static const char *TAG = "hmc5883l"; +static const char *const TAG = "hmc5883l"; static const uint8_t HMC5883L_ADDRESS = 0x1E; static const uint8_t HMC5883L_REGISTER_CONFIG_A = 0x00; static const uint8_t HMC5883L_REGISTER_CONFIG_B = 0x01; diff --git a/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.cpp b/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.cpp index b4c68615d7..cea02f072a 100644 --- a/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.cpp +++ b/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace homeassistant { -static const char *TAG = "homeassistant.binary_sensor"; +static const char *const TAG = "homeassistant.binary_sensor"; void HomeassistantBinarySensor::setup() { api::global_api_server->subscribe_home_assistant_state( diff --git a/esphome/components/homeassistant/sensor/homeassistant_sensor.cpp b/esphome/components/homeassistant/sensor/homeassistant_sensor.cpp index da870bd90b..b6f2acdbe4 100644 --- a/esphome/components/homeassistant/sensor/homeassistant_sensor.cpp +++ b/esphome/components/homeassistant/sensor/homeassistant_sensor.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace homeassistant { -static const char *TAG = "homeassistant.sensor"; +static const char *const TAG = "homeassistant.sensor"; void HomeassistantSensor::setup() { api::global_api_server->subscribe_home_assistant_state( diff --git a/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp b/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp index 962663d8b4..9b933fbbbe 100644 --- a/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp +++ b/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace homeassistant { -static const char *TAG = "homeassistant.text_sensor"; +static const char *const TAG = "homeassistant.text_sensor"; void HomeassistantTextSensor::setup() { api::global_api_server->subscribe_home_assistant_state( diff --git a/esphome/components/homeassistant/time/homeassistant_time.cpp b/esphome/components/homeassistant/time/homeassistant_time.cpp index 9ace8cf67f..9f5239404a 100644 --- a/esphome/components/homeassistant/time/homeassistant_time.cpp +++ b/esphome/components/homeassistant/time/homeassistant_time.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace homeassistant { -static const char *TAG = "homeassistant.time"; +static const char *const TAG = "homeassistant.time"; void HomeassistantTime::dump_config() { ESP_LOGCONFIG(TAG, "Home Assistant Time:"); @@ -17,6 +17,6 @@ void HomeassistantTime::setup() { global_homeassistant_time = this; } void HomeassistantTime::update() { api::global_api_server->request_time(); } -HomeassistantTime *global_homeassistant_time = nullptr; +HomeassistantTime *global_homeassistant_time = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace homeassistant } // namespace esphome diff --git a/esphome/components/homeassistant/time/homeassistant_time.h b/esphome/components/homeassistant/time/homeassistant_time.h index 94f4704c2f..36e28ea16b 100644 --- a/esphome/components/homeassistant/time/homeassistant_time.h +++ b/esphome/components/homeassistant/time/homeassistant_time.h @@ -16,7 +16,7 @@ class HomeassistantTime : public time::RealTimeClock { float get_setup_priority() const override; }; -extern HomeassistantTime *global_homeassistant_time; +extern HomeassistantTime *global_homeassistant_time; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace homeassistant } // namespace esphome diff --git a/esphome/components/http_request/http_request.cpp b/esphome/components/http_request/http_request.cpp index fbe4fa0e54..0fafa8cd86 100644 --- a/esphome/components/http_request/http_request.cpp +++ b/esphome/components/http_request/http_request.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace http_request { -static const char *TAG = "http_request"; +static const char *const TAG = "http_request"; void HttpRequestComponent::dump_config() { ESP_LOGCONFIG(TAG, "HTTP Request:"); diff --git a/esphome/components/htu21d/htu21d.cpp b/esphome/components/htu21d/htu21d.cpp index 45926dae36..a954b2ad59 100644 --- a/esphome/components/htu21d/htu21d.cpp +++ b/esphome/components/htu21d/htu21d.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace htu21d { -static const char *TAG = "htu21d"; +static const char *const TAG = "htu21d"; static const uint8_t HTU21D_ADDRESS = 0x40; static const uint8_t HTU21D_REGISTER_RESET = 0xFE; diff --git a/esphome/components/hx711/hx711.cpp b/esphome/components/hx711/hx711.cpp index 605f534f91..62adc4ae86 100644 --- a/esphome/components/hx711/hx711.cpp +++ b/esphome/components/hx711/hx711.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace hx711 { -static const char *TAG = "hx711"; +static const char *const TAG = "hx711"; void HX711Sensor::setup() { ESP_LOGCONFIG(TAG, "Setting up HX711 '%s'...", this->name_.c_str()); diff --git a/esphome/components/i2c/i2c.cpp b/esphome/components/i2c/i2c.cpp index 2111711264..77dfcedc04 100644 --- a/esphome/components/i2c/i2c.cpp +++ b/esphome/components/i2c/i2c.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace i2c { -static const char *TAG = "i2c"; +static const char *const TAG = "i2c"; I2CComponent::I2CComponent() { #ifdef ARDUINO_ARCH_ESP32 diff --git a/esphome/components/ili9341/ili9341_display.cpp b/esphome/components/ili9341/ili9341_display.cpp index 48a95f4df0..e973671acc 100644 --- a/esphome/components/ili9341/ili9341_display.cpp +++ b/esphome/components/ili9341/ili9341_display.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace ili9341 { -static const char *TAG = "ili9341"; +static const char *const TAG = "ili9341"; void ILI9341Display::setup_pins_() { this->init_internal_(this->get_buffer_length_()); diff --git a/esphome/components/improv/improv.h b/esphome/components/improv/improv.h index 3d905e70f8..47afecfc2b 100644 --- a/esphome/components/improv/improv.h +++ b/esphome/components/improv/improv.h @@ -7,12 +7,12 @@ namespace improv { -static const char *SERVICE_UUID = "00467768-6228-2272-4663-277478268000"; -static const char *STATUS_UUID = "00467768-6228-2272-4663-277478268001"; -static const char *ERROR_UUID = "00467768-6228-2272-4663-277478268002"; -static const char *RPC_COMMAND_UUID = "00467768-6228-2272-4663-277478268003"; -static const char *RPC_RESULT_UUID = "00467768-6228-2272-4663-277478268004"; -static const char *CAPABILITIES_UUID = "00467768-6228-2272-4663-277478268005"; +static const char *const SERVICE_UUID = "00467768-6228-2272-4663-277478268000"; +static const char *const STATUS_UUID = "00467768-6228-2272-4663-277478268001"; +static const char *const ERROR_UUID = "00467768-6228-2272-4663-277478268002"; +static const char *const RPC_COMMAND_UUID = "00467768-6228-2272-4663-277478268003"; +static const char *const RPC_RESULT_UUID = "00467768-6228-2272-4663-277478268004"; +static const char *const CAPABILITIES_UUID = "00467768-6228-2272-4663-277478268005"; enum Error : uint8_t { ERROR_NONE = 0x00, diff --git a/esphome/components/ina219/ina219.cpp b/esphome/components/ina219/ina219.cpp index 44d6501e36..506b7e06ed 100644 --- a/esphome/components/ina219/ina219.cpp +++ b/esphome/components/ina219/ina219.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ina219 { -static const char *TAG = "ina219"; +static const char *const TAG = "ina219"; // | A0 | A1 | Address | // | GND | GND | 0x40 | diff --git a/esphome/components/ina226/ina226.cpp b/esphome/components/ina226/ina226.cpp index cbb06d73b6..701a833041 100644 --- a/esphome/components/ina226/ina226.cpp +++ b/esphome/components/ina226/ina226.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ina226 { -static const char *TAG = "ina226"; +static const char *const TAG = "ina226"; // | A0 | A1 | Address | // | GND | GND | 0x40 | diff --git a/esphome/components/ina3221/ina3221.cpp b/esphome/components/ina3221/ina3221.cpp index 17492433e3..f2fcdb21eb 100644 --- a/esphome/components/ina3221/ina3221.cpp +++ b/esphome/components/ina3221/ina3221.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ina3221 { -static const char *TAG = "ina3221"; +static const char *const TAG = "ina3221"; static const uint8_t INA3221_REGISTER_CONFIG = 0x00; static const uint8_t INA3221_REGISTER_CHANNEL1_SHUNT_VOLTAGE = 0x01; diff --git a/esphome/components/inkbird_ibsth1_mini/inkbird_ibsth1_mini.cpp b/esphome/components/inkbird_ibsth1_mini/inkbird_ibsth1_mini.cpp index a1c1c5d201..03bc4f9f92 100644 --- a/esphome/components/inkbird_ibsth1_mini/inkbird_ibsth1_mini.cpp +++ b/esphome/components/inkbird_ibsth1_mini/inkbird_ibsth1_mini.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace inkbird_ibsth1_mini { -static const char *TAG = "inkbird_ibsth1_mini"; +static const char *const TAG = "inkbird_ibsth1_mini"; void InkbirdIBSTH1_MINI::dump_config() { ESP_LOGCONFIG(TAG, "Inkbird IBS TH1 MINI"); diff --git a/esphome/components/inkplate6/inkplate.cpp b/esphome/components/inkplate6/inkplate.cpp index d60f97c36d..089b4791a6 100644 --- a/esphome/components/inkplate6/inkplate.cpp +++ b/esphome/components/inkplate6/inkplate.cpp @@ -8,7 +8,7 @@ namespace esphome { namespace inkplate6 { -static const char *TAG = "inkplate"; +static const char *const TAG = "inkplate"; void Inkplate6::setup() { this->initialize_(); diff --git a/esphome/components/integration/integration_sensor.cpp b/esphome/components/integration/integration_sensor.cpp index 806c0ce567..bfcf8d3561 100644 --- a/esphome/components/integration/integration_sensor.cpp +++ b/esphome/components/integration/integration_sensor.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace integration { -static const char *TAG = "integration"; +static const char *const TAG = "integration"; void IntegrationSensor::setup() { if (this->restore_) { diff --git a/esphome/components/json/json_util.cpp b/esphome/components/json/json_util.cpp index b82ddf90f0..4720c8f9c9 100644 --- a/esphome/components/json/json_util.cpp +++ b/esphome/components/json/json_util.cpp @@ -4,10 +4,10 @@ namespace esphome { namespace json { -static const char *TAG = "json"; +static const char *const TAG = "json"; -static char *global_json_build_buffer = nullptr; -static size_t global_json_build_buffer_size = 0; +static char *global_json_build_buffer = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) +static size_t global_json_build_buffer_size = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) void reserve_global_json_build_buffer(size_t required_size) { if (global_json_build_buffer_size == 0 || global_json_build_buffer_size < required_size) { @@ -123,7 +123,7 @@ void VectorJsonBuffer::reserve(size_t size) { // NOLINT size_t VectorJsonBuffer::size() const { return this->size_; } -VectorJsonBuffer global_json_buffer; +VectorJsonBuffer global_json_buffer; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace json } // namespace esphome diff --git a/esphome/components/json/json_util.h b/esphome/components/json/json_util.h index d7b5267064..aafd039b9a 100644 --- a/esphome/components/json/json_util.h +++ b/esphome/components/json/json_util.h @@ -56,7 +56,7 @@ class VectorJsonBuffer : public ArduinoJson::Internals::JsonBufferBase free_blocks_; }; -extern VectorJsonBuffer global_json_buffer; +extern VectorJsonBuffer global_json_buffer; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace json } // namespace esphome diff --git a/esphome/components/lcd_base/lcd_display.cpp b/esphome/components/lcd_base/lcd_display.cpp index 50bd818cdb..95b349b9c1 100644 --- a/esphome/components/lcd_base/lcd_display.cpp +++ b/esphome/components/lcd_base/lcd_display.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace lcd_base { -static const char *TAG = "lcd"; +static const char *const TAG = "lcd"; // First set bit determines command, bits after that are the data. static const uint8_t LCD_DISPLAY_COMMAND_CLEAR_DISPLAY = 0x01; diff --git a/esphome/components/lcd_gpio/gpio_lcd_display.cpp b/esphome/components/lcd_gpio/gpio_lcd_display.cpp index 96d074bec8..5c1656ec3e 100644 --- a/esphome/components/lcd_gpio/gpio_lcd_display.cpp +++ b/esphome/components/lcd_gpio/gpio_lcd_display.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace lcd_gpio { -static const char *TAG = "lcd_gpio"; +static const char *const TAG = "lcd_gpio"; void GPIOLCDDisplay::setup() { ESP_LOGCONFIG(TAG, "Setting up GPIO LCD Display..."); diff --git a/esphome/components/lcd_pcf8574/pcf8574_display.cpp b/esphome/components/lcd_pcf8574/pcf8574_display.cpp index e3002da25d..4830b6f223 100644 --- a/esphome/components/lcd_pcf8574/pcf8574_display.cpp +++ b/esphome/components/lcd_pcf8574/pcf8574_display.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace lcd_pcf8574 { -static const char *TAG = "lcd_pcf8574"; +static const char *const TAG = "lcd_pcf8574"; static const uint8_t LCD_DISPLAY_BACKLIGHT_ON = 0x08; static const uint8_t LCD_DISPLAY_BACKLIGHT_OFF = 0x00; diff --git a/esphome/components/ledc/ledc_output.cpp b/esphome/components/ledc/ledc_output.cpp index d4e3327bb1..0575dbee6a 100644 --- a/esphome/components/ledc/ledc_output.cpp +++ b/esphome/components/ledc/ledc_output.cpp @@ -8,7 +8,7 @@ namespace esphome { namespace ledc { -static const char *TAG = "ledc.output"; +static const char *const TAG = "ledc.output"; void LEDCOutput::write_state(float state) { if (this->pin_->is_inverted()) diff --git a/esphome/components/light/addressable_light.cpp b/esphome/components/light/addressable_light.cpp index 64973549ec..ecc48e32b8 100644 --- a/esphome/components/light/addressable_light.cpp +++ b/esphome/components/light/addressable_light.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace light { -static const char *TAG = "light.addressable"; +static const char *const TAG = "light.addressable"; Color ESPHSVColor::to_rgb() const { // based on FastLED's hsv rainbow to rgb diff --git a/esphome/components/light/light_state.cpp b/esphome/components/light/light_state.cpp index e0a850149a..177dbb8d4e 100644 --- a/esphome/components/light/light_state.cpp +++ b/esphome/components/light/light_state.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace light { -static const char *TAG = "light"; +static const char *const TAG = "light"; void LightState::start_transition_(const LightColorValues &target, uint32_t length) { this->transformer_ = make_unique(millis(), length, this->current_values, target); diff --git a/esphome/components/logger/logger.cpp b/esphome/components/logger/logger.cpp index 9c65f494f0..ce82a51b94 100644 --- a/esphome/components/logger/logger.cpp +++ b/esphome/components/logger/logger.cpp @@ -8,9 +8,9 @@ namespace esphome { namespace logger { -static const char *TAG = "logger"; +static const char *const TAG = "logger"; -static const char *LOG_LEVEL_COLORS[] = { +static const char *const LOG_LEVEL_COLORS[] = { "", // NONE ESPHOME_LOG_BOLD(ESPHOME_LOG_COLOR_RED), // ERROR ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_YELLOW), // WARNING @@ -20,7 +20,7 @@ static const char *LOG_LEVEL_COLORS[] = { ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_GRAY), // VERBOSE ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_WHITE), // VERY_VERBOSE }; -static const char *LOG_LEVEL_LETTERS[] = { +static const char *const LOG_LEVEL_LETTERS[] = { "", // NONE "E", // ERROR "W", // WARNING @@ -178,12 +178,12 @@ void Logger::add_on_log_callback(std::functionlog_callback_.add(std::move(callback)); } float Logger::get_setup_priority() const { return setup_priority::HARDWARE - 1.0f; } -const char *LOG_LEVELS[] = {"NONE", "ERROR", "WARN", "INFO", "CONFIG", "DEBUG", "VERBOSE", "VERY_VERBOSE"}; +const char *const LOG_LEVELS[] = {"NONE", "ERROR", "WARN", "INFO", "CONFIG", "DEBUG", "VERBOSE", "VERY_VERBOSE"}; #ifdef ARDUINO_ARCH_ESP32 -const char *UART_SELECTIONS[] = {"UART0", "UART1", "UART2"}; +const char *const UART_SELECTIONS[] = {"UART0", "UART1", "UART2"}; #endif #ifdef ARDUINO_ARCH_ESP8266 -const char *UART_SELECTIONS[] = {"UART0", "UART1", "UART0_SWAP"}; +const char *const UART_SELECTIONS[] = {"UART0", "UART1", "UART0_SWAP"}; #endif void Logger::dump_config() { ESP_LOGCONFIG(TAG, "Logger:"); @@ -196,7 +196,7 @@ void Logger::dump_config() { } void Logger::write_footer_() { this->write_to_buffer_(ESPHOME_LOG_RESET_COLOR, strlen(ESPHOME_LOG_RESET_COLOR)); } -Logger *global_logger = nullptr; +Logger *global_logger = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace logger } // namespace esphome diff --git a/esphome/components/logger/logger.h b/esphome/components/logger/logger.h index 039ad78c63..1724875229 100644 --- a/esphome/components/logger/logger.h +++ b/esphome/components/logger/logger.h @@ -115,7 +115,7 @@ class Logger : public Component { CallbackManager log_callback_{}; }; -extern Logger *global_logger; +extern Logger *global_logger; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) class LoggerMessageTrigger : public Trigger { public: diff --git a/esphome/components/max31855/max31855.cpp b/esphome/components/max31855/max31855.cpp index 750685a4ad..2578c4742d 100644 --- a/esphome/components/max31855/max31855.cpp +++ b/esphome/components/max31855/max31855.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace max31855 { -static const char *TAG = "max31855"; +static const char *const TAG = "max31855"; void MAX31855Sensor::update() { this->enable(); diff --git a/esphome/components/max31856/max31856.cpp b/esphome/components/max31856/max31856.cpp index b3e5b9277a..9b627e21a2 100644 --- a/esphome/components/max31856/max31856.cpp +++ b/esphome/components/max31856/max31856.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace max31856 { -static const char *TAG = "max31856"; +static const char *const TAG = "max31856"; // Based on Adafruit's library: https://github.com/adafruit/Adafruit_MAX31856 diff --git a/esphome/components/max31865/max31865.cpp b/esphome/components/max31865/max31865.cpp index 5f4cf212c9..daadc26cdc 100644 --- a/esphome/components/max31865/max31865.cpp +++ b/esphome/components/max31865/max31865.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace max31865 { -static const char *TAG = "max31865"; +static const char *const TAG = "max31865"; void MAX31865Sensor::update() { // Check new faults since last measurement diff --git a/esphome/components/max6675/max6675.cpp b/esphome/components/max6675/max6675.cpp index 53442b9cb1..1ec1d5ee53 100644 --- a/esphome/components/max6675/max6675.cpp +++ b/esphome/components/max6675/max6675.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace max6675 { -static const char *TAG = "max6675"; +static const char *const TAG = "max6675"; void MAX6675Sensor::update() { this->enable(); diff --git a/esphome/components/max7219/max7219.cpp b/esphome/components/max7219/max7219.cpp index 9c5c729487..91bea22e46 100644 --- a/esphome/components/max7219/max7219.cpp +++ b/esphome/components/max7219/max7219.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace max7219 { -static const char *TAG = "max7219"; +static const char *const TAG = "max7219"; static const uint8_t MAX7219_REGISTER_NOOP = 0x00; static const uint8_t MAX7219_REGISTER_DECODE_MODE = 0x09; diff --git a/esphome/components/max7219digit/max7219digit.cpp b/esphome/components/max7219digit/max7219digit.cpp index a1efb07d51..b130823c12 100644 --- a/esphome/components/max7219digit/max7219digit.cpp +++ b/esphome/components/max7219digit/max7219digit.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace max7219digit { -static const char *TAG = "max7219DIGIT"; +static const char *const TAG = "max7219DIGIT"; static const uint8_t MAX7219_REGISTER_NOOP = 0x00; static const uint8_t MAX7219_REGISTER_DECODE_MODE = 0x09; diff --git a/esphome/components/mcp23008/mcp23008.cpp b/esphome/components/mcp23008/mcp23008.cpp index eb66bfc7d7..351360fe1c 100644 --- a/esphome/components/mcp23008/mcp23008.cpp +++ b/esphome/components/mcp23008/mcp23008.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp23008 { -static const char *TAG = "mcp23008"; +static const char *const TAG = "mcp23008"; void MCP23008::setup() { ESP_LOGCONFIG(TAG, "Setting up MCP23008..."); diff --git a/esphome/components/mcp23016/mcp23016.cpp b/esphome/components/mcp23016/mcp23016.cpp index bd04486965..f2b55fe2e2 100644 --- a/esphome/components/mcp23016/mcp23016.cpp +++ b/esphome/components/mcp23016/mcp23016.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp23016 { -static const char *TAG = "mcp23016"; +static const char *const TAG = "mcp23016"; void MCP23016::setup() { ESP_LOGCONFIG(TAG, "Setting up MCP23016..."); diff --git a/esphome/components/mcp23017/mcp23017.cpp b/esphome/components/mcp23017/mcp23017.cpp index 0523b14d5a..7344f482e0 100644 --- a/esphome/components/mcp23017/mcp23017.cpp +++ b/esphome/components/mcp23017/mcp23017.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp23017 { -static const char *TAG = "mcp23017"; +static const char *const TAG = "mcp23017"; void MCP23017::setup() { ESP_LOGCONFIG(TAG, "Setting up MCP23017..."); diff --git a/esphome/components/mcp23s08/mcp23s08.cpp b/esphome/components/mcp23s08/mcp23s08.cpp index 3bb03cb225..b7adeb94d2 100644 --- a/esphome/components/mcp23s08/mcp23s08.cpp +++ b/esphome/components/mcp23s08/mcp23s08.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp23s08 { -static const char *TAG = "mcp23s08"; +static const char *const TAG = "mcp23s08"; void MCP23S08::set_device_address(uint8_t device_addr) { if (device_addr != 0) { diff --git a/esphome/components/mcp23s17/mcp23s17.cpp b/esphome/components/mcp23s17/mcp23s17.cpp index 7c2cfcd526..8e3d5213f8 100644 --- a/esphome/components/mcp23s17/mcp23s17.cpp +++ b/esphome/components/mcp23s17/mcp23s17.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp23s17 { -static const char *TAG = "mcp23s17"; +static const char *const TAG = "mcp23s17"; void MCP23S17::set_device_address(uint8_t device_addr) { if (device_addr != 0) { diff --git a/esphome/components/mcp23x08_base/mcp23x08_base.cpp b/esphome/components/mcp23x08_base/mcp23x08_base.cpp index c14e0020dd..2b047fa288 100644 --- a/esphome/components/mcp23x08_base/mcp23x08_base.cpp +++ b/esphome/components/mcp23x08_base/mcp23x08_base.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp23x08_base { -static const char *TAG = "mcp23x08_base"; +static const char *const TAG = "mcp23x08_base"; bool MCP23X08Base::digital_read(uint8_t pin) { uint8_t bit = pin % 8; diff --git a/esphome/components/mcp23x17_base/mcp23x17_base.cpp b/esphome/components/mcp23x17_base/mcp23x17_base.cpp index 18f3ba7c6d..72dec2d457 100644 --- a/esphome/components/mcp23x17_base/mcp23x17_base.cpp +++ b/esphome/components/mcp23x17_base/mcp23x17_base.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp23x17_base { -static const char *TAG = "mcp23x17_base"; +static const char *const TAG = "mcp23x17_base"; bool MCP23X17Base::digital_read(uint8_t pin) { uint8_t bit = pin % 8; diff --git a/esphome/components/mcp2515/mcp2515.cpp b/esphome/components/mcp2515/mcp2515.cpp index ccd8d0ee6c..ce451cbb33 100644 --- a/esphome/components/mcp2515/mcp2515.cpp +++ b/esphome/components/mcp2515/mcp2515.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp2515 { -static const char *TAG = "mcp2515"; +static const char *const TAG = "mcp2515"; const struct MCP2515::TxBnRegs MCP2515::TXB[N_TXBUFFERS] = {{MCP_TXB0CTRL, MCP_TXB0SIDH, MCP_TXB0DATA}, {MCP_TXB1CTRL, MCP_TXB1SIDH, MCP_TXB1DATA}, diff --git a/esphome/components/mcp3008/mcp3008.cpp b/esphome/components/mcp3008/mcp3008.cpp index 18eaee89c2..909a6f4708 100644 --- a/esphome/components/mcp3008/mcp3008.cpp +++ b/esphome/components/mcp3008/mcp3008.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp3008 { -static const char *TAG = "mcp3008"; +static const char *const TAG = "mcp3008"; float MCP3008::get_setup_priority() const { return setup_priority::HARDWARE; } diff --git a/esphome/components/mcp4725/mcp4725.cpp b/esphome/components/mcp4725/mcp4725.cpp index 37ae7ac2b8..a8b130208e 100644 --- a/esphome/components/mcp4725/mcp4725.cpp +++ b/esphome/components/mcp4725/mcp4725.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mcp4725 { -static const char *TAG = "mcp4725"; +static const char *const TAG = "mcp4725"; void MCP4725::setup() { ESP_LOGCONFIG(TAG, "Setting up MCP4725 (0x%02X)...", this->address_); diff --git a/esphome/components/mcp9808/mcp9808.cpp b/esphome/components/mcp9808/mcp9808.cpp index 38870b3b00..8f60df1d88 100644 --- a/esphome/components/mcp9808/mcp9808.cpp +++ b/esphome/components/mcp9808/mcp9808.cpp @@ -15,7 +15,7 @@ static const uint8_t MCP9808_AMBIENT_CLEAR_FLAGS = 0x1F; static const uint8_t MCP9808_AMBIENT_CLEAR_SIGN = 0x0F; static const uint8_t MCP9808_AMBIENT_TEMP_NEGATIVE = 0x10; -static const char *TAG = "mcp9808"; +static const char *const TAG = "mcp9808"; void MCP9808Sensor::setup() { ESP_LOGCONFIG(TAG, "Setting up %s...", this->name_.c_str()); diff --git a/esphome/components/mhz19/mhz19.cpp b/esphome/components/mhz19/mhz19.cpp index 8e28d04dea..db3ad50851 100644 --- a/esphome/components/mhz19/mhz19.cpp +++ b/esphome/components/mhz19/mhz19.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mhz19 { -static const char *TAG = "mhz19"; +static const char *const TAG = "mhz19"; static const uint8_t MHZ19_REQUEST_LENGTH = 8; static const uint8_t MHZ19_RESPONSE_LENGTH = 9; static const uint8_t MHZ19_COMMAND_GET_PPM[] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/esphome/components/midea_ac/midea_climate.cpp b/esphome/components/midea_ac/midea_climate.cpp index f98cf74ac1..1efe6c93f8 100644 --- a/esphome/components/midea_ac/midea_climate.cpp +++ b/esphome/components/midea_ac/midea_climate.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace midea_ac { -static const char *TAG = "midea_ac"; +static const char *const TAG = "midea_ac"; static void set_sensor(sensor::Sensor *sensor, float value) { if (sensor != nullptr && (!sensor->has_state() || sensor->get_raw_state() != value)) diff --git a/esphome/components/midea_ac/midea_frame.cpp b/esphome/components/midea_ac/midea_frame.cpp index e90155bad3..3d210d89f0 100644 --- a/esphome/components/midea_ac/midea_frame.cpp +++ b/esphome/components/midea_ac/midea_frame.cpp @@ -3,7 +3,7 @@ namespace esphome { namespace midea_ac { -static const char *TAG = "midea_ac"; +static const char *const TAG = "midea_ac"; const std::string MIDEA_SILENT_FAN_MODE = "silent"; const std::string MIDEA_TURBO_FAN_MODE = "turbo"; const std::string MIDEA_FREEZE_PROTECTION_PRESET = "freeze protection"; diff --git a/esphome/components/midea_dongle/midea_dongle.cpp b/esphome/components/midea_dongle/midea_dongle.cpp index c14b1bb3d3..7e3683a964 100644 --- a/esphome/components/midea_dongle/midea_dongle.cpp +++ b/esphome/components/midea_dongle/midea_dongle.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace midea_dongle { -static const char *TAG = "midea_dongle"; +static const char *const TAG = "midea_dongle"; void MideaDongle::loop() { while (this->available()) { diff --git a/esphome/components/mitsubishi/mitsubishi.cpp b/esphome/components/mitsubishi/mitsubishi.cpp index dbc70af75c..d0f07e42dc 100644 --- a/esphome/components/mitsubishi/mitsubishi.cpp +++ b/esphome/components/mitsubishi/mitsubishi.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mitsubishi { -static const char *TAG = "mitsubishi.climate"; +static const char *const TAG = "mitsubishi.climate"; const uint32_t MITSUBISHI_OFF = 0x00; diff --git a/esphome/components/modbus/modbus.cpp b/esphome/components/modbus/modbus.cpp index 7820e14bf9..2d714e72a2 100644 --- a/esphome/components/modbus/modbus.cpp +++ b/esphome/components/modbus/modbus.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace modbus { -static const char *TAG = "modbus"; +static const char *const TAG = "modbus"; void Modbus::setup() { if (this->flow_control_pin_ != nullptr) { diff --git a/esphome/components/mpr121/mpr121.cpp b/esphome/components/mpr121/mpr121.cpp index 2025bc5b3f..274ed6dfec 100644 --- a/esphome/components/mpr121/mpr121.cpp +++ b/esphome/components/mpr121/mpr121.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mpr121 { -static const char *TAG = "mpr121"; +static const char *const TAG = "mpr121"; void MPR121Component::setup() { ESP_LOGCONFIG(TAG, "Setting up MPR121..."); diff --git a/esphome/components/mpu6050/mpu6050.cpp b/esphome/components/mpu6050/mpu6050.cpp index 06f8951bf5..8a0756e63c 100644 --- a/esphome/components/mpu6050/mpu6050.cpp +++ b/esphome/components/mpu6050/mpu6050.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mpu6050 { -static const char *TAG = "mpu6050"; +static const char *const TAG = "mpu6050"; const uint8_t MPU6050_REGISTER_WHO_AM_I = 0x75; const uint8_t MPU6050_REGISTER_POWER_MANAGEMENT_1 = 0x6B; diff --git a/esphome/components/mqtt/custom_mqtt_device.cpp b/esphome/components/mqtt/custom_mqtt_device.cpp index 8b17c5f17f..9dec9498ad 100644 --- a/esphome/components/mqtt/custom_mqtt_device.cpp +++ b/esphome/components/mqtt/custom_mqtt_device.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.custom"; +static const char *const TAG = "mqtt.custom"; bool CustomMQTTDevice::publish(const std::string &topic, const std::string &payload, uint8_t qos, bool retain) { return global_mqtt_client->publish(topic, payload, qos, retain); diff --git a/esphome/components/mqtt/mqtt_binary_sensor.cpp b/esphome/components/mqtt/mqtt_binary_sensor.cpp index edabcb398c..53a49c6844 100644 --- a/esphome/components/mqtt/mqtt_binary_sensor.cpp +++ b/esphome/components/mqtt/mqtt_binary_sensor.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.binary_sensor"; +static const char *const TAG = "mqtt.binary_sensor"; std::string MQTTBinarySensorComponent::component_type() const { return "binary_sensor"; } diff --git a/esphome/components/mqtt/mqtt_client.cpp b/esphome/components/mqtt/mqtt_client.cpp index 6e16af2ea1..afb67d36ed 100644 --- a/esphome/components/mqtt/mqtt_client.cpp +++ b/esphome/components/mqtt/mqtt_client.cpp @@ -15,7 +15,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt"; +static const char *const TAG = "mqtt"; MQTTClientComponent::MQTTClientComponent() { global_mqtt_client = this; @@ -560,7 +560,7 @@ void MQTTClientComponent::add_ssl_fingerprint(const std::array disconnect_reason_{}; }; -extern MQTTClientComponent *global_mqtt_client; +extern MQTTClientComponent *global_mqtt_client; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) class MQTTMessageTrigger : public Trigger, public Component { public: diff --git a/esphome/components/mqtt/mqtt_climate.cpp b/esphome/components/mqtt/mqtt_climate.cpp index 47923dc924..164ba16faf 100644 --- a/esphome/components/mqtt/mqtt_climate.cpp +++ b/esphome/components/mqtt/mqtt_climate.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.climate"; +static const char *const TAG = "mqtt.climate"; using namespace esphome::climate; diff --git a/esphome/components/mqtt/mqtt_component.cpp b/esphome/components/mqtt/mqtt_component.cpp index 3efa70e4ed..13acdcacd8 100644 --- a/esphome/components/mqtt/mqtt_component.cpp +++ b/esphome/components/mqtt/mqtt_component.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.component"; +static const char *const TAG = "mqtt.component"; void MQTTComponent::set_retain(bool retain) { this->retain_ = retain; } diff --git a/esphome/components/mqtt/mqtt_cover.cpp b/esphome/components/mqtt/mqtt_cover.cpp index a414c261f0..25ac430abb 100644 --- a/esphome/components/mqtt/mqtt_cover.cpp +++ b/esphome/components/mqtt/mqtt_cover.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.cover"; +static const char *const TAG = "mqtt.cover"; using namespace esphome::cover; diff --git a/esphome/components/mqtt/mqtt_fan.cpp b/esphome/components/mqtt/mqtt_fan.cpp index c020d73105..4171dae04c 100644 --- a/esphome/components/mqtt/mqtt_fan.cpp +++ b/esphome/components/mqtt/mqtt_fan.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.fan"; +static const char *const TAG = "mqtt.fan"; using namespace esphome::fan; diff --git a/esphome/components/mqtt/mqtt_light.cpp b/esphome/components/mqtt/mqtt_light.cpp index d392169435..4bd0882b8c 100644 --- a/esphome/components/mqtt/mqtt_light.cpp +++ b/esphome/components/mqtt/mqtt_light.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.light"; +static const char *const TAG = "mqtt.light"; using namespace esphome::light; diff --git a/esphome/components/mqtt/mqtt_sensor.cpp b/esphome/components/mqtt/mqtt_sensor.cpp index f87e7651b9..07c7fdc00d 100644 --- a/esphome/components/mqtt/mqtt_sensor.cpp +++ b/esphome/components/mqtt/mqtt_sensor.cpp @@ -10,7 +10,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.sensor"; +static const char *const TAG = "mqtt.sensor"; using namespace esphome::sensor; diff --git a/esphome/components/mqtt/mqtt_switch.cpp b/esphome/components/mqtt/mqtt_switch.cpp index a01d6a6c6e..b73e1ab8dc 100644 --- a/esphome/components/mqtt/mqtt_switch.cpp +++ b/esphome/components/mqtt/mqtt_switch.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.switch"; +static const char *const TAG = "mqtt.switch"; using namespace esphome::switch_; diff --git a/esphome/components/mqtt/mqtt_text_sensor.cpp b/esphome/components/mqtt/mqtt_text_sensor.cpp index 37d475d25d..8bc11d954c 100644 --- a/esphome/components/mqtt/mqtt_text_sensor.cpp +++ b/esphome/components/mqtt/mqtt_text_sensor.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace mqtt { -static const char *TAG = "mqtt.text_sensor"; +static const char *const TAG = "mqtt.text_sensor"; using namespace esphome::text_sensor; diff --git a/esphome/components/mqtt_subscribe/sensor/mqtt_subscribe_sensor.cpp b/esphome/components/mqtt_subscribe/sensor/mqtt_subscribe_sensor.cpp index 87a190870b..06251bd7c8 100644 --- a/esphome/components/mqtt_subscribe/sensor/mqtt_subscribe_sensor.cpp +++ b/esphome/components/mqtt_subscribe/sensor/mqtt_subscribe_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace mqtt_subscribe { -static const char *TAG = "mqtt_subscribe.sensor"; +static const char *const TAG = "mqtt_subscribe.sensor"; void MQTTSubscribeSensor::setup() { mqtt::global_mqtt_client->subscribe( diff --git a/esphome/components/mqtt_subscribe/text_sensor/mqtt_subscribe_text_sensor.cpp b/esphome/components/mqtt_subscribe/text_sensor/mqtt_subscribe_text_sensor.cpp index 3538857e8b..2b0908979c 100644 --- a/esphome/components/mqtt_subscribe/text_sensor/mqtt_subscribe_text_sensor.cpp +++ b/esphome/components/mqtt_subscribe/text_sensor/mqtt_subscribe_text_sensor.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace mqtt_subscribe { -static const char *TAG = "mqtt_subscribe.text_sensor"; +static const char *const TAG = "mqtt_subscribe.text_sensor"; void MQTTSubscribeTextSensor::setup() { this->parent_->subscribe( diff --git a/esphome/components/ms5611/ms5611.cpp b/esphome/components/ms5611/ms5611.cpp index 39bce9f32c..51dc569240 100644 --- a/esphome/components/ms5611/ms5611.cpp +++ b/esphome/components/ms5611/ms5611.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ms5611 { -static const char *TAG = "ms5611"; +static const char *const TAG = "ms5611"; static const uint8_t MS5611_ADDRESS = 0x77; static const uint8_t MS5611_CMD_ADC_READ = 0x00; diff --git a/esphome/components/my9231/my9231.cpp b/esphome/components/my9231/my9231.cpp index 4b4603d56b..a97587b7be 100644 --- a/esphome/components/my9231/my9231.cpp +++ b/esphome/components/my9231/my9231.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace my9231 { -static const char *TAG = "my9231.output"; +static const char *const TAG = "my9231.output"; // One-shot select (frame cycle repeat mode / frame cycle One-shot mode) static const uint8_t MY9231_CMD_ONE_SHOT_DISABLE = 0x0 << 6; diff --git a/esphome/components/nextion/nextion.cpp b/esphome/components/nextion/nextion.cpp index d18d9f33d8..fe0767342b 100644 --- a/esphome/components/nextion/nextion.cpp +++ b/esphome/components/nextion/nextion.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace nextion { -static const char *TAG = "nextion"; +static const char *const TAG = "nextion"; void Nextion::setup() { this->send_command_no_ack(""); diff --git a/esphome/components/nfc/ndef_message.cpp b/esphome/components/nfc/ndef_message.cpp index caba833932..4e295d4469 100644 --- a/esphome/components/nfc/ndef_message.cpp +++ b/esphome/components/nfc/ndef_message.cpp @@ -3,7 +3,7 @@ namespace esphome { namespace nfc { -static const char *TAG = "nfc.ndef_message"; +static const char *const TAG = "nfc.ndef_message"; NdefMessage::NdefMessage(std::vector &data) { ESP_LOGV(TAG, "Building NdefMessage with %zu bytes", data.size()); diff --git a/esphome/components/nfc/ndef_record.cpp b/esphome/components/nfc/ndef_record.cpp index 78f7b51eaa..a75f5978ec 100644 --- a/esphome/components/nfc/ndef_record.cpp +++ b/esphome/components/nfc/ndef_record.cpp @@ -3,7 +3,7 @@ namespace esphome { namespace nfc { -static const char *TAG = "nfc.ndef_record"; +static const char *const TAG = "nfc.ndef_record"; uint32_t NdefRecord::get_encoded_size() { uint32_t size = 2; diff --git a/esphome/components/nfc/ndef_record.h b/esphome/components/nfc/ndef_record.h index bc03ccf093..2059444882 100644 --- a/esphome/components/nfc/ndef_record.h +++ b/esphome/components/nfc/ndef_record.h @@ -16,42 +16,42 @@ static const uint8_t TNF_UNCHANGED = 0x06; static const uint8_t TNF_RESERVED = 0x07; static const uint8_t PAYLOAD_IDENTIFIERS_COUNT = 0x23; -static const char *PAYLOAD_IDENTIFIERS[] = {"", - "http://www.", - "https://www.", - "http://", - "https://", - "tel:", - "mailto:", - "ftp://anonymous:anonymous@", - "ftp://ftp.", - "ftps://", - "sftp://", - "smb://", - "nfs://", - "ftp://", - "dav://", - "news:", - "telnet://", - "imap:", - "rtsp://", - "urn:", - "pop:", - "sip:", - "sips:", - "tftp:", - "btspp://", - "btl2cap://", - "btgoep://", - "tcpobex://", - "irdaobex://", - "file://", - "urn:epc:id:", - "urn:epc:tag:", - "urn:epc:pat:", - "urn:epc:raw:", - "urn:epc:", - "urn:nfc:"}; +static const char *const PAYLOAD_IDENTIFIERS[] = {"", + "http://www.", + "https://www.", + "http://", + "https://", + "tel:", + "mailto:", + "ftp://anonymous:anonymous@", + "ftp://ftp.", + "ftps://", + "sftp://", + "smb://", + "nfs://", + "ftp://", + "dav://", + "news:", + "telnet://", + "imap:", + "rtsp://", + "urn:", + "pop:", + "sip:", + "sips:", + "tftp:", + "btspp://", + "btl2cap://", + "btgoep://", + "tcpobex://", + "irdaobex://", + "file://", + "urn:epc:id:", + "urn:epc:tag:", + "urn:epc:pat:", + "urn:epc:raw:", + "urn:epc:", + "urn:nfc:"}; class NdefRecord { public: diff --git a/esphome/components/nfc/nfc.cpp b/esphome/components/nfc/nfc.cpp index d1f7cbe15f..01f63e6ec9 100644 --- a/esphome/components/nfc/nfc.cpp +++ b/esphome/components/nfc/nfc.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace nfc { -static const char *TAG = "nfc"; +static const char *const TAG = "nfc"; std::string format_uid(std::vector &uid) { char buf[(uid.size() * 2) + uid.size() - 1]; diff --git a/esphome/components/nfc/nfc.h b/esphome/components/nfc/nfc.h index cf56f9f4de..d482131057 100644 --- a/esphome/components/nfc/nfc.h +++ b/esphome/components/nfc/nfc.h @@ -32,9 +32,9 @@ static const uint8_t MIFARE_CMD_READ = 0x30; static const uint8_t MIFARE_CMD_WRITE = 0xA0; static const uint8_t MIFARE_CMD_WRITE_ULTRALIGHT = 0xA2; -static const char *MIFARE_CLASSIC = "Mifare Classic"; -static const char *NFC_FORUM_TYPE_2 = "NFC Forum Type 2"; -static const char *ERROR = "Error"; +static const char *const MIFARE_CLASSIC = "Mifare Classic"; +static const char *const NFC_FORUM_TYPE_2 = "NFC Forum Type 2"; +static const char *const ERROR = "Error"; static const uint8_t DEFAULT_KEY[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; static const uint8_t NDEF_KEY[6] = {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7}; diff --git a/esphome/components/nfc/nfc_tag.cpp b/esphome/components/nfc/nfc_tag.cpp index 39e84e2032..c5c15b00ec 100644 --- a/esphome/components/nfc/nfc_tag.cpp +++ b/esphome/components/nfc/nfc_tag.cpp @@ -3,7 +3,7 @@ namespace esphome { namespace nfc { -static const char *TAG = "nfc.tag"; +static const char *const TAG = "nfc.tag"; } // namespace nfc } // namespace esphome diff --git a/esphome/components/ntc/ntc.cpp b/esphome/components/ntc/ntc.cpp index 9446508b0b..80a11384b9 100644 --- a/esphome/components/ntc/ntc.cpp +++ b/esphome/components/ntc/ntc.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ntc { -static const char *TAG = "ntc"; +static const char *const TAG = "ntc"; void NTC::setup() { this->sensor_->add_on_state_callback([this](float value) { this->process_(value); }); diff --git a/esphome/components/ota/ota_component.cpp b/esphome/components/ota/ota_component.cpp index c8221d1bdf..5302b7bc24 100644 --- a/esphome/components/ota/ota_component.cpp +++ b/esphome/components/ota/ota_component.cpp @@ -15,9 +15,9 @@ namespace esphome { namespace ota { -static const char *TAG = "ota"; +static const char *const TAG = "ota"; -uint8_t OTA_VERSION_1_0 = 1; +static const uint8_t OTA_VERSION_1_0 = 1; void OTAComponent::setup() { this->server_ = new WiFiServer(this->port_); diff --git a/esphome/components/output/automation.cpp b/esphome/components/output/automation.cpp index 57d68dacf7..5533a6bee4 100644 --- a/esphome/components/output/automation.cpp +++ b/esphome/components/output/automation.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace output { -static const char *TAG = "output.automation"; +static const char *const TAG = "output.automation"; } // namespace output } // namespace esphome diff --git a/esphome/components/output/float_output.cpp b/esphome/components/output/float_output.cpp index d9f2db559c..f44383db36 100644 --- a/esphome/components/output/float_output.cpp +++ b/esphome/components/output/float_output.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace output { -static const char *TAG = "output.float"; +static const char *const TAG = "output.float"; void FloatOutput::set_max_power(float max_power) { this->max_power_ = clamp(max_power, this->min_power_, 1.0f); // Clamp to MIN>=MAX>=1.0 diff --git a/esphome/components/output/switch/output_switch.cpp b/esphome/components/output/switch/output_switch.cpp index e2c3b19f28..8db45f3a2b 100644 --- a/esphome/components/output/switch/output_switch.cpp +++ b/esphome/components/output/switch/output_switch.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace output { -static const char *TAG = "output.switch"; +static const char *const TAG = "output.switch"; void OutputSwitch::dump_config() { LOG_SWITCH("", "Output Switch", this); } void OutputSwitch::setup() { diff --git a/esphome/components/partition/light_partition.cpp b/esphome/components/partition/light_partition.cpp index 4bef9ba196..63c0d0186e 100644 --- a/esphome/components/partition/light_partition.cpp +++ b/esphome/components/partition/light_partition.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace partition { -static const char *TAG = "partition.light"; +static const char *const TAG = "partition.light"; } // namespace partition } // namespace esphome diff --git a/esphome/components/pca9685/pca9685_output.cpp b/esphome/components/pca9685/pca9685_output.cpp index 72f5687bb9..c3fd2b60e4 100644 --- a/esphome/components/pca9685/pca9685_output.cpp +++ b/esphome/components/pca9685/pca9685_output.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace pca9685 { -static const char *TAG = "pca9685"; +static const char *const TAG = "pca9685"; const uint8_t PCA9685_MODE_INVERTED = 0x10; const uint8_t PCA9685_MODE_OUTPUT_ONACK = 0x08; diff --git a/esphome/components/pcd8544/pcd_8544.cpp b/esphome/components/pcd8544/pcd_8544.cpp index 85614874ee..5651d60b15 100644 --- a/esphome/components/pcd8544/pcd_8544.cpp +++ b/esphome/components/pcd8544/pcd_8544.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace pcd8544 { -static const char *TAG = "pcd_8544"; +static const char *const TAG = "pcd_8544"; void PCD8544::setup_pins_() { this->spi_setup(); diff --git a/esphome/components/pcf8574/pcf8574.cpp b/esphome/components/pcf8574/pcf8574.cpp index 6cadf565de..02817df888 100644 --- a/esphome/components/pcf8574/pcf8574.cpp +++ b/esphome/components/pcf8574/pcf8574.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pcf8574 { -static const char *TAG = "pcf8574"; +static const char *const TAG = "pcf8574"; void PCF8574Component::setup() { ESP_LOGCONFIG(TAG, "Setting up PCF8574..."); diff --git a/esphome/components/pid/pid_autotuner.cpp b/esphome/components/pid/pid_autotuner.cpp index e8b006b8d7..83e4b6be32 100644 --- a/esphome/components/pid/pid_autotuner.cpp +++ b/esphome/components/pid/pid_autotuner.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pid { -static const char *TAG = "pid.autotune"; +static const char *const TAG = "pid.autotune"; /* * # PID Autotuner diff --git a/esphome/components/pid/pid_climate.cpp b/esphome/components/pid/pid_climate.cpp index 24fb0ec905..4c32d92576 100644 --- a/esphome/components/pid/pid_climate.cpp +++ b/esphome/components/pid/pid_climate.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pid { -static const char *TAG = "pid.climate"; +static const char *const TAG = "pid.climate"; void PIDClimate::setup() { this->sensor_->add_on_state_callback([this](float state) { diff --git a/esphome/components/pid/sensor/pid_climate_sensor.cpp b/esphome/components/pid/sensor/pid_climate_sensor.cpp index f60627b6ac..2a76c775d3 100644 --- a/esphome/components/pid/sensor/pid_climate_sensor.cpp +++ b/esphome/components/pid/sensor/pid_climate_sensor.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace pid { -static const char *TAG = "pid.sensor"; +static const char *const TAG = "pid.sensor"; void PIDClimateSensor::setup() { this->parent_->add_on_pid_computed_callback([this]() { this->update_from_parent_(); }); diff --git a/esphome/components/pmsx003/pmsx003.cpp b/esphome/components/pmsx003/pmsx003.cpp index 489442c637..abea287c0b 100644 --- a/esphome/components/pmsx003/pmsx003.cpp +++ b/esphome/components/pmsx003/pmsx003.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pmsx003 { -static const char *TAG = "pmsx003"; +static const char *const TAG = "pmsx003"; void PMSX003Component::set_pm_1_0_sensor(sensor::Sensor *pm_1_0_sensor) { pm_1_0_sensor_ = pm_1_0_sensor; } void PMSX003Component::set_pm_2_5_sensor(sensor::Sensor *pm_2_5_sensor) { pm_2_5_sensor_ = pm_2_5_sensor; } diff --git a/esphome/components/pn532/pn532.cpp b/esphome/components/pn532/pn532.cpp index 5e0ec458ab..fc84f30078 100644 --- a/esphome/components/pn532/pn532.cpp +++ b/esphome/components/pn532/pn532.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace pn532 { -static const char *TAG = "pn532"; +static const char *const TAG = "pn532"; void PN532::setup() { ESP_LOGCONFIG(TAG, "Setting up PN532..."); diff --git a/esphome/components/pn532/pn532_mifare_classic.cpp b/esphome/components/pn532/pn532_mifare_classic.cpp index 93d394330d..119d1ceef6 100644 --- a/esphome/components/pn532/pn532_mifare_classic.cpp +++ b/esphome/components/pn532/pn532_mifare_classic.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pn532 { -static const char *TAG = "pn532.mifare_classic"; +static const char *const TAG = "pn532.mifare_classic"; nfc::NfcTag *PN532::read_mifare_classic_tag_(std::vector &uid) { uint8_t current_block = 4; diff --git a/esphome/components/pn532/pn532_mifare_ultralight.cpp b/esphome/components/pn532/pn532_mifare_ultralight.cpp index 09d94c42b1..1787a3c225 100644 --- a/esphome/components/pn532/pn532_mifare_ultralight.cpp +++ b/esphome/components/pn532/pn532_mifare_ultralight.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pn532 { -static const char *TAG = "pn532.mifare_ultralight"; +static const char *const TAG = "pn532.mifare_ultralight"; nfc::NfcTag *PN532::read_mifare_ultralight_tag_(std::vector &uid) { if (!this->is_mifare_ultralight_formatted_()) { diff --git a/esphome/components/pn532_i2c/pn532_i2c.cpp b/esphome/components/pn532_i2c/pn532_i2c.cpp index 37147c5eb9..25f24758bf 100644 --- a/esphome/components/pn532_i2c/pn532_i2c.cpp +++ b/esphome/components/pn532_i2c/pn532_i2c.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace pn532_i2c { -static const char *TAG = "pn532_i2c"; +static const char *const TAG = "pn532_i2c"; bool PN532I2C::write_data(const std::vector &data) { return this->write_bytes_raw(data.data(), data.size()); } diff --git a/esphome/components/pn532_spi/pn532_spi.cpp b/esphome/components/pn532_spi/pn532_spi.cpp index 6f87ad8ca7..ec32e45b3d 100644 --- a/esphome/components/pn532_spi/pn532_spi.cpp +++ b/esphome/components/pn532_spi/pn532_spi.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace pn532_spi { -static const char *TAG = "pn532_spi"; +static const char *const TAG = "pn532_spi"; void PN532Spi::setup() { ESP_LOGI(TAG, "PN532Spi setup started!"); diff --git a/esphome/components/power_supply/power_supply.cpp b/esphome/components/power_supply/power_supply.cpp index 1f8471ac9f..f50adac6f9 100644 --- a/esphome/components/power_supply/power_supply.cpp +++ b/esphome/components/power_supply/power_supply.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace power_supply { -static const char *TAG = "power_supply"; +static const char *const TAG = "power_supply"; void PowerSupply::setup() { ESP_LOGCONFIG(TAG, "Setting up Power Supply..."); diff --git a/esphome/components/pulse_counter/pulse_counter_sensor.cpp b/esphome/components/pulse_counter/pulse_counter_sensor.cpp index 46b50a3021..9a0cf568a9 100644 --- a/esphome/components/pulse_counter/pulse_counter_sensor.cpp +++ b/esphome/components/pulse_counter/pulse_counter_sensor.cpp @@ -4,9 +4,9 @@ namespace esphome { namespace pulse_counter { -static const char *TAG = "pulse_counter"; +static const char *const TAG = "pulse_counter"; -const char *EDGE_MODE_TO_STRING[] = {"DISABLE", "INCREMENT", "DECREMENT"}; +const char *const EDGE_MODE_TO_STRING[] = {"DISABLE", "INCREMENT", "DECREMENT"}; #ifdef ARDUINO_ARCH_ESP8266 void ICACHE_RAM_ATTR PulseCounterStorage::gpio_intr(PulseCounterStorage *arg) { diff --git a/esphome/components/pulse_meter/pulse_meter_sensor.cpp b/esphome/components/pulse_meter/pulse_meter_sensor.cpp index 539da3a2aa..1a35deba2f 100644 --- a/esphome/components/pulse_meter/pulse_meter_sensor.cpp +++ b/esphome/components/pulse_meter/pulse_meter_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pulse_meter { -static const char *TAG = "pulse_meter"; +static const char *const TAG = "pulse_meter"; void PulseMeterSensor::setup() { this->pin_->setup(); diff --git a/esphome/components/pulse_width/pulse_width.cpp b/esphome/components/pulse_width/pulse_width.cpp index 4be536662b..fb998ef4e1 100644 --- a/esphome/components/pulse_width/pulse_width.cpp +++ b/esphome/components/pulse_width/pulse_width.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pulse_width { -static const char *TAG = "pulse_width"; +static const char *const TAG = "pulse_width"; void ICACHE_RAM_ATTR PulseWidthSensorStore::gpio_intr(PulseWidthSensorStore *arg) { const bool new_level = arg->pin_->digital_read(); diff --git a/esphome/components/pzem004t/pzem004t.cpp b/esphome/components/pzem004t/pzem004t.cpp index b9deab1949..969ce8fa10 100644 --- a/esphome/components/pzem004t/pzem004t.cpp +++ b/esphome/components/pzem004t/pzem004t.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pzem004t { -static const char *TAG = "pzem004t"; +static const char *const TAG = "pzem004t"; void PZEM004T::loop() { const uint32_t now = millis(); diff --git a/esphome/components/pzemac/pzemac.cpp b/esphome/components/pzemac/pzemac.cpp index c79508d22f..b1a9607304 100644 --- a/esphome/components/pzemac/pzemac.cpp +++ b/esphome/components/pzemac/pzemac.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pzemac { -static const char *TAG = "pzemac"; +static const char *const TAG = "pzemac"; static const uint8_t PZEM_CMD_READ_IN_REGISTERS = 0x04; static const uint8_t PZEM_REGISTER_COUNT = 10; // 10x 16-bit registers diff --git a/esphome/components/pzemdc/pzemdc.cpp b/esphome/components/pzemdc/pzemdc.cpp index 9bd58410c0..6a31a723a1 100644 --- a/esphome/components/pzemdc/pzemdc.cpp +++ b/esphome/components/pzemdc/pzemdc.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace pzemdc { -static const char *TAG = "pzemdc"; +static const char *const TAG = "pzemdc"; static const uint8_t PZEM_CMD_READ_IN_REGISTERS = 0x04; static const uint8_t PZEM_REGISTER_COUNT = 10; // 10x 16-bit registers diff --git a/esphome/components/qmc5883l/qmc5883l.cpp b/esphome/components/qmc5883l/qmc5883l.cpp index f809f9dfb3..43e7939cf1 100644 --- a/esphome/components/qmc5883l/qmc5883l.cpp +++ b/esphome/components/qmc5883l/qmc5883l.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace qmc5883l { -static const char *TAG = "qmc5883l"; +static const char *const TAG = "qmc5883l"; static const uint8_t QMC5883L_ADDRESS = 0x0D; static const uint8_t QMC5883L_REGISTER_DATA_X_LSB = 0x00; diff --git a/esphome/components/rc522/rc522.cpp b/esphome/components/rc522/rc522.cpp index ced58760ad..789ab6197b 100644 --- a/esphome/components/rc522/rc522.cpp +++ b/esphome/components/rc522/rc522.cpp @@ -9,7 +9,7 @@ namespace rc522 { static const uint8_t WAIT_I_RQ = 0x30; // RxIRq and IdleIRq -static const char *TAG = "rc522"; +static const char *const TAG = "rc522"; static const uint8_t RESET_COUNT = 5; diff --git a/esphome/components/rc522_i2c/rc522_i2c.cpp b/esphome/components/rc522_i2c/rc522_i2c.cpp index fe88f567c0..896e27214a 100644 --- a/esphome/components/rc522_i2c/rc522_i2c.cpp +++ b/esphome/components/rc522_i2c/rc522_i2c.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace rc522_i2c { -static const char *TAG = "rc522_i2c"; +static const char *const TAG = "rc522_i2c"; void RC522I2C::dump_config() { RC522::dump_config(); diff --git a/esphome/components/rc522_spi/rc522_spi.cpp b/esphome/components/rc522_spi/rc522_spi.cpp index 1865b36da6..fe1f6097e2 100644 --- a/esphome/components/rc522_spi/rc522_spi.cpp +++ b/esphome/components/rc522_spi/rc522_spi.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace rc522_spi { -static const char *TAG = "rc522_spi"; +static const char *const TAG = "rc522_spi"; void RC522Spi::setup() { ESP_LOGI(TAG, "SPI Setup"); diff --git a/esphome/components/rdm6300/rdm6300.cpp b/esphome/components/rdm6300/rdm6300.cpp index 2d2ba61824..434b9f5720 100644 --- a/esphome/components/rdm6300/rdm6300.cpp +++ b/esphome/components/rdm6300/rdm6300.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace rdm6300 { -static const char *TAG = "rdm6300"; +static const char *const TAG = "rdm6300"; static const uint8_t RDM6300_START_BYTE = 0x02; static const uint8_t RDM6300_END_BYTE = 0x03; diff --git a/esphome/components/remote_base/__init__.py b/esphome/components/remote_base/__init__.py index 99778c3088..76e4b51bde 100644 --- a/esphome/components/remote_base/__init__.py +++ b/esphome/components/remote_base/__init__.py @@ -698,7 +698,7 @@ RC_SWITCH_TRANSMITTER = cv.Schema( } ) -rc_switch_protocols = ns.rc_switch_protocols +rc_switch_protocols = ns.RC_SWITCH_PROTOCOLS RCSwitchData = ns.struct("RCSwitchData") RCSwitchBase = ns.class_("RCSwitchBase") RCSwitchTrigger = ns.class_("RCSwitchTrigger", RemoteReceiverTrigger) diff --git a/esphome/components/remote_base/jvc_protocol.cpp b/esphome/components/remote_base/jvc_protocol.cpp index 94d15c2304..f43a28bdc5 100644 --- a/esphome/components/remote_base/jvc_protocol.cpp +++ b/esphome/components/remote_base/jvc_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.jvc"; +static const char *const TAG = "remote.jvc"; static const uint8_t NBITS = 16; static const uint32_t HEADER_HIGH_US = 8400; diff --git a/esphome/components/remote_base/lg_protocol.cpp b/esphome/components/remote_base/lg_protocol.cpp index c01348ef94..a3e7f9828b 100644 --- a/esphome/components/remote_base/lg_protocol.cpp +++ b/esphome/components/remote_base/lg_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.lg"; +static const char *const TAG = "remote.lg"; static const uint32_t HEADER_HIGH_US = 8000; static const uint32_t HEADER_LOW_US = 4000; diff --git a/esphome/components/remote_base/nec_protocol.cpp b/esphome/components/remote_base/nec_protocol.cpp index e352d051c0..79a30903a4 100644 --- a/esphome/components/remote_base/nec_protocol.cpp +++ b/esphome/components/remote_base/nec_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.nec"; +static const char *const TAG = "remote.nec"; static const uint32_t HEADER_HIGH_US = 9000; static const uint32_t HEADER_LOW_US = 4500; diff --git a/esphome/components/remote_base/panasonic_protocol.cpp b/esphome/components/remote_base/panasonic_protocol.cpp index 4a19f8c1fc..fd4f7c4bf7 100644 --- a/esphome/components/remote_base/panasonic_protocol.cpp +++ b/esphome/components/remote_base/panasonic_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.panasonic"; +static const char *const TAG = "remote.panasonic"; static const uint32_t HEADER_HIGH_US = 3502; static const uint32_t HEADER_LOW_US = 1750; diff --git a/esphome/components/remote_base/pioneer_protocol.cpp b/esphome/components/remote_base/pioneer_protocol.cpp index 49a27e08e7..74a3998f11 100644 --- a/esphome/components/remote_base/pioneer_protocol.cpp +++ b/esphome/components/remote_base/pioneer_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.pioneer"; +static const char *const TAG = "remote.pioneer"; static const uint32_t HEADER_HIGH_US = 9000; static const uint32_t HEADER_LOW_US = 4500; diff --git a/esphome/components/remote_base/raw_protocol.cpp b/esphome/components/remote_base/raw_protocol.cpp index 62d578caf9..3446dcdbb8 100644 --- a/esphome/components/remote_base/raw_protocol.cpp +++ b/esphome/components/remote_base/raw_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.raw"; +static const char *const TAG = "remote.raw"; bool RawDumper::dump(RemoteReceiveData src) { char buffer[256]; diff --git a/esphome/components/remote_base/rc5_protocol.cpp b/esphome/components/remote_base/rc5_protocol.cpp index a6165492ac..80af2f9ad8 100644 --- a/esphome/components/remote_base/rc5_protocol.cpp +++ b/esphome/components/remote_base/rc5_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.rc5"; +static const char *const TAG = "remote.rc5"; static const uint32_t BIT_TIME_US = 889; static const uint8_t NBITS = 14; diff --git a/esphome/components/remote_base/rc_switch_protocol.cpp b/esphome/components/remote_base/rc_switch_protocol.cpp index dc4438a84e..6b7d1b725a 100644 --- a/esphome/components/remote_base/rc_switch_protocol.cpp +++ b/esphome/components/remote_base/rc_switch_protocol.cpp @@ -4,17 +4,17 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.rc_switch"; +static const char *const TAG = "remote.rc_switch"; -RCSwitchBase rc_switch_protocols[9] = {RCSwitchBase(0, 0, 0, 0, 0, 0, false), - RCSwitchBase(350, 10850, 350, 1050, 1050, 350, false), - RCSwitchBase(650, 6500, 650, 1300, 1300, 650, false), - RCSwitchBase(3000, 7100, 400, 1100, 900, 600, false), - RCSwitchBase(380, 2280, 380, 1140, 1140, 380, false), - RCSwitchBase(3000, 7000, 500, 1000, 1000, 500, false), - RCSwitchBase(10350, 450, 450, 900, 900, 450, true), - RCSwitchBase(300, 9300, 150, 900, 900, 150, false), - RCSwitchBase(250, 2500, 250, 1250, 250, 250, false)}; +const RCSwitchBase RC_SWITCH_PROTOCOLS[9] = {RCSwitchBase(0, 0, 0, 0, 0, 0, false), + RCSwitchBase(350, 10850, 350, 1050, 1050, 350, false), + RCSwitchBase(650, 6500, 650, 1300, 1300, 650, false), + RCSwitchBase(3000, 7100, 400, 1100, 900, 600, false), + RCSwitchBase(380, 2280, 380, 1140, 1140, 380, false), + RCSwitchBase(3000, 7000, 500, 1000, 1000, 500, false), + RCSwitchBase(10350, 450, 450, 900, 900, 450, true), + RCSwitchBase(300, 9300, 150, 900, 900, 150, false), + RCSwitchBase(250, 2500, 250, 1250, 250, 250, false)}; RCSwitchBase::RCSwitchBase(uint32_t sync_high, uint32_t sync_low, uint32_t zero_high, uint32_t zero_low, uint32_t one_high, uint32_t one_low, bool inverted) @@ -132,7 +132,7 @@ optional RCSwitchBase::decode(RemoteReceiveData &src) const { uint8_t out_nbits; for (uint8_t i = 1; i <= 8; i++) { src.reset(); - RCSwitchBase *protocol = &rc_switch_protocols[i]; + const RCSwitchBase *protocol = &RC_SWITCH_PROTOCOLS[i]; if (protocol->decode(src, &out.code, &out_nbits) && out_nbits >= 3) { out.protocol = i; return out; @@ -246,7 +246,7 @@ bool RCSwitchDumper::dump(RemoteReceiveData src) { src.reset(); uint64_t out_data; uint8_t out_nbits; - RCSwitchBase *protocol = &rc_switch_protocols[i]; + const RCSwitchBase *protocol = &RC_SWITCH_PROTOCOLS[i]; if (protocol->decode(src, &out_data, &out_nbits) && out_nbits >= 3) { char buffer[65]; for (uint8_t j = 0; j < out_nbits; j++) diff --git a/esphome/components/remote_base/rc_switch_protocol.h b/esphome/components/remote_base/rc_switch_protocol.h index 8362899cec..fc465dbd5d 100644 --- a/esphome/components/remote_base/rc_switch_protocol.h +++ b/esphome/components/remote_base/rc_switch_protocol.h @@ -60,7 +60,7 @@ class RCSwitchBase { bool inverted_{}; }; -extern RCSwitchBase rc_switch_protocols[9]; +extern const RCSwitchBase RC_SWITCH_PROTOCOLS[9]; uint64_t decode_binary_string(const std::string &data); diff --git a/esphome/components/remote_base/remote_base.cpp b/esphome/components/remote_base/remote_base.cpp index 04407ad3b1..7198f2d917 100644 --- a/esphome/components/remote_base/remote_base.cpp +++ b/esphome/components/remote_base/remote_base.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote_base"; +static const char *const TAG = "remote_base"; #ifdef ARDUINO_ARCH_ESP32 RemoteRMTChannel::RemoteRMTChannel(uint8_t mem_block_num) : mem_block_num_(mem_block_num) { diff --git a/esphome/components/remote_base/samsung36_protocol.cpp b/esphome/components/remote_base/samsung36_protocol.cpp index 22b158fd8a..9ef8ade205 100644 --- a/esphome/components/remote_base/samsung36_protocol.cpp +++ b/esphome/components/remote_base/samsung36_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.samsung36"; +static const char *const TAG = "remote.samsung36"; static const uint8_t NBITS = 78; diff --git a/esphome/components/remote_base/samsung_protocol.cpp b/esphome/components/remote_base/samsung_protocol.cpp index 25f68ceb97..5062c46126 100644 --- a/esphome/components/remote_base/samsung_protocol.cpp +++ b/esphome/components/remote_base/samsung_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.samsung"; +static const char *const TAG = "remote.samsung"; static const uint8_t NBITS = 32; static const uint32_t HEADER_HIGH_US = 4500; diff --git a/esphome/components/remote_base/sony_protocol.cpp b/esphome/components/remote_base/sony_protocol.cpp index 97318f6608..3bb643266a 100644 --- a/esphome/components/remote_base/sony_protocol.cpp +++ b/esphome/components/remote_base/sony_protocol.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace remote_base { -static const char *TAG = "remote.sony"; +static const char *const TAG = "remote.sony"; static const uint32_t HEADER_HIGH_US = 2400; static const uint32_t HEADER_LOW_US = 600; diff --git a/esphome/components/remote_receiver/remote_receiver_esp32.cpp b/esphome/components/remote_receiver/remote_receiver_esp32.cpp index 97806f8a52..b2ddc69b1c 100644 --- a/esphome/components/remote_receiver/remote_receiver_esp32.cpp +++ b/esphome/components/remote_receiver/remote_receiver_esp32.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace remote_receiver { -static const char *TAG = "remote_receiver.esp32"; +static const char *const TAG = "remote_receiver.esp32"; void RemoteReceiverComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up Remote Receiver..."); diff --git a/esphome/components/remote_receiver/remote_receiver_esp8266.cpp b/esphome/components/remote_receiver/remote_receiver_esp8266.cpp index cafbc34d69..3fb68caca2 100644 --- a/esphome/components/remote_receiver/remote_receiver_esp8266.cpp +++ b/esphome/components/remote_receiver/remote_receiver_esp8266.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace remote_receiver { -static const char *TAG = "remote_receiver.esp8266"; +static const char *const TAG = "remote_receiver.esp8266"; void ICACHE_RAM_ATTR HOT RemoteReceiverComponentStore::gpio_intr(RemoteReceiverComponentStore *arg) { const uint32_t now = micros(); diff --git a/esphome/components/remote_transmitter/remote_transmitter.cpp b/esphome/components/remote_transmitter/remote_transmitter.cpp index 877b190a1d..425418ff39 100644 --- a/esphome/components/remote_transmitter/remote_transmitter.cpp +++ b/esphome/components/remote_transmitter/remote_transmitter.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace remote_transmitter { -static const char *TAG = "remote_transmitter"; +static const char *const TAG = "remote_transmitter"; } // namespace remote_transmitter } // namespace esphome diff --git a/esphome/components/remote_transmitter/remote_transmitter_esp32.cpp b/esphome/components/remote_transmitter/remote_transmitter_esp32.cpp index d5e4a7b1b8..3d3e26160a 100644 --- a/esphome/components/remote_transmitter/remote_transmitter_esp32.cpp +++ b/esphome/components/remote_transmitter/remote_transmitter_esp32.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace remote_transmitter { -static const char *TAG = "remote_transmitter"; +static const char *const TAG = "remote_transmitter"; void RemoteTransmitterComponent::setup() {} diff --git a/esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp b/esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp index e8906e87aa..f8735fe763 100644 --- a/esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +++ b/esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace remote_transmitter { -static const char *TAG = "remote_transmitter"; +static const char *const TAG = "remote_transmitter"; void RemoteTransmitterComponent::setup() { this->pin_->setup(); diff --git a/esphome/components/resistance/resistance_sensor.cpp b/esphome/components/resistance/resistance_sensor.cpp index 7c48bbbc08..1380354a5f 100644 --- a/esphome/components/resistance/resistance_sensor.cpp +++ b/esphome/components/resistance/resistance_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace resistance { -static const char *TAG = "resistance"; +static const char *const TAG = "resistance"; void ResistanceSensor::dump_config() { LOG_SENSOR("", "Resistance Sensor", this); diff --git a/esphome/components/restart/restart_switch.cpp b/esphome/components/restart/restart_switch.cpp index f66ebc616e..ea46c5f910 100644 --- a/esphome/components/restart/restart_switch.cpp +++ b/esphome/components/restart/restart_switch.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace restart { -static const char *TAG = "restart"; +static const char *const TAG = "restart"; void RestartSwitch::write_state(bool state) { // Acknowledge diff --git a/esphome/components/rf_bridge/rf_bridge.cpp b/esphome/components/rf_bridge/rf_bridge.cpp index 26f2d031ab..a4259e5aa2 100644 --- a/esphome/components/rf_bridge/rf_bridge.cpp +++ b/esphome/components/rf_bridge/rf_bridge.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace rf_bridge { -static const char *TAG = "rf_bridge"; +static const char *const TAG = "rf_bridge"; void RFBridgeComponent::ack_() { ESP_LOGV(TAG, "Sending ACK"); diff --git a/esphome/components/rotary_encoder/rotary_encoder.cpp b/esphome/components/rotary_encoder/rotary_encoder.cpp index 0398489dca..8ef6f932c5 100644 --- a/esphome/components/rotary_encoder/rotary_encoder.cpp +++ b/esphome/components/rotary_encoder/rotary_encoder.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace rotary_encoder { -static const char *TAG = "rotary_encoder"; +static const char *const TAG = "rotary_encoder"; // based on https://github.com/jkDesignDE/MechInputs/blob/master/QEIx4.cpp static const uint8_t STATE_LUT_MASK = 0x1C; // clears upper counter increment/decrement bits and pin states diff --git a/esphome/components/rtttl/rtttl.cpp b/esphome/components/rtttl/rtttl.cpp index a13c0a6946..84cc2ce48c 100644 --- a/esphome/components/rtttl/rtttl.cpp +++ b/esphome/components/rtttl/rtttl.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace rtttl { -static const char *TAG = "rtttl"; +static const char *const TAG = "rtttl"; static const uint32_t DOUBLE_NOTE_GAP_MS = 10; diff --git a/esphome/components/rtttl/rtttl.h b/esphome/components/rtttl/rtttl.h index 76d8241ddf..ec6fe7f98f 100644 --- a/esphome/components/rtttl/rtttl.h +++ b/esphome/components/rtttl/rtttl.h @@ -7,8 +7,6 @@ namespace esphome { namespace rtttl { -extern uint32_t global_rtttl_id; - class Rtttl : public Component { public: void set_output(output::FloatOutput *output) { output_ = output; } diff --git a/esphome/components/ruuvi_ble/ruuvi_ble.cpp b/esphome/components/ruuvi_ble/ruuvi_ble.cpp index 897e4a2504..e3e9f42305 100644 --- a/esphome/components/ruuvi_ble/ruuvi_ble.cpp +++ b/esphome/components/ruuvi_ble/ruuvi_ble.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace ruuvi_ble { -static const char *TAG = "ruuvi_ble"; +static const char *const TAG = "ruuvi_ble"; bool parse_ruuvi_data_byte(const esp32_ble_tracker::adv_data_t &adv_data, RuuviParseResult &result) { const uint8_t data_type = adv_data[0]; diff --git a/esphome/components/ruuvitag/ruuvitag.cpp b/esphome/components/ruuvitag/ruuvitag.cpp index 2963b777d1..f4e4a72270 100644 --- a/esphome/components/ruuvitag/ruuvitag.cpp +++ b/esphome/components/ruuvitag/ruuvitag.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace ruuvitag { -static const char *TAG = "ruuvitag"; +static const char *const TAG = "ruuvitag"; void RuuviTag::dump_config() { ESP_LOGCONFIG(TAG, "RuuviTag"); diff --git a/esphome/components/scd30/scd30.cpp b/esphome/components/scd30/scd30.cpp index e658397e35..3eda98d41d 100644 --- a/esphome/components/scd30/scd30.cpp +++ b/esphome/components/scd30/scd30.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace scd30 { -static const char *TAG = "scd30"; +static const char *const TAG = "scd30"; static const uint16_t SCD30_CMD_GET_FIRMWARE_VERSION = 0xd100; static const uint16_t SCD30_CMD_START_CONTINUOUS_MEASUREMENTS = 0x0010; diff --git a/esphome/components/script/script.cpp b/esphome/components/script/script.cpp index e99931ced6..46bcef905b 100644 --- a/esphome/components/script/script.cpp +++ b/esphome/components/script/script.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace script { -static const char *TAG = "script"; +static const char *const TAG = "script"; void SingleScript::execute() { if (this->is_action_running()) { diff --git a/esphome/components/sdm_meter/sdm_meter.cpp b/esphome/components/sdm_meter/sdm_meter.cpp index de7c42421e..2348c88938 100644 --- a/esphome/components/sdm_meter/sdm_meter.cpp +++ b/esphome/components/sdm_meter/sdm_meter.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace sdm_meter { -static const char *TAG = "sdm_meter"; +static const char *const TAG = "sdm_meter"; static const uint8_t MODBUS_CMD_READ_IN_REGISTERS = 0x04; static const uint8_t MODBUS_REGISTER_COUNT = 80; // 74 x 16-bit registers diff --git a/esphome/components/sds011/sds011.cpp b/esphome/components/sds011/sds011.cpp index ddcbdbb712..0c04ff557f 100644 --- a/esphome/components/sds011/sds011.cpp +++ b/esphome/components/sds011/sds011.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sds011 { -static const char *TAG = "sds011"; +static const char *const TAG = "sds011"; static const uint8_t SDS011_MSG_REQUEST_LENGTH = 19; static const uint8_t SDS011_MSG_RESPONSE_LENGTH = 10; diff --git a/esphome/components/senseair/senseair.cpp b/esphome/components/senseair/senseair.cpp index 80b67dfa17..8fbb6f69db 100644 --- a/esphome/components/senseair/senseair.cpp +++ b/esphome/components/senseair/senseair.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace senseair { -static const char *TAG = "senseair"; +static const char *const TAG = "senseair"; static const uint8_t SENSEAIR_REQUEST_LENGTH = 8; static const uint8_t SENSEAIR_PPM_STATUS_RESPONSE_LENGTH = 13; static const uint8_t SENSEAIR_ABC_PERIOD_RESPONSE_LENGTH = 7; diff --git a/esphome/components/sensor/automation.cpp b/esphome/components/sensor/automation.cpp index 1e8f3f4c3e..f53c43d1f6 100644 --- a/esphome/components/sensor/automation.cpp +++ b/esphome/components/sensor/automation.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sensor { -static const char *TAG = "sensor.automation"; +static const char *const TAG = "sensor.automation"; } // namespace sensor } // namespace esphome diff --git a/esphome/components/sensor/filter.cpp b/esphome/components/sensor/filter.cpp index 57ffe9b482..a2058f7d90 100644 --- a/esphome/components/sensor/filter.cpp +++ b/esphome/components/sensor/filter.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace sensor { -static const char *TAG = "sensor.filter"; +static const char *const TAG = "sensor.filter"; // Filter uint32_t Filter::expected_interval(uint32_t input) { return input; } diff --git a/esphome/components/sensor/sensor.cpp b/esphome/components/sensor/sensor.cpp index d7be618c2a..b19d8be634 100644 --- a/esphome/components/sensor/sensor.cpp +++ b/esphome/components/sensor/sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sensor { -static const char *TAG = "sensor"; +static const char *const TAG = "sensor"; const char *state_class_to_string(StateClass state_class) { switch (state_class) { diff --git a/esphome/components/servo/servo.cpp b/esphome/components/servo/servo.cpp index 57baf4aecf..0b018ddb2e 100644 --- a/esphome/components/servo/servo.cpp +++ b/esphome/components/servo/servo.cpp @@ -4,9 +4,9 @@ namespace esphome { namespace servo { -static const char *TAG = "servo"; +static const char *const TAG = "servo"; -uint32_t global_servo_id = 1911044085ULL; +uint32_t global_servo_id = 1911044085ULL; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) void Servo::dump_config() { ESP_LOGCONFIG(TAG, "Servo:"); diff --git a/esphome/components/servo/servo.h b/esphome/components/servo/servo.h index 937706d44d..d95a524a8b 100644 --- a/esphome/components/servo/servo.h +++ b/esphome/components/servo/servo.h @@ -9,7 +9,7 @@ namespace esphome { namespace servo { -extern uint32_t global_servo_id; +extern uint32_t global_servo_id; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) class Servo : public Component { public: diff --git a/esphome/components/sgp30/sgp30.cpp b/esphome/components/sgp30/sgp30.cpp index a26f5f8b30..56e5c7214c 100644 --- a/esphome/components/sgp30/sgp30.cpp +++ b/esphome/components/sgp30/sgp30.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sgp30 { -static const char *TAG = "sgp30"; +static const char *const TAG = "sgp30"; static const uint16_t SGP30_CMD_GET_SERIAL_ID = 0x3682; static const uint16_t SGP30_CMD_GET_FEATURESET = 0x202f; diff --git a/esphome/components/sgp40/sgp40.cpp b/esphome/components/sgp40/sgp40.cpp index cfd9766aa9..3b634353c4 100644 --- a/esphome/components/sgp40/sgp40.cpp +++ b/esphome/components/sgp40/sgp40.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sgp40 { -static const char *TAG = "sgp40"; +static const char *const TAG = "sgp40"; void SGP40Component::setup() { ESP_LOGCONFIG(TAG, "Setting up SGP40..."); diff --git a/esphome/components/sht3xd/sht3xd.cpp b/esphome/components/sht3xd/sht3xd.cpp index 559fdc21ab..0bf2cc1a81 100644 --- a/esphome/components/sht3xd/sht3xd.cpp +++ b/esphome/components/sht3xd/sht3xd.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sht3xd { -static const char *TAG = "sht3xd"; +static const char *const TAG = "sht3xd"; static const uint16_t SHT3XD_COMMAND_READ_SERIAL_NUMBER = 0x3780; static const uint16_t SHT3XD_COMMAND_READ_STATUS = 0xF32D; diff --git a/esphome/components/sht4x/sht4x.cpp b/esphome/components/sht4x/sht4x.cpp index a4b315940d..6d7c917b57 100644 --- a/esphome/components/sht4x/sht4x.cpp +++ b/esphome/components/sht4x/sht4x.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sht4x { -static const char *TAG = "sht4x"; +static const char *const TAG = "sht4x"; static const uint8_t MEASURECOMMANDS[] = {0xFD, 0xF6, 0xE0}; diff --git a/esphome/components/shtcx/shtcx.cpp b/esphome/components/shtcx/shtcx.cpp index d67031febf..848da8d7d7 100644 --- a/esphome/components/shtcx/shtcx.cpp +++ b/esphome/components/shtcx/shtcx.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace shtcx { -static const char *TAG = "shtcx"; +static const char *const TAG = "shtcx"; static const uint16_t SHTCX_COMMAND_SLEEP = 0xB098; static const uint16_t SHTCX_COMMAND_WAKEUP = 0x3517; diff --git a/esphome/components/shutdown/shutdown_switch.cpp b/esphome/components/shutdown/shutdown_switch.cpp index ce33cd187f..3cc8ba9e1b 100644 --- a/esphome/components/shutdown/shutdown_switch.cpp +++ b/esphome/components/shutdown/shutdown_switch.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace shutdown { -static const char *TAG = "shutdown.switch"; +static const char *const TAG = "shutdown.switch"; void ShutdownSwitch::dump_config() { LOG_SWITCH("", "Shutdown Switch", this); } void ShutdownSwitch::write_state(bool state) { diff --git a/esphome/components/sim800l/sim800l.cpp b/esphome/components/sim800l/sim800l.cpp index 2cbf8d6ff2..e48b1ac9bd 100644 --- a/esphome/components/sim800l/sim800l.cpp +++ b/esphome/components/sim800l/sim800l.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace sim800l { -static const char *TAG = "sim800l"; +static const char *const TAG = "sim800l"; const char ASCII_CR = 0x0D; const char ASCII_LF = 0x0A; diff --git a/esphome/components/slow_pwm/slow_pwm_output.cpp b/esphome/components/slow_pwm/slow_pwm_output.cpp index b8fec2adf6..9b2589e735 100644 --- a/esphome/components/slow_pwm/slow_pwm_output.cpp +++ b/esphome/components/slow_pwm/slow_pwm_output.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace slow_pwm { -static const char *TAG = "output.slow_pwm"; +static const char *const TAG = "output.slow_pwm"; void SlowPWMOutput::setup() { this->pin_->setup(); diff --git a/esphome/components/sm16716/sm16716.cpp b/esphome/components/sm16716/sm16716.cpp index bc8e4fc1f4..373fbd4766 100644 --- a/esphome/components/sm16716/sm16716.cpp +++ b/esphome/components/sm16716/sm16716.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sm16716 { -static const char *TAG = "sm16716"; +static const char *const TAG = "sm16716"; void SM16716::setup() { ESP_LOGCONFIG(TAG, "Setting up SM16716OutputComponent..."); diff --git a/esphome/components/sm2135/sm2135.cpp b/esphome/components/sm2135/sm2135.cpp index 3991c220ec..8bd64972c9 100644 --- a/esphome/components/sm2135/sm2135.cpp +++ b/esphome/components/sm2135/sm2135.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace sm2135 { -static const char *TAG = "sm2135"; +static const char *const TAG = "sm2135"; static const uint8_t SM2135_ADDR_MC = 0xC0; // Max current register static const uint8_t SM2135_ADDR_CH = 0xC1; // RGB or CW channel select register diff --git a/esphome/components/sm300d2/sm300d2.cpp b/esphome/components/sm300d2/sm300d2.cpp index 25abc82f3c..34d80349f9 100644 --- a/esphome/components/sm300d2/sm300d2.cpp +++ b/esphome/components/sm300d2/sm300d2.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sm300d2 { -static const char *TAG = "sm300d2"; +static const char *const TAG = "sm300d2"; static const uint8_t SM300D2_RESPONSE_LENGTH = 17; void SM300D2Sensor::update() { diff --git a/esphome/components/sn74hc595/sn74hc595.cpp b/esphome/components/sn74hc595/sn74hc595.cpp index d82c5d5036..596ebf755d 100644 --- a/esphome/components/sn74hc595/sn74hc595.cpp +++ b/esphome/components/sn74hc595/sn74hc595.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sn74hc595 { -static const char *TAG = "sn74hc595"; +static const char *const TAG = "sn74hc595"; void SN74HC595Component::setup() { ESP_LOGCONFIG(TAG, "Setting up SN74HC595..."); diff --git a/esphome/components/sntp/sntp_component.cpp b/esphome/components/sntp/sntp_component.cpp index 4050609dd8..b667f3b1ce 100644 --- a/esphome/components/sntp/sntp_component.cpp +++ b/esphome/components/sntp/sntp_component.cpp @@ -11,7 +11,7 @@ namespace esphome { namespace sntp { -static const char *TAG = "sntp"; +static const char *const TAG = "sntp"; void SNTPComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up SNTP..."); diff --git a/esphome/components/speed/fan/speed_fan.cpp b/esphome/components/speed/fan/speed_fan.cpp index 0455fa200d..8c6ec54d4c 100644 --- a/esphome/components/speed/fan/speed_fan.cpp +++ b/esphome/components/speed/fan/speed_fan.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace speed { -static const char *TAG = "speed.fan"; +static const char *const TAG = "speed.fan"; void SpeedFan::dump_config() { ESP_LOGCONFIG(TAG, "Fan '%s':", this->fan_->get_name().c_str()); diff --git a/esphome/components/spi/spi.cpp b/esphome/components/spi/spi.cpp index d2850b8e7d..a5d7fba30a 100644 --- a/esphome/components/spi/spi.cpp +++ b/esphome/components/spi/spi.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace spi { -static const char *TAG = "spi"; +static const char *const TAG = "spi"; void ICACHE_RAM_ATTR HOT SPIComponent::disable() { if (this->hw_spi_ != nullptr) { diff --git a/esphome/components/sps30/sps30.cpp b/esphome/components/sps30/sps30.cpp index 181bf44189..30bd134626 100644 --- a/esphome/components/sps30/sps30.cpp +++ b/esphome/components/sps30/sps30.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sps30 { -static const char *TAG = "sps30"; +static const char *const TAG = "sps30"; static const uint16_t SPS30_CMD_GET_ARTICLE_CODE = 0xD025; static const uint16_t SPS30_CMD_GET_SERIAL_NUMBER = 0xD033; diff --git a/esphome/components/ssd1306_base/ssd1306_base.cpp b/esphome/components/ssd1306_base/ssd1306_base.cpp index 1537d3b526..58f86fd182 100644 --- a/esphome/components/ssd1306_base/ssd1306_base.cpp +++ b/esphome/components/ssd1306_base/ssd1306_base.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1306_base { -static const char *TAG = "ssd1306"; +static const char *const TAG = "ssd1306"; static const uint8_t BLACK = 0; static const uint8_t WHITE = 1; diff --git a/esphome/components/ssd1306_i2c/ssd1306_i2c.cpp b/esphome/components/ssd1306_i2c/ssd1306_i2c.cpp index 8c535094ac..fce9796008 100644 --- a/esphome/components/ssd1306_i2c/ssd1306_i2c.cpp +++ b/esphome/components/ssd1306_i2c/ssd1306_i2c.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ssd1306_i2c { -static const char *TAG = "ssd1306_i2c"; +static const char *const TAG = "ssd1306_i2c"; void I2CSSD1306::setup() { ESP_LOGCONFIG(TAG, "Setting up I2C SSD1306..."); diff --git a/esphome/components/ssd1306_spi/ssd1306_spi.cpp b/esphome/components/ssd1306_spi/ssd1306_spi.cpp index d87f412f70..5ef25b8139 100644 --- a/esphome/components/ssd1306_spi/ssd1306_spi.cpp +++ b/esphome/components/ssd1306_spi/ssd1306_spi.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1306_spi { -static const char *TAG = "ssd1306_spi"; +static const char *const TAG = "ssd1306_spi"; void SPISSD1306::setup() { ESP_LOGCONFIG(TAG, "Setting up SPI SSD1306..."); diff --git a/esphome/components/ssd1322_base/ssd1322_base.cpp b/esphome/components/ssd1322_base/ssd1322_base.cpp index 703f53fa93..0a3233acfe 100644 --- a/esphome/components/ssd1322_base/ssd1322_base.cpp +++ b/esphome/components/ssd1322_base/ssd1322_base.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1322_base { -static const char *TAG = "ssd1322"; +static const char *const TAG = "ssd1322"; static const uint8_t SSD1322_MAX_CONTRAST = 255; static const uint8_t SSD1322_COLORMASK = 0x0f; diff --git a/esphome/components/ssd1322_spi/ssd1322_spi.cpp b/esphome/components/ssd1322_spi/ssd1322_spi.cpp index 561a2e7a71..50c46c4d02 100644 --- a/esphome/components/ssd1322_spi/ssd1322_spi.cpp +++ b/esphome/components/ssd1322_spi/ssd1322_spi.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1322_spi { -static const char *TAG = "ssd1322_spi"; +static const char *const TAG = "ssd1322_spi"; void SPISSD1322::setup() { ESP_LOGCONFIG(TAG, "Setting up SPI SSD1322..."); diff --git a/esphome/components/ssd1325_base/ssd1325_base.cpp b/esphome/components/ssd1325_base/ssd1325_base.cpp index 9818880505..1cca1853b1 100644 --- a/esphome/components/ssd1325_base/ssd1325_base.cpp +++ b/esphome/components/ssd1325_base/ssd1325_base.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1325_base { -static const char *TAG = "ssd1325"; +static const char *const TAG = "ssd1325"; static const uint8_t BLACK = 0; static const uint8_t WHITE = 15; diff --git a/esphome/components/ssd1325_spi/ssd1325_spi.cpp b/esphome/components/ssd1325_spi/ssd1325_spi.cpp index 9df05439ca..98f48b8538 100644 --- a/esphome/components/ssd1325_spi/ssd1325_spi.cpp +++ b/esphome/components/ssd1325_spi/ssd1325_spi.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1325_spi { -static const char *TAG = "ssd1325_spi"; +static const char *const TAG = "ssd1325_spi"; void SPISSD1325::setup() { ESP_LOGCONFIG(TAG, "Setting up SPI SSD1325..."); diff --git a/esphome/components/ssd1327_base/ssd1327_base.cpp b/esphome/components/ssd1327_base/ssd1327_base.cpp index 398712c083..798f67e4fc 100644 --- a/esphome/components/ssd1327_base/ssd1327_base.cpp +++ b/esphome/components/ssd1327_base/ssd1327_base.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1327_base { -static const char *TAG = "ssd1327"; +static const char *const TAG = "ssd1327"; static const uint8_t SSD1327_MAX_CONTRAST = 127; static const uint8_t SSD1327_COLORMASK = 0x0f; diff --git a/esphome/components/ssd1327_i2c/ssd1327_i2c.cpp b/esphome/components/ssd1327_i2c/ssd1327_i2c.cpp index 16cada0ef2..2967d2f9c4 100644 --- a/esphome/components/ssd1327_i2c/ssd1327_i2c.cpp +++ b/esphome/components/ssd1327_i2c/ssd1327_i2c.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ssd1327_i2c { -static const char *TAG = "ssd1327_i2c"; +static const char *const TAG = "ssd1327_i2c"; void I2CSSD1327::setup() { ESP_LOGCONFIG(TAG, "Setting up I2C SSD1327..."); diff --git a/esphome/components/ssd1327_spi/ssd1327_spi.cpp b/esphome/components/ssd1327_spi/ssd1327_spi.cpp index c10ce6e9c8..1dd2b73e66 100644 --- a/esphome/components/ssd1327_spi/ssd1327_spi.cpp +++ b/esphome/components/ssd1327_spi/ssd1327_spi.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1327_spi { -static const char *TAG = "ssd1327_spi"; +static const char *const TAG = "ssd1327_spi"; void SPISSD1327::setup() { ESP_LOGCONFIG(TAG, "Setting up SPI SSD1327..."); diff --git a/esphome/components/ssd1331_base/ssd1331_base.cpp b/esphome/components/ssd1331_base/ssd1331_base.cpp index 9db5581044..a4bbad508c 100644 --- a/esphome/components/ssd1331_base/ssd1331_base.cpp +++ b/esphome/components/ssd1331_base/ssd1331_base.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1331_base { -static const char *TAG = "ssd1331"; +static const char *const TAG = "ssd1331"; static const uint16_t BLACK = 0; static const uint16_t WHITE = 0xffff; diff --git a/esphome/components/ssd1331_spi/ssd1331_spi.cpp b/esphome/components/ssd1331_spi/ssd1331_spi.cpp index f618c6d368..ff42c74b9f 100644 --- a/esphome/components/ssd1331_spi/ssd1331_spi.cpp +++ b/esphome/components/ssd1331_spi/ssd1331_spi.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1331_spi { -static const char *TAG = "ssd1331_spi"; +static const char *const TAG = "ssd1331_spi"; void SPISSD1331::setup() { ESP_LOGCONFIG(TAG, "Setting up SPI SSD1331..."); diff --git a/esphome/components/ssd1351_base/ssd1351_base.cpp b/esphome/components/ssd1351_base/ssd1351_base.cpp index 42407a13de..34f357e38a 100644 --- a/esphome/components/ssd1351_base/ssd1351_base.cpp +++ b/esphome/components/ssd1351_base/ssd1351_base.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1351_base { -static const char *TAG = "ssd1351"; +static const char *const TAG = "ssd1351"; static const uint16_t BLACK = 0; static const uint16_t WHITE = 0xffff; diff --git a/esphome/components/ssd1351_spi/ssd1351_spi.cpp b/esphome/components/ssd1351_spi/ssd1351_spi.cpp index 2839ef7a8e..9599c6e644 100644 --- a/esphome/components/ssd1351_spi/ssd1351_spi.cpp +++ b/esphome/components/ssd1351_spi/ssd1351_spi.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace ssd1351_spi { -static const char *TAG = "ssd1351_spi"; +static const char *const TAG = "ssd1351_spi"; void SPISSD1351::setup() { ESP_LOGCONFIG(TAG, "Setting up SPI SSD1351..."); diff --git a/esphome/components/st7735/st7735.cpp b/esphome/components/st7735/st7735.cpp index 201098f3cf..f0711f7c87 100644 --- a/esphome/components/st7735/st7735.cpp +++ b/esphome/components/st7735/st7735.cpp @@ -218,7 +218,7 @@ static const uint8_t PROGMEM 100 }; // 100 ms delay // clang-format on -static const char *TAG = "st7735"; +static const char *const TAG = "st7735"; ST7735::ST7735(ST7735Model model, int width, int height, int colstart, int rowstart, boolean eightbitcolor, boolean usebgr) { diff --git a/esphome/components/st7789v/st7789v.cpp b/esphome/components/st7789v/st7789v.cpp index 3a6374263a..c84153970d 100644 --- a/esphome/components/st7789v/st7789v.cpp +++ b/esphome/components/st7789v/st7789v.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace st7789v { -static const char *TAG = "st7789v"; +static const char *const TAG = "st7789v"; void ST7789V::setup() { ESP_LOGCONFIG(TAG, "Setting up SPI ST7789V..."); diff --git a/esphome/components/status/status_binary_sensor.cpp b/esphome/components/status/status_binary_sensor.cpp index 90ac1faad7..152e3aff9d 100644 --- a/esphome/components/status/status_binary_sensor.cpp +++ b/esphome/components/status/status_binary_sensor.cpp @@ -13,7 +13,7 @@ namespace esphome { namespace status { -static const char *TAG = "status"; +static const char *const TAG = "status"; void StatusBinarySensor::loop() { bool status = network_is_connected(); diff --git a/esphome/components/status_led/status_led.cpp b/esphome/components/status_led/status_led.cpp index 472b3cd92f..d2d56cf05b 100644 --- a/esphome/components/status_led/status_led.cpp +++ b/esphome/components/status_led/status_led.cpp @@ -5,9 +5,9 @@ namespace esphome { namespace status_led { -static const char *TAG = "status_led"; +static const char *const TAG = "status_led"; -StatusLED *global_status_led = nullptr; +StatusLED *global_status_led = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) StatusLED::StatusLED(GPIOPin *pin) : pin_(pin) { global_status_led = this; } void StatusLED::pre_setup() { diff --git a/esphome/components/status_led/status_led.h b/esphome/components/status_led/status_led.h index 7da325e460..79f9f524a3 100644 --- a/esphome/components/status_led/status_led.h +++ b/esphome/components/status_led/status_led.h @@ -20,7 +20,7 @@ class StatusLED : public Component { GPIOPin *pin_; }; -extern StatusLED *global_status_led; +extern StatusLED *global_status_led; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace status_led } // namespace esphome diff --git a/esphome/components/stepper/stepper.cpp b/esphome/components/stepper/stepper.cpp index b966fb00cc..d7f6cc6dda 100644 --- a/esphome/components/stepper/stepper.cpp +++ b/esphome/components/stepper/stepper.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace stepper { -static const char *TAG = "stepper"; +static const char *const TAG = "stepper"; void Stepper::calculate_speed_(uint32_t now) { // delta t since last calculation in seconds diff --git a/esphome/components/sts3x/sts3x.cpp b/esphome/components/sts3x/sts3x.cpp index 1a24a17caf..5d6d725a17 100644 --- a/esphome/components/sts3x/sts3x.cpp +++ b/esphome/components/sts3x/sts3x.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sts3x { -static const char *TAG = "sts3x"; +static const char *const TAG = "sts3x"; static const uint16_t STS3X_COMMAND_READ_SERIAL_NUMBER = 0x3780; static const uint16_t STS3X_COMMAND_READ_STATUS = 0xF32D; diff --git a/esphome/components/sun/sensor/sun_sensor.cpp b/esphome/components/sun/sensor/sun_sensor.cpp index 63b7715287..6c90722c29 100644 --- a/esphome/components/sun/sensor/sun_sensor.cpp +++ b/esphome/components/sun/sensor/sun_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sun { -static const char *TAG = "sun.sensor"; +static const char *const TAG = "sun.sensor"; void SunSensor::dump_config() { LOG_SENSOR("", "Sun Sensor", this); } diff --git a/esphome/components/sun/sun.cpp b/esphome/components/sun/sun.cpp index 0722e66e67..4fd034ce7d 100644 --- a/esphome/components/sun/sun.cpp +++ b/esphome/components/sun/sun.cpp @@ -16,7 +16,7 @@ namespace sun { using namespace esphome::sun::internal; -static const char *TAG = "sun"; +static const char *const TAG = "sun"; #undef PI #undef degrees diff --git a/esphome/components/sun/text_sensor/sun_text_sensor.cpp b/esphome/components/sun/text_sensor/sun_text_sensor.cpp index ee949584cc..c047b87fdd 100644 --- a/esphome/components/sun/text_sensor/sun_text_sensor.cpp +++ b/esphome/components/sun/text_sensor/sun_text_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace sun { -static const char *TAG = "sun.text_sensor"; +static const char *const TAG = "sun.text_sensor"; void SunTextSensor::dump_config() { LOG_TEXT_SENSOR("", "Sun Text Sensor", this); } diff --git a/esphome/components/switch/automation.cpp b/esphome/components/switch/automation.cpp index ba9bb7e05a..5989ae9ce3 100644 --- a/esphome/components/switch/automation.cpp +++ b/esphome/components/switch/automation.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace switch_ { -static const char *TAG = "switch.automation"; +static const char *const TAG = "switch.automation"; } // namespace switch_ } // namespace esphome diff --git a/esphome/components/switch/switch.cpp b/esphome/components/switch/switch.cpp index a6a25dd9dc..c96f9a40d0 100644 --- a/esphome/components/switch/switch.cpp +++ b/esphome/components/switch/switch.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace switch_ { -static const char *TAG = "switch"; +static const char *const TAG = "switch"; std::string Switch::icon() { return ""; } Switch::Switch(const std::string &name) : Nameable(name), state(false) {} diff --git a/esphome/components/sx1509/output/sx1509_float_output.cpp b/esphome/components/sx1509/output/sx1509_float_output.cpp index 7ff1bbb61b..c68f8f9ded 100644 --- a/esphome/components/sx1509/output/sx1509_float_output.cpp +++ b/esphome/components/sx1509/output/sx1509_float_output.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace sx1509 { -static const char *TAG = "sx1509_float_channel"; +static const char *const TAG = "sx1509_float_channel"; void SX1509FloatOutputChannel::write_state(float state) { const uint16_t max_duty = 255; diff --git a/esphome/components/sx1509/sx1509.cpp b/esphome/components/sx1509/sx1509.cpp index 0d6ffbb9b8..14d9ad7a61 100644 --- a/esphome/components/sx1509/sx1509.cpp +++ b/esphome/components/sx1509/sx1509.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace sx1509 { -static const char *TAG = "sx1509"; +static const char *const TAG = "sx1509"; void SX1509Component::setup() { ESP_LOGCONFIG(TAG, "Setting up SX1509Component..."); diff --git a/esphome/components/sx1509/sx1509_gpio_pin.cpp b/esphome/components/sx1509/sx1509_gpio_pin.cpp index 1d1c87b4e6..ac55ac1ca5 100644 --- a/esphome/components/sx1509/sx1509_gpio_pin.cpp +++ b/esphome/components/sx1509/sx1509_gpio_pin.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace sx1509 { -static const char *TAG = "sx1509_gpio_pin"; +static const char *const TAG = "sx1509_gpio_pin"; void SX1509GPIOPin::setup() { ESP_LOGD(TAG, "setup pin %d", this->pin_); diff --git a/esphome/components/tca9548a/tca9548a.cpp b/esphome/components/tca9548a/tca9548a.cpp index 0df60d6dd2..472b8b6673 100644 --- a/esphome/components/tca9548a/tca9548a.cpp +++ b/esphome/components/tca9548a/tca9548a.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tca9548a { -static const char *TAG = "tca9548a"; +static const char *const TAG = "tca9548a"; void TCA9548AComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up TCA9548A..."); diff --git a/esphome/components/tcl112/tcl112.cpp b/esphome/components/tcl112/tcl112.cpp index 91cec27094..da44b3c827 100644 --- a/esphome/components/tcl112/tcl112.cpp +++ b/esphome/components/tcl112/tcl112.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tcl112 { -static const char *TAG = "tcl112.climate"; +static const char *const TAG = "tcl112.climate"; const uint16_t TCL112_STATE_LENGTH = 14; const uint16_t TCL112_BITS = TCL112_STATE_LENGTH * 8; diff --git a/esphome/components/tcs34725/tcs34725.cpp b/esphome/components/tcs34725/tcs34725.cpp index 49aff5b162..52548262c1 100644 --- a/esphome/components/tcs34725/tcs34725.cpp +++ b/esphome/components/tcs34725/tcs34725.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tcs34725 { -static const char *TAG = "tcs34725"; +static const char *const TAG = "tcs34725"; static const uint8_t TCS34725_ADDRESS = 0x29; static const uint8_t TCS34725_COMMAND_BIT = 0x80; diff --git a/esphome/components/teleinfo/sensor/teleinfo_sensor.cpp b/esphome/components/teleinfo/sensor/teleinfo_sensor.cpp index 202cae37c3..661c149c09 100644 --- a/esphome/components/teleinfo/sensor/teleinfo_sensor.cpp +++ b/esphome/components/teleinfo/sensor/teleinfo_sensor.cpp @@ -3,7 +3,7 @@ namespace esphome { namespace teleinfo { -static const char *TAG = "teleinfo_sensor"; +static const char *const TAG = "teleinfo_sensor"; TeleInfoSensor::TeleInfoSensor(const char *tag) { this->tag = std::string(tag); } void TeleInfoSensor::publish_val(const std::string &val) { auto newval = parse_float(val); diff --git a/esphome/components/teleinfo/teleinfo.cpp b/esphome/components/teleinfo/teleinfo.cpp index 36e6b4a2b1..fa76dcfe76 100644 --- a/esphome/components/teleinfo/teleinfo.cpp +++ b/esphome/components/teleinfo/teleinfo.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace teleinfo { -static const char *TAG = "teleinfo"; +static const char *const TAG = "teleinfo"; /* Helpers */ static int get_field(char *dest, char *buf_start, char *buf_end, int sep) { diff --git a/esphome/components/teleinfo/text_sensor/teleinfo_text_sensor.cpp b/esphome/components/teleinfo/text_sensor/teleinfo_text_sensor.cpp index 221e2cba4c..1adbd9ce13 100644 --- a/esphome/components/teleinfo/text_sensor/teleinfo_text_sensor.cpp +++ b/esphome/components/teleinfo/text_sensor/teleinfo_text_sensor.cpp @@ -3,7 +3,7 @@ namespace esphome { namespace teleinfo { -static const char *TAG = "teleinfo_text_sensor"; +static const char *const TAG = "teleinfo_text_sensor"; TeleInfoTextSensor::TeleInfoTextSensor(const char *tag) { this->tag = std::string(tag); } void TeleInfoTextSensor::publish_val(const std::string &val) { publish_state(val); } void TeleInfoTextSensor::dump_config() { LOG_TEXT_SENSOR(" ", tag.c_str(), this); } diff --git a/esphome/components/template/binary_sensor/template_binary_sensor.cpp b/esphome/components/template/binary_sensor/template_binary_sensor.cpp index a4199faa9a..66ff4be4c4 100644 --- a/esphome/components/template/binary_sensor/template_binary_sensor.cpp +++ b/esphome/components/template/binary_sensor/template_binary_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace template_ { -static const char *TAG = "template.binary_sensor"; +static const char *const TAG = "template.binary_sensor"; void TemplateBinarySensor::loop() { if (!this->f_.has_value()) diff --git a/esphome/components/template/cover/template_cover.cpp b/esphome/components/template/cover/template_cover.cpp index 147f76af7d..47c651e643 100644 --- a/esphome/components/template/cover/template_cover.cpp +++ b/esphome/components/template/cover/template_cover.cpp @@ -6,7 +6,7 @@ namespace template_ { using namespace esphome::cover; -static const char *TAG = "template.cover"; +static const char *const TAG = "template.cover"; TemplateCover::TemplateCover() : open_trigger_(new Trigger<>()), diff --git a/esphome/components/template/sensor/template_sensor.cpp b/esphome/components/template/sensor/template_sensor.cpp index e2d36f13a0..9324cb5dea 100644 --- a/esphome/components/template/sensor/template_sensor.cpp +++ b/esphome/components/template/sensor/template_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace template_ { -static const char *TAG = "template.sensor"; +static const char *const TAG = "template.sensor"; void TemplateSensor::update() { if (!this->f_.has_value()) diff --git a/esphome/components/template/switch/template_switch.cpp b/esphome/components/template/switch/template_switch.cpp index d9f95e203c..b3e545d3e9 100644 --- a/esphome/components/template/switch/template_switch.cpp +++ b/esphome/components/template/switch/template_switch.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace template_ { -static const char *TAG = "template.switch"; +static const char *const TAG = "template.switch"; TemplateSwitch::TemplateSwitch() : turn_on_trigger_(new Trigger<>()), turn_off_trigger_(new Trigger<>()) {} diff --git a/esphome/components/template/text_sensor/template_text_sensor.cpp b/esphome/components/template/text_sensor/template_text_sensor.cpp index e06c70d95e..885ad47bbf 100644 --- a/esphome/components/template/text_sensor/template_text_sensor.cpp +++ b/esphome/components/template/text_sensor/template_text_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace template_ { -static const char *TAG = "template.text_sensor"; +static const char *const TAG = "template.text_sensor"; void TemplateTextSensor::update() { if (!this->f_.has_value()) diff --git a/esphome/components/text_sensor/text_sensor.cpp b/esphome/components/text_sensor/text_sensor.cpp index 0b6a02b2d4..8738860d55 100644 --- a/esphome/components/text_sensor/text_sensor.cpp +++ b/esphome/components/text_sensor/text_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace text_sensor { -static const char *TAG = "text_sensor"; +static const char *const TAG = "text_sensor"; TextSensor::TextSensor() : TextSensor("") {} TextSensor::TextSensor(const std::string &name) : Nameable(name) {} diff --git a/esphome/components/thermostat/thermostat_climate.cpp b/esphome/components/thermostat/thermostat_climate.cpp index 3bab0e85fd..6154f293dc 100644 --- a/esphome/components/thermostat/thermostat_climate.cpp +++ b/esphome/components/thermostat/thermostat_climate.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace thermostat { -static const char *TAG = "thermostat.climate"; +static const char *const TAG = "thermostat.climate"; void ThermostatClimate::setup() { this->sensor_->add_on_state_callback([this](float state) { diff --git a/esphome/components/time/automation.cpp b/esphome/components/time/automation.cpp index 8e41fba0da..6d34459fea 100644 --- a/esphome/components/time/automation.cpp +++ b/esphome/components/time/automation.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace time { -static const char *TAG = "automation"; +static const char *const TAG = "automation"; void CronTrigger::add_second(uint8_t second) { this->seconds_[second] = true; } void CronTrigger::add_minute(uint8_t minute) { this->minutes_[minute] = true; } diff --git a/esphome/components/time/real_time_clock.cpp b/esphome/components/time/real_time_clock.cpp index 4bda6bdfe9..c2a93b5191 100644 --- a/esphome/components/time/real_time_clock.cpp +++ b/esphome/components/time/real_time_clock.cpp @@ -9,7 +9,7 @@ namespace esphome { namespace time { -static const char *TAG = "time"; +static const char *const TAG = "time"; RealTimeClock::RealTimeClock() = default; void RealTimeClock::call_setup() { diff --git a/esphome/components/time_based/time_based_cover.cpp b/esphome/components/time_based/time_based_cover.cpp index 1aa3c2471a..066004f014 100644 --- a/esphome/components/time_based/time_based_cover.cpp +++ b/esphome/components/time_based/time_based_cover.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace time_based { -static const char *TAG = "time_based.cover"; +static const char *const TAG = "time_based.cover"; using namespace esphome::cover; diff --git a/esphome/components/tlc59208f/tlc59208f_output.cpp b/esphome/components/tlc59208f/tlc59208f_output.cpp index 6e65ff4e76..784a0947ed 100644 --- a/esphome/components/tlc59208f/tlc59208f_output.cpp +++ b/esphome/components/tlc59208f/tlc59208f_output.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace tlc59208f { -static const char *TAG = "tlc59208f"; +static const char *const TAG = "tlc59208f"; // * marks register defaults // 0*: Register auto increment disabled, 1: Register auto increment enabled diff --git a/esphome/components/tm1637/tm1637.cpp b/esphome/components/tm1637/tm1637.cpp index 52cf9ebd1b..1f1c0fd301 100644 --- a/esphome/components/tm1637/tm1637.cpp +++ b/esphome/components/tm1637/tm1637.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace tm1637 { -const char *TAG = "display.tm1637"; +static const char *const TAG = "display.tm1637"; const uint8_t TM1637_I2C_COMM1 = 0x40; const uint8_t TM1637_I2C_COMM2 = 0xC0; const uint8_t TM1637_I2C_COMM3 = 0x80; diff --git a/esphome/components/tm1651/tm1651.cpp b/esphome/components/tm1651/tm1651.cpp index 0417706327..bb37e9f4c9 100644 --- a/esphome/components/tm1651/tm1651.cpp +++ b/esphome/components/tm1651/tm1651.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tm1651 { -static const char *TAG = "tm1651.display"; +static const char *const TAG = "tm1651.display"; static const uint8_t MAX_INPUT_LEVEL_PERCENT = 100; static const uint8_t TM1651_MAX_LEVEL = 7; diff --git a/esphome/components/tmp102/tmp102.cpp b/esphome/components/tmp102/tmp102.cpp index 204c4f0805..7b3dcad4aa 100644 --- a/esphome/components/tmp102/tmp102.cpp +++ b/esphome/components/tmp102/tmp102.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tmp102 { -static const char *TAG = "tmp102"; +static const char *const TAG = "tmp102"; static const uint8_t TMP102_ADDRESS = 0x48; static const uint8_t TMP102_REGISTER_TEMPERATURE = 0x00; diff --git a/esphome/components/tmp117/tmp117.cpp b/esphome/components/tmp117/tmp117.cpp index 9040d9bfed..f719ea93b6 100644 --- a/esphome/components/tmp117/tmp117.cpp +++ b/esphome/components/tmp117/tmp117.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace tmp117 { -static const char *TAG = "tmp117"; +static const char *const TAG = "tmp117"; void TMP117Component::update() { int16_t data; diff --git a/esphome/components/tof10120/tof10120_sensor.cpp b/esphome/components/tof10120/tof10120_sensor.cpp index 4e2732bb08..cabfdad41d 100644 --- a/esphome/components/tof10120/tof10120_sensor.cpp +++ b/esphome/components/tof10120/tof10120_sensor.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace tof10120 { -static const char *TAG = "tof10120"; +static const char *const TAG = "tof10120"; static const uint8_t TOF10120_READ_DISTANCE_CMD[] = {0x00}; static const uint8_t TOF10120_DEFAULT_DELAY = 30; diff --git a/esphome/components/toshiba/toshiba.cpp b/esphome/components/toshiba/toshiba.cpp index 33e2831dd3..4f5b7d8537 100644 --- a/esphome/components/toshiba/toshiba.cpp +++ b/esphome/components/toshiba/toshiba.cpp @@ -36,7 +36,7 @@ const uint8_t TOSHIBA_POWER_ECO = 0x03; const uint8_t TOSHIBA_MOTION_SWING = 0x04; const uint8_t TOSHIBA_MOTION_FIX = 0x00; -static const char *TAG = "toshiba.climate"; +static const char *const TAG = "toshiba.climate"; void ToshibaClimate::transmit_state() { uint8_t message[16] = {0}; diff --git a/esphome/components/total_daily_energy/total_daily_energy.cpp b/esphome/components/total_daily_energy/total_daily_energy.cpp index 1816c46844..8c5ef8c137 100644 --- a/esphome/components/total_daily_energy/total_daily_energy.cpp +++ b/esphome/components/total_daily_energy/total_daily_energy.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace total_daily_energy { -static const char *TAG = "total_daily_energy"; +static const char *const TAG = "total_daily_energy"; void TotalDailyEnergy::setup() { this->pref_ = global_preferences.make_preference(this->get_object_id_hash()); diff --git a/esphome/components/tsl2561/tsl2561.cpp b/esphome/components/tsl2561/tsl2561.cpp index ffd39a54b0..e80e9220d8 100644 --- a/esphome/components/tsl2561/tsl2561.cpp +++ b/esphome/components/tsl2561/tsl2561.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tsl2561 { -static const char *TAG = "tsl2561"; +static const char *const TAG = "tsl2561"; static const uint8_t TSL2561_COMMAND_BIT = 0x80; static const uint8_t TSL2561_WORD_BIT = 0x20; diff --git a/esphome/components/ttp229_bsf/ttp229_bsf.cpp b/esphome/components/ttp229_bsf/ttp229_bsf.cpp index 9b5c3c67de..93c947d28a 100644 --- a/esphome/components/ttp229_bsf/ttp229_bsf.cpp +++ b/esphome/components/ttp229_bsf/ttp229_bsf.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ttp229_bsf { -static const char *TAG = "ttp229_bsf"; +static const char *const TAG = "ttp229_bsf"; void TTP229BSFComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up ttp229_bsf... "); diff --git a/esphome/components/ttp229_lsf/ttp229_lsf.cpp b/esphome/components/ttp229_lsf/ttp229_lsf.cpp index 2bd5f8556d..6e3e68ea7a 100644 --- a/esphome/components/ttp229_lsf/ttp229_lsf.cpp +++ b/esphome/components/ttp229_lsf/ttp229_lsf.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ttp229_lsf { -static const char *TAG = "ttp229_lsf"; +static const char *const TAG = "ttp229_lsf"; void TTP229LSFComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up ttp229..."); diff --git a/esphome/components/tuya/binary_sensor/tuya_binary_sensor.cpp b/esphome/components/tuya/binary_sensor/tuya_binary_sensor.cpp index abc4051514..edfbb2ac60 100644 --- a/esphome/components/tuya/binary_sensor/tuya_binary_sensor.cpp +++ b/esphome/components/tuya/binary_sensor/tuya_binary_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tuya { -static const char *TAG = "tuya.binary_sensor"; +static const char *const TAG = "tuya.binary_sensor"; void TuyaBinarySensor::setup() { this->parent_->register_listener(this->sensor_id_, [this](const TuyaDatapoint &datapoint) { diff --git a/esphome/components/tuya/climate/tuya_climate.cpp b/esphome/components/tuya/climate/tuya_climate.cpp index 1211a4856f..66fdcbb472 100644 --- a/esphome/components/tuya/climate/tuya_climate.cpp +++ b/esphome/components/tuya/climate/tuya_climate.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tuya { -static const char *TAG = "tuya.climate"; +static const char *const TAG = "tuya.climate"; void TuyaClimate::setup() { if (this->switch_id_.has_value()) { diff --git a/esphome/components/tuya/fan/tuya_fan.cpp b/esphome/components/tuya/fan/tuya_fan.cpp index d3da3139f5..56efcf2d77 100644 --- a/esphome/components/tuya/fan/tuya_fan.cpp +++ b/esphome/components/tuya/fan/tuya_fan.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace tuya { -static const char *TAG = "tuya.fan"; +static const char *const TAG = "tuya.fan"; void TuyaFan::setup() { auto traits = fan::FanTraits(this->oscillation_id_.has_value(), this->speed_id_.has_value(), diff --git a/esphome/components/tuya/light/tuya_light.cpp b/esphome/components/tuya/light/tuya_light.cpp index 10aff93f75..d7e3561328 100644 --- a/esphome/components/tuya/light/tuya_light.cpp +++ b/esphome/components/tuya/light/tuya_light.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tuya { -static const char *TAG = "tuya.light"; +static const char *const TAG = "tuya.light"; void TuyaLight::setup() { if (this->color_temperature_id_.has_value()) { diff --git a/esphome/components/tuya/sensor/tuya_sensor.cpp b/esphome/components/tuya/sensor/tuya_sensor.cpp index d5fad63f64..1e39c1bc35 100644 --- a/esphome/components/tuya/sensor/tuya_sensor.cpp +++ b/esphome/components/tuya/sensor/tuya_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tuya { -static const char *TAG = "tuya.sensor"; +static const char *const TAG = "tuya.sensor"; void TuyaSensor::setup() { this->parent_->register_listener(this->sensor_id_, [this](const TuyaDatapoint &datapoint) { diff --git a/esphome/components/tuya/switch/tuya_switch.cpp b/esphome/components/tuya/switch/tuya_switch.cpp index 62008c3580..8cd09fb01c 100644 --- a/esphome/components/tuya/switch/tuya_switch.cpp +++ b/esphome/components/tuya/switch/tuya_switch.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace tuya { -static const char *TAG = "tuya.switch"; +static const char *const TAG = "tuya.switch"; void TuyaSwitch::setup() { this->parent_->register_listener(this->switch_id_, [this](const TuyaDatapoint &datapoint) { diff --git a/esphome/components/tuya/tuya.cpp b/esphome/components/tuya/tuya.cpp index 1a116219a6..540a925879 100644 --- a/esphome/components/tuya/tuya.cpp +++ b/esphome/components/tuya/tuya.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace tuya { -static const char *TAG = "tuya"; +static const char *const TAG = "tuya"; static const int COMMAND_DELAY = 50; void Tuya::setup() { diff --git a/esphome/components/tx20/tx20.cpp b/esphome/components/tx20/tx20.cpp index f3dafda288..f48e29521c 100644 --- a/esphome/components/tx20/tx20.cpp +++ b/esphome/components/tx20/tx20.cpp @@ -5,12 +5,12 @@ namespace esphome { namespace tx20 { -static const char *TAG = "tx20"; +static const char *const TAG = "tx20"; static const uint8_t MAX_BUFFER_SIZE = 41; static const uint16_t TX20_MAX_TIME = MAX_BUFFER_SIZE * 1200 + 5000; static const uint16_t TX20_BIT_TIME = 1200; -static const char *DIRECTIONS[] = {"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", - "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"}; +static const char *const DIRECTIONS[] = {"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", + "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"}; void Tx20Component::setup() { ESP_LOGCONFIG(TAG, "Setting up Tx20"); diff --git a/esphome/components/uart/switch/uart_switch.cpp b/esphome/components/uart/switch/uart_switch.cpp index a1ebb6dbb9..ffed08c731 100644 --- a/esphome/components/uart/switch/uart_switch.cpp +++ b/esphome/components/uart/switch/uart_switch.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace uart { -static const char *TAG = "uart.switch"; +static const char *const TAG = "uart.switch"; void UARTSwitch::loop() { if (this->state && this->send_every_) { diff --git a/esphome/components/uart/uart.cpp b/esphome/components/uart/uart.cpp index 1cfdb38a90..08e3395a7a 100644 --- a/esphome/components/uart/uart.cpp +++ b/esphome/components/uart/uart.cpp @@ -11,7 +11,7 @@ namespace esphome { namespace uart { -static const char *TAG = "uart"; +static const char *const TAG = "uart"; size_t UARTComponent::write(uint8_t data) { this->write_byte(data); diff --git a/esphome/components/uart/uart_esp32.cpp b/esphome/components/uart/uart_esp32.cpp index 920fe660be..89de4c0cc1 100644 --- a/esphome/components/uart/uart_esp32.cpp +++ b/esphome/components/uart/uart_esp32.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace uart { -static const char *TAG = "uart_esp32"; +static const char *const TAG = "uart_esp32"; uint8_t next_uart_num = 1; static const uint32_t UART_PARITY_EVEN = 0 << 0; diff --git a/esphome/components/uart/uart_esp8266.cpp b/esphome/components/uart/uart_esp8266.cpp index edb530f537..6f7d4c1f8b 100644 --- a/esphome/components/uart/uart_esp8266.cpp +++ b/esphome/components/uart/uart_esp8266.cpp @@ -8,7 +8,7 @@ namespace esphome { namespace uart { -static const char *TAG = "uart_esp8266"; +static const char *const TAG = "uart_esp8266"; uint32_t UARTComponent::get_config() { uint32_t config = 0; diff --git a/esphome/components/uln2003/uln2003.cpp b/esphome/components/uln2003/uln2003.cpp index 9bf34490ec..1af9806906 100644 --- a/esphome/components/uln2003/uln2003.cpp +++ b/esphome/components/uln2003/uln2003.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace uln2003 { -static const char *TAG = "uln2003.stepper"; +static const char *const TAG = "uln2003.stepper"; void ULN2003::setup() { this->pin_a_->setup(); diff --git a/esphome/components/ultrasonic/ultrasonic_sensor.cpp b/esphome/components/ultrasonic/ultrasonic_sensor.cpp index c573c21863..e53cd7cf7a 100644 --- a/esphome/components/ultrasonic/ultrasonic_sensor.cpp +++ b/esphome/components/ultrasonic/ultrasonic_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace ultrasonic { -static const char *TAG = "ultrasonic.sensor"; +static const char *const TAG = "ultrasonic.sensor"; void UltrasonicSensorComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up Ultrasonic Sensor..."); diff --git a/esphome/components/uptime/uptime_sensor.cpp b/esphome/components/uptime/uptime_sensor.cpp index 5d117ab61d..755795ad53 100644 --- a/esphome/components/uptime/uptime_sensor.cpp +++ b/esphome/components/uptime/uptime_sensor.cpp @@ -5,7 +5,7 @@ namespace esphome { namespace uptime { -static const char *TAG = "uptime.sensor"; +static const char *const TAG = "uptime.sensor"; void UptimeSensor::update() { const uint32_t ms = millis(); diff --git a/esphome/components/version/version_text_sensor.cpp b/esphome/components/version/version_text_sensor.cpp index fa8e6a9d01..5b2437ab62 100644 --- a/esphome/components/version/version_text_sensor.cpp +++ b/esphome/components/version/version_text_sensor.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace version { -static const char *TAG = "version.text_sensor"; +static const char *const TAG = "version.text_sensor"; void VersionTextSensor::setup() { if (this->hide_timestamp_) { diff --git a/esphome/components/vl53l0x/vl53l0x_sensor.cpp b/esphome/components/vl53l0x/vl53l0x_sensor.cpp index 1926f7d113..65a4ec72bb 100644 --- a/esphome/components/vl53l0x/vl53l0x_sensor.cpp +++ b/esphome/components/vl53l0x/vl53l0x_sensor.cpp @@ -13,9 +13,10 @@ namespace esphome { namespace vl53l0x { -static const char *TAG = "vl53l0x"; -std::list VL53L0XSensor::vl53_sensors; -bool VL53L0XSensor::enable_pin_setup_complete = false; +static const char *const TAG = "vl53l0x"; + +std::list VL53L0XSensor::vl53_sensors; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) +bool VL53L0XSensor::enable_pin_setup_complete = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) VL53L0XSensor::VL53L0XSensor() { VL53L0XSensor::vl53_sensors.push_back(this); } diff --git a/esphome/components/vl53l0x/vl53l0x_sensor.h b/esphome/components/vl53l0x/vl53l0x_sensor.h index 2662b768ae..0c37df67a2 100644 --- a/esphome/components/vl53l0x/vl53l0x_sensor.h +++ b/esphome/components/vl53l0x/vl53l0x_sensor.h @@ -264,8 +264,8 @@ class VL53L0XSensor : public sensor::Sensor, public PollingComponent, public i2c uint16_t timeout_start_us_; uint16_t timeout_us_{}; - static std::list vl53_sensors; - static bool enable_pin_setup_complete; + static std::list vl53_sensors; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) + static bool enable_pin_setup_complete; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) }; } // namespace vl53l0x diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index daaa77b7fa..4518dd60df 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace waveshare_epaper { -static const char *TAG = "waveshare_epaper"; +static const char *const TAG = "waveshare_epaper"; static const uint8_t LUT_SIZE_WAVESHARE = 30; diff --git a/esphome/components/web_server/web_server.cpp b/esphome/components/web_server/web_server.cpp index 381366b420..7a6d877d8f 100644 --- a/esphome/components/web_server/web_server.cpp +++ b/esphome/components/web_server/web_server.cpp @@ -19,7 +19,7 @@ namespace esphome { namespace web_server { -static const char *TAG = "web_server"; +static const char *const TAG = "web_server"; void write_row(AsyncResponseStream *stream, Nameable *obj, const std::string &klass, const std::string &action) { if (obj->is_internal()) diff --git a/esphome/components/web_server_base/web_server_base.cpp b/esphome/components/web_server_base/web_server_base.cpp index b7548504e3..85711704b9 100644 --- a/esphome/components/web_server_base/web_server_base.cpp +++ b/esphome/components/web_server_base/web_server_base.cpp @@ -13,7 +13,7 @@ namespace esphome { namespace web_server_base { -static const char *TAG = "web_server_base"; +static const char *const TAG = "web_server_base"; void report_ota_error() { StreamString ss; diff --git a/esphome/components/whirlpool/whirlpool.cpp b/esphome/components/whirlpool/whirlpool.cpp index e7c93246f2..07296b6fa5 100644 --- a/esphome/components/whirlpool/whirlpool.cpp +++ b/esphome/components/whirlpool/whirlpool.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace whirlpool { -static const char *TAG = "whirlpool.climate"; +static const char *const TAG = "whirlpool.climate"; const uint16_t WHIRLPOOL_HEADER_MARK = 9000; const uint16_t WHIRLPOOL_HEADER_SPACE = 4494; diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index fcb1b177a5..f0c149dbd0 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -29,7 +29,7 @@ namespace esphome { namespace wifi { -static const char *TAG = "wifi"; +static const char *const TAG = "wifi"; float WiFiComponent::get_setup_priority() const { return setup_priority::WIFI; } @@ -692,7 +692,7 @@ int8_t WiFiScanResult::get_rssi() const { return this->rssi_; } bool WiFiScanResult::get_with_auth() const { return this->with_auth_; } bool WiFiScanResult::get_is_hidden() const { return this->is_hidden_; } -WiFiComponent *global_wifi_component; +WiFiComponent *global_wifi_component; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace wifi } // namespace esphome diff --git a/esphome/components/wifi/wifi_component.h b/esphome/components/wifi/wifi_component.h index 18f46eaa4a..d690a35420 100644 --- a/esphome/components/wifi/wifi_component.h +++ b/esphome/components/wifi/wifi_component.h @@ -299,7 +299,7 @@ class WiFiComponent : public Component { bool has_saved_wifi_settings_{false}; }; -extern WiFiComponent *global_wifi_component; +extern WiFiComponent *global_wifi_component; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) template class WiFiConnectedCondition : public Condition { public: diff --git a/esphome/components/wifi/wifi_component_esp32.cpp b/esphome/components/wifi/wifi_component_esp32.cpp index a402973c6b..c51c17d60c 100644 --- a/esphome/components/wifi/wifi_component_esp32.cpp +++ b/esphome/components/wifi/wifi_component_esp32.cpp @@ -21,7 +21,7 @@ namespace esphome { namespace wifi { -static const char *TAG = "wifi_esp32"; +static const char *const TAG = "wifi_esp32"; bool WiFiComponent::wifi_mode_(optional sta, optional ap) { uint8_t current_mode = WiFi.getMode(); diff --git a/esphome/components/wifi/wifi_component_esp8266.cpp b/esphome/components/wifi/wifi_component_esp8266.cpp index d6ded763d0..0425f58c28 100644 --- a/esphome/components/wifi/wifi_component_esp8266.cpp +++ b/esphome/components/wifi/wifi_component_esp8266.cpp @@ -29,7 +29,7 @@ extern "C" { namespace esphome { namespace wifi { -static const char *TAG = "wifi_esp8266"; +static const char *const TAG = "wifi_esp8266"; bool WiFiComponent::wifi_mode_(optional sta, optional ap) { uint8_t current_mode = wifi_get_opmode(); diff --git a/esphome/components/wifi_info/wifi_info_text_sensor.cpp b/esphome/components/wifi_info/wifi_info_text_sensor.cpp index 08a69998fb..92e5d93a5a 100644 --- a/esphome/components/wifi_info/wifi_info_text_sensor.cpp +++ b/esphome/components/wifi_info/wifi_info_text_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace wifi_info { -static const char *TAG = "wifi_info"; +static const char *const TAG = "wifi_info"; void IPAddressWiFiInfo::dump_config() { LOG_TEXT_SENSOR("", "WifiInfo IPAddress", this); } void SSIDWiFiInfo::dump_config() { LOG_TEXT_SENSOR("", "WifiInfo SSID", this); } diff --git a/esphome/components/wifi_signal/wifi_signal_sensor.cpp b/esphome/components/wifi_signal/wifi_signal_sensor.cpp index 7b2f010c07..ba22138e2a 100644 --- a/esphome/components/wifi_signal/wifi_signal_sensor.cpp +++ b/esphome/components/wifi_signal/wifi_signal_sensor.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace wifi_signal { -static const char *TAG = "wifi_signal.sensor"; +static const char *const TAG = "wifi_signal.sensor"; void WiFiSignalSensor::dump_config() { LOG_SENSOR("", "WiFi Signal", this); } diff --git a/esphome/components/wled/wled_light_effect.cpp b/esphome/components/wled/wled_light_effect.cpp index f3d8fbd082..afff956c9c 100644 --- a/esphome/components/wled/wled_light_effect.cpp +++ b/esphome/components/wled/wled_light_effect.cpp @@ -19,7 +19,7 @@ enum Protocol { WLED_NOTIFIER = 0, WARLS = 1, DRGB = 2, DRGBW = 3, DNRGB = 4 }; const int DEFAULT_BLANK_TIME = 1000; -static const char *TAG = "wled_light_effect"; +static const char *const TAG = "wled_light_effect"; WLEDLightEffect::WLEDLightEffect(const std::string &name) : AddressableLightEffect(name) {} diff --git a/esphome/components/xiaomi_ble/xiaomi_ble.cpp b/esphome/components/xiaomi_ble/xiaomi_ble.cpp index 5806ceb72b..c736a236a1 100644 --- a/esphome/components/xiaomi_ble/xiaomi_ble.cpp +++ b/esphome/components/xiaomi_ble/xiaomi_ble.cpp @@ -10,7 +10,7 @@ namespace esphome { namespace xiaomi_ble { -static const char *TAG = "xiaomi_ble"; +static const char *const TAG = "xiaomi_ble"; bool parse_xiaomi_value(uint8_t value_type, const uint8_t *data, uint8_t value_length, XiaomiParseResult &result) { // motion detection, 1 byte, 8-bit unsigned integer diff --git a/esphome/components/xiaomi_cgd1/xiaomi_cgd1.cpp b/esphome/components/xiaomi_cgd1/xiaomi_cgd1.cpp index d701e8ee6d..c6e7a3f962 100644 --- a/esphome/components/xiaomi_cgd1/xiaomi_cgd1.cpp +++ b/esphome/components/xiaomi_cgd1/xiaomi_cgd1.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_cgd1 { -static const char *TAG = "xiaomi_cgd1"; +static const char *const TAG = "xiaomi_cgd1"; void XiaomiCGD1::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi CGD1"); diff --git a/esphome/components/xiaomi_cgdk2/xiaomi_cgdk2.cpp b/esphome/components/xiaomi_cgdk2/xiaomi_cgdk2.cpp index cd18c12afc..2ba2ac4c0a 100644 --- a/esphome/components/xiaomi_cgdk2/xiaomi_cgdk2.cpp +++ b/esphome/components/xiaomi_cgdk2/xiaomi_cgdk2.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_cgdk2 { -static const char *TAG = "xiaomi_cgdk2"; +static const char *const TAG = "xiaomi_cgdk2"; void XiaomiCGDK2::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi CGDK2"); diff --git a/esphome/components/xiaomi_cgg1/xiaomi_cgg1.cpp b/esphome/components/xiaomi_cgg1/xiaomi_cgg1.cpp index 86725956e0..86192fb028 100644 --- a/esphome/components/xiaomi_cgg1/xiaomi_cgg1.cpp +++ b/esphome/components/xiaomi_cgg1/xiaomi_cgg1.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_cgg1 { -static const char *TAG = "xiaomi_cgg1"; +static const char *const TAG = "xiaomi_cgg1"; void XiaomiCGG1::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi CGG1"); diff --git a/esphome/components/xiaomi_gcls002/xiaomi_gcls002.cpp b/esphome/components/xiaomi_gcls002/xiaomi_gcls002.cpp index 24156f98ac..5f7d67b85a 100644 --- a/esphome/components/xiaomi_gcls002/xiaomi_gcls002.cpp +++ b/esphome/components/xiaomi_gcls002/xiaomi_gcls002.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_gcls002 { -static const char *TAG = "xiaomi_gcls002"; +static const char *const TAG = "xiaomi_gcls002"; void XiaomiGCLS002::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi GCLS002"); diff --git a/esphome/components/xiaomi_hhccjcy01/xiaomi_hhccjcy01.cpp b/esphome/components/xiaomi_hhccjcy01/xiaomi_hhccjcy01.cpp index 18e2b2439f..103201d511 100644 --- a/esphome/components/xiaomi_hhccjcy01/xiaomi_hhccjcy01.cpp +++ b/esphome/components/xiaomi_hhccjcy01/xiaomi_hhccjcy01.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_hhccjcy01 { -static const char *TAG = "xiaomi_hhccjcy01"; +static const char *const TAG = "xiaomi_hhccjcy01"; void XiaomiHHCCJCY01::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi HHCCJCY01"); diff --git a/esphome/components/xiaomi_hhccpot002/xiaomi_hhccpot002.cpp b/esphome/components/xiaomi_hhccpot002/xiaomi_hhccpot002.cpp index 2b5ad3a826..efc83cb6cc 100644 --- a/esphome/components/xiaomi_hhccpot002/xiaomi_hhccpot002.cpp +++ b/esphome/components/xiaomi_hhccpot002/xiaomi_hhccpot002.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_hhccpot002 { -static const char *TAG = "xiaomi_hhccpot002"; +static const char *const TAG = "xiaomi_hhccpot002"; void XiaomiHHCCPOT002 ::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi HHCCPOT002"); diff --git a/esphome/components/xiaomi_jqjcy01ym/xiaomi_jqjcy01ym.cpp b/esphome/components/xiaomi_jqjcy01ym/xiaomi_jqjcy01ym.cpp index 3e7090509b..c88a3c3b61 100644 --- a/esphome/components/xiaomi_jqjcy01ym/xiaomi_jqjcy01ym.cpp +++ b/esphome/components/xiaomi_jqjcy01ym/xiaomi_jqjcy01ym.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_jqjcy01ym { -static const char *TAG = "xiaomi_jqjcy01ym"; +static const char *const TAG = "xiaomi_jqjcy01ym"; void XiaomiJQJCY01YM::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi JQJCY01YM"); diff --git a/esphome/components/xiaomi_lywsd02/xiaomi_lywsd02.cpp b/esphome/components/xiaomi_lywsd02/xiaomi_lywsd02.cpp index 12590960e4..6b8ecdeaff 100644 --- a/esphome/components/xiaomi_lywsd02/xiaomi_lywsd02.cpp +++ b/esphome/components/xiaomi_lywsd02/xiaomi_lywsd02.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_lywsd02 { -static const char *TAG = "xiaomi_lywsd02"; +static const char *const TAG = "xiaomi_lywsd02"; void XiaomiLYWSD02::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi LYWSD02"); diff --git a/esphome/components/xiaomi_lywsd03mmc/xiaomi_lywsd03mmc.cpp b/esphome/components/xiaomi_lywsd03mmc/xiaomi_lywsd03mmc.cpp index e9cc99358b..f0a2cee8d4 100644 --- a/esphome/components/xiaomi_lywsd03mmc/xiaomi_lywsd03mmc.cpp +++ b/esphome/components/xiaomi_lywsd03mmc/xiaomi_lywsd03mmc.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_lywsd03mmc { -static const char *TAG = "xiaomi_lywsd03mmc"; +static const char *const TAG = "xiaomi_lywsd03mmc"; void XiaomiLYWSD03MMC::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi LYWSD03MMC"); diff --git a/esphome/components/xiaomi_lywsdcgq/xiaomi_lywsdcgq.cpp b/esphome/components/xiaomi_lywsdcgq/xiaomi_lywsdcgq.cpp index 035ac8c906..39bcd9df03 100644 --- a/esphome/components/xiaomi_lywsdcgq/xiaomi_lywsdcgq.cpp +++ b/esphome/components/xiaomi_lywsdcgq/xiaomi_lywsdcgq.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_lywsdcgq { -static const char *TAG = "xiaomi_lywsdcgq"; +static const char *const TAG = "xiaomi_lywsdcgq"; void XiaomiLYWSDCGQ::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi LYWSDCGQ"); diff --git a/esphome/components/xiaomi_mhoc401/xiaomi_mhoc401.cpp b/esphome/components/xiaomi_mhoc401/xiaomi_mhoc401.cpp index a41df3e6a1..e93a4b91ae 100644 --- a/esphome/components/xiaomi_mhoc401/xiaomi_mhoc401.cpp +++ b/esphome/components/xiaomi_mhoc401/xiaomi_mhoc401.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_mhoc401 { -static const char *TAG = "xiaomi_mhoc401"; +static const char *const TAG = "xiaomi_mhoc401"; void XiaomiMHOC401::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi MHOC401"); diff --git a/esphome/components/xiaomi_miscale/xiaomi_miscale.cpp b/esphome/components/xiaomi_miscale/xiaomi_miscale.cpp index 441bca6270..78464da6e3 100644 --- a/esphome/components/xiaomi_miscale/xiaomi_miscale.cpp +++ b/esphome/components/xiaomi_miscale/xiaomi_miscale.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_miscale { -static const char *TAG = "xiaomi_miscale"; +static const char *const TAG = "xiaomi_miscale"; void XiaomiMiscale::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi Miscale"); diff --git a/esphome/components/xiaomi_miscale2/xiaomi_miscale2.cpp b/esphome/components/xiaomi_miscale2/xiaomi_miscale2.cpp index 2bc4656cb9..cc63e46573 100644 --- a/esphome/components/xiaomi_miscale2/xiaomi_miscale2.cpp +++ b/esphome/components/xiaomi_miscale2/xiaomi_miscale2.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_miscale2 { -static const char *TAG = "xiaomi_miscale2"; +static const char *const TAG = "xiaomi_miscale2"; void XiaomiMiscale2::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi Miscale2"); diff --git a/esphome/components/xiaomi_mjyd02yla/xiaomi_mjyd02yla.cpp b/esphome/components/xiaomi_mjyd02yla/xiaomi_mjyd02yla.cpp index c7a2a75348..739543ddb6 100644 --- a/esphome/components/xiaomi_mjyd02yla/xiaomi_mjyd02yla.cpp +++ b/esphome/components/xiaomi_mjyd02yla/xiaomi_mjyd02yla.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_mjyd02yla { -static const char *TAG = "xiaomi_mjyd02yla"; +static const char *const TAG = "xiaomi_mjyd02yla"; void XiaomiMJYD02YLA::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi MJYD02YL-A"); diff --git a/esphome/components/xiaomi_mue4094rt/xiaomi_mue4094rt.cpp b/esphome/components/xiaomi_mue4094rt/xiaomi_mue4094rt.cpp index 45337f330e..c1eff2e066 100644 --- a/esphome/components/xiaomi_mue4094rt/xiaomi_mue4094rt.cpp +++ b/esphome/components/xiaomi_mue4094rt/xiaomi_mue4094rt.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_mue4094rt { -static const char *TAG = "xiaomi_mue4094rt"; +static const char *const TAG = "xiaomi_mue4094rt"; void XiaomiMUE4094RT::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi MUE4094RT"); diff --git a/esphome/components/xiaomi_wx08zm/xiaomi_wx08zm.cpp b/esphome/components/xiaomi_wx08zm/xiaomi_wx08zm.cpp index 6ecdf8f4f4..d6e2ebe5b2 100644 --- a/esphome/components/xiaomi_wx08zm/xiaomi_wx08zm.cpp +++ b/esphome/components/xiaomi_wx08zm/xiaomi_wx08zm.cpp @@ -6,7 +6,7 @@ namespace esphome { namespace xiaomi_wx08zm { -static const char *TAG = "xiaomi_wx08zm"; +static const char *const TAG = "xiaomi_wx08zm"; void XiaomiWX08ZM::dump_config() { ESP_LOGCONFIG(TAG, "Xiaomi WX08ZM"); diff --git a/esphome/components/xpt2046/xpt2046.cpp b/esphome/components/xpt2046/xpt2046.cpp index 6a3b7bbcbb..aaadeea52e 100644 --- a/esphome/components/xpt2046/xpt2046.cpp +++ b/esphome/components/xpt2046/xpt2046.cpp @@ -7,7 +7,7 @@ namespace esphome { namespace xpt2046 { -static const char *TAG = "xpt2046"; +static const char *const TAG = "xpt2046"; void XPT2046Component::setup() { if (this->irq_pin_ != nullptr) { diff --git a/esphome/components/yashima/yashima.cpp b/esphome/components/yashima/yashima.cpp index e3c0a33127..2615d7a353 100644 --- a/esphome/components/yashima/yashima.cpp +++ b/esphome/components/yashima/yashima.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace yashima { -static const char *TAG = "yashima.climate"; +static const char *const TAG = "yashima.climate"; const uint16_t YASHIMA_STATE_LENGTH = 9; const uint16_t YASHIMA_BITS = YASHIMA_STATE_LENGTH * 8; diff --git a/esphome/components/zyaura/zyaura.cpp b/esphome/components/zyaura/zyaura.cpp index 265b70aa74..989791f098 100644 --- a/esphome/components/zyaura/zyaura.cpp +++ b/esphome/components/zyaura/zyaura.cpp @@ -4,7 +4,7 @@ namespace esphome { namespace zyaura { -static const char *TAG = "zyaura"; +static const char *const TAG = "zyaura"; bool ICACHE_RAM_ATTR ZaDataProcessor::decode(uint32_t ms, bool data) { // check if a new message has started, based on time since previous bit diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 99726b6248..17a2725de5 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -9,7 +9,7 @@ namespace esphome { -static const char *TAG = "app"; +static const char *const TAG = "app"; void Application::register_component_(Component *comp) { if (comp == nullptr) { @@ -161,6 +161,6 @@ void Application::calculate_looping_components_() { } } -Application App; +Application App; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace esphome diff --git a/esphome/core/application.h b/esphome/core/application.h index aeda245161..c674210ac0 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -252,6 +252,6 @@ class Application { }; /// Global storage of Application pointer - only one Application can exist. -extern Application App; +extern Application App; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace esphome diff --git a/esphome/core/component.cpp b/esphome/core/component.cpp index 5568134c03..09c91fbb0c 100644 --- a/esphome/core/component.cpp +++ b/esphome/core/component.cpp @@ -8,7 +8,7 @@ namespace esphome { -static const char *TAG = "component"; +static const char *const TAG = "component"; namespace setup_priority { @@ -36,7 +36,7 @@ const uint32_t STATUS_LED_OK = 0x0000; const uint32_t STATUS_LED_WARNING = 0x0100; const uint32_t STATUS_LED_ERROR = 0x0200; -uint32_t global_state = 0; +uint32_t global_state = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) float Component::get_loop_priority() const { return 0.0f; } diff --git a/esphome/core/esphal.cpp b/esphome/core/esphal.cpp index 30a1e9c49f..d7adc8dbf1 100644 --- a/esphome/core/esphal.cpp +++ b/esphome/core/esphal.cpp @@ -18,7 +18,7 @@ void ICACHE_RAM_ATTR __detachInterrupt(uint8_t pin); // NOLINT namespace esphome { -static const char *TAG = "esphal"; +static const char *const TAG = "esphal"; GPIOPin::GPIOPin(uint8_t pin, uint8_t mode, bool inverted) : pin_(pin), diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 85682f1864..f78dcf3183 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -13,7 +13,7 @@ namespace esphome { -static const char *TAG = "helpers"; +static const char *const TAG = "helpers"; std::string get_mac_address() { char tmp[20]; @@ -55,7 +55,7 @@ double random_double() { return random_uint32() / double(UINT32_MAX); } float random_float() { return float(random_double()); } -static uint32_t fast_random_seed = 0; +static uint32_t fast_random_seed = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) void fast_random_set_seed(uint32_t seed) { fast_random_seed = seed; } uint32_t fast_random_32() { @@ -123,8 +123,8 @@ std::string uint32_to_string(uint32_t num) { snprintf(buffer, sizeof(buffer), "%04X%04X", address16[1], address16[0]); return std::string(buffer); } -static char *global_json_build_buffer = nullptr; -static size_t global_json_build_buffer_size = 0; +static char *global_json_build_buffer = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) +static size_t global_json_build_buffer_size = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) void reserve_global_json_build_buffer(size_t required_size) { if (global_json_build_buffer_size == 0 || global_json_build_buffer_size < required_size) { @@ -154,7 +154,7 @@ ParseOnOffState parse_on_off(const char *str, const char *on, const char *off) { return PARSE_NONE; } -const char *HOSTNAME_CHARACTER_ALLOWLIST = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"; +const char *const HOSTNAME_CHARACTER_ALLOWLIST = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"; uint8_t crc8(uint8_t *data, uint8_t len) { uint8_t crc = 0; @@ -271,7 +271,7 @@ template uint32_t reverse_bits(uint32_t x) { return uint32_t(reverse_bits_16(x & 0xFFFF) << 16) | uint32_t(reverse_bits_16(x >> 16)); } -static int high_freq_num_requests = 0; +static int high_freq_num_requests = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) void HighFrequencyLoopRequester::start() { if (this->started_) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 5369f634f9..8096228a0f 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -28,7 +28,7 @@ namespace esphome { /// The characters that are allowed in a hostname. -extern const char *HOSTNAME_CHARACTER_ALLOWLIST; +extern const char *const HOSTNAME_CHARACTER_ALLOWLIST; /// Gets the MAC address as a string, this can be used as way to identify this ESP. std::string get_mac_address(); diff --git a/esphome/core/preferences.cpp b/esphome/core/preferences.cpp index 7df30bedb5..68030a2d59 100644 --- a/esphome/core/preferences.cpp +++ b/esphome/core/preferences.cpp @@ -15,7 +15,7 @@ extern "C" { namespace esphome { -static const char *TAG = "preferences"; +static const char *const TAG = "preferences"; ESPPreferenceObject::ESPPreferenceObject() : offset_(0), length_words_(0), type_(0), data_(nullptr) {} ESPPreferenceObject::ESPPreferenceObject(size_t offset, size_t length, uint32_t type) @@ -73,7 +73,7 @@ static inline bool esp_rtc_user_mem_read(uint32_t index, uint32_t *dest) { return true; } -static bool esp8266_flash_dirty = false; +static bool esp8266_flash_dirty = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) static inline bool esp_rtc_user_mem_write(uint32_t index, uint32_t value) { if (index >= ESP_RTC_USER_MEM_SIZE_WORDS) { @@ -303,6 +303,6 @@ uint32_t ESPPreferenceObject::calculate_crc_() const { } bool ESPPreferenceObject::is_initialized() const { return this->data_ != nullptr; } -ESPPreferences global_preferences; +ESPPreferences global_preferences; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace esphome diff --git a/esphome/core/preferences.h b/esphome/core/preferences.h index bfea4c2336..43d0f023e3 100644 --- a/esphome/core/preferences.h +++ b/esphome/core/preferences.h @@ -39,14 +39,14 @@ class ESPPreferenceObject { #ifdef ARDUINO_ARCH_ESP8266 #ifdef USE_ESP8266_PREFERENCES_FLASH -static bool DEFAULT_IN_FLASH = true; +static const bool DEFAULT_IN_FLASH = true; #else -static bool DEFAULT_IN_FLASH = false; +static const bool DEFAULT_IN_FLASH = false; #endif #endif #ifdef ARDUINO_ARCH_ESP32 -static bool DEFAULT_IN_FLASH = true; +static const bool DEFAULT_IN_FLASH = true; #endif class ESPPreferences { @@ -83,7 +83,7 @@ class ESPPreferences { #endif }; -extern ESPPreferences global_preferences; +extern ESPPreferences global_preferences; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) template ESPPreferenceObject ESPPreferences::make_preference(uint32_t type, bool in_flash) { return this->make_preference((sizeof(T) + 3) / 4, type, in_flash); diff --git a/esphome/core/scheduler.cpp b/esphome/core/scheduler.cpp index 9be39f4938..410c68052f 100644 --- a/esphome/core/scheduler.cpp +++ b/esphome/core/scheduler.cpp @@ -5,7 +5,7 @@ namespace esphome { -static const char *TAG = "scheduler"; +static const char *const TAG = "scheduler"; static const uint32_t SCHEDULER_DONT_RUN = 4294967295UL; static const uint32_t MAX_LOGICALLY_DELETED_ITEMS = 10; diff --git a/esphome/core/util.cpp b/esphome/core/util.cpp index e918cd2e76..67e575e1c5 100644 --- a/esphome/core/util.cpp +++ b/esphome/core/util.cpp @@ -66,7 +66,7 @@ bool mqtt_is_connected() { bool remote_is_connected() { return api_is_connected() || mqtt_is_connected(); } #if defined(ARDUINO_ARCH_ESP8266) && defined(USE_MDNS) -bool mdns_setup; +static bool mdns_setup; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) #endif #ifndef WEBSERVER_PORT