From 4e4e4b4411e09a0c5cfa68bc4309067ba81987ba Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Thu, 7 May 2026 16:49:55 -0400 Subject: [PATCH] [clang-tidy] Concatenate nested namespaces (2/7: components d-h) (#16295) --- esphome/components/dac7678/dac7678_output.cpp | 6 ++---- esphome/components/dac7678/dac7678_output.h | 6 ++---- esphome/components/daikin/daikin.cpp | 6 ++---- esphome/components/daikin/daikin.h | 6 ++---- esphome/components/daikin_arc/daikin_arc.cpp | 6 ++---- esphome/components/daikin_arc/daikin_arc.h | 6 ++---- esphome/components/daikin_brc/daikin_brc.cpp | 6 ++---- esphome/components/daikin_brc/daikin_brc.h | 6 ++---- esphome/components/dallas_temp/dallas_temp.cpp | 6 ++---- esphome/components/dallas_temp/dallas_temp.h | 6 ++---- esphome/components/daly_bms/daly_bms.cpp | 6 ++---- esphome/components/daly_bms/daly_bms.h | 6 ++---- esphome/components/dashboard_import/dashboard_import.cpp | 6 ++---- esphome/components/dashboard_import/dashboard_import.h | 6 ++---- esphome/components/debug/debug_component.cpp | 6 ++---- esphome/components/debug/debug_component.h | 6 ++---- esphome/components/debug/debug_esp32.cpp | 7 +++---- esphome/components/deep_sleep/deep_sleep_component.cpp | 6 ++---- esphome/components/deep_sleep/deep_sleep_component.h | 6 ++---- esphome/components/deep_sleep/deep_sleep_esp32.cpp | 7 +++---- esphome/components/delonghi/delonghi.cpp | 6 ++---- esphome/components/delonghi/delonghi.h | 6 ++---- esphome/components/demo/demo_alarm_control_panel.h | 6 ++---- esphome/components/demo/demo_binary_sensor.h | 6 ++---- esphome/components/demo/demo_button.h | 6 ++---- esphome/components/demo/demo_climate.h | 6 ++---- esphome/components/demo/demo_cover.h | 6 ++---- esphome/components/demo/demo_date.h | 6 ++---- esphome/components/demo/demo_datetime.h | 6 ++---- esphome/components/demo/demo_fan.h | 6 ++---- esphome/components/demo/demo_light.h | 6 ++---- esphome/components/demo/demo_lock.h | 6 ++---- esphome/components/demo/demo_number.h | 6 ++---- esphome/components/demo/demo_select.h | 6 ++---- esphome/components/demo/demo_sensor.h | 6 ++---- esphome/components/demo/demo_switch.h | 6 ++---- esphome/components/demo/demo_text.h | 6 ++---- esphome/components/demo/demo_text_sensor.h | 6 ++---- esphome/components/demo/demo_time.h | 6 ++---- esphome/components/demo/demo_valve.h | 6 ++---- esphome/components/dfplayer/dfplayer.cpp | 6 ++---- esphome/components/dfplayer/dfplayer.h | 6 ++---- esphome/components/dfrobot_sen0395/automation.h | 6 ++---- esphome/components/dfrobot_sen0395/commands.cpp | 6 ++---- esphome/components/dfrobot_sen0395/commands.h | 6 ++---- esphome/components/dfrobot_sen0395/dfrobot_sen0395.cpp | 6 ++---- esphome/components/dfrobot_sen0395/dfrobot_sen0395.h | 6 ++---- .../dfrobot_sen0395/switch/dfrobot_sen0395_switch.cpp | 6 ++---- .../dfrobot_sen0395/switch/dfrobot_sen0395_switch.h | 6 ++---- esphome/components/dht12/dht12.cpp | 6 ++---- esphome/components/dht12/dht12.h | 6 ++---- esphome/components/display/display.cpp | 6 ++---- esphome/components/display/display.h | 6 ++---- esphome/components/display/display_buffer.cpp | 6 ++---- esphome/components/display/display_buffer.h | 6 ++---- esphome/components/display/display_color_utils.h | 6 ++---- esphome/components/display/rect.cpp | 6 ++---- esphome/components/display/rect.h | 6 ++---- esphome/components/display_menu_base/automation.h | 6 ++---- .../components/display_menu_base/display_menu_base.cpp | 6 ++---- esphome/components/display_menu_base/display_menu_base.h | 6 ++---- esphome/components/display_menu_base/menu_item.cpp | 6 ++---- esphome/components/display_menu_base/menu_item.h | 6 ++---- esphome/components/dps310/dps310.cpp | 6 ++---- esphome/components/dps310/dps310.h | 6 ++---- esphome/components/ds1307/ds1307.cpp | 6 ++---- esphome/components/ds1307/ds1307.h | 6 ++---- esphome/components/ds2484/ds2484.cpp | 6 ++---- esphome/components/ds2484/ds2484.h | 6 ++---- esphome/components/duty_cycle/duty_cycle_sensor.cpp | 6 ++---- esphome/components/duty_cycle/duty_cycle_sensor.h | 6 ++---- esphome/components/duty_time/duty_time_sensor.cpp | 6 ++---- esphome/components/duty_time/duty_time_sensor.h | 6 ++---- esphome/components/e131/e131.cpp | 7 +++---- esphome/components/e131/e131.h | 7 +++---- esphome/components/e131/e131_addressable_light_effect.cpp | 7 +++---- esphome/components/e131/e131_addressable_light_effect.h | 8 ++++---- esphome/components/e131/e131_packet.cpp | 7 +++---- esphome/components/ee895/ee895.cpp | 6 ++---- esphome/components/ee895/ee895.h | 6 ++---- esphome/components/ektf2232/touchscreen/ektf2232.cpp | 6 ++---- esphome/components/ektf2232/touchscreen/ektf2232.h | 6 ++---- esphome/components/emc2101/emc2101.cpp | 6 ++---- esphome/components/emc2101/emc2101.h | 6 ++---- esphome/components/emc2101/output/emc2101_output.cpp | 6 ++---- esphome/components/emc2101/output/emc2101_output.h | 6 ++---- esphome/components/emc2101/sensor/emc2101_sensor.cpp | 6 ++---- esphome/components/emc2101/sensor/emc2101_sensor.h | 6 ++---- esphome/components/emmeti/emmeti.cpp | 6 ++---- esphome/components/emmeti/emmeti.h | 6 ++---- esphome/components/endstop/endstop_cover.cpp | 6 ++---- esphome/components/endstop/endstop_cover.h | 6 ++---- esphome/components/ens160_base/ens160_base.cpp | 6 ++---- esphome/components/ens160_base/ens160_base.h | 6 ++---- esphome/components/ens160_i2c/ens160_i2c.cpp | 6 ++---- esphome/components/ens160_i2c/ens160_i2c.h | 6 ++---- esphome/components/ens160_spi/ens160_spi.cpp | 6 ++---- esphome/components/ens160_spi/ens160_spi.h | 6 ++---- esphome/components/ens210/ens210.cpp | 6 ++---- esphome/components/ens210/ens210.h | 6 ++---- esphome/components/es7210/es7210.cpp | 6 ++---- esphome/components/es7210/es7210.h | 6 ++---- esphome/components/es7210/es7210_const.h | 6 ++---- esphome/components/es7243e/es7243e.cpp | 6 ++---- esphome/components/es7243e/es7243e.h | 6 ++---- esphome/components/es7243e/es7243e_const.h | 6 ++---- esphome/components/es8156/es8156.cpp | 6 ++---- esphome/components/es8156/es8156.h | 6 ++---- esphome/components/es8156/es8156_const.h | 6 ++---- esphome/components/es8311/es8311.cpp | 6 ++---- esphome/components/es8311/es8311.h | 6 ++---- esphome/components/es8311/es8311_const.h | 6 ++---- esphome/components/es8388/es8388.cpp | 6 ++---- esphome/components/es8388/es8388.h | 6 ++---- esphome/components/es8388/es8388_const.h | 6 ++---- esphome/components/es8388/select/adc_input_mic_select.cpp | 6 ++---- esphome/components/es8388/select/adc_input_mic_select.h | 6 ++---- esphome/components/es8388/select/dac_output_select.cpp | 6 ++---- esphome/components/es8388/select/dac_output_select.h | 6 ++---- esphome/components/esp32/gpio.h | 6 ++---- esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp | 6 ++---- esphome/components/esp32_ble_beacon/esp32_ble_beacon.h | 6 ++---- esphome/components/esp32_ble_server/ble_2902.cpp | 6 ++---- esphome/components/esp32_ble_server/ble_2902.h | 6 ++---- .../components/esp32_ble_server/ble_characteristic.cpp | 6 ++---- esphome/components/esp32_ble_server/ble_characteristic.h | 6 ++---- esphome/components/esp32_ble_server/ble_descriptor.cpp | 6 ++---- esphome/components/esp32_ble_server/ble_descriptor.h | 6 ++---- esphome/components/esp32_ble_server/ble_server.cpp | 6 ++---- esphome/components/esp32_ble_server/ble_server.h | 6 ++---- .../esp32_ble_server/ble_server_automations.cpp | 8 ++------ .../components/esp32_ble_server/ble_server_automations.h | 8 ++------ esphome/components/esp32_ble_server/ble_service.cpp | 6 ++---- esphome/components/esp32_ble_server/ble_service.h | 6 ++---- esphome/components/esp32_camera/esp32_camera.cpp | 6 ++---- esphome/components/esp32_camera/esp32_camera.h | 6 ++---- .../esp32_camera_web_server/camera_web_server.cpp | 6 ++---- .../esp32_camera_web_server/camera_web_server.h | 6 ++---- esphome/components/esp32_can/esp32_can.cpp | 6 ++---- esphome/components/esp32_can/esp32_can.h | 6 ++---- esphome/components/esp32_dac/esp32_dac.cpp | 6 ++---- esphome/components/esp32_dac/esp32_dac.h | 6 ++---- esphome/components/esp32_improv/automation.h | 7 +++---- .../components/esp32_improv/esp32_improv_component.cpp | 6 ++---- esphome/components/esp32_improv/esp32_improv_component.h | 6 ++---- esphome/components/esp32_rmt_led_strip/led_strip.cpp | 6 ++---- esphome/components/esp32_rmt_led_strip/led_strip.h | 6 ++---- .../espnow/packet_transport/espnow_transport.cpp | 6 ++---- .../components/espnow/packet_transport/espnow_transport.h | 6 ++---- esphome/components/event/automation.h | 6 ++---- esphome/components/event/event.cpp | 6 ++---- esphome/components/event/event.h | 6 ++---- .../exposure_notifications/exposure_notifications.cpp | 6 ++---- .../exposure_notifications/exposure_notifications.h | 6 ++---- esphome/components/ezo/ezo.cpp | 6 ++---- esphome/components/ezo/ezo.h | 6 ++---- esphome/components/ezo_pmp/ezo_pmp.cpp | 6 ++---- esphome/components/ezo_pmp/ezo_pmp.h | 6 ++---- .../factory_reset/button/factory_reset_button.cpp | 6 ++---- .../factory_reset/button/factory_reset_button.h | 6 ++---- .../factory_reset/switch/factory_reset_switch.cpp | 6 ++---- .../factory_reset/switch/factory_reset_switch.h | 6 ++---- esphome/components/fan/automation.h | 6 ++---- esphome/components/fan/fan.cpp | 6 ++---- esphome/components/fan/fan.h | 6 ++---- esphome/components/fan/fan_traits.h | 7 ++----- esphome/components/fastled_base/fastled_light.cpp | 6 ++---- esphome/components/fastled_base/fastled_light.h | 6 ++---- esphome/components/fingerprint_grow/fingerprint_grow.cpp | 6 ++---- esphome/components/fingerprint_grow/fingerprint_grow.h | 6 ++---- esphome/components/font/font.cpp | 6 ++---- esphome/components/font/font.h | 6 ++---- esphome/components/fs3000/fs3000.cpp | 6 ++---- esphome/components/fs3000/fs3000.h | 6 ++---- .../components/ft5x06/touchscreen/ft5x06_touchscreen.cpp | 6 ++---- .../components/ft5x06/touchscreen/ft5x06_touchscreen.h | 6 ++---- esphome/components/ft63x6/ft63x6.cpp | 7 +++---- esphome/components/ft63x6/ft63x6.h | 6 ++---- esphome/components/fujitsu_general/fujitsu_general.cpp | 6 ++---- esphome/components/fujitsu_general/fujitsu_general.h | 6 ++---- esphome/components/gcja5/gcja5.cpp | 6 ++---- esphome/components/gcja5/gcja5.h | 6 ++---- esphome/components/gdk101/gdk101.cpp | 6 ++---- esphome/components/gdk101/gdk101.h | 6 ++---- esphome/components/gl_r01_i2c/gl_r01_i2c.cpp | 6 ++---- esphome/components/gl_r01_i2c/gl_r01_i2c.h | 6 ++---- esphome/components/gp2y1010au0f/gp2y1010au0f.cpp | 6 ++---- esphome/components/gp2y1010au0f/gp2y1010au0f.h | 6 ++---- esphome/components/gp8403/gp8403.cpp | 6 ++---- esphome/components/gp8403/gp8403.h | 6 ++---- esphome/components/gp8403/output/gp8403_output.cpp | 6 ++---- esphome/components/gp8403/output/gp8403_output.h | 6 ++---- .../components/gpio/binary_sensor/gpio_binary_sensor.cpp | 6 ++---- .../components/gpio/binary_sensor/gpio_binary_sensor.h | 6 ++---- esphome/components/gpio/one_wire/gpio_one_wire.cpp | 6 ++---- esphome/components/gpio/one_wire/gpio_one_wire.h | 6 ++---- esphome/components/gpio/output/gpio_binary_output.cpp | 6 ++---- esphome/components/gpio/output/gpio_binary_output.h | 6 ++---- esphome/components/gpio/switch/gpio_switch.cpp | 6 ++---- esphome/components/gpio/switch/gpio_switch.h | 6 ++---- esphome/components/gps/gps.cpp | 6 ++---- esphome/components/gps/gps.h | 6 ++---- esphome/components/gps/time/gps_time.cpp | 6 ++---- esphome/components/gps/time/gps_time.h | 6 ++---- esphome/components/graph/graph.cpp | 7 +++---- .../graphical_display_menu/graphical_display_menu.cpp | 6 ++---- esphome/components/gree/gree.cpp | 6 ++---- esphome/components/gree/switch/gree_switch.cpp | 6 ++---- esphome/components/gree/switch/gree_switch.h | 6 ++---- esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp | 6 ++---- esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.h | 6 ++---- esphome/components/grove_tb6612fng/grove_tb6612fng.cpp | 6 ++---- esphome/components/grove_tb6612fng/grove_tb6612fng.h | 8 +++----- esphome/components/growatt_solar/growatt_solar.cpp | 6 ++---- esphome/components/growatt_solar/growatt_solar.h | 6 ++---- esphome/components/gt911/binary_sensor/gt911_button.cpp | 6 ++---- esphome/components/gt911/binary_sensor/gt911_button.h | 6 ++---- .../components/gt911/touchscreen/gt911_touchscreen.cpp | 6 ++---- esphome/components/gt911/touchscreen/gt911_touchscreen.h | 6 ++---- esphome/components/haier/automation.h | 6 ++---- esphome/components/haier/button/self_cleaning.cpp | 6 ++---- esphome/components/haier/button/self_cleaning.h | 6 ++---- esphome/components/haier/button/steri_cleaning.cpp | 6 ++---- esphome/components/haier/button/steri_cleaning.h | 6 ++---- esphome/components/haier/haier_base.cpp | 6 ++---- esphome/components/haier/haier_base.h | 6 ++---- esphome/components/haier/hon_climate.cpp | 6 ++---- esphome/components/haier/hon_climate.h | 6 ++---- esphome/components/haier/hon_packet.h | 8 ++------ esphome/components/haier/logger_handler.cpp | 6 ++---- esphome/components/haier/logger_handler.h | 6 ++---- esphome/components/haier/smartair2_climate.cpp | 6 ++---- esphome/components/haier/smartair2_climate.h | 6 ++---- esphome/components/haier/smartair2_packet.h | 8 ++------ esphome/components/haier/switch/beeper.cpp | 6 ++---- esphome/components/haier/switch/beeper.h | 6 ++---- esphome/components/haier/switch/display.cpp | 6 ++---- esphome/components/haier/switch/display.h | 6 ++---- esphome/components/haier/switch/health_mode.cpp | 6 ++---- esphome/components/haier/switch/health_mode.h | 6 ++---- esphome/components/haier/switch/quiet_mode.cpp | 6 ++---- esphome/components/haier/switch/quiet_mode.h | 6 ++---- esphome/components/havells_solar/havells_solar.cpp | 6 ++---- esphome/components/havells_solar/havells_solar.h | 6 ++---- .../components/havells_solar/havells_solar_registers.h | 7 +++---- esphome/components/hbridge/fan/hbridge_fan.cpp | 6 ++---- esphome/components/hbridge/fan/hbridge_fan.h | 6 ++---- esphome/components/hbridge/light/hbridge_light_output.h | 6 ++---- esphome/components/hbridge/switch/hbridge_switch.cpp | 6 ++---- esphome/components/hbridge/switch/hbridge_switch.h | 6 ++---- esphome/components/hdc1080/hdc1080.cpp | 6 ++---- esphome/components/hdc1080/hdc1080.h | 6 ++---- esphome/components/hdc2010/hdc2010.cpp | 7 +++---- esphome/components/hdc2010/hdc2010.h | 6 ++---- esphome/components/he60r/he60r.cpp | 6 ++---- esphome/components/he60r/he60r.h | 6 ++---- esphome/components/heatpumpir/heatpumpir.cpp | 6 ++---- esphome/components/heatpumpir/heatpumpir.h | 6 ++---- esphome/components/hitachi_ac344/hitachi_ac344.cpp | 6 ++---- esphome/components/hitachi_ac344/hitachi_ac344.h | 6 ++---- esphome/components/hitachi_ac424/hitachi_ac424.cpp | 6 ++---- esphome/components/hitachi_ac424/hitachi_ac424.h | 6 ++---- esphome/components/hlw8012/hlw8012.cpp | 6 ++---- esphome/components/hlw8012/hlw8012.h | 6 ++---- esphome/components/hm3301/hm3301.cpp | 6 ++---- esphome/components/hm3301/hm3301.h | 6 ++---- esphome/components/hmac_md5/hmac_md5.cpp | 7 +++---- esphome/components/hmac_md5/hmac_md5.h | 7 +++---- esphome/components/hmc5883l/hmc5883l.cpp | 6 ++---- esphome/components/hmc5883l/hmc5883l.h | 6 ++---- .../binary_sensor/homeassistant_binary_sensor.cpp | 6 ++---- .../binary_sensor/homeassistant_binary_sensor.h | 6 ++---- .../homeassistant/number/homeassistant_number.cpp | 6 ++---- .../homeassistant/number/homeassistant_number.h | 6 ++---- .../homeassistant/sensor/homeassistant_sensor.cpp | 6 ++---- .../homeassistant/sensor/homeassistant_sensor.h | 6 ++---- .../homeassistant/switch/homeassistant_switch.cpp | 6 ++---- .../homeassistant/switch/homeassistant_switch.h | 6 ++---- .../text_sensor/homeassistant_text_sensor.cpp | 6 ++---- .../homeassistant/text_sensor/homeassistant_text_sensor.h | 6 ++---- .../components/homeassistant/time/homeassistant_time.cpp | 6 ++---- .../components/homeassistant/time/homeassistant_time.h | 6 ++---- esphome/components/honeywell_hih_i2c/honeywell_hih.cpp | 6 ++---- esphome/components/honeywell_hih_i2c/honeywell_hih.h | 6 ++---- esphome/components/honeywellabp/honeywellabp.cpp | 6 ++---- esphome/components/honeywellabp/honeywellabp.h | 6 ++---- esphome/components/honeywellabp2_i2c/honeywellabp2.cpp | 6 ++---- esphome/components/honeywellabp2_i2c/honeywellabp2.h | 6 ++---- esphome/components/host/time/host_time.h | 6 ++---- esphome/components/hrxl_maxsonar_wr/hrxl_maxsonar_wr.cpp | 6 ++---- esphome/components/hrxl_maxsonar_wr/hrxl_maxsonar_wr.h | 6 ++---- esphome/components/hte501/hte501.cpp | 6 ++---- esphome/components/hte501/hte501.h | 6 ++---- esphome/components/http_request/ota/automation.h | 6 ++---- esphome/components/http_request/ota/ota_http_request.cpp | 6 ++---- esphome/components/http_request/ota/ota_http_request.h | 6 ++---- .../http_request/update/http_request_update.cpp | 6 ++---- .../components/http_request/update/http_request_update.h | 6 ++---- esphome/components/htu21d/htu21d.cpp | 6 ++---- esphome/components/htu21d/htu21d.h | 6 ++---- esphome/components/htu31d/htu31d.cpp | 6 ++---- esphome/components/htu31d/htu31d.h | 6 ++---- esphome/components/hx711/hx711.cpp | 6 ++---- esphome/components/hx711/hx711.h | 6 ++---- esphome/components/hydreon_rgxx/hydreon_rgxx.cpp | 6 ++---- esphome/components/hydreon_rgxx/hydreon_rgxx.h | 6 ++---- esphome/components/hyt271/hyt271.cpp | 6 ++---- esphome/components/hyt271/hyt271.h | 6 ++---- 308 files changed, 632 insertions(+), 1242 deletions(-) diff --git a/esphome/components/dac7678/dac7678_output.cpp b/esphome/components/dac7678/dac7678_output.cpp index 27ab54f0be..15575583d9 100644 --- a/esphome/components/dac7678/dac7678_output.cpp +++ b/esphome/components/dac7678/dac7678_output.cpp @@ -3,8 +3,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace dac7678 { +namespace esphome::dac7678 { static const char *const TAG = "dac7678"; @@ -82,5 +81,4 @@ void DAC7678Channel::write_state(float state) { this->parent_->set_channel_value_(this->channel_, input); } -} // namespace dac7678 -} // namespace esphome +} // namespace esphome::dac7678 diff --git a/esphome/components/dac7678/dac7678_output.h b/esphome/components/dac7678/dac7678_output.h index abd9875e4c..a017325939 100644 --- a/esphome/components/dac7678/dac7678_output.h +++ b/esphome/components/dac7678/dac7678_output.h @@ -5,8 +5,7 @@ #include "esphome/components/output/float_output.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace dac7678 { +namespace esphome::dac7678 { class DAC7678Output; @@ -51,5 +50,4 @@ class DAC7678Output : public Component, public i2c::I2CDevice { }; }; -} // namespace dac7678 -} // namespace esphome +} // namespace esphome::dac7678 diff --git a/esphome/components/daikin/daikin.cpp b/esphome/components/daikin/daikin.cpp index a285f3613d..d45586ba2d 100644 --- a/esphome/components/daikin/daikin.cpp +++ b/esphome/components/daikin/daikin.cpp @@ -1,8 +1,7 @@ #include "daikin.h" #include "esphome/components/remote_base/remote_base.h" -namespace esphome { -namespace daikin { +namespace esphome::daikin { static const char *const TAG = "daikin.climate"; @@ -251,5 +250,4 @@ bool DaikinClimate::on_receive(remote_base::RemoteReceiveData data) { return this->parse_state_frame_(state_frame); } -} // namespace daikin -} // namespace esphome +} // namespace esphome::daikin diff --git a/esphome/components/daikin/daikin.h b/esphome/components/daikin/daikin.h index 159292cb55..9c05993f37 100644 --- a/esphome/components/daikin/daikin.h +++ b/esphome/components/daikin/daikin.h @@ -2,8 +2,7 @@ #include "esphome/components/climate_ir/climate_ir.h" -namespace esphome { -namespace daikin { +namespace esphome::daikin { // Values for Daikin ARC43XXX IR Controllers // Temperature @@ -60,5 +59,4 @@ class DaikinClimate : public climate_ir::ClimateIR { bool parse_state_frame_(const uint8_t frame[]); }; -} // namespace daikin -} // namespace esphome +} // namespace esphome::daikin diff --git a/esphome/components/daikin_arc/daikin_arc.cpp b/esphome/components/daikin_arc/daikin_arc.cpp index 18f12dbfc6..a455e2fd7f 100644 --- a/esphome/components/daikin_arc/daikin_arc.cpp +++ b/esphome/components/daikin_arc/daikin_arc.cpp @@ -5,8 +5,7 @@ #include "esphome/components/remote_base/remote_base.h" #include "esphome/core/log.h" -namespace esphome { -namespace daikin_arc { +namespace esphome::daikin_arc { static const char *const TAG = "daikin.climate"; @@ -492,5 +491,4 @@ void DaikinArcClimate::control(const climate::ClimateCall &call) { climate_ir::ClimateIR::control(call); } -} // namespace daikin_arc -} // namespace esphome +} // namespace esphome::daikin_arc diff --git a/esphome/components/daikin_arc/daikin_arc.h b/esphome/components/daikin_arc/daikin_arc.h index 2b4d4375aa..2337351e28 100644 --- a/esphome/components/daikin_arc/daikin_arc.h +++ b/esphome/components/daikin_arc/daikin_arc.h @@ -2,8 +2,7 @@ #include "esphome/components/climate_ir/climate_ir.h" -namespace esphome { -namespace daikin_arc { +namespace esphome::daikin_arc { // Values for Daikin ARC43XXX IR Controllers // Temperature @@ -73,5 +72,4 @@ class DaikinArcClimate : public climate_ir::ClimateIR { uint8_t last_humidity_{0x66}; }; -} // namespace daikin_arc -} // namespace esphome +} // namespace esphome::daikin_arc diff --git a/esphome/components/daikin_brc/daikin_brc.cpp b/esphome/components/daikin_brc/daikin_brc.cpp index 1179cb07d7..5fe3d30a85 100644 --- a/esphome/components/daikin_brc/daikin_brc.cpp +++ b/esphome/components/daikin_brc/daikin_brc.cpp @@ -1,8 +1,7 @@ #include "daikin_brc.h" #include "esphome/components/remote_base/remote_base.h" -namespace esphome { -namespace daikin_brc { +namespace esphome::daikin_brc { static const char *const TAG = "daikin_brc.climate"; @@ -269,5 +268,4 @@ bool DaikinBrcClimate::on_receive(remote_base::RemoteReceiveData data) { return this->parse_state_frame_(state_frame); } -} // namespace daikin_brc -} // namespace esphome +} // namespace esphome::daikin_brc diff --git a/esphome/components/daikin_brc/daikin_brc.h b/esphome/components/daikin_brc/daikin_brc.h index bdc6384809..4b5c679f7f 100644 --- a/esphome/components/daikin_brc/daikin_brc.h +++ b/esphome/components/daikin_brc/daikin_brc.h @@ -2,8 +2,7 @@ #include "esphome/components/climate_ir/climate_ir.h" -namespace esphome { -namespace daikin_brc { +namespace esphome::daikin_brc { // Values for Daikin BRC4CXXX IR Controllers // Temperature @@ -78,5 +77,4 @@ class DaikinBrcClimate : public climate_ir::ClimateIR { bool fahrenheit_{false}; }; -} // namespace daikin_brc -} // namespace esphome +} // namespace esphome::daikin_brc diff --git a/esphome/components/dallas_temp/dallas_temp.cpp b/esphome/components/dallas_temp/dallas_temp.cpp index f119e28e78..35488eab03 100644 --- a/esphome/components/dallas_temp/dallas_temp.cpp +++ b/esphome/components/dallas_temp/dallas_temp.cpp @@ -1,8 +1,7 @@ #include "dallas_temp.h" #include "esphome/core/log.h" -namespace esphome { -namespace dallas_temp { +namespace esphome::dallas_temp { static const char *const TAG = "dallas.temp.sensor"; @@ -159,5 +158,4 @@ float DallasTemperatureSensor::get_temp_c_() { return temp / 16.0f; } -} // namespace dallas_temp -} // namespace esphome +} // namespace esphome::dallas_temp diff --git a/esphome/components/dallas_temp/dallas_temp.h b/esphome/components/dallas_temp/dallas_temp.h index 1bd2865095..3f7b447fc7 100644 --- a/esphome/components/dallas_temp/dallas_temp.h +++ b/esphome/components/dallas_temp/dallas_temp.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/one_wire/one_wire.h" -namespace esphome { -namespace dallas_temp { +namespace esphome::dallas_temp { class DallasTemperatureSensor : public PollingComponent, public sensor::Sensor, public one_wire::OneWireDevice { public: @@ -27,5 +26,4 @@ class DallasTemperatureSensor : public PollingComponent, public sensor::Sensor, float get_temp_c_(); }; -} // namespace dallas_temp -} // namespace esphome +} // namespace esphome::dallas_temp diff --git a/esphome/components/daly_bms/daly_bms.cpp b/esphome/components/daly_bms/daly_bms.cpp index 90ccee78f8..530d8ad541 100644 --- a/esphome/components/daly_bms/daly_bms.cpp +++ b/esphome/components/daly_bms/daly_bms.cpp @@ -4,8 +4,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace daly_bms { +namespace esphome::daly_bms { static const char *const TAG = "daly_bms"; @@ -321,5 +320,4 @@ void DalyBmsComponent::decode_data_(std::vector data) { } } -} // namespace daly_bms -} // namespace esphome +} // namespace esphome::daly_bms diff --git a/esphome/components/daly_bms/daly_bms.h b/esphome/components/daly_bms/daly_bms.h index 1983ba0ef1..6dcc66b5ee 100644 --- a/esphome/components/daly_bms/daly_bms.h +++ b/esphome/components/daly_bms/daly_bms.h @@ -15,8 +15,7 @@ #include -namespace esphome { -namespace daly_bms { +namespace esphome::daly_bms { class DalyBmsComponent : public PollingComponent, public uart::UARTDevice { public: @@ -88,5 +87,4 @@ class DalyBmsComponent : public PollingComponent, public uart::UARTDevice { uint8_t next_request_; }; -} // namespace daly_bms -} // namespace esphome +} // namespace esphome::daly_bms diff --git a/esphome/components/dashboard_import/dashboard_import.cpp b/esphome/components/dashboard_import/dashboard_import.cpp index d4a95b81f6..f553adf273 100644 --- a/esphome/components/dashboard_import/dashboard_import.cpp +++ b/esphome/components/dashboard_import/dashboard_import.cpp @@ -1,12 +1,10 @@ #include "dashboard_import.h" -namespace esphome { -namespace dashboard_import { +namespace esphome::dashboard_import { static const char *g_package_import_url = ""; // NOLINT const char *get_package_import_url() { return g_package_import_url; } void set_package_import_url(const char *url) { g_package_import_url = url; } -} // namespace dashboard_import -} // namespace esphome +} // namespace esphome::dashboard_import diff --git a/esphome/components/dashboard_import/dashboard_import.h b/esphome/components/dashboard_import/dashboard_import.h index 488bf80a2e..19f69b8546 100644 --- a/esphome/components/dashboard_import/dashboard_import.h +++ b/esphome/components/dashboard_import/dashboard_import.h @@ -1,10 +1,8 @@ #pragma once -namespace esphome { -namespace dashboard_import { +namespace esphome::dashboard_import { const char *get_package_import_url(); void set_package_import_url(const char *url); -} // namespace dashboard_import -} // namespace esphome +} // namespace esphome::dashboard_import diff --git a/esphome/components/debug/debug_component.cpp b/esphome/components/debug/debug_component.cpp index d97a4aa135..9020c261c2 100644 --- a/esphome/components/debug/debug_component.cpp +++ b/esphome/components/debug/debug_component.cpp @@ -9,8 +9,7 @@ #include #include -namespace esphome { -namespace debug { +namespace esphome::debug { static const char *const TAG = "debug"; @@ -93,5 +92,4 @@ void DebugComponent::update() { float DebugComponent::get_setup_priority() const { return setup_priority::LATE; } -} // namespace debug -} // namespace esphome +} // namespace esphome::debug diff --git a/esphome/components/debug/debug_component.h b/esphome/components/debug/debug_component.h index 3da6b800c6..871b7cfd25 100644 --- a/esphome/components/debug/debug_component.h +++ b/esphome/components/debug/debug_component.h @@ -13,8 +13,7 @@ #include "esphome/components/text_sensor/text_sensor.h" #endif -namespace esphome { -namespace debug { +namespace esphome::debug { static constexpr size_t DEVICE_INFO_BUFFER_SIZE = 256; static constexpr size_t RESET_REASON_BUFFER_SIZE = 128; @@ -101,5 +100,4 @@ class DebugComponent : public PollingComponent { void update_platform_(); }; -} // namespace debug -} // namespace esphome +} // namespace esphome::debug diff --git a/esphome/components/debug/debug_esp32.cpp b/esphome/components/debug/debug_esp32.cpp index ea0c635207..7c01f9b54f 100644 --- a/esphome/components/debug/debug_esp32.cpp +++ b/esphome/components/debug/debug_esp32.cpp @@ -16,8 +16,7 @@ #include #endif -namespace esphome { -namespace debug { +namespace esphome::debug { static const char *const TAG = "debug"; @@ -311,6 +310,6 @@ void DebugComponent::update_platform_() { #endif } -} // namespace debug -} // namespace esphome +} // namespace esphome::debug + #endif // USE_ESP32 diff --git a/esphome/components/deep_sleep/deep_sleep_component.cpp b/esphome/components/deep_sleep/deep_sleep_component.cpp index d5e34b1f1c..e7ce70b60c 100644 --- a/esphome/components/deep_sleep/deep_sleep_component.cpp +++ b/esphome/components/deep_sleep/deep_sleep_component.cpp @@ -2,8 +2,7 @@ #include "esphome/core/application.h" #include "esphome/core/log.h" -namespace esphome { -namespace deep_sleep { +namespace esphome::deep_sleep { static const char *const TAG = "deep_sleep"; // 5 seconds for deep sleep to ensure clean disconnect from Home Assistant @@ -81,5 +80,4 @@ void DeepSleepComponent::prevent_deep_sleep() { this->prevent_ = true; } void DeepSleepComponent::allow_deep_sleep() { this->prevent_ = false; } -} // namespace deep_sleep -} // namespace esphome +} // namespace esphome::deep_sleep diff --git a/esphome/components/deep_sleep/deep_sleep_component.h b/esphome/components/deep_sleep/deep_sleep_component.h index 59381eeabe..2df53f1540 100644 --- a/esphome/components/deep_sleep/deep_sleep_component.h +++ b/esphome/components/deep_sleep/deep_sleep_component.h @@ -15,8 +15,7 @@ #include -namespace esphome { -namespace deep_sleep { +namespace esphome::deep_sleep { #if defined(USE_ESP32) || defined(USE_BK72XX) @@ -244,5 +243,4 @@ template class AllowDeepSleepAction : public Action, publ void play(const Ts &...x) override { this->parent_->allow_deep_sleep(); } }; -} // namespace deep_sleep -} // namespace esphome +} // namespace esphome::deep_sleep diff --git a/esphome/components/deep_sleep/deep_sleep_esp32.cpp b/esphome/components/deep_sleep/deep_sleep_esp32.cpp index 80a218e913..c905b8fcbc 100644 --- a/esphome/components/deep_sleep/deep_sleep_esp32.cpp +++ b/esphome/components/deep_sleep/deep_sleep_esp32.cpp @@ -5,8 +5,7 @@ #include "esphome/core/log.h" #include -namespace esphome { -namespace deep_sleep { +namespace esphome::deep_sleep { // Deep Sleep feature support matrix for ESP32 variants: // @@ -167,6 +166,6 @@ void DeepSleepComponent::deep_sleep_() { bool DeepSleepComponent::should_teardown_() { return true; } -} // namespace deep_sleep -} // namespace esphome +} // namespace esphome::deep_sleep + #endif // USE_ESP32 diff --git a/esphome/components/delonghi/delonghi.cpp b/esphome/components/delonghi/delonghi.cpp index 19af703ab2..fab2d68347 100644 --- a/esphome/components/delonghi/delonghi.cpp +++ b/esphome/components/delonghi/delonghi.cpp @@ -1,8 +1,7 @@ #include "delonghi.h" #include "esphome/components/remote_base/remote_base.h" -namespace esphome { -namespace delonghi { +namespace esphome::delonghi { static const char *const TAG = "delonghi.climate"; @@ -182,5 +181,4 @@ bool DelonghiClimate::on_receive(remote_base::RemoteReceiveData data) { return this->parse_state_frame_(state_frame); } -} // namespace delonghi -} // namespace esphome +} // namespace esphome::delonghi diff --git a/esphome/components/delonghi/delonghi.h b/esphome/components/delonghi/delonghi.h index d310a58aee..c2fbc36b4f 100644 --- a/esphome/components/delonghi/delonghi.h +++ b/esphome/components/delonghi/delonghi.h @@ -2,8 +2,7 @@ #include "esphome/components/climate_ir/climate_ir.h" -namespace esphome { -namespace delonghi { +namespace esphome::delonghi { // Values for DELONGHI ARC43XXX IR Controllers const uint8_t DELONGHI_ADDRESS = 83; @@ -60,5 +59,4 @@ class DelonghiClimate : public climate_ir::ClimateIR { bool parse_state_frame_(const uint8_t frame[]); }; -} // namespace delonghi -} // namespace esphome +} // namespace esphome::delonghi diff --git a/esphome/components/demo/demo_alarm_control_panel.h b/esphome/components/demo/demo_alarm_control_panel.h index 5f0725dd4b..7aaf3219cf 100644 --- a/esphome/components/demo/demo_alarm_control_panel.h +++ b/esphome/components/demo/demo_alarm_control_panel.h @@ -3,8 +3,7 @@ #include "esphome/components/alarm_control_panel/alarm_control_panel.h" #include "esphome/core/component.h" -namespace esphome { -namespace demo { +namespace esphome::demo { using namespace alarm_control_panel; @@ -62,5 +61,4 @@ class DemoAlarmControlPanel : public AlarmControlPanel, public Component { DemoAlarmControlPanelType type_{}; }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_binary_sensor.h b/esphome/components/demo/demo_binary_sensor.h index 4dfd038761..4bc3737d5a 100644 --- a/esphome/components/demo/demo_binary_sensor.h +++ b/esphome/components/demo/demo_binary_sensor.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/binary_sensor/binary_sensor.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoBinarySensor : public binary_sensor::BinarySensor, public PollingComponent { public: @@ -18,5 +17,4 @@ class DemoBinarySensor : public binary_sensor::BinarySensor, public PollingCompo bool last_state_ = false; }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_button.h b/esphome/components/demo/demo_button.h index be80d26a8a..a0ed92d3d8 100644 --- a/esphome/components/demo/demo_button.h +++ b/esphome/components/demo/demo_button.h @@ -3,13 +3,11 @@ #include "esphome/components/button/button.h" #include "esphome/core/log.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoButton : public button::Button { protected: void press_action() override {} }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_climate.h b/esphome/components/demo/demo_climate.h index c6d328b1bc..d0cd2d553d 100644 --- a/esphome/components/demo/demo_climate.h +++ b/esphome/components/demo/demo_climate.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/climate/climate.h" -namespace esphome { -namespace demo { +namespace esphome::demo { enum class DemoClimateType { TYPE_1, @@ -158,5 +157,4 @@ class DemoClimate : public climate::Climate, public Component { DemoClimateType type_; }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_cover.h b/esphome/components/demo/demo_cover.h index 69dd5a4d2d..c1597a7565 100644 --- a/esphome/components/demo/demo_cover.h +++ b/esphome/components/demo/demo_cover.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/cover/cover.h" -namespace esphome { -namespace demo { +namespace esphome::demo { enum class DemoCoverType { TYPE_1, @@ -85,5 +84,4 @@ class DemoCover : public cover::Cover, public Component { DemoCoverType type_; }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_date.h b/esphome/components/demo/demo_date.h index e09ab5f887..5a868342cd 100644 --- a/esphome/components/demo/demo_date.h +++ b/esphome/components/demo/demo_date.h @@ -7,8 +7,7 @@ #include "esphome/components/datetime/date_entity.h" #include "esphome/core/component.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoDate : public datetime::DateEntity, public Component { public: @@ -28,7 +27,6 @@ class DemoDate : public datetime::DateEntity, public Component { } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo #endif diff --git a/esphome/components/demo/demo_datetime.h b/esphome/components/demo/demo_datetime.h index 5ebcc3e64e..84869d1a9f 100644 --- a/esphome/components/demo/demo_datetime.h +++ b/esphome/components/demo/demo_datetime.h @@ -7,8 +7,7 @@ #include "esphome/components/datetime/datetime_entity.h" #include "esphome/core/component.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoDateTime : public datetime::DateTimeEntity, public Component { public: @@ -34,7 +33,6 @@ class DemoDateTime : public datetime::DateTimeEntity, public Component { } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo #endif diff --git a/esphome/components/demo/demo_fan.h b/esphome/components/demo/demo_fan.h index a8b397f19a..2e2fbce7d6 100644 --- a/esphome/components/demo/demo_fan.h +++ b/esphome/components/demo/demo_fan.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/fan/fan.h" -namespace esphome { -namespace demo { +namespace esphome::demo { enum class DemoFanType { TYPE_1, @@ -66,5 +65,4 @@ class DemoFan : public fan::Fan, public Component { DemoFanType type_; }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_light.h b/esphome/components/demo/demo_light.h index 2007e9ff50..071adb0831 100644 --- a/esphome/components/demo/demo_light.h +++ b/esphome/components/demo/demo_light.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/light/light_output.h" -namespace esphome { -namespace demo { +namespace esphome::demo { enum class DemoLightType { // binary @@ -64,5 +63,4 @@ class DemoLight : public light::LightOutput, public Component { DemoLightType type_; }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_lock.h b/esphome/components/demo/demo_lock.h index 1e3fd51db4..85c1c238ef 100644 --- a/esphome/components/demo/demo_lock.h +++ b/esphome/components/demo/demo_lock.h @@ -2,8 +2,7 @@ #include "esphome/components/lock/lock.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoLock : public lock::Lock { protected: @@ -14,5 +13,4 @@ class DemoLock : public lock::Lock { } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_number.h b/esphome/components/demo/demo_number.h index 2ce3a269bc..0059cdc2ee 100644 --- a/esphome/components/demo/demo_number.h +++ b/esphome/components/demo/demo_number.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/number/number.h" -namespace esphome { -namespace demo { +namespace esphome::demo { enum class DemoNumberType { TYPE_1, @@ -35,5 +34,4 @@ class DemoNumber : public number::Number, public Component { DemoNumberType type_; }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_select.h b/esphome/components/demo/demo_select.h index 1a5df13eda..2ecb37db99 100644 --- a/esphome/components/demo/demo_select.h +++ b/esphome/components/demo/demo_select.h @@ -3,13 +3,11 @@ #include "esphome/components/select/select.h" #include "esphome/core/component.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoSelect : public select::Select, public Component { protected: void control(size_t index) override { this->publish_state(index); } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_sensor.h b/esphome/components/demo/demo_sensor.h index d965d987de..867115f21b 100644 --- a/esphome/components/demo/demo_sensor.h +++ b/esphome/components/demo/demo_sensor.h @@ -4,8 +4,7 @@ #include "esphome/core/helpers.h" #include "esphome/components/sensor/sensor.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoSensor : public sensor::Sensor, public PollingComponent { public: @@ -25,5 +24,4 @@ class DemoSensor : public sensor::Sensor, public PollingComponent { } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_switch.h b/esphome/components/demo/demo_switch.h index 9c291318ca..b2d6e52c67 100644 --- a/esphome/components/demo/demo_switch.h +++ b/esphome/components/demo/demo_switch.h @@ -4,8 +4,7 @@ #include "esphome/core/helpers.h" #include "esphome/components/switch/switch.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoSwitch : public switch_::Switch, public Component { public: @@ -18,5 +17,4 @@ class DemoSwitch : public switch_::Switch, public Component { void write_state(bool state) override { this->publish_state(state); } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_text.h b/esphome/components/demo/demo_text.h index a753175062..56376c8c42 100644 --- a/esphome/components/demo/demo_text.h +++ b/esphome/components/demo/demo_text.h @@ -3,8 +3,7 @@ #include "esphome/components/text/text.h" #include "esphome/core/component.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoText : public text::Text, public Component { public: @@ -14,5 +13,4 @@ class DemoText : public text::Text, public Component { void control(const std::string &value) override { this->publish_state(value); } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_text_sensor.h b/esphome/components/demo/demo_text_sensor.h index b4152fc248..03852a1e7f 100644 --- a/esphome/components/demo/demo_text_sensor.h +++ b/esphome/components/demo/demo_text_sensor.h @@ -4,8 +4,7 @@ #include "esphome/core/helpers.h" #include "esphome/components/text_sensor/text_sensor.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoTextSensor : public text_sensor::TextSensor, public PollingComponent { public: @@ -21,5 +20,4 @@ class DemoTextSensor : public text_sensor::TextSensor, public PollingComponent { } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/demo/demo_time.h b/esphome/components/demo/demo_time.h index 42788504bb..f94678fae4 100644 --- a/esphome/components/demo/demo_time.h +++ b/esphome/components/demo/demo_time.h @@ -7,8 +7,7 @@ #include "esphome/components/datetime/time_entity.h" #include "esphome/core/component.h" -namespace esphome { -namespace demo { +namespace esphome::demo { class DemoTime : public datetime::TimeEntity, public Component { public: @@ -28,7 +27,6 @@ class DemoTime : public datetime::TimeEntity, public Component { } }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo #endif diff --git a/esphome/components/demo/demo_valve.h b/esphome/components/demo/demo_valve.h index 9a3122aca5..3f1342959a 100644 --- a/esphome/components/demo/demo_valve.h +++ b/esphome/components/demo/demo_valve.h @@ -2,8 +2,7 @@ #include "esphome/components/valve/valve.h" -namespace esphome { -namespace demo { +namespace esphome::demo { enum class DemoValveType { TYPE_1, @@ -53,5 +52,4 @@ class DemoValve : public valve::Valve { DemoValveType type_{}; }; -} // namespace demo -} // namespace esphome +} // namespace esphome::demo diff --git a/esphome/components/dfplayer/dfplayer.cpp b/esphome/components/dfplayer/dfplayer.cpp index 1e1c33adaf..5c9d497c87 100644 --- a/esphome/components/dfplayer/dfplayer.cpp +++ b/esphome/components/dfplayer/dfplayer.cpp @@ -2,8 +2,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace dfplayer { +namespace esphome::dfplayer { static const char *const TAG = "dfplayer"; @@ -283,5 +282,4 @@ void DFPlayer::dump_config() { this->check_uart_settings(9600); } -} // namespace dfplayer -} // namespace esphome +} // namespace esphome::dfplayer diff --git a/esphome/components/dfplayer/dfplayer.h b/esphome/components/dfplayer/dfplayer.h index 0d240566c3..5936a06b60 100644 --- a/esphome/components/dfplayer/dfplayer.h +++ b/esphome/components/dfplayer/dfplayer.h @@ -6,8 +6,7 @@ const size_t DFPLAYER_READ_BUFFER_LENGTH = 25; // two messages + some extra -namespace esphome { -namespace dfplayer { +namespace esphome::dfplayer { enum EqPreset { NORMAL = 0, @@ -171,5 +170,4 @@ template class DFPlayerIsPlayingCondition : public Conditionparent_->is_playing(); } }; -} // namespace dfplayer -} // namespace esphome +} // namespace esphome::dfplayer diff --git a/esphome/components/dfrobot_sen0395/automation.h b/esphome/components/dfrobot_sen0395/automation.h index 422555d6eb..bd91381d47 100644 --- a/esphome/components/dfrobot_sen0395/automation.h +++ b/esphome/components/dfrobot_sen0395/automation.h @@ -5,8 +5,7 @@ #include "dfrobot_sen0395.h" -namespace esphome { -namespace dfrobot_sen0395 { +namespace esphome::dfrobot_sen0395 { template class DfrobotSen0395ResetAction : public Action, public Parented { @@ -85,5 +84,4 @@ class DfrobotSen0395SettingsAction : public Action, public Parentedparent_->enqueue(make_unique(state)); } @@ -44,5 +43,4 @@ void Sen0395StartAfterBootSwitch::write_state(bool state) { } } -} // namespace dfrobot_sen0395 -} // namespace esphome +} // namespace esphome::dfrobot_sen0395 diff --git a/esphome/components/dfrobot_sen0395/switch/dfrobot_sen0395_switch.h b/esphome/components/dfrobot_sen0395/switch/dfrobot_sen0395_switch.h index ab32d81dd8..d83734b034 100644 --- a/esphome/components/dfrobot_sen0395/switch/dfrobot_sen0395_switch.h +++ b/esphome/components/dfrobot_sen0395/switch/dfrobot_sen0395_switch.h @@ -5,8 +5,7 @@ #include "../dfrobot_sen0395.h" -namespace esphome { -namespace dfrobot_sen0395 { +namespace esphome::dfrobot_sen0395 { class DfrobotSen0395Switch : public switch_::Switch, public Component, public Parented {}; @@ -30,5 +29,4 @@ class Sen0395StartAfterBootSwitch : public DfrobotSen0395Switch { void write_state(bool state) override; }; -} // namespace dfrobot_sen0395 -} // namespace esphome +} // namespace esphome::dfrobot_sen0395 diff --git a/esphome/components/dht12/dht12.cpp b/esphome/components/dht12/dht12.cpp index 1d884daad6..78f9140929 100644 --- a/esphome/components/dht12/dht12.cpp +++ b/esphome/components/dht12/dht12.cpp @@ -5,8 +5,7 @@ #include "dht12.h" #include "esphome/core/log.h" -namespace esphome { -namespace dht12 { +namespace esphome::dht12 { static const char *const TAG = "dht12"; @@ -65,5 +64,4 @@ bool DHT12Component::read_data_(uint8_t *data) { return true; } -} // namespace dht12 -} // namespace esphome +} // namespace esphome::dht12 diff --git a/esphome/components/dht12/dht12.h b/esphome/components/dht12/dht12.h index ab19d7c723..5f4f822e70 100644 --- a/esphome/components/dht12/dht12.h +++ b/esphome/components/dht12/dht12.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace dht12 { +namespace esphome::dht12 { class DHT12Component : public PollingComponent, public i2c::I2CDevice { public: @@ -23,5 +22,4 @@ class DHT12Component : public PollingComponent, public i2c::I2CDevice { sensor::Sensor *humidity_sensor_{nullptr}; }; -} // namespace dht12 -} // namespace esphome +} // namespace esphome::dht12 diff --git a/esphome/components/display/display.cpp b/esphome/components/display/display.cpp index f8569b6e7c..cd2d2143f5 100644 --- a/esphome/components/display/display.cpp +++ b/esphome/components/display/display.cpp @@ -5,8 +5,7 @@ #include "esphome/core/hal.h" #include "esphome/core/log.h" -namespace esphome { -namespace display { +namespace esphome::display { static const char *const TAG = "display"; // COLOR_OFF and COLOR_ON are now inline constexpr in display.h @@ -927,5 +926,4 @@ const LogString *text_align_to_string(TextAlign textalign) { return LOG_STR("UNKNOWN"); } } -} // namespace display -} // namespace esphome +} // namespace esphome::display diff --git a/esphome/components/display/display.h b/esphome/components/display/display.h index 6e38300d0e..6d0b7acfe8 100644 --- a/esphome/components/display/display.h +++ b/esphome/components/display/display.h @@ -23,8 +23,7 @@ #include "esphome/components/graphical_display_menu/graphical_display_menu.h" #endif -namespace esphome { -namespace display { +namespace esphome::display { /** TextAlign is used to tell the display class how to position a piece of text. By default * the coordinates you enter for the print*() functions take the upper left corner of the text @@ -871,5 +870,4 @@ class DisplayOnPageChangeTrigger : public Trigger const LogString *text_align_to_string(TextAlign textalign); -} // namespace display -} // namespace esphome +} // namespace esphome::display diff --git a/esphome/components/display/display_buffer.cpp b/esphome/components/display/display_buffer.cpp index 0ecdccc38a..4c91914049 100644 --- a/esphome/components/display/display_buffer.cpp +++ b/esphome/components/display/display_buffer.cpp @@ -5,8 +5,7 @@ #include "esphome/core/application.h" #include "esphome/core/log.h" -namespace esphome { -namespace display { +namespace esphome::display { static const char *const TAG = "display"; @@ -68,5 +67,4 @@ void HOT DisplayBuffer::draw_pixel_at(int x, int y, Color color) { App.feed_wdt(); } -} // namespace display -} // namespace esphome +} // namespace esphome::display diff --git a/esphome/components/display/display_buffer.h b/esphome/components/display/display_buffer.h index b7c4db56be..d3032a33f7 100644 --- a/esphome/components/display/display_buffer.h +++ b/esphome/components/display/display_buffer.h @@ -9,8 +9,7 @@ #include "esphome/core/component.h" #include "esphome/core/defines.h" -namespace esphome { -namespace display { +namespace esphome::display { class DisplayBuffer : public Display { public: @@ -30,5 +29,4 @@ class DisplayBuffer : public Display { uint8_t *buffer_{nullptr}; }; -} // namespace display -} // namespace esphome +} // namespace esphome::display diff --git a/esphome/components/display/display_color_utils.h b/esphome/components/display/display_color_utils.h index 3114dee359..608642caa4 100644 --- a/esphome/components/display/display_color_utils.h +++ b/esphome/components/display/display_color_utils.h @@ -1,8 +1,7 @@ #pragma once #include "esphome/core/color.h" -namespace esphome { -namespace display { +namespace esphome::display { enum ColorOrder : uint8_t { COLOR_ORDER_RGB = 0, COLOR_ORDER_BGR = 1, COLOR_ORDER_GRB = 2 }; enum ColorBitness : uint8_t { COLOR_BITNESS_888 = 0, COLOR_BITNESS_565 = 1, COLOR_BITNESS_332 = 2 }; inline static uint8_t esp_scale(uint8_t i, uint8_t scale, uint8_t max_value = 255) { return (max_value * i / scale); } @@ -155,5 +154,4 @@ class ColorUtil { return color; } }; -} // namespace display -} // namespace esphome +} // namespace esphome::display diff --git a/esphome/components/display/rect.cpp b/esphome/components/display/rect.cpp index 2c41127860..a47f726917 100644 --- a/esphome/components/display/rect.cpp +++ b/esphome/components/display/rect.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" -namespace esphome { -namespace display { +namespace esphome::display { static const char *const TAG = "display"; @@ -90,5 +89,4 @@ void Rect::info(const std::string &prefix) { } } -} // namespace display -} // namespace esphome +} // namespace esphome::display diff --git a/esphome/components/display/rect.h b/esphome/components/display/rect.h index 5f11d94681..f4958fab88 100644 --- a/esphome/components/display/rect.h +++ b/esphome/components/display/rect.h @@ -2,8 +2,7 @@ #include "esphome/core/helpers.h" -namespace esphome { -namespace display { +namespace esphome::display { static const int16_t VALUE_NO_SET = 32766; @@ -32,5 +31,4 @@ class Rect { void info(const std::string &prefix = "rect info:"); }; -} // namespace display -} // namespace esphome +} // namespace esphome::display diff --git a/esphome/components/display_menu_base/automation.h b/esphome/components/display_menu_base/automation.h index 50c26c344c..d4f83055d1 100644 --- a/esphome/components/display_menu_base/automation.h +++ b/esphome/components/display_menu_base/automation.h @@ -3,8 +3,7 @@ #include "esphome/core/automation.h" #include "display_menu_base.h" -namespace esphome { -namespace display_menu_base { +namespace esphome::display_menu_base { template class UpAction : public Action { public: @@ -144,5 +143,4 @@ class DisplayMenuOnPrevTrigger : public Trigger { MenuItemCustom *parent_; }; -} // namespace display_menu_base -} // namespace esphome +} // namespace esphome::display_menu_base diff --git a/esphome/components/display_menu_base/display_menu_base.cpp b/esphome/components/display_menu_base/display_menu_base.cpp index 2d8e6ae5fc..634a82a892 100644 --- a/esphome/components/display_menu_base/display_menu_base.cpp +++ b/esphome/components/display_menu_base/display_menu_base.cpp @@ -1,8 +1,7 @@ #include "display_menu_base.h" #include -namespace esphome { -namespace display_menu_base { +namespace esphome::display_menu_base { void DisplayMenuComponent::up() { if (this->check_healthy_and_active_()) { @@ -325,5 +324,4 @@ void DisplayMenuComponent::draw_menu() { } } -} // namespace display_menu_base -} // namespace esphome +} // namespace esphome::display_menu_base diff --git a/esphome/components/display_menu_base/display_menu_base.h b/esphome/components/display_menu_base/display_menu_base.h index 6208fcd3b4..07cdb7a10f 100644 --- a/esphome/components/display_menu_base/display_menu_base.h +++ b/esphome/components/display_menu_base/display_menu_base.h @@ -6,8 +6,7 @@ #include -namespace esphome { -namespace display_menu_base { +namespace esphome::display_menu_base { enum MenuMode { MENU_MODE_ROTARY, @@ -78,5 +77,4 @@ class DisplayMenuComponent : public Component { bool root_on_enter_called_{false}; }; -} // namespace display_menu_base -} // namespace esphome +} // namespace esphome::display_menu_base diff --git a/esphome/components/display_menu_base/menu_item.cpp b/esphome/components/display_menu_base/menu_item.cpp index ad8b03de60..8d1d315e32 100644 --- a/esphome/components/display_menu_base/menu_item.cpp +++ b/esphome/components/display_menu_base/menu_item.cpp @@ -2,8 +2,7 @@ #include -namespace esphome { -namespace display_menu_base { +namespace esphome::display_menu_base { const LogString *menu_item_type_to_string(MenuItemType type) { switch (type) { @@ -201,5 +200,4 @@ void MenuItemCustom::on_next_() { this->on_next_callbacks_.call(); } void MenuItemCustom::on_prev_() { this->on_prev_callbacks_.call(); } -} // namespace display_menu_base -} // namespace esphome +} // namespace esphome::display_menu_base diff --git a/esphome/components/display_menu_base/menu_item.h b/esphome/components/display_menu_base/menu_item.h index 57d7350b9e..f3c41583f7 100644 --- a/esphome/components/display_menu_base/menu_item.h +++ b/esphome/components/display_menu_base/menu_item.h @@ -16,8 +16,7 @@ #include #include "esphome/core/log.h" -namespace esphome { -namespace display_menu_base { +namespace esphome::display_menu_base { enum MenuItemType { MENU_ITEM_LABEL, @@ -187,5 +186,4 @@ class MenuItemCustom : public MenuItemEditable { CallbackManager on_prev_callbacks_{}; }; -} // namespace display_menu_base -} // namespace esphome +} // namespace esphome::display_menu_base diff --git a/esphome/components/dps310/dps310.cpp b/esphome/components/dps310/dps310.cpp index b1366cd069..3b4693139d 100644 --- a/esphome/components/dps310/dps310.cpp +++ b/esphome/components/dps310/dps310.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" -namespace esphome { -namespace dps310 { +namespace esphome::dps310 { static const char *const TAG = "dps310"; @@ -182,5 +181,4 @@ int32_t DPS310Component::twos_complement(int32_t val, uint8_t bits) { return val; } -} // namespace dps310 -} // namespace esphome +} // namespace esphome::dps310 diff --git a/esphome/components/dps310/dps310.h b/esphome/components/dps310/dps310.h index dce220d44b..09143bf6b8 100644 --- a/esphome/components/dps310/dps310.h +++ b/esphome/components/dps310/dps310.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace dps310 { +namespace esphome::dps310 { static const uint8_t DPS310_REG_PRS_B2 = 0x00; // Highest byte of pressure data static const uint8_t DPS310_REG_TMP_B2 = 0x03; // Highest byte of temperature data @@ -60,5 +59,4 @@ class DPS310Component : public PollingComponent, public i2c::I2CDevice { bool got_pres_, got_temp_, update_in_progress_; }; -} // namespace dps310 -} // namespace esphome +} // namespace esphome::dps310 diff --git a/esphome/components/ds1307/ds1307.cpp b/esphome/components/ds1307/ds1307.cpp index ba2ad6032f..1d04b52168 100644 --- a/esphome/components/ds1307/ds1307.cpp +++ b/esphome/components/ds1307/ds1307.cpp @@ -4,8 +4,7 @@ // Datasheet: // - https://datasheets.maximintegrated.com/en/ds/DS1307.pdf -namespace esphome { -namespace ds1307 { +namespace esphome::ds1307 { static const char *const TAG = "ds1307"; @@ -99,5 +98,4 @@ bool DS1307Component::write_rtc_() { ds1307_.reg.day, ONOFF(ds1307_.reg.ch), ds1307_.reg.rs, ONOFF(ds1307_.reg.sqwe), ONOFF(ds1307_.reg.out)); return true; } -} // namespace ds1307 -} // namespace esphome +} // namespace esphome::ds1307 diff --git a/esphome/components/ds1307/ds1307.h b/esphome/components/ds1307/ds1307.h index 1712056006..2004978cc6 100644 --- a/esphome/components/ds1307/ds1307.h +++ b/esphome/components/ds1307/ds1307.h @@ -4,8 +4,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/components/time/real_time_clock.h" -namespace esphome { -namespace ds1307 { +namespace esphome::ds1307 { class DS1307Component : public time::RealTimeClock, public i2c::I2CDevice { public: @@ -65,5 +64,4 @@ template class ReadAction : public Action, public Parente public: void play(const Ts &...x) override { this->parent_->read_time(); } }; -} // namespace ds1307 -} // namespace esphome +} // namespace esphome::ds1307 diff --git a/esphome/components/ds2484/ds2484.cpp b/esphome/components/ds2484/ds2484.cpp index 0b36f86874..69103ccbd2 100644 --- a/esphome/components/ds2484/ds2484.cpp +++ b/esphome/components/ds2484/ds2484.cpp @@ -1,7 +1,6 @@ #include "ds2484.h" -namespace esphome { -namespace ds2484 { +namespace esphome::ds2484 { static const char *const TAG = "ds2484.onewire"; void DS2484OneWireBus::setup() { @@ -204,5 +203,4 @@ uint64_t IRAM_ATTR DS2484OneWireBus::search_int() { return address; } -} // namespace ds2484 -} // namespace esphome +} // namespace esphome::ds2484 diff --git a/esphome/components/ds2484/ds2484.h b/esphome/components/ds2484/ds2484.h index 223227c0a2..9e6bb08858 100644 --- a/esphome/components/ds2484/ds2484.h +++ b/esphome/components/ds2484/ds2484.h @@ -6,8 +6,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/components/one_wire/one_wire.h" -namespace esphome { -namespace ds2484 { +namespace esphome::ds2484 { class DS2484OneWireBus : public one_wire::OneWireBus, public i2c::I2CDevice, public Component { public: @@ -39,5 +38,4 @@ class DS2484OneWireBus : public one_wire::OneWireBus, public i2c::I2CDevice, pub bool active_pullup_{false}; bool strong_pullup_{false}; }; -} // namespace ds2484 -} // namespace esphome +} // namespace esphome::ds2484 diff --git a/esphome/components/duty_cycle/duty_cycle_sensor.cpp b/esphome/components/duty_cycle/duty_cycle_sensor.cpp index f801769d27..fd0a48b935 100644 --- a/esphome/components/duty_cycle/duty_cycle_sensor.cpp +++ b/esphome/components/duty_cycle/duty_cycle_sensor.cpp @@ -2,8 +2,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace duty_cycle { +namespace esphome::duty_cycle { static const char *const TAG = "duty_cycle"; @@ -56,5 +55,4 @@ void IRAM_ATTR DutyCycleSensorStore::gpio_intr(DutyCycleSensorStore *arg) { arg->last_interrupt = now; } -} // namespace duty_cycle -} // namespace esphome +} // namespace esphome::duty_cycle diff --git a/esphome/components/duty_cycle/duty_cycle_sensor.h b/esphome/components/duty_cycle/duty_cycle_sensor.h index ffb8e3b622..58beee946a 100644 --- a/esphome/components/duty_cycle/duty_cycle_sensor.h +++ b/esphome/components/duty_cycle/duty_cycle_sensor.h @@ -4,8 +4,7 @@ #include "esphome/core/hal.h" #include "esphome/components/sensor/sensor.h" -namespace esphome { -namespace duty_cycle { +namespace esphome::duty_cycle { /// Store data in a class that doesn't use multiple-inheritance (vtables in flash) struct DutyCycleSensorStore { @@ -32,5 +31,4 @@ class DutyCycleSensor : public sensor::Sensor, public PollingComponent { uint32_t last_update_{0}; }; -} // namespace duty_cycle -} // namespace esphome +} // namespace esphome::duty_cycle diff --git a/esphome/components/duty_time/duty_time_sensor.cpp b/esphome/components/duty_time/duty_time_sensor.cpp index 561040623d..697a4e96f3 100644 --- a/esphome/components/duty_time/duty_time_sensor.cpp +++ b/esphome/components/duty_time/duty_time_sensor.cpp @@ -1,8 +1,7 @@ #include "duty_time_sensor.h" #include "esphome/core/hal.h" -namespace esphome { -namespace duty_time_sensor { +namespace esphome::duty_time_sensor { static const char *const TAG = "duty_time_sensor"; @@ -103,5 +102,4 @@ void DutyTimeSensor::dump_config() { LOG_SENSOR(" ", "Last Duty Time Sensor:", this->last_duty_time_sensor_); } -} // namespace duty_time_sensor -} // namespace esphome +} // namespace esphome::duty_time_sensor diff --git a/esphome/components/duty_time/duty_time_sensor.h b/esphome/components/duty_time/duty_time_sensor.h index d21802ebb6..9b1e10ea8c 100644 --- a/esphome/components/duty_time/duty_time_sensor.h +++ b/esphome/components/duty_time/duty_time_sensor.h @@ -10,8 +10,7 @@ #include "esphome/components/binary_sensor/binary_sensor.h" #endif -namespace esphome { -namespace duty_time_sensor { +namespace esphome::duty_time_sensor { class DutyTimeSensor : public sensor::Sensor, public PollingComponent { public: @@ -71,5 +70,4 @@ template class RunningCondition : public Condition, publi bool state_; }; -} // namespace duty_time_sensor -} // namespace esphome +} // namespace esphome::duty_time_sensor diff --git a/esphome/components/e131/e131.cpp b/esphome/components/e131/e131.cpp index a7a695c167..061af4c4c0 100644 --- a/esphome/components/e131/e131.cpp +++ b/esphome/components/e131/e131.cpp @@ -5,8 +5,7 @@ #include -namespace esphome { -namespace e131 { +namespace esphome::e131 { static const char *const TAG = "e131"; static const int PORT = 5568; @@ -134,6 +133,6 @@ bool E131Component::process_(int universe, const E131Packet &packet) { return handled; } -} // namespace e131 -} // namespace esphome +} // namespace esphome::e131 + #endif diff --git a/esphome/components/e131/e131.h b/esphome/components/e131/e131.h index 8f0b808946..bfcb0ca7f8 100644 --- a/esphome/components/e131/e131.h +++ b/esphome/components/e131/e131.h @@ -12,8 +12,7 @@ #include #include -namespace esphome { -namespace e131 { +namespace esphome::e131 { class E131AddressableLightEffect; @@ -72,6 +71,6 @@ class E131Component : public esphome::Component { std::vector universe_consumers_; }; -} // namespace e131 -} // namespace esphome +} // namespace esphome::e131 + #endif diff --git a/esphome/components/e131/e131_addressable_light_effect.cpp b/esphome/components/e131/e131_addressable_light_effect.cpp index f6300874ac..6157eba4e9 100644 --- a/esphome/components/e131/e131_addressable_light_effect.cpp +++ b/esphome/components/e131/e131_addressable_light_effect.cpp @@ -3,8 +3,7 @@ #ifdef USE_NETWORK #include "esphome/core/log.h" -namespace esphome { -namespace e131 { +namespace esphome::e131 { static const char *const TAG = "e131_addressable_light_effect"; static const int MAX_DATA_SIZE = (sizeof(E131Packet::values) - 1); @@ -91,6 +90,6 @@ bool E131AddressableLightEffect::process_(int universe, const E131Packet &packet return true; } -} // namespace e131 -} // namespace esphome +} // namespace esphome::e131 + #endif diff --git a/esphome/components/e131/e131_addressable_light_effect.h b/esphome/components/e131/e131_addressable_light_effect.h index 381e08163b..b28dc22dbe 100644 --- a/esphome/components/e131/e131_addressable_light_effect.h +++ b/esphome/components/e131/e131_addressable_light_effect.h @@ -3,8 +3,8 @@ #include "esphome/core/component.h" #include "esphome/components/light/addressable_light_effect.h" #ifdef USE_NETWORK -namespace esphome { -namespace e131 { + +namespace esphome::e131 { class E131Component; struct E131Packet; @@ -40,6 +40,6 @@ class E131AddressableLightEffect : public light::AddressableLightEffect { friend class E131Component; }; -} // namespace e131 -} // namespace esphome +} // namespace esphome::e131 + #endif diff --git a/esphome/components/e131/e131_packet.cpp b/esphome/components/e131/e131_packet.cpp index 600793f5d3..afed2abe31 100644 --- a/esphome/components/e131/e131_packet.cpp +++ b/esphome/components/e131/e131_packet.cpp @@ -12,8 +12,7 @@ #include #include -namespace esphome { -namespace e131 { +namespace esphome::e131 { static const char *const TAG = "e131"; @@ -158,6 +157,6 @@ bool E131Component::packet_(const uint8_t *data, size_t len, int &universe, E131 return true; } -} // namespace e131 -} // namespace esphome +} // namespace esphome::e131 + #endif diff --git a/esphome/components/ee895/ee895.cpp b/esphome/components/ee895/ee895.cpp index 93e5d4203b..2dd7405ff5 100644 --- a/esphome/components/ee895/ee895.cpp +++ b/esphome/components/ee895/ee895.cpp @@ -2,8 +2,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace ee895 { +namespace esphome::ee895 { static const char *const TAG = "ee895"; @@ -111,5 +110,4 @@ uint16_t EE895Component::calc_crc16_(const uint8_t buf[], uint8_t len) { uint16_t crc = crc16(&addr, 1); return crc16(buf, len, crc); } -} // namespace ee895 -} // namespace esphome +} // namespace esphome::ee895 diff --git a/esphome/components/ee895/ee895.h b/esphome/components/ee895/ee895.h index ff1085e05d..ba8e594fea 100644 --- a/esphome/components/ee895/ee895.h +++ b/esphome/components/ee895/ee895.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace ee895 { +namespace esphome::ee895 { /// This class implements support for the ee895 of temperature i2c sensors. class EE895Component : public PollingComponent, public i2c::I2CDevice { @@ -29,5 +28,4 @@ class EE895Component : public PollingComponent, public i2c::I2CDevice { enum ErrorCode { NONE = 0, COMMUNICATION_FAILED, CRC_CHECK_FAILED } error_code_{NONE}; }; -} // namespace ee895 -} // namespace esphome +} // namespace esphome::ee895 diff --git a/esphome/components/ektf2232/touchscreen/ektf2232.cpp b/esphome/components/ektf2232/touchscreen/ektf2232.cpp index 63ebb2166b..51532548c1 100644 --- a/esphome/components/ektf2232/touchscreen/ektf2232.cpp +++ b/esphome/components/ektf2232/touchscreen/ektf2232.cpp @@ -4,8 +4,7 @@ #include -namespace esphome { -namespace ektf2232 { +namespace esphome::ektf2232 { static const char *const TAG = "ektf2232"; @@ -130,5 +129,4 @@ void EKTF2232Touchscreen::dump_config() { LOG_PIN(" Reset Pin: ", this->reset_pin_); } -} // namespace ektf2232 -} // namespace esphome +} // namespace esphome::ektf2232 diff --git a/esphome/components/ektf2232/touchscreen/ektf2232.h b/esphome/components/ektf2232/touchscreen/ektf2232.h index 2ddc60851f..45da74a2a5 100644 --- a/esphome/components/ektf2232/touchscreen/ektf2232.h +++ b/esphome/components/ektf2232/touchscreen/ektf2232.h @@ -6,8 +6,7 @@ #include "esphome/core/component.h" #include "esphome/core/hal.h" -namespace esphome { -namespace ektf2232 { +namespace esphome::ektf2232 { using namespace touchscreen; @@ -31,5 +30,4 @@ class EKTF2232Touchscreen : public Touchscreen, public i2c::I2CDevice { GPIOPin *reset_pin_; }; -} // namespace ektf2232 -} // namespace esphome +} // namespace esphome::ektf2232 diff --git a/esphome/components/emc2101/emc2101.cpp b/esphome/components/emc2101/emc2101.cpp index 068e25568f..464f49fe51 100644 --- a/esphome/components/emc2101/emc2101.cpp +++ b/esphome/components/emc2101/emc2101.cpp @@ -5,8 +5,7 @@ #include "esphome/core/log.h" #include "emc2101.h" -namespace esphome { -namespace emc2101 { +namespace esphome::emc2101 { static const char *const TAG = "EMC2101"; @@ -165,5 +164,4 @@ float Emc2101Component::get_speed() { return tach == 0xFFFF ? 0.0f : 5400000.0f / tach; } -} // namespace emc2101 -} // namespace esphome +} // namespace esphome::emc2101 diff --git a/esphome/components/emc2101/emc2101.h b/esphome/components/emc2101/emc2101.h index 0f4bc560dd..1fe03a2630 100644 --- a/esphome/components/emc2101/emc2101.h +++ b/esphome/components/emc2101/emc2101.h @@ -3,8 +3,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/core/component.h" -namespace esphome { -namespace emc2101 { +namespace esphome::emc2101 { /** Enum listing all DAC conversion rates for the EMC2101. * @@ -111,5 +110,4 @@ class Emc2101Component : public Component, public i2c::I2CDevice { Emc2101DACConversionRate dac_conversion_rate_; }; -} // namespace emc2101 -} // namespace esphome +} // namespace esphome::emc2101 diff --git a/esphome/components/emc2101/output/emc2101_output.cpp b/esphome/components/emc2101/output/emc2101_output.cpp index 2ed506cd99..6b046296f3 100644 --- a/esphome/components/emc2101/output/emc2101_output.cpp +++ b/esphome/components/emc2101/output/emc2101_output.cpp @@ -1,9 +1,7 @@ #include "emc2101_output.h" -namespace esphome { -namespace emc2101 { +namespace esphome::emc2101 { void EMC2101Output::write_state(float state) { this->parent_->set_duty_cycle(state); } -} // namespace emc2101 -} // namespace esphome +} // namespace esphome::emc2101 diff --git a/esphome/components/emc2101/output/emc2101_output.h b/esphome/components/emc2101/output/emc2101_output.h index 232df6ff5f..95077f5524 100644 --- a/esphome/components/emc2101/output/emc2101_output.h +++ b/esphome/components/emc2101/output/emc2101_output.h @@ -3,8 +3,7 @@ #include "../emc2101.h" #include "esphome/components/output/float_output.h" -namespace esphome { -namespace emc2101 { +namespace esphome::emc2101 { /// This class allows to control the EMC2101 output. class EMC2101Output : public output::FloatOutput { @@ -18,5 +17,4 @@ class EMC2101Output : public output::FloatOutput { Emc2101Component *parent_; }; -} // namespace emc2101 -} // namespace esphome +} // namespace esphome::emc2101 diff --git a/esphome/components/emc2101/sensor/emc2101_sensor.cpp b/esphome/components/emc2101/sensor/emc2101_sensor.cpp index 3014c7da07..bb5eea21f3 100644 --- a/esphome/components/emc2101/sensor/emc2101_sensor.cpp +++ b/esphome/components/emc2101/sensor/emc2101_sensor.cpp @@ -2,8 +2,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace emc2101 { +namespace esphome::emc2101 { static const char *const TAG = "EMC2101.sensor"; @@ -37,5 +36,4 @@ void EMC2101Sensor::update() { } } -} // namespace emc2101 -} // namespace esphome +} // namespace esphome::emc2101 diff --git a/esphome/components/emc2101/sensor/emc2101_sensor.h b/esphome/components/emc2101/sensor/emc2101_sensor.h index 3e033f58a7..2336ac2f15 100644 --- a/esphome/components/emc2101/sensor/emc2101_sensor.h +++ b/esphome/components/emc2101/sensor/emc2101_sensor.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/core/component.h" -namespace esphome { -namespace emc2101 { +namespace esphome::emc2101 { /// This class exposes the EMC2101 sensors. class EMC2101Sensor : public PollingComponent { @@ -33,5 +32,4 @@ class EMC2101Sensor : public PollingComponent { sensor::Sensor *duty_cycle_sensor_{nullptr}; }; -} // namespace emc2101 -} // namespace esphome +} // namespace esphome::emc2101 diff --git a/esphome/components/emmeti/emmeti.cpp b/esphome/components/emmeti/emmeti.cpp index 04976d95d7..82991aeac7 100644 --- a/esphome/components/emmeti/emmeti.cpp +++ b/esphome/components/emmeti/emmeti.cpp @@ -1,8 +1,7 @@ #include "emmeti.h" #include "esphome/components/remote_base/remote_base.h" -namespace esphome { -namespace emmeti { +namespace esphome::emmeti { static const char *const TAG = "emmeti.climate"; @@ -308,5 +307,4 @@ bool EmmetiClimate::on_receive(remote_base::RemoteReceiveData data) { return this->parse_state_frame_(curr_state); } -} // namespace emmeti -} // namespace esphome +} // namespace esphome::emmeti diff --git a/esphome/components/emmeti/emmeti.h b/esphome/components/emmeti/emmeti.h index 9bfb7a7a98..9dc78ce07c 100644 --- a/esphome/components/emmeti/emmeti.h +++ b/esphome/components/emmeti/emmeti.h @@ -2,8 +2,7 @@ #include "esphome/components/climate_ir/climate_ir.h" -namespace esphome { -namespace emmeti { +namespace esphome::emmeti { const uint8_t EMMETI_TEMP_MIN = 16; // Celsius const uint8_t EMMETI_TEMP_MAX = 30; // Celsius @@ -105,5 +104,4 @@ class EmmetiClimate : public climate_ir::ClimateIR { uint8_t blades_ = EMMETI_BLADES_STOP; }; -} // namespace emmeti -} // namespace esphome +} // namespace esphome::emmeti diff --git a/esphome/components/endstop/endstop_cover.cpp b/esphome/components/endstop/endstop_cover.cpp index 5e0b9c72d3..b3c210a8d8 100644 --- a/esphome/components/endstop/endstop_cover.cpp +++ b/esphome/components/endstop/endstop_cover.cpp @@ -3,8 +3,7 @@ #include "esphome/core/hal.h" #include "esphome/core/application.h" -namespace esphome { -namespace endstop { +namespace esphome::endstop { static const char *const TAG = "endstop.cover"; @@ -192,5 +191,4 @@ void EndstopCover::recompute_position_() { this->last_recompute_time_ = now; } -} // namespace endstop -} // namespace esphome +} // namespace esphome::endstop diff --git a/esphome/components/endstop/endstop_cover.h b/esphome/components/endstop/endstop_cover.h index 32ede12335..b910139bcd 100644 --- a/esphome/components/endstop/endstop_cover.h +++ b/esphome/components/endstop/endstop_cover.h @@ -5,8 +5,7 @@ #include "esphome/components/binary_sensor/binary_sensor.h" #include "esphome/components/cover/cover.h" -namespace esphome { -namespace endstop { +namespace esphome::endstop { class EndstopCover : public cover::Cover, public Component { public: @@ -53,5 +52,4 @@ class EndstopCover : public cover::Cover, public Component { cover::CoverOperation last_operation_{cover::COVER_OPERATION_OPENING}; }; -} // namespace endstop -} // namespace esphome +} // namespace esphome::endstop diff --git a/esphome/components/ens160_base/ens160_base.cpp b/esphome/components/ens160_base/ens160_base.cpp index 42baa68b35..20c67c3450 100644 --- a/esphome/components/ens160_base/ens160_base.cpp +++ b/esphome/components/ens160_base/ens160_base.cpp @@ -18,8 +18,7 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" -namespace esphome { -namespace ens160_base { +namespace esphome::ens160_base { static const char *const TAG = "ens160"; @@ -332,5 +331,4 @@ void ENS160Component::dump_config() { } } -} // namespace ens160_base -} // namespace esphome +} // namespace esphome::ens160_base diff --git a/esphome/components/ens160_base/ens160_base.h b/esphome/components/ens160_base/ens160_base.h index ae850c8180..f42272684e 100644 --- a/esphome/components/ens160_base/ens160_base.h +++ b/esphome/components/ens160_base/ens160_base.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/sensor/sensor.h" -namespace esphome { -namespace ens160_base { +namespace esphome::ens160_base { class ENS160Component : public PollingComponent, public sensor::Sensor { public: @@ -59,5 +58,4 @@ class ENS160Component : public PollingComponent, public sensor::Sensor { sensor::Sensor *temperature_{nullptr}; }; -} // namespace ens160_base -} // namespace esphome +} // namespace esphome::ens160_base diff --git a/esphome/components/ens160_i2c/ens160_i2c.cpp b/esphome/components/ens160_i2c/ens160_i2c.cpp index 7163a5ad6e..1f02ddb718 100644 --- a/esphome/components/ens160_i2c/ens160_i2c.cpp +++ b/esphome/components/ens160_i2c/ens160_i2c.cpp @@ -5,8 +5,7 @@ #include "esphome/components/i2c/i2c.h" #include "../ens160_base/ens160_base.h" -namespace esphome { -namespace ens160_i2c { +namespace esphome::ens160_i2c { static const char *const TAG = "ens160_i2c.sensor"; @@ -28,5 +27,4 @@ void ENS160I2CComponent::dump_config() { LOG_I2C_DEVICE(this); } -} // namespace ens160_i2c -} // namespace esphome +} // namespace esphome::ens160_i2c diff --git a/esphome/components/ens160_i2c/ens160_i2c.h b/esphome/components/ens160_i2c/ens160_i2c.h index 2df32f27bf..98318a7eca 100644 --- a/esphome/components/ens160_i2c/ens160_i2c.h +++ b/esphome/components/ens160_i2c/ens160_i2c.h @@ -3,8 +3,7 @@ #include "esphome/components/ens160_base/ens160_base.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace ens160_i2c { +namespace esphome::ens160_i2c { class ENS160I2CComponent : public esphome::ens160_base::ENS160Component, public i2c::I2CDevice { void dump_config() override; @@ -15,5 +14,4 @@ class ENS160I2CComponent : public esphome::ens160_base::ENS160Component, public bool write_bytes(uint8_t a_register, uint8_t *data, size_t len) override; }; -} // namespace ens160_i2c -} // namespace esphome +} // namespace esphome::ens160_i2c diff --git a/esphome/components/ens160_spi/ens160_spi.cpp b/esphome/components/ens160_spi/ens160_spi.cpp index fba2fdf0e4..41ab8298db 100644 --- a/esphome/components/ens160_spi/ens160_spi.cpp +++ b/esphome/components/ens160_spi/ens160_spi.cpp @@ -4,8 +4,7 @@ #include "ens160_spi.h" #include -namespace esphome { -namespace ens160_spi { +namespace esphome::ens160_spi { static const char *const TAG = "ens160_spi.sensor"; @@ -55,5 +54,4 @@ bool ENS160SPIComponent::write_bytes(uint8_t a_register, uint8_t *data, size_t l return true; } -} // namespace ens160_spi -} // namespace esphome +} // namespace esphome::ens160_spi diff --git a/esphome/components/ens160_spi/ens160_spi.h b/esphome/components/ens160_spi/ens160_spi.h index 3371f37ffd..d4d3cf3ae9 100644 --- a/esphome/components/ens160_spi/ens160_spi.h +++ b/esphome/components/ens160_spi/ens160_spi.h @@ -3,8 +3,7 @@ #include "esphome/components/ens160_base/ens160_base.h" #include "esphome/components/spi/spi.h" -namespace esphome { -namespace ens160_spi { +namespace esphome::ens160_spi { class ENS160SPIComponent : public esphome::ens160_base::ENS160Component, public spi::SPIDevice -namespace esphome { -namespace es7210 { +namespace esphome::es7210 { static const char *const TAG = "es7210"; @@ -224,5 +223,4 @@ bool ES7210::es7210_update_reg_bit_(uint8_t reg_addr, uint8_t update_bits, uint8 return this->write_byte(reg_addr, regv); } -} // namespace es7210 -} // namespace esphome +} // namespace esphome::es7210 diff --git a/esphome/components/es7210/es7210.h b/esphome/components/es7210/es7210.h index 7071a547ec..914fbd633b 100644 --- a/esphome/components/es7210/es7210.h +++ b/esphome/components/es7210/es7210.h @@ -6,8 +6,7 @@ #include "es7210_const.h" -namespace esphome { -namespace es7210 { +namespace esphome::es7210 { enum ES7210BitsPerSample : uint8_t { ES7210_BITS_PER_SAMPLE_16 = 16, @@ -57,5 +56,4 @@ class ES7210 : public audio_adc::AudioAdc, public Component, public i2c::I2CDevi uint32_t sample_rate_{0}; }; -} // namespace es7210 -} // namespace esphome +} // namespace esphome::es7210 diff --git a/esphome/components/es7210/es7210_const.h b/esphome/components/es7210/es7210_const.h index e5ffea5743..70705b2474 100644 --- a/esphome/components/es7210/es7210_const.h +++ b/esphome/components/es7210/es7210_const.h @@ -2,8 +2,7 @@ #include -namespace esphome { -namespace es7210 { +namespace esphome::es7210 { // ES7210 register addresses static const uint8_t ES7210_RESET_REG00 = 0x00; /* Reset control */ @@ -125,5 +124,4 @@ static const ES7210Coefficient ES7210_COEFFICIENTS[] = { static const float ES7210_MIC_GAIN_MIN = 0.0; static const float ES7210_MIC_GAIN_MAX = 37.5; -} // namespace es7210 -} // namespace esphome +} // namespace esphome::es7210 diff --git a/esphome/components/es7243e/es7243e.cpp b/esphome/components/es7243e/es7243e.cpp index d45c1d5a8c..b4d9fba4c5 100644 --- a/esphome/components/es7243e/es7243e.cpp +++ b/esphome/components/es7243e/es7243e.cpp @@ -6,8 +6,7 @@ #include -namespace esphome { -namespace es7243e { +namespace esphome::es7243e { static const char *const TAG = "es7243e"; @@ -119,5 +118,4 @@ uint8_t ES7243E::es7243e_gain_reg_value_(float mic_gain) { return 14; } -} // namespace es7243e -} // namespace esphome +} // namespace esphome::es7243e diff --git a/esphome/components/es7243e/es7243e.h b/esphome/components/es7243e/es7243e.h index f7c9d67371..6386ea529a 100644 --- a/esphome/components/es7243e/es7243e.h +++ b/esphome/components/es7243e/es7243e.h @@ -4,8 +4,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/core/component.h" -namespace esphome { -namespace es7243e { +namespace esphome::es7243e { class ES7243E : public audio_adc::AudioAdc, public Component, public i2c::I2CDevice { /* Class for configuring an ES7243E ADC for microphone input. @@ -32,5 +31,4 @@ class ES7243E : public audio_adc::AudioAdc, public Component, public i2c::I2CDev float mic_gain_{0}; }; -} // namespace es7243e -} // namespace esphome +} // namespace esphome::es7243e diff --git a/esphome/components/es7243e/es7243e_const.h b/esphome/components/es7243e/es7243e_const.h index daae53a108..9f926db3b1 100644 --- a/esphome/components/es7243e/es7243e_const.h +++ b/esphome/components/es7243e/es7243e_const.h @@ -2,8 +2,7 @@ #include -namespace esphome { -namespace es7243e { +namespace esphome::es7243e { // ES7243E register addresses static const uint8_t ES7243E_RESET_REG00 = 0x00; // Reset control @@ -50,5 +49,4 @@ static const uint8_t ES7243E_CHIP_ID1_REGFD = 0xFD; // chip ID 1, reads 0x7 static const uint8_t ES7243E_CHIP_ID2_REGFE = 0xFE; // chip ID 2, reads 0x43 (RO) static const uint8_t ES7243E_CHIP_VERSION_REGFF = 0xFF; // chip version, reads 0x00 (RO) -} // namespace es7243e -} // namespace esphome +} // namespace esphome::es7243e diff --git a/esphome/components/es8156/es8156.cpp b/esphome/components/es8156/es8156.cpp index 961dc24b29..03d9713df9 100644 --- a/esphome/components/es8156/es8156.cpp +++ b/esphome/components/es8156/es8156.cpp @@ -4,8 +4,7 @@ #include "esphome/core/log.h" #include -namespace esphome { -namespace es8156 { +namespace esphome::es8156 { static const char *const TAG = "es8156"; @@ -118,5 +117,4 @@ bool ES8156::set_mute_state_(bool mute_state) { return this->write_byte(ES8156_REG13_DAC_MUTE, reg13); } -} // namespace es8156 -} // namespace esphome +} // namespace esphome::es8156 diff --git a/esphome/components/es8156/es8156.h b/esphome/components/es8156/es8156.h index 082514485c..c3cec3dc14 100644 --- a/esphome/components/es8156/es8156.h +++ b/esphome/components/es8156/es8156.h @@ -4,8 +4,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/core/component.h" -namespace esphome { -namespace es8156 { +namespace esphome::es8156 { class ES8156 : public audio_dac::AudioDac, public Component, public i2c::I2CDevice { public: @@ -46,5 +45,4 @@ class ES8156 : public audio_dac::AudioDac, public Component, public i2c::I2CDevi bool set_mute_state_(bool mute_state); }; -} // namespace es8156 -} // namespace esphome +} // namespace esphome::es8156 diff --git a/esphome/components/es8156/es8156_const.h b/esphome/components/es8156/es8156_const.h index 0bc8f89dd4..0836e4766d 100644 --- a/esphome/components/es8156/es8156_const.h +++ b/esphome/components/es8156/es8156_const.h @@ -2,8 +2,7 @@ #include "es8156.h" -namespace esphome { -namespace es8156 { +namespace esphome::es8156 { /* ES8156 register addresses */ /* @@ -64,5 +63,4 @@ static const uint8_t ES8156_REGFD_CHIPID1 = 0xFD; static const uint8_t ES8156_REGFE_CHIPID0 = 0xFE; static const uint8_t ES8156_REGFF_CHIP_VERSION = 0xFF; -} // namespace es8156 -} // namespace esphome +} // namespace esphome::es8156 diff --git a/esphome/components/es8311/es8311.cpp b/esphome/components/es8311/es8311.cpp index cf864187f9..0386d84200 100644 --- a/esphome/components/es8311/es8311.cpp +++ b/esphome/components/es8311/es8311.cpp @@ -4,8 +4,7 @@ #include "esphome/core/log.h" #include -namespace esphome { -namespace es8311 { +namespace esphome::es8311 { static const char *const TAG = "es8311"; @@ -223,5 +222,4 @@ bool ES8311::set_mute_state_(bool mute_state) { return this->write_byte(ES8311_REG31_DAC, reg31); } -} // namespace es8311 -} // namespace esphome +} // namespace esphome::es8311 diff --git a/esphome/components/es8311/es8311.h b/esphome/components/es8311/es8311.h index 5eccc48004..1190bcb0aa 100644 --- a/esphome/components/es8311/es8311.h +++ b/esphome/components/es8311/es8311.h @@ -4,8 +4,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/core/component.h" -namespace esphome { -namespace es8311 { +namespace esphome::es8311 { enum ES8311MicGain { ES8311_MIC_GAIN_MIN = -1, @@ -130,5 +129,4 @@ class ES8311 : public audio_dac::AudioDac, public Component, public i2c::I2CDevi ES8311Resolution resolution_out_; }; -} // namespace es8311 -} // namespace esphome +} // namespace esphome::es8311 diff --git a/esphome/components/es8311/es8311_const.h b/esphome/components/es8311/es8311_const.h index 7463a92ef1..27b9e02c13 100644 --- a/esphome/components/es8311/es8311_const.h +++ b/esphome/components/es8311/es8311_const.h @@ -2,8 +2,7 @@ #include "es8311.h" -namespace esphome { -namespace es8311 { +namespace esphome::es8311 { // ES8311 register addresses static const uint8_t ES8311_REG00_RESET = 0x00; // Reset @@ -191,5 +190,4 @@ static const ES8311Coefficient ES8311_COEFFICIENTS[] = { // clang-format on }; -} // namespace es8311 -} // namespace esphome +} // namespace esphome::es8311 diff --git a/esphome/components/es8388/es8388.cpp b/esphome/components/es8388/es8388.cpp index c252cdb707..c015393e14 100644 --- a/esphome/components/es8388/es8388.cpp +++ b/esphome/components/es8388/es8388.cpp @@ -4,8 +4,7 @@ #include "esphome/core/hal.h" #include "esphome/core/log.h" -namespace esphome { -namespace es8388 { +namespace esphome::es8388 { static const char *const TAG = "es8388"; @@ -284,5 +283,4 @@ optional ES8388::get_mic_input() { }; } -} // namespace es8388 -} // namespace esphome +} // namespace esphome::es8388 diff --git a/esphome/components/es8388/es8388.h b/esphome/components/es8388/es8388.h index 373f71b437..1f744e25b3 100644 --- a/esphome/components/es8388/es8388.h +++ b/esphome/components/es8388/es8388.h @@ -11,8 +11,7 @@ #include "es8388_const.h" -namespace esphome { -namespace es8388 { +namespace esphome::es8388 { enum DacOutputLine : uint8_t { DAC_OUTPUT_LINE1, @@ -76,5 +75,4 @@ class ES8388 : public audio_dac::AudioDac, public Component, public i2c::I2CDevi bool set_mute_state_(bool mute_state); }; -} // namespace es8388 -} // namespace esphome +} // namespace esphome::es8388 diff --git a/esphome/components/es8388/es8388_const.h b/esphome/components/es8388/es8388_const.h index 2a51f078bc..451c9cc026 100644 --- a/esphome/components/es8388/es8388_const.h +++ b/esphome/components/es8388/es8388_const.h @@ -1,8 +1,7 @@ #pragma once #include -namespace esphome { -namespace es8388 { +namespace esphome::es8388 { /* ES8388 register */ static const uint8_t ES8388_CONTROL1 = 0x00; @@ -79,5 +78,4 @@ static const uint8_t ES8388_ADC_INPUT_MIC2 = 0x06; static const uint8_t ES8388_ADC_INPUT_LINPUT2_RINPUT2 = 0x50; static const uint8_t ES8388_ADC_INPUT_DIFFERENCE = 0xf0; -} // namespace es8388 -} // namespace esphome +} // namespace esphome::es8388 diff --git a/esphome/components/es8388/select/adc_input_mic_select.cpp b/esphome/components/es8388/select/adc_input_mic_select.cpp index 2e47534296..a91ccf4d5b 100644 --- a/esphome/components/es8388/select/adc_input_mic_select.cpp +++ b/esphome/components/es8388/select/adc_input_mic_select.cpp @@ -1,12 +1,10 @@ #include "adc_input_mic_select.h" -namespace esphome { -namespace es8388 { +namespace esphome::es8388 { void ADCInputMicSelect::control(size_t index) { this->publish_state(index); this->parent_->set_adc_input_mic(static_cast(index)); } -} // namespace es8388 -} // namespace esphome +} // namespace esphome::es8388 diff --git a/esphome/components/es8388/select/adc_input_mic_select.h b/esphome/components/es8388/select/adc_input_mic_select.h index f0fa840d00..29978f1623 100644 --- a/esphome/components/es8388/select/adc_input_mic_select.h +++ b/esphome/components/es8388/select/adc_input_mic_select.h @@ -3,13 +3,11 @@ #include "esphome/components/es8388/es8388.h" #include "esphome/components/select/select.h" -namespace esphome { -namespace es8388 { +namespace esphome::es8388 { class ADCInputMicSelect : public select::Select, public Parented { protected: void control(size_t index) override; }; -} // namespace es8388 -} // namespace esphome +} // namespace esphome::es8388 diff --git a/esphome/components/es8388/select/dac_output_select.cpp b/esphome/components/es8388/select/dac_output_select.cpp index 9af288a721..cfe0fe1472 100644 --- a/esphome/components/es8388/select/dac_output_select.cpp +++ b/esphome/components/es8388/select/dac_output_select.cpp @@ -1,12 +1,10 @@ #include "dac_output_select.h" -namespace esphome { -namespace es8388 { +namespace esphome::es8388 { void DacOutputSelect::control(size_t index) { this->publish_state(index); this->parent_->set_dac_output(static_cast(index)); } -} // namespace es8388 -} // namespace esphome +} // namespace esphome::es8388 diff --git a/esphome/components/es8388/select/dac_output_select.h b/esphome/components/es8388/select/dac_output_select.h index 40d8a66553..030f12406e 100644 --- a/esphome/components/es8388/select/dac_output_select.h +++ b/esphome/components/es8388/select/dac_output_select.h @@ -3,13 +3,11 @@ #include "esphome/components/es8388/es8388.h" #include "esphome/components/select/select.h" -namespace esphome { -namespace es8388 { +namespace esphome::es8388 { class DacOutputSelect : public select::Select, public Parented { protected: void control(size_t index) override; }; -} // namespace es8388 -} // namespace esphome +} // namespace esphome::es8388 diff --git a/esphome/components/esp32/gpio.h b/esphome/components/esp32/gpio.h index 3c13bd9b4f..a140eeef77 100644 --- a/esphome/components/esp32/gpio.h +++ b/esphome/components/esp32/gpio.h @@ -4,8 +4,7 @@ #include "esphome/core/hal.h" #include -namespace esphome { -namespace esp32 { +namespace esphome::esp32 { // Static assertions to ensure our bit-packed fields can hold the enum values static_assert(GPIO_NUM_MAX <= 256, "gpio_num_t has too many values for uint8_t"); @@ -51,7 +50,6 @@ class ESP32InternalGPIOPin : public InternalGPIOPin { static bool isr_service_installed; }; -} // namespace esp32 -} // namespace esphome +} // namespace esphome::esp32 #endif // USE_ESP32 diff --git a/esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp b/esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp index 093273b399..9f1723430b 100644 --- a/esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +++ b/esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp @@ -16,8 +16,7 @@ #include "esphome/core/hal.h" #include "esphome/core/helpers.h" -namespace esphome { -namespace esp32_ble_beacon { +namespace esphome::esp32_ble_beacon { static const char *const TAG = "esp32_ble_beacon"; @@ -129,7 +128,6 @@ void ESP32BLEBeacon::gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap } } -} // namespace esp32_ble_beacon -} // namespace esphome +} // namespace esphome::esp32_ble_beacon #endif diff --git a/esphome/components/esp32_ble_beacon/esp32_ble_beacon.h b/esphome/components/esp32_ble_beacon/esp32_ble_beacon.h index 44a7133454..8b3899a681 100644 --- a/esphome/components/esp32_ble_beacon/esp32_ble_beacon.h +++ b/esphome/components/esp32_ble_beacon/esp32_ble_beacon.h @@ -10,8 +10,7 @@ #endif #include -namespace esphome { -namespace esp32_ble_beacon { +namespace esphome::esp32_ble_beacon { using esp_ble_ibeacon_head_t = struct { uint8_t flags[3]; @@ -69,7 +68,6 @@ class ESP32BLEBeacon : public Component { bool advertising_{false}; }; -} // namespace esp32_ble_beacon -} // namespace esphome +} // namespace esphome::esp32_ble_beacon #endif diff --git a/esphome/components/esp32_ble_server/ble_2902.cpp b/esphome/components/esp32_ble_server/ble_2902.cpp index 2f34573c37..90d0871a96 100644 --- a/esphome/components/esp32_ble_server/ble_2902.cpp +++ b/esphome/components/esp32_ble_server/ble_2902.cpp @@ -5,8 +5,7 @@ #include -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { BLE2902::BLE2902() : BLEDescriptor(esp32_ble::ESPBTUUID::from_uint16(0x2902)) { this->value_.attr_len = 2; @@ -14,7 +13,6 @@ BLE2902::BLE2902() : BLEDescriptor(esp32_ble::ESPBTUUID::from_uint16(0x2902)) { memcpy(this->value_.attr_value, data, 2); } -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_ble_server/ble_2902.h b/esphome/components/esp32_ble_server/ble_2902.h index 64605924ad..46a5f73e9e 100644 --- a/esphome/components/esp32_ble_server/ble_2902.h +++ b/esphome/components/esp32_ble_server/ble_2902.h @@ -4,15 +4,13 @@ #ifdef USE_ESP32 -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { class BLE2902 : public BLEDescriptor { public: BLE2902(); }; -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_ble_server/ble_characteristic.cpp b/esphome/components/esp32_ble_server/ble_characteristic.cpp index aa82b773ba..cc519846be 100644 --- a/esphome/components/esp32_ble_server/ble_characteristic.cpp +++ b/esphome/components/esp32_ble_server/ble_characteristic.cpp @@ -7,8 +7,7 @@ #ifdef USE_ESP32 -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { static const char *const TAG = "esp32_ble_server.characteristic"; @@ -340,7 +339,6 @@ BLECharacteristic::ClientNotificationEntry *BLECharacteristic::find_client_in_no return nullptr; } -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_ble_server/ble_characteristic.h b/esphome/components/esp32_ble_server/ble_characteristic.h index 062052cdf8..94c7495cbd 100644 --- a/esphome/components/esp32_ble_server/ble_characteristic.h +++ b/esphome/components/esp32_ble_server/ble_characteristic.h @@ -17,8 +17,7 @@ #include #include -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { using namespace esp32_ble; using namespace bytebuffer; @@ -109,7 +108,6 @@ class BLECharacteristic { } state_{INIT}; }; -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_ble_server/ble_descriptor.cpp b/esphome/components/esp32_ble_server/ble_descriptor.cpp index 4ffca7312b..5ca80d6a7a 100644 --- a/esphome/components/esp32_ble_server/ble_descriptor.cpp +++ b/esphome/components/esp32_ble_server/ble_descriptor.cpp @@ -7,8 +7,7 @@ #ifdef USE_ESP32 -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { static const char *const TAG = "esp32_ble_server.descriptor"; @@ -91,7 +90,6 @@ void BLEDescriptor::gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_ } } -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_ble_server/ble_descriptor.h b/esphome/components/esp32_ble_server/ble_descriptor.h index 5f4f146d6f..5096d39f28 100644 --- a/esphome/components/esp32_ble_server/ble_descriptor.h +++ b/esphome/components/esp32_ble_server/ble_descriptor.h @@ -11,8 +11,7 @@ #include #include -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { using namespace esp32_ble; using namespace bytebuffer; @@ -63,7 +62,6 @@ class BLEDescriptor { } state_{INIT}; }; -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_ble_server/ble_server.cpp b/esphome/components/esp32_ble_server/ble_server.cpp index be0691dc06..2dea1666bb 100644 --- a/esphome/components/esp32_ble_server/ble_server.cpp +++ b/esphome/components/esp32_ble_server/ble_server.cpp @@ -16,8 +16,7 @@ #include #include -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { static const char *const TAG = "esp32_ble_server"; @@ -248,7 +247,6 @@ void BLEServer::dump_config() { BLEServer *global_ble_server = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_ble_server/ble_server.h b/esphome/components/esp32_ble_server/ble_server.h index 9708ed40c8..9ba108499e 100644 --- a/esphome/components/esp32_ble_server/ble_server.h +++ b/esphome/components/esp32_ble_server/ble_server.h @@ -18,8 +18,7 @@ #include -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { using namespace esp32_ble; using namespace bytebuffer; @@ -113,7 +112,6 @@ class BLEServer : public Component, public Parented { // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) extern BLEServer *global_ble_server; -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_ble_server/ble_server_automations.cpp b/esphome/components/esp32_ble_server/ble_server_automations.cpp index 0761de994a..1b15c90fe8 100644 --- a/esphome/components/esp32_ble_server/ble_server_automations.cpp +++ b/esphome/components/esp32_ble_server/ble_server_automations.cpp @@ -2,10 +2,8 @@ #ifdef USE_ESP32 -namespace esphome { -namespace esp32_ble_server { // Interface to interact with ESPHome automations and triggers -namespace esp32_ble_server_automations { +namespace esphome::esp32_ble_server::esp32_ble_server_automations { using namespace esp32_ble; @@ -86,8 +84,6 @@ void BLECharacteristicSetValueActionManager::remove_listener_(BLECharacteristic } #endif -} // namespace esp32_ble_server_automations -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server::esp32_ble_server_automations #endif diff --git a/esphome/components/esp32_ble_server/ble_server_automations.h b/esphome/components/esp32_ble_server/ble_server_automations.h index 0bbfdffd5b..b4e9ed004e 100644 --- a/esphome/components/esp32_ble_server/ble_server_automations.h +++ b/esphome/components/esp32_ble_server/ble_server_automations.h @@ -11,10 +11,8 @@ #ifdef USE_ESP32 -namespace esphome { -namespace esp32_ble_server { // Interface to interact with ESPHome actions and triggers -namespace esp32_ble_server_automations { +namespace esphome::esp32_ble_server::esp32_ble_server_automations { using namespace esp32_ble; @@ -125,8 +123,6 @@ template class BLEDescriptorSetValueAction : public Action #include -namespace esphome { -namespace esp32_ble_server { +namespace esphome::esp32_ble_server { class BLEServer; @@ -80,7 +79,6 @@ class BLEService { } state_{INIT}; }; -} // namespace esp32_ble_server -} // namespace esphome +} // namespace esphome::esp32_ble_server #endif diff --git a/esphome/components/esp32_camera/esp32_camera.cpp b/esphome/components/esp32_camera/esp32_camera.cpp index a7546476d8..598fe61d46 100644 --- a/esphome/components/esp32_camera/esp32_camera.cpp +++ b/esphome/components/esp32_camera/esp32_camera.cpp @@ -7,8 +7,7 @@ #include -namespace esphome { -namespace esp32_camera { +namespace esphome::esp32_camera { static const char *const TAG = "esp32_camera"; static constexpr size_t FRAMEBUFFER_TASK_STACK_SIZE = 1792; @@ -556,7 +555,6 @@ bool ESP32CameraImage::was_requested_by(camera::CameraRequester requester) const return (this->requesters_ & (1 << requester)) != 0; } -} // namespace esp32_camera -} // namespace esphome +} // namespace esphome::esp32_camera #endif diff --git a/esphome/components/esp32_camera/esp32_camera.h b/esphome/components/esp32_camera/esp32_camera.h index 9fbd3848f2..7d020b5caf 100644 --- a/esphome/components/esp32_camera/esp32_camera.h +++ b/esphome/components/esp32_camera/esp32_camera.h @@ -15,8 +15,7 @@ #include "esphome/components/i2c/i2c_bus.h" #endif // USE_I2C -namespace esphome { -namespace esp32_camera { +namespace esphome::esp32_camera { class ESP32Camera; @@ -259,7 +258,6 @@ class ESP32CameraStreamStopTrigger : public Trigger<>, public camera::CameraList void on_stream_stop() override { this->trigger(); } }; -} // namespace esp32_camera -} // namespace esphome +} // namespace esphome::esp32_camera #endif diff --git a/esphome/components/esp32_camera_web_server/camera_web_server.cpp b/esphome/components/esp32_camera_web_server/camera_web_server.cpp index f49578c425..7527bbf7e4 100644 --- a/esphome/components/esp32_camera_web_server/camera_web_server.cpp +++ b/esphome/components/esp32_camera_web_server/camera_web_server.cpp @@ -11,8 +11,7 @@ #include #include -namespace esphome { -namespace esp32_camera_web_server { +namespace esphome::esp32_camera_web_server { static const int IMAGE_REQUEST_TIMEOUT = 5000; static const char *const TAG = "esp32_camera_web_server"; @@ -242,7 +241,6 @@ esp_err_t CameraWebServer::snapshot_handler_(struct httpd_req *req) { return res; } -} // namespace esp32_camera_web_server -} // namespace esphome +} // namespace esphome::esp32_camera_web_server #endif // USE_ESP32 diff --git a/esphome/components/esp32_camera_web_server/camera_web_server.h b/esphome/components/esp32_camera_web_server/camera_web_server.h index ad7b29fb11..568dc68c46 100644 --- a/esphome/components/esp32_camera_web_server/camera_web_server.h +++ b/esphome/components/esp32_camera_web_server/camera_web_server.h @@ -13,8 +13,7 @@ struct httpd_req; // NOLINT(readability-identifier-naming) -namespace esphome { -namespace esp32_camera_web_server { +namespace esphome::esp32_camera_web_server { enum Mode { STREAM, SNAPSHOT }; @@ -48,7 +47,6 @@ class CameraWebServer : public Component, public camera::CameraListener { Mode mode_{STREAM}; }; -} // namespace esp32_camera_web_server -} // namespace esphome +} // namespace esphome::esp32_camera_web_server #endif // USE_ESP32 diff --git a/esphome/components/esp32_can/esp32_can.cpp b/esphome/components/esp32_can/esp32_can.cpp index f521b63430..e04405c63c 100644 --- a/esphome/components/esp32_can/esp32_can.cpp +++ b/esphome/components/esp32_can/esp32_can.cpp @@ -9,8 +9,7 @@ #undef CAN_IO_UNUSED #define CAN_IO_UNUSED ((gpio_num_t) -1) -namespace esphome { -namespace esp32_can { +namespace esphome::esp32_can { static const char *const TAG = "esp32_can"; @@ -184,7 +183,6 @@ canbus::Error ESP32Can::read_message(struct canbus::CanFrame *frame) { return canbus::ERROR_OK; } -} // namespace esp32_can -} // namespace esphome +} // namespace esphome::esp32_can #endif diff --git a/esphome/components/esp32_can/esp32_can.h b/esphome/components/esp32_can/esp32_can.h index c3f200271b..2e10d254e6 100644 --- a/esphome/components/esp32_can/esp32_can.h +++ b/esphome/components/esp32_can/esp32_can.h @@ -7,8 +7,7 @@ #include -namespace esphome { -namespace esp32_can { +namespace esphome::esp32_can { enum CanMode : uint8_t { CAN_MODE_NORMAL = 0, @@ -41,7 +40,6 @@ class ESP32Can : public canbus::Canbus { twai_handle_t twai_handle_{nullptr}; }; -} // namespace esp32_can -} // namespace esphome +} // namespace esphome::esp32_can #endif diff --git a/esphome/components/esp32_dac/esp32_dac.cpp b/esphome/components/esp32_dac/esp32_dac.cpp index 8f226a5cc2..54b89c46ad 100644 --- a/esphome/components/esp32_dac/esp32_dac.cpp +++ b/esphome/components/esp32_dac/esp32_dac.cpp @@ -4,8 +4,7 @@ #if defined(USE_ESP32_VARIANT_ESP32) || defined(USE_ESP32_VARIANT_ESP32S2) -namespace esphome { -namespace esp32_dac { +namespace esphome::esp32_dac { #ifdef USE_ESP32_VARIANT_ESP32S2 static constexpr uint8_t DAC0_PIN = 17; @@ -41,7 +40,6 @@ void ESP32DAC::write_state(float state) { dac_oneshot_output_voltage(this->dac_handle_, state); } -} // namespace esp32_dac -} // namespace esphome +} // namespace esphome::esp32_dac #endif // USE_ESP32_VARIANT_ESP32 || USE_ESP32_VARIANT_ESP32S2 diff --git a/esphome/components/esp32_dac/esp32_dac.h b/esphome/components/esp32_dac/esp32_dac.h index 95c687d307..108b96cd39 100644 --- a/esphome/components/esp32_dac/esp32_dac.h +++ b/esphome/components/esp32_dac/esp32_dac.h @@ -9,8 +9,7 @@ #include -namespace esphome { -namespace esp32_dac { +namespace esphome::esp32_dac { class ESP32DAC : public output::FloatOutput, public Component { public: @@ -30,7 +29,6 @@ class ESP32DAC : public output::FloatOutput, public Component { dac_oneshot_handle_t dac_handle_; }; -} // namespace esp32_dac -} // namespace esphome +} // namespace esphome::esp32_dac #endif // USE_ESP32_VARIANT_ESP32 || USE_ESP32_VARIANT_ESP32S2 diff --git a/esphome/components/esp32_improv/automation.h b/esphome/components/esp32_improv/automation.h index cd2bd84c30..19e1b6e7e3 100644 --- a/esphome/components/esp32_improv/automation.h +++ b/esphome/components/esp32_improv/automation.h @@ -7,8 +7,7 @@ #include -namespace esphome { -namespace esp32_improv { +namespace esphome::esp32_improv { class ESP32ImprovProvisionedTrigger : public Trigger<> { public: @@ -81,7 +80,7 @@ class ESP32ImprovStoppedTrigger : public Trigger<> { ESP32ImprovComponent *parent_; }; -} // namespace esp32_improv -} // namespace esphome +} // namespace esphome::esp32_improv + #endif #endif diff --git a/esphome/components/esp32_improv/esp32_improv_component.cpp b/esphome/components/esp32_improv/esp32_improv_component.cpp index c24b08b06f..183820256f 100644 --- a/esphome/components/esp32_improv/esp32_improv_component.cpp +++ b/esphome/components/esp32_improv/esp32_improv_component.cpp @@ -9,8 +9,7 @@ #ifdef USE_ESP32 -namespace esphome { -namespace esp32_improv { +namespace esphome::esp32_improv { using namespace bytebuffer; @@ -490,7 +489,6 @@ improv::State ESP32ImprovComponent::get_initial_state_() const { ESP32ImprovComponent *global_improv_component = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) -} // namespace esp32_improv -} // namespace esphome +} // namespace esphome::esp32_improv #endif diff --git a/esphome/components/esp32_improv/esp32_improv_component.h b/esphome/components/esp32_improv/esp32_improv_component.h index 41799f2325..400006cfb3 100644 --- a/esphome/components/esp32_improv/esp32_improv_component.h +++ b/esphome/components/esp32_improv/esp32_improv_component.h @@ -28,8 +28,7 @@ #include -namespace esphome { -namespace esp32_improv { +namespace esphome::esp32_improv { using namespace esp32_ble_server; @@ -124,7 +123,6 @@ class ESP32ImprovComponent : public Component, public improv_base::ImprovBase { // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) extern ESP32ImprovComponent *global_improv_component; -} // namespace esp32_improv -} // namespace esphome +} // namespace esphome::esp32_improv #endif diff --git a/esphome/components/esp32_rmt_led_strip/led_strip.cpp b/esphome/components/esp32_rmt_led_strip/led_strip.cpp index ca97a181fd..ed2a8c5a68 100644 --- a/esphome/components/esp32_rmt_led_strip/led_strip.cpp +++ b/esphome/components/esp32_rmt_led_strip/led_strip.cpp @@ -9,8 +9,7 @@ #include #include -namespace esphome { -namespace esp32_rmt_led_strip { +namespace esphome::esp32_rmt_led_strip { static const char *const TAG = "esp32_rmt_led_strip"; @@ -305,7 +304,6 @@ void ESP32RMTLEDStripLightOutput::dump_config() { float ESP32RMTLEDStripLightOutput::get_setup_priority() const { return setup_priority::HARDWARE; } -} // namespace esp32_rmt_led_strip -} // namespace esphome +} // namespace esphome::esp32_rmt_led_strip #endif // USE_ESP32 diff --git a/esphome/components/esp32_rmt_led_strip/led_strip.h b/esphome/components/esp32_rmt_led_strip/led_strip.h index 6f3aea9878..8fb6b63afe 100644 --- a/esphome/components/esp32_rmt_led_strip/led_strip.h +++ b/esphome/components/esp32_rmt_led_strip/led_strip.h @@ -13,8 +13,7 @@ #include #include -namespace esphome { -namespace esp32_rmt_led_strip { +namespace esphome::esp32_rmt_led_strip { enum RGBOrder : uint8_t { ORDER_RGB, @@ -102,7 +101,6 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight { optional max_refresh_rate_{}; }; -} // namespace esp32_rmt_led_strip -} // namespace esphome +} // namespace esphome::esp32_rmt_led_strip #endif // USE_ESP32 diff --git a/esphome/components/espnow/packet_transport/espnow_transport.cpp b/esphome/components/espnow/packet_transport/espnow_transport.cpp index 384e3fe2a9..1e37073321 100644 --- a/esphome/components/espnow/packet_transport/espnow_transport.cpp +++ b/esphome/components/espnow/packet_transport/espnow_transport.cpp @@ -5,8 +5,7 @@ #include "esphome/core/application.h" #include "esphome/core/log.h" -namespace esphome { -namespace espnow { +namespace esphome::espnow { static const char *const TAG = "espnow.transport"; @@ -86,7 +85,6 @@ bool ESPNowTransport::on_broadcast(const ESPNowRecvInfo &info, const uint8_t *da return false; // Allow other handlers to run } -} // namespace espnow -} // namespace esphome +} // namespace esphome::espnow #endif // USE_ESP32 diff --git a/esphome/components/espnow/packet_transport/espnow_transport.h b/esphome/components/espnow/packet_transport/espnow_transport.h index 98c33f01fd..5916a7fa5f 100644 --- a/esphome/components/espnow/packet_transport/espnow_transport.h +++ b/esphome/components/espnow/packet_transport/espnow_transport.h @@ -9,8 +9,7 @@ #include -namespace esphome { -namespace espnow { +namespace esphome::espnow { class ESPNowTransport : public packet_transport::PacketTransport, public Parented, @@ -37,7 +36,6 @@ class ESPNowTransport : public packet_transport::PacketTransport, std::vector packet_buffer_; }; -} // namespace espnow -} // namespace esphome +} // namespace esphome::espnow #endif // USE_ESP32 diff --git a/esphome/components/event/automation.h b/esphome/components/event/automation.h index 7730506c10..3444a7b1bb 100644 --- a/esphome/components/event/automation.h +++ b/esphome/components/event/automation.h @@ -4,8 +4,7 @@ #include "esphome/core/automation.h" #include "esphome/core/component.h" -namespace esphome { -namespace event { +namespace esphome::event { template class TriggerEventAction : public Action, public Parented { public: @@ -21,5 +20,4 @@ class EventTrigger : public Trigger { } }; -} // namespace event -} // namespace esphome +} // namespace esphome::event diff --git a/esphome/components/event/event.cpp b/esphome/components/event/event.cpp index a5d64a2748..673ccc9802 100644 --- a/esphome/components/event/event.cpp +++ b/esphome/components/event/event.cpp @@ -3,8 +3,7 @@ #include "esphome/core/controller_registry.h" #include "esphome/core/log.h" -namespace esphome { -namespace event { +namespace esphome::event { static const char *const TAG = "event"; @@ -45,5 +44,4 @@ void Event::set_event_types(const std::vector &event_types) { this->last_event_type_ = nullptr; // Reset when types change } -} // namespace event -} // namespace esphome +} // namespace esphome::event diff --git a/esphome/components/event/event.h b/esphome/components/event/event.h index ebbee0bfe2..e6fc7111c8 100644 --- a/esphome/components/event/event.h +++ b/esphome/components/event/event.h @@ -10,8 +10,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/string_ref.h" -namespace esphome { -namespace event { +namespace esphome::event { #define LOG_EVENT(prefix, type, obj) \ if ((obj) != nullptr) { \ @@ -80,5 +79,4 @@ class Event : public EntityBase { const char *last_event_type_{nullptr}; }; -} // namespace event -} // namespace esphome +} // namespace esphome::event diff --git a/esphome/components/exposure_notifications/exposure_notifications.cpp b/esphome/components/exposure_notifications/exposure_notifications.cpp index 307bee26f8..e7038d2ca9 100644 --- a/esphome/components/exposure_notifications/exposure_notifications.cpp +++ b/esphome/components/exposure_notifications/exposure_notifications.cpp @@ -4,8 +4,7 @@ #ifdef USE_ESP32 -namespace esphome { -namespace exposure_notifications { +namespace esphome::exposure_notifications { using namespace esp32_ble_tracker; @@ -43,7 +42,6 @@ bool ExposureNotificationTrigger::parse_device(const ESPBTDevice &device) { return true; } -} // namespace exposure_notifications -} // namespace esphome +} // namespace esphome::exposure_notifications #endif diff --git a/esphome/components/exposure_notifications/exposure_notifications.h b/esphome/components/exposure_notifications/exposure_notifications.h index f7383c28d9..80184f9cfd 100644 --- a/esphome/components/exposure_notifications/exposure_notifications.h +++ b/esphome/components/exposure_notifications/exposure_notifications.h @@ -7,8 +7,7 @@ #ifdef USE_ESP32 -namespace esphome { -namespace exposure_notifications { +namespace esphome::exposure_notifications { struct ExposureNotification { std::array address; @@ -23,7 +22,6 @@ class ExposureNotificationTrigger : public Trigger, bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override; }; -} // namespace exposure_notifications -} // namespace esphome +} // namespace esphome::exposure_notifications #endif diff --git a/esphome/components/ezo/ezo.cpp b/esphome/components/ezo/ezo.cpp index bb8fb92f21..d18e6e67cb 100644 --- a/esphome/components/ezo/ezo.cpp +++ b/esphome/components/ezo/ezo.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" -namespace esphome { -namespace ezo { +namespace esphome::ezo { static const char *const EZO_COMMAND_TYPE_STRINGS[] = {"EZO_READ", "EZO_LED", "EZO_DEVICE_INFORMATION", "EZO_SLOPE", "EZO_CALIBRATION", "EZO_SLEEP", @@ -238,5 +237,4 @@ void EZOSensor::send_custom(const std::string &to_send) { this->add_command_(to_send.c_str(), EzoCommandType::EZO_CUSTOM); } -} // namespace ezo -} // namespace esphome +} // namespace esphome::ezo diff --git a/esphome/components/ezo/ezo.h b/esphome/components/ezo/ezo.h index d80869fbd9..aea276e001 100644 --- a/esphome/components/ezo/ezo.h +++ b/esphome/components/ezo/ezo.h @@ -5,8 +5,7 @@ #include "esphome/components/i2c/i2c.h" #include -namespace esphome { -namespace ezo { +namespace esphome::ezo { static const char *const TAG = "ezo.sensor"; @@ -102,5 +101,4 @@ class EZOSensor : public sensor::Sensor, public PollingComponent, public i2c::I2 uint32_t start_time_ = 0; }; -} // namespace ezo -} // namespace esphome +} // namespace esphome::ezo diff --git a/esphome/components/ezo_pmp/ezo_pmp.cpp b/esphome/components/ezo_pmp/ezo_pmp.cpp index 4ce4da57ff..21307fcd7a 100644 --- a/esphome/components/ezo_pmp/ezo_pmp.cpp +++ b/esphome/components/ezo_pmp/ezo_pmp.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" -namespace esphome { -namespace ezo_pmp { +namespace esphome::ezo_pmp { static const char *const TAG = "ezo-pmp"; @@ -547,5 +546,4 @@ void EzoPMP::exec_arbitrary_command(const std::basic_string &command) { this->queue_command_(EZO_PMP_COMMAND_EXEC_ARBITRARY_COMMAND_ADDRESS, 0, 0, true); } -} // namespace ezo_pmp -} // namespace esphome +} // namespace esphome::ezo_pmp diff --git a/esphome/components/ezo_pmp/ezo_pmp.h b/esphome/components/ezo_pmp/ezo_pmp.h index bbfd899170..8a6da5fe74 100644 --- a/esphome/components/ezo_pmp/ezo_pmp.h +++ b/esphome/components/ezo_pmp/ezo_pmp.h @@ -17,8 +17,7 @@ #include "esphome/components/text_sensor/text_sensor.h" #endif -namespace esphome { -namespace ezo_pmp { +namespace esphome::ezo_pmp { class EzoPMP : public PollingComponent, public i2c::I2CDevice { public: @@ -247,5 +246,4 @@ template class EzoPMPArbitraryCommandAction : public Action { StringRef last_preset_mode_{}; }; -} // namespace fan -} // namespace esphome +} // namespace esphome::fan diff --git a/esphome/components/fan/fan.cpp b/esphome/components/fan/fan.cpp index 9301e0cea4..853bf94ffe 100644 --- a/esphome/components/fan/fan.cpp +++ b/esphome/components/fan/fan.cpp @@ -4,8 +4,7 @@ #include "esphome/core/log.h" #include "esphome/core/progmem.h" -namespace esphome { -namespace fan { +namespace esphome::fan { static const char *const TAG = "fan"; @@ -345,5 +344,4 @@ void Fan::dump_traits_(const char *tag, const char *prefix) { } } -} // namespace fan -} // namespace esphome +} // namespace esphome::fan diff --git a/esphome/components/fan/fan.h b/esphome/components/fan/fan.h index d5763edf2f..3d731e6eb0 100644 --- a/esphome/components/fan/fan.h +++ b/esphome/components/fan/fan.h @@ -8,8 +8,7 @@ #include "esphome/core/string_ref.h" #include "fan_traits.h" -namespace esphome { -namespace fan { +namespace esphome::fan { #define LOG_FAN(prefix, type, obj) \ if ((obj) != nullptr) { \ @@ -199,5 +198,4 @@ class Fan : public EntityBase { const char *preset_mode_{nullptr}; }; -} // namespace fan -} // namespace esphome +} // namespace esphome::fan diff --git a/esphome/components/fan/fan_traits.h b/esphome/components/fan/fan_traits.h index a2b2633af1..1d42cce371 100644 --- a/esphome/components/fan/fan_traits.h +++ b/esphome/components/fan/fan_traits.h @@ -5,9 +5,7 @@ #include #include "esphome/core/helpers.h" -namespace esphome { - -namespace fan { +namespace esphome::fan { class Fan; // Forward declaration @@ -95,5 +93,4 @@ class FanTraits { std::vector compat_preset_modes_; }; -} // namespace fan -} // namespace esphome +} // namespace esphome::fan diff --git a/esphome/components/fastled_base/fastled_light.cpp b/esphome/components/fastled_base/fastled_light.cpp index 504b8d473e..8d1dd49dad 100644 --- a/esphome/components/fastled_base/fastled_light.cpp +++ b/esphome/components/fastled_base/fastled_light.cpp @@ -3,8 +3,7 @@ #include "fastled_light.h" #include "esphome/core/log.h" -namespace esphome { -namespace fastled_base { +namespace esphome::fastled_base { static const char *const TAG = "fastled"; @@ -39,7 +38,6 @@ void FastLEDLightOutput::write_state(light::LightState *state) { this->controller_->showLeds(this->state_parent_->current_values.get_brightness() * 255); } -} // namespace fastled_base -} // namespace esphome +} // namespace esphome::fastled_base #endif // USE_ARDUINO diff --git a/esphome/components/fastled_base/fastled_light.h b/esphome/components/fastled_base/fastled_light.h index 26f0f33d2a..8e87f67e6d 100644 --- a/esphome/components/fastled_base/fastled_light.h +++ b/esphome/components/fastled_base/fastled_light.h @@ -15,8 +15,7 @@ #include "FastLED.h" -namespace esphome { -namespace fastled_base { +namespace esphome::fastled_base { class FastLEDLightOutput : public light::AddressableLight { public: @@ -237,7 +236,6 @@ class FastLEDLightOutput : public light::AddressableLight { optional max_refresh_rate_{}; }; -} // namespace fastled_base -} // namespace esphome +} // namespace esphome::fastled_base #endif // USE_ARDUINO diff --git a/esphome/components/fingerprint_grow/fingerprint_grow.cpp b/esphome/components/fingerprint_grow/fingerprint_grow.cpp index a633fbca28..3f57789034 100644 --- a/esphome/components/fingerprint_grow/fingerprint_grow.cpp +++ b/esphome/components/fingerprint_grow/fingerprint_grow.cpp @@ -3,8 +3,7 @@ #include "esphome/core/log.h" #include -namespace esphome { -namespace fingerprint_grow { +namespace esphome::fingerprint_grow { static const char *const TAG = "fingerprint_grow"; @@ -581,5 +580,4 @@ void FingerprintGrowComponent::dump_config() { } } -} // namespace fingerprint_grow -} // namespace esphome +} // namespace esphome::fingerprint_grow diff --git a/esphome/components/fingerprint_grow/fingerprint_grow.h b/esphome/components/fingerprint_grow/fingerprint_grow.h index 947c701c98..7cecb7dc82 100644 --- a/esphome/components/fingerprint_grow/fingerprint_grow.h +++ b/esphome/components/fingerprint_grow/fingerprint_grow.h @@ -9,8 +9,7 @@ #include #include -namespace esphome { -namespace fingerprint_grow { +namespace esphome::fingerprint_grow { static const uint16_t START_CODE = 0xEF01; @@ -274,5 +273,4 @@ template class AuraLEDControlAction : public Action, publ } }; -} // namespace fingerprint_grow -} // namespace esphome +} // namespace esphome::fingerprint_grow diff --git a/esphome/components/font/font.cpp b/esphome/components/font/font.cpp index ecf0ca6bdd..fda9c269e5 100644 --- a/esphome/components/font/font.cpp +++ b/esphome/components/font/font.cpp @@ -4,8 +4,7 @@ #include "esphome/core/hal.h" #include "esphome/core/log.h" -namespace esphome { -namespace font { +namespace esphome::font { static const char *const TAG = "font"; #ifdef USE_LVGL_FONT @@ -359,5 +358,4 @@ void Font::print(int x_start, int y_start, display::Display *display, Color colo } } #endif -} // namespace font -} // namespace esphome +} // namespace esphome::font diff --git a/esphome/components/font/font.h b/esphome/components/font/font.h index 4a09d7314d..9c9cfa0f6d 100644 --- a/esphome/components/font/font.h +++ b/esphome/components/font/font.h @@ -10,8 +10,7 @@ #include #endif -namespace esphome { -namespace font { +namespace esphome::font { class Font; @@ -98,5 +97,4 @@ class Font #endif }; -} // namespace font -} // namespace esphome +} // namespace esphome::font diff --git a/esphome/components/fs3000/fs3000.cpp b/esphome/components/fs3000/fs3000.cpp index cea599211d..a89b166182 100644 --- a/esphome/components/fs3000/fs3000.cpp +++ b/esphome/components/fs3000/fs3000.cpp @@ -1,8 +1,7 @@ #include "fs3000.h" #include "esphome/core/log.h" -namespace esphome { -namespace fs3000 { +namespace esphome::fs3000 { static const char *const TAG = "fs3000"; @@ -101,5 +100,4 @@ float FS3000Component::fit_raw_(uint16_t raw_value) { } } -} // namespace fs3000 -} // namespace esphome +} // namespace esphome::fs3000 diff --git a/esphome/components/fs3000/fs3000.h b/esphome/components/fs3000/fs3000.h index e33c72215f..c019b1366b 100644 --- a/esphome/components/fs3000/fs3000.h +++ b/esphome/components/fs3000/fs3000.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace fs3000 { +namespace esphome::fs3000 { // FS3000 has two models, 1005 and 1015 // 1005 has a max speed detection of 7.23 m/s @@ -30,5 +29,4 @@ class FS3000Component : public PollingComponent, public i2c::I2CDevice, public s float fit_raw_(uint16_t raw_value); }; -} // namespace fs3000 -} // namespace esphome +} // namespace esphome::fs3000 diff --git a/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.cpp b/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.cpp index 505c3cffc0..835dc4aac0 100644 --- a/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.cpp +++ b/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.cpp @@ -3,8 +3,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace ft5x06 { +namespace esphome::ft5x06 { static const char *const TAG = "ft5x06.touchscreen"; @@ -99,5 +98,4 @@ bool FT5x06Touchscreen::set_mode_(FTMode mode) { return this->err_check_(this->write_register(FT5X06_MODE_REG, (uint8_t *) &mode, 1), "Set mode"); } -} // namespace ft5x06 -} // namespace esphome +} // namespace esphome::ft5x06 diff --git a/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.h b/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.h index 23e5a0c49f..7cf8769f7a 100644 --- a/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.h +++ b/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.h @@ -6,8 +6,7 @@ #include "esphome/core/gpio.h" #include "esphome/core/hal.h" -namespace esphome { -namespace ft5x06 { +namespace esphome::ft5x06 { enum VendorId { FT5X06_ID_UNKNOWN = 0, @@ -52,5 +51,4 @@ class FT5x06Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice InternalGPIOPin *interrupt_pin_{nullptr}; }; -} // namespace ft5x06 -} // namespace esphome +} // namespace esphome::ft5x06 diff --git a/esphome/components/ft63x6/ft63x6.cpp b/esphome/components/ft63x6/ft63x6.cpp index f7c4f255a0..dd8f5ba629 100644 --- a/esphome/components/ft63x6/ft63x6.cpp +++ b/esphome/components/ft63x6/ft63x6.cpp @@ -10,8 +10,8 @@ // Registers // Reference: https://focuslcds.com/content/FT6236.pdf -namespace esphome { -namespace ft63x6 { + +namespace esphome::ft63x6 { static const uint8_t FT6X36_ADDR_DEVICE_MODE = 0x00; static const uint8_t FT63X6_ADDR_TD_STATUS = 0x02; @@ -133,5 +133,4 @@ uint8_t FT63X6Touchscreen::read_byte_(uint8_t addr) { return byte; } -} // namespace ft63x6 -} // namespace esphome +} // namespace esphome::ft63x6 diff --git a/esphome/components/ft63x6/ft63x6.h b/esphome/components/ft63x6/ft63x6.h index 8000894294..efa03168d9 100644 --- a/esphome/components/ft63x6/ft63x6.h +++ b/esphome/components/ft63x6/ft63x6.h @@ -11,8 +11,7 @@ #include "esphome/components/touchscreen/touchscreen.h" #include "esphome/core/component.h" -namespace esphome { -namespace ft63x6 { +namespace esphome::ft63x6 { using namespace touchscreen; @@ -47,5 +46,4 @@ class FT63X6Touchscreen : public Touchscreen, public i2c::I2CDevice { uint8_t read_byte_(uint8_t addr); }; -} // namespace ft63x6 -} // namespace esphome +} // namespace esphome::ft63x6 diff --git a/esphome/components/fujitsu_general/fujitsu_general.cpp b/esphome/components/fujitsu_general/fujitsu_general.cpp index 8aa0f51728..f801239153 100644 --- a/esphome/components/fujitsu_general/fujitsu_general.cpp +++ b/esphome/components/fujitsu_general/fujitsu_general.cpp @@ -1,7 +1,6 @@ #include "fujitsu_general.h" -namespace esphome { -namespace fujitsu_general { +namespace esphome::fujitsu_general { // bytes' bits are reversed for fujitsu, so nibbles are ordered 1, 0, 3, 2, 5, 4, etc... @@ -400,5 +399,4 @@ bool FujitsuGeneralClimate::on_receive(remote_base::RemoteReceiveData data) { return true; } -} // namespace fujitsu_general -} // namespace esphome +} // namespace esphome::fujitsu_general diff --git a/esphome/components/fujitsu_general/fujitsu_general.h b/esphome/components/fujitsu_general/fujitsu_general.h index d7d01bf6f3..ca93e4b300 100644 --- a/esphome/components/fujitsu_general/fujitsu_general.h +++ b/esphome/components/fujitsu_general/fujitsu_general.h @@ -5,8 +5,7 @@ #include "esphome/core/automation.h" #include "esphome/components/climate_ir/climate_ir.h" -namespace esphome { -namespace fujitsu_general { +namespace esphome::fujitsu_general { const uint8_t FUJITSU_GENERAL_TEMP_MIN = 16; // Celsius // TODO 16 for heating, 18 for cooling, unsupported in ESPH const uint8_t FUJITSU_GENERAL_TEMP_MAX = 30; // Celsius @@ -78,5 +77,4 @@ class FujitsuGeneralClimate : public climate_ir::ClimateIR { bool power_{false}; }; -} // namespace fujitsu_general -} // namespace esphome +} // namespace esphome::fujitsu_general diff --git a/esphome/components/gcja5/gcja5.cpp b/esphome/components/gcja5/gcja5.cpp index 43b2fa20d3..e84c51bde8 100644 --- a/esphome/components/gcja5/gcja5.cpp +++ b/esphome/components/gcja5/gcja5.cpp @@ -9,8 +9,7 @@ #include "esphome/core/application.h" #include -namespace esphome { -namespace gcja5 { +namespace esphome::gcja5 { static const char *const TAG = "gcja5"; @@ -107,5 +106,4 @@ void GCJA5Component::parse_data_() { void GCJA5Component::dump_config() { ; } -} // namespace gcja5 -} // namespace esphome +} // namespace esphome::gcja5 diff --git a/esphome/components/gcja5/gcja5.h b/esphome/components/gcja5/gcja5.h index 30bc877169..30c9464b4a 100644 --- a/esphome/components/gcja5/gcja5.h +++ b/esphome/components/gcja5/gcja5.h @@ -5,8 +5,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/uart/uart.h" -namespace esphome { -namespace gcja5 { +namespace esphome::gcja5 { class GCJA5Component : public Component, public uart::UARTDevice { public: @@ -52,5 +51,4 @@ class GCJA5Component : public Component, public uart::UARTDevice { sensor::Sensor *pmc_10_0_sensor_{nullptr}; }; -} // namespace gcja5 -} // namespace esphome +} // namespace esphome::gcja5 diff --git a/esphome/components/gdk101/gdk101.cpp b/esphome/components/gdk101/gdk101.cpp index 0ee718cd20..bc0ef70578 100644 --- a/esphome/components/gdk101/gdk101.cpp +++ b/esphome/components/gdk101/gdk101.cpp @@ -2,8 +2,7 @@ #include "esphome/core/hal.h" #include "esphome/core/log.h" -namespace esphome { -namespace gdk101 { +namespace esphome::gdk101 { static const char *const TAG = "gdk101"; static constexpr uint8_t NUMBER_OF_READ_RETRIES = 5; @@ -206,5 +205,4 @@ bool GDK101Component::read_measurement_duration_(uint8_t *data) { return true; } -} // namespace gdk101 -} // namespace esphome +} // namespace esphome::gdk101 diff --git a/esphome/components/gdk101/gdk101.h b/esphome/components/gdk101/gdk101.h index abe3fd60d8..2ef7526294 100644 --- a/esphome/components/gdk101/gdk101.h +++ b/esphome/components/gdk101/gdk101.h @@ -13,8 +13,7 @@ #endif // USE_TEXT_SENSOR #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace gdk101 { +namespace esphome::gdk101 { static const uint8_t GDK101_REG_READ_FIRMWARE = 0xB4; // Firmware version static const uint8_t GDK101_REG_RESET = 0xA0; // Reset register - reading its value triggers reset @@ -55,5 +54,4 @@ class GDK101Component : public PollingComponent, public i2c::I2CDevice { uint8_t reset_retries_remaining_{0}; }; -} // namespace gdk101 -} // namespace esphome +} // namespace esphome::gdk101 diff --git a/esphome/components/gl_r01_i2c/gl_r01_i2c.cpp b/esphome/components/gl_r01_i2c/gl_r01_i2c.cpp index 38328c4b03..75f0c69a7b 100644 --- a/esphome/components/gl_r01_i2c/gl_r01_i2c.cpp +++ b/esphome/components/gl_r01_i2c/gl_r01_i2c.cpp @@ -2,8 +2,7 @@ #include "esphome/core/hal.h" #include "gl_r01_i2c.h" -namespace esphome { -namespace gl_r01_i2c { +namespace esphome::gl_r01_i2c { static const char *const TAG = "gl_r01_i2c"; @@ -65,5 +64,4 @@ void GLR01I2CComponent::read_distance_() { } } -} // namespace gl_r01_i2c -} // namespace esphome +} // namespace esphome::gl_r01_i2c diff --git a/esphome/components/gl_r01_i2c/gl_r01_i2c.h b/esphome/components/gl_r01_i2c/gl_r01_i2c.h index 9a7aa023fd..1d023c245a 100644 --- a/esphome/components/gl_r01_i2c/gl_r01_i2c.h +++ b/esphome/components/gl_r01_i2c/gl_r01_i2c.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace gl_r01_i2c { +namespace esphome::gl_r01_i2c { class GLR01I2CComponent : public sensor::Sensor, public i2c::I2CDevice, public PollingComponent { public: @@ -18,5 +17,4 @@ class GLR01I2CComponent : public sensor::Sensor, public i2c::I2CDevice, public P uint16_t version_{0}; }; -} // namespace gl_r01_i2c -} // namespace esphome +} // namespace esphome::gl_r01_i2c diff --git a/esphome/components/gp2y1010au0f/gp2y1010au0f.cpp b/esphome/components/gp2y1010au0f/gp2y1010au0f.cpp index c8b0f13d3a..0dd4a13a21 100644 --- a/esphome/components/gp2y1010au0f/gp2y1010au0f.cpp +++ b/esphome/components/gp2y1010au0f/gp2y1010au0f.cpp @@ -4,8 +4,7 @@ #include -namespace esphome { -namespace gp2y1010au0f { +namespace esphome::gp2y1010au0f { static const char *const TAG = "gp2y1010au0f"; static const float MIN_VOLTAGE = 0.0f; @@ -65,5 +64,4 @@ void GP2Y1010AU0FSensor::loop() { this->sample_sum_ += read_voltage; } -} // namespace gp2y1010au0f -} // namespace esphome +} // namespace esphome::gp2y1010au0f diff --git a/esphome/components/gp2y1010au0f/gp2y1010au0f.h b/esphome/components/gp2y1010au0f/gp2y1010au0f.h index 5ee58e68d2..f3398ac4a3 100644 --- a/esphome/components/gp2y1010au0f/gp2y1010au0f.h +++ b/esphome/components/gp2y1010au0f/gp2y1010au0f.h @@ -5,8 +5,7 @@ #include "esphome/components/voltage_sampler/voltage_sampler.h" #include "esphome/components/output/binary_output.h" -namespace esphome { -namespace gp2y1010au0f { +namespace esphome::gp2y1010au0f { class GP2Y1010AU0FSensor : public sensor::Sensor, public PollingComponent { public: @@ -48,5 +47,4 @@ class GP2Y1010AU0FSensor : public sensor::Sensor, public PollingComponent { bool is_sampling_ = false; }; -} // namespace gp2y1010au0f -} // namespace esphome +} // namespace esphome::gp2y1010au0f diff --git a/esphome/components/gp8403/gp8403.cpp b/esphome/components/gp8403/gp8403.cpp index 11c2f9a7c0..7e93bb6295 100644 --- a/esphome/components/gp8403/gp8403.cpp +++ b/esphome/components/gp8403/gp8403.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" -namespace esphome { -namespace gp8403 { +namespace esphome::gp8403 { static const char *const TAG = "gp8403"; @@ -51,5 +50,4 @@ void GP8403Component::write_state(float state, uint8_t channel) { } } -} // namespace gp8403 -} // namespace esphome +} // namespace esphome::gp8403 diff --git a/esphome/components/gp8403/gp8403.h b/esphome/components/gp8403/gp8403.h index a19df15515..d30d967479 100644 --- a/esphome/components/gp8403/gp8403.h +++ b/esphome/components/gp8403/gp8403.h @@ -3,8 +3,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/core/component.h" -namespace esphome { -namespace gp8403 { +namespace esphome::gp8403 { enum GP8403Voltage : uint8_t { GP8403_VOLTAGE_5V = 0x00, @@ -30,5 +29,4 @@ class GP8403Component : public Component, public i2c::I2CDevice { GP8403Model model_{GP8403Model::GP8403}; }; -} // namespace gp8403 -} // namespace esphome +} // namespace esphome::gp8403 diff --git a/esphome/components/gp8403/output/gp8403_output.cpp b/esphome/components/gp8403/output/gp8403_output.cpp index dfdc2d6ccb..7a22a280ac 100644 --- a/esphome/components/gp8403/output/gp8403_output.cpp +++ b/esphome/components/gp8403/output/gp8403_output.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" -namespace esphome { -namespace gp8403 { +namespace esphome::gp8403 { static const char *const TAG = "gp8403.output"; @@ -16,5 +15,4 @@ void GP8403Output::dump_config() { void GP8403Output::write_state(float state) { this->parent_->write_state(state, this->channel_); } -} // namespace gp8403 -} // namespace esphome +} // namespace esphome::gp8403 diff --git a/esphome/components/gp8403/output/gp8403_output.h b/esphome/components/gp8403/output/gp8403_output.h index c0d6650500..8b1f920680 100644 --- a/esphome/components/gp8403/output/gp8403_output.h +++ b/esphome/components/gp8403/output/gp8403_output.h @@ -5,8 +5,7 @@ #include "esphome/components/gp8403/gp8403.h" -namespace esphome { -namespace gp8403 { +namespace esphome::gp8403 { class GP8403Output : public Component, public output::FloatOutput, public Parented { public: @@ -19,5 +18,4 @@ class GP8403Output : public Component, public output::FloatOutput, public Parent uint8_t channel_; }; -} // namespace gp8403 -} // namespace esphome +} // namespace esphome::gp8403 diff --git a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp index 1f0154c70b..ff07d76901 100644 --- a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp +++ b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/progmem.h" -namespace esphome { -namespace gpio { +namespace esphome::gpio { static const char *const TAG = "gpio.binary_sensor"; @@ -86,5 +85,4 @@ void GPIOBinarySensor::loop() { float GPIOBinarySensor::get_setup_priority() const { return setup_priority::HARDWARE; } -} // namespace gpio -} // namespace esphome +} // namespace esphome::gpio diff --git a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h index 24efc2a0e6..100edb4cca 100644 --- a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h +++ b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h @@ -5,8 +5,7 @@ #include "esphome/core/helpers.h" #include "esphome/components/binary_sensor/binary_sensor.h" -namespace esphome { -namespace gpio { +namespace esphome::gpio { // Store class for ISR data and configuration (no vtables, ISR-safe) class GPIOBinarySensorStore { @@ -64,5 +63,4 @@ class GPIOBinarySensor final : public binary_sensor::BinarySensor, public Compon GPIOBinarySensorStore store_; }; -} // namespace gpio -} // namespace esphome +} // namespace esphome::gpio diff --git a/esphome/components/gpio/one_wire/gpio_one_wire.cpp b/esphome/components/gpio/one_wire/gpio_one_wire.cpp index 4e2a306fc9..1fecfbf0dd 100644 --- a/esphome/components/gpio/one_wire/gpio_one_wire.cpp +++ b/esphome/components/gpio/one_wire/gpio_one_wire.cpp @@ -2,8 +2,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace gpio { +namespace esphome::gpio { static const char *const TAG = "gpio.one_wire"; @@ -202,5 +201,4 @@ uint64_t IRAM_ATTR GPIOOneWireBus::search_int() { return address; } -} // namespace gpio -} // namespace esphome +} // namespace esphome::gpio diff --git a/esphome/components/gpio/one_wire/gpio_one_wire.h b/esphome/components/gpio/one_wire/gpio_one_wire.h index 8874703971..02797b5737 100644 --- a/esphome/components/gpio/one_wire/gpio_one_wire.h +++ b/esphome/components/gpio/one_wire/gpio_one_wire.h @@ -4,8 +4,7 @@ #include "esphome/core/hal.h" #include "esphome/components/one_wire/one_wire.h" -namespace esphome { -namespace gpio { +namespace esphome::gpio { class GPIOOneWireBus : public one_wire::OneWireBus, public Component { public: @@ -38,5 +37,4 @@ class GPIOOneWireBus : public one_wire::OneWireBus, public Component { bool read_bit_(uint32_t *t); }; -} // namespace gpio -} // namespace esphome +} // namespace esphome::gpio diff --git a/esphome/components/gpio/output/gpio_binary_output.cpp b/esphome/components/gpio/output/gpio_binary_output.cpp index 13538b6f2b..402ad03c49 100644 --- a/esphome/components/gpio/output/gpio_binary_output.cpp +++ b/esphome/components/gpio/output/gpio_binary_output.cpp @@ -1,8 +1,7 @@ #include "gpio_binary_output.h" #include "esphome/core/log.h" -namespace esphome { -namespace gpio { +namespace esphome::gpio { static const char *const TAG = "gpio.output"; @@ -12,5 +11,4 @@ void GPIOBinaryOutput::dump_config() { LOG_BINARY_OUTPUT(this); } -} // namespace gpio -} // namespace esphome +} // namespace esphome::gpio diff --git a/esphome/components/gpio/output/gpio_binary_output.h b/esphome/components/gpio/output/gpio_binary_output.h index 6b72c61c0f..4100cb94c2 100644 --- a/esphome/components/gpio/output/gpio_binary_output.h +++ b/esphome/components/gpio/output/gpio_binary_output.h @@ -4,8 +4,7 @@ #include "esphome/core/hal.h" #include "esphome/components/output/binary_output.h" -namespace esphome { -namespace gpio { +namespace esphome::gpio { class GPIOBinaryOutput : public output::BinaryOutput, public Component { public: @@ -25,5 +24,4 @@ class GPIOBinaryOutput : public output::BinaryOutput, public Component { GPIOPin *pin_; }; -} // namespace gpio -} // namespace esphome +} // namespace esphome::gpio diff --git a/esphome/components/gpio/switch/gpio_switch.cpp b/esphome/components/gpio/switch/gpio_switch.cpp index 9c6464815a..d432655a2a 100644 --- a/esphome/components/gpio/switch/gpio_switch.cpp +++ b/esphome/components/gpio/switch/gpio_switch.cpp @@ -1,8 +1,7 @@ #include "gpio_switch.h" #include "esphome/core/log.h" -namespace esphome { -namespace gpio { +namespace esphome::gpio { static const char *const TAG = "switch.gpio"; #ifdef USE_GPIO_SWITCH_INTERLOCK @@ -79,5 +78,4 @@ void GPIOSwitch::write_state(bool state) { void GPIOSwitch::set_interlock(const std::initializer_list &interlock) { this->interlock_ = interlock; } #endif -} // namespace gpio -} // namespace esphome +} // namespace esphome::gpio diff --git a/esphome/components/gpio/switch/gpio_switch.h b/esphome/components/gpio/switch/gpio_switch.h index f7415d1dba..7ed0de7c6f 100644 --- a/esphome/components/gpio/switch/gpio_switch.h +++ b/esphome/components/gpio/switch/gpio_switch.h @@ -5,8 +5,7 @@ #include "esphome/core/helpers.h" #include "esphome/components/switch/switch.h" -namespace esphome { -namespace gpio { +namespace esphome::gpio { class GPIOSwitch final : public switch_::Switch, public Component { public: @@ -33,5 +32,4 @@ class GPIOSwitch final : public switch_::Switch, public Component { #endif }; -} // namespace gpio -} // namespace esphome +} // namespace esphome::gpio diff --git a/esphome/components/gps/gps.cpp b/esphome/components/gps/gps.cpp index 65cddcd984..4b8abd219b 100644 --- a/esphome/components/gps/gps.cpp +++ b/esphome/components/gps/gps.cpp @@ -1,8 +1,7 @@ #include "gps.h" #include "esphome/core/log.h" -namespace esphome { -namespace gps { +namespace esphome::gps { static const char *const TAG = "gps"; @@ -91,5 +90,4 @@ void GPS::loop() { } } -} // namespace gps -} // namespace esphome +} // namespace esphome::gps diff --git a/esphome/components/gps/gps.h b/esphome/components/gps/gps.h index 36923c68be..9cd79e25b4 100644 --- a/esphome/components/gps/gps.h +++ b/esphome/components/gps/gps.h @@ -7,8 +7,7 @@ #include -namespace esphome { -namespace gps { +namespace esphome::gps { class GPS; @@ -67,5 +66,4 @@ class GPS : public PollingComponent, public uart::UARTDevice { std::vector listeners_{}; }; -} // namespace gps -} // namespace esphome +} // namespace esphome::gps diff --git a/esphome/components/gps/time/gps_time.cpp b/esphome/components/gps/time/gps_time.cpp index fb662a3d60..3859983ceb 100644 --- a/esphome/components/gps/time/gps_time.cpp +++ b/esphome/components/gps/time/gps_time.cpp @@ -1,8 +1,7 @@ #include "gps_time.h" #include "esphome/core/log.h" -namespace esphome { -namespace gps { +namespace esphome::gps { static const char *const TAG = "gps.time"; @@ -24,5 +23,4 @@ void GPSTime::from_tiny_gps_(TinyGPSPlus &tiny_gps) { this->has_time_ = true; } -} // namespace gps -} // namespace esphome +} // namespace esphome::gps diff --git a/esphome/components/gps/time/gps_time.h b/esphome/components/gps/time/gps_time.h index a8414f0015..3d6d870efc 100644 --- a/esphome/components/gps/time/gps_time.h +++ b/esphome/components/gps/time/gps_time.h @@ -4,8 +4,7 @@ #include "esphome/components/time/real_time_clock.h" #include "esphome/core/component.h" -namespace esphome { -namespace gps { +namespace esphome::gps { class GPSTime : public time::RealTimeClock, public GPSListener { public: @@ -21,5 +20,4 @@ class GPSTime : public time::RealTimeClock, public GPSListener { bool has_time_{false}; }; -} // namespace gps -} // namespace esphome +} // namespace esphome::gps diff --git a/esphome/components/graph/graph.cpp b/esphome/components/graph/graph.cpp index 801c97e3f5..5d59f60509 100644 --- a/esphome/components/graph/graph.cpp +++ b/esphome/components/graph/graph.cpp @@ -4,8 +4,8 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" #include -namespace esphome { -namespace graph { + +namespace esphome::graph { using namespace display; @@ -397,5 +397,4 @@ void Graph::dump_config() { } } -} // namespace graph -} // namespace esphome +} // namespace esphome::graph diff --git a/esphome/components/graphical_display_menu/graphical_display_menu.cpp b/esphome/components/graphical_display_menu/graphical_display_menu.cpp index cf1672f217..81971e457c 100644 --- a/esphome/components/graphical_display_menu/graphical_display_menu.cpp +++ b/esphome/components/graphical_display_menu/graphical_display_menu.cpp @@ -5,8 +5,7 @@ #include #include "esphome/components/display/display.h" -namespace esphome { -namespace graphical_display_menu { +namespace esphome::graphical_display_menu { static const char *const TAG = "graphical_display_menu"; @@ -246,5 +245,4 @@ void GraphicalDisplayMenu::draw_item(const display_menu_base::MenuItem *item, co void GraphicalDisplayMenu::update() { this->on_redraw_callbacks_.call(); } -} // namespace graphical_display_menu -} // namespace esphome +} // namespace esphome::graphical_display_menu diff --git a/esphome/components/gree/gree.cpp b/esphome/components/gree/gree.cpp index 732ebd9632..705c741dd0 100644 --- a/esphome/components/gree/gree.cpp +++ b/esphome/components/gree/gree.cpp @@ -1,8 +1,7 @@ #include "gree.h" #include "esphome/components/remote_base/remote_base.h" -namespace esphome { -namespace gree { +namespace esphome::gree { static const char *const TAG = "gree.climate"; @@ -241,5 +240,4 @@ uint8_t GreeClimate::preset_() { return GREE_PRESET_NONE; } -} // namespace gree -} // namespace esphome +} // namespace esphome::gree diff --git a/esphome/components/gree/switch/gree_switch.cpp b/esphome/components/gree/switch/gree_switch.cpp index 13f14e5453..2f649733af 100644 --- a/esphome/components/gree/switch/gree_switch.cpp +++ b/esphome/components/gree/switch/gree_switch.cpp @@ -1,8 +1,7 @@ #include "gree_switch.h" #include "esphome/core/log.h" -namespace esphome { -namespace gree { +namespace esphome::gree { static const char *const TAG = "gree.switch"; @@ -20,5 +19,4 @@ void GreeModeBitSwitch::write_state(bool state) { this->publish_state(state); } -} // namespace gree -} // namespace esphome +} // namespace esphome::gree diff --git a/esphome/components/gree/switch/gree_switch.h b/esphome/components/gree/switch/gree_switch.h index 239ac4bf17..9d9f187f9d 100644 --- a/esphome/components/gree/switch/gree_switch.h +++ b/esphome/components/gree/switch/gree_switch.h @@ -4,8 +4,7 @@ #include "esphome/components/switch/switch.h" #include "esphome/components/gree/gree.h" -namespace esphome { -namespace gree { +namespace esphome::gree { class GreeModeBitSwitch : public switch_::Switch, public Component, public Parented { public: @@ -20,5 +19,4 @@ class GreeModeBitSwitch : public switch_::Switch, public Component, public Paren uint8_t bit_mask_; }; -} // namespace gree -} // namespace esphome +} // namespace esphome::gree diff --git a/esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp b/esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp index b0f3429314..0de0b02182 100644 --- a/esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp +++ b/esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp @@ -2,8 +2,7 @@ #include "esphome/core/hal.h" #include "esphome/core/log.h" -namespace esphome { -namespace grove_gas_mc_v2 { +namespace esphome::grove_gas_mc_v2 { static const char *const TAG = "grove_gas_mc_v2"; @@ -82,5 +81,4 @@ void GroveGasMultichannelV2Component::dump_config() { } } -} // namespace grove_gas_mc_v2 -} // namespace esphome +} // namespace esphome::grove_gas_mc_v2 diff --git a/esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.h b/esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.h index aab881bd05..38165ab68c 100644 --- a/esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.h +++ b/esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.h @@ -5,8 +5,7 @@ #include "esphome/core/component.h" #include "esphome/core/preferences.h" -namespace esphome { -namespace grove_gas_mc_v2 { +namespace esphome::grove_gas_mc_v2 { class GroveGasMultichannelV2Component : public PollingComponent, public i2c::I2CDevice { SUB_SENSOR(tvoc) @@ -33,5 +32,4 @@ class GroveGasMultichannelV2Component : public PollingComponent, public i2c::I2C bool read_sensor_(uint8_t address, sensor::Sensor *sensor); }; -} // namespace grove_gas_mc_v2 -} // namespace esphome +} // namespace esphome::grove_gas_mc_v2 diff --git a/esphome/components/grove_tb6612fng/grove_tb6612fng.cpp b/esphome/components/grove_tb6612fng/grove_tb6612fng.cpp index c10fa4cf25..eaa1440c4d 100644 --- a/esphome/components/grove_tb6612fng/grove_tb6612fng.cpp +++ b/esphome/components/grove_tb6612fng/grove_tb6612fng.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" -namespace esphome { -namespace grove_tb6612fng { +namespace esphome::grove_tb6612fng { static const char *const TAG = "GroveMotorDriveTB6612FNG"; @@ -167,5 +166,4 @@ void GroveMotorDriveTB6612FNG::stepper_keep_run(StepperModeTypeT mode, uint16_t return; } } -} // namespace grove_tb6612fng -} // namespace esphome +} // namespace esphome::grove_tb6612fng diff --git a/esphome/components/grove_tb6612fng/grove_tb6612fng.h b/esphome/components/grove_tb6612fng/grove_tb6612fng.h index bf47163226..c021680519 100644 --- a/esphome/components/grove_tb6612fng/grove_tb6612fng.h +++ b/esphome/components/grove_tb6612fng/grove_tb6612fng.h @@ -4,7 +4,7 @@ #include "esphome/core/automation.h" #include "esphome/core/component.h" #include "esphome/core/hal.h" -//#include "esphome/core/helpers.h" +// #include "esphome/core/helpers.h" /* Grove_Motor_Driver_TB6612FNG.h @@ -33,8 +33,7 @@ THE SOFTWARE. */ -namespace esphome { -namespace grove_tb6612fng { +namespace esphome::grove_tb6612fng { enum MotorChannelTypeT { MOTOR_CHA = 0, @@ -219,5 +218,4 @@ class GROVETB6612FNGMotorChangeAddressAction : public Action, public Pare void play(const Ts &...x) override { this->parent_->set_i2c_addr(this->address_.value(x...)); } }; -} // namespace grove_tb6612fng -} // namespace esphome +} // namespace esphome::grove_tb6612fng diff --git a/esphome/components/growatt_solar/growatt_solar.cpp b/esphome/components/growatt_solar/growatt_solar.cpp index 2997425872..41beb6e4e9 100644 --- a/esphome/components/growatt_solar/growatt_solar.cpp +++ b/esphome/components/growatt_solar/growatt_solar.cpp @@ -3,8 +3,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace growatt_solar { +namespace esphome::growatt_solar { static const char *const TAG = "growatt_solar"; @@ -141,5 +140,4 @@ void GrowattSolar::dump_config() { this->address_); } -} // namespace growatt_solar -} // namespace esphome +} // namespace esphome::growatt_solar diff --git a/esphome/components/growatt_solar/growatt_solar.h b/esphome/components/growatt_solar/growatt_solar.h index 833d6a36dd..7eba795601 100644 --- a/esphome/components/growatt_solar/growatt_solar.h +++ b/esphome/components/growatt_solar/growatt_solar.h @@ -6,8 +6,7 @@ #include -namespace esphome { -namespace growatt_solar { +namespace esphome::growatt_solar { static const float TWO_DEC_UNIT = 0.01; static const float ONE_DEC_UNIT = 0.1; @@ -83,5 +82,4 @@ class GrowattSolar : public PollingComponent, public modbus::ModbusDevice { GrowattProtocolVersion protocol_version_; }; -} // namespace growatt_solar -} // namespace esphome +} // namespace esphome::growatt_solar diff --git a/esphome/components/gt911/binary_sensor/gt911_button.cpp b/esphome/components/gt911/binary_sensor/gt911_button.cpp index 35ffaecefc..7b356f3946 100644 --- a/esphome/components/gt911/binary_sensor/gt911_button.cpp +++ b/esphome/components/gt911/binary_sensor/gt911_button.cpp @@ -1,8 +1,7 @@ #include "gt911_button.h" #include "esphome/core/log.h" -namespace esphome { -namespace gt911 { +namespace esphome::gt911 { static const char *const TAG = "GT911.binary_sensor"; @@ -23,5 +22,4 @@ void GT911Button::update_button(uint8_t index, bool state) { this->publish_state(state); } -} // namespace gt911 -} // namespace esphome +} // namespace esphome::gt911 diff --git a/esphome/components/gt911/binary_sensor/gt911_button.h b/esphome/components/gt911/binary_sensor/gt911_button.h index 556ed65f91..5aab457095 100644 --- a/esphome/components/gt911/binary_sensor/gt911_button.h +++ b/esphome/components/gt911/binary_sensor/gt911_button.h @@ -5,8 +5,7 @@ #include "esphome/core/component.h" #include "esphome/core/helpers.h" -namespace esphome { -namespace gt911 { +namespace esphome::gt911 { class GT911Button : public binary_sensor::BinarySensor, public Component, @@ -24,5 +23,4 @@ class GT911Button : public binary_sensor::BinarySensor, uint8_t index_; }; -} // namespace gt911 -} // namespace esphome +} // namespace esphome::gt911 diff --git a/esphome/components/gt911/touchscreen/gt911_touchscreen.cpp b/esphome/components/gt911/touchscreen/gt911_touchscreen.cpp index 17bfa82cb4..2152ae7b84 100644 --- a/esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +++ b/esphome/components/gt911/touchscreen/gt911_touchscreen.cpp @@ -4,8 +4,7 @@ #include "esphome/core/log.h" #include "esphome/core/gpio.h" -namespace esphome { -namespace gt911 { +namespace esphome::gt911 { static const char *const TAG = "gt911.touchscreen"; @@ -157,5 +156,4 @@ void GT911Touchscreen::dump_config() { LOG_PIN(" Reset Pin: ", this->reset_pin_); } -} // namespace gt911 -} // namespace esphome +} // namespace esphome::gt911 diff --git a/esphome/components/gt911/touchscreen/gt911_touchscreen.h b/esphome/components/gt911/touchscreen/gt911_touchscreen.h index a6577b5879..0f1eeae720 100644 --- a/esphome/components/gt911/touchscreen/gt911_touchscreen.h +++ b/esphome/components/gt911/touchscreen/gt911_touchscreen.h @@ -5,8 +5,7 @@ #include "esphome/core/component.h" #include "esphome/core/hal.h" -namespace esphome { -namespace gt911 { +namespace esphome::gt911 { class GT911ButtonListener { public: @@ -57,5 +56,4 @@ class GT911Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice uint8_t button_state_{0xFF}; // last button state. Initial FF guarantees first update. }; -} // namespace gt911 -} // namespace esphome +} // namespace esphome::gt911 diff --git a/esphome/components/haier/automation.h b/esphome/components/haier/automation.h index c1ce7c01ea..e345867d6f 100644 --- a/esphome/components/haier/automation.h +++ b/esphome/components/haier/automation.h @@ -4,8 +4,7 @@ #include "haier_base.h" #include "hon_climate.h" -namespace esphome { -namespace haier { +namespace esphome::haier { template class DisplayOnAction : public Action { public: @@ -126,5 +125,4 @@ template class PowerToggleAction : public Action { HaierClimateBase *parent_; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/button/self_cleaning.cpp b/esphome/components/haier/button/self_cleaning.cpp index 128726036e..bf4baa716e 100644 --- a/esphome/components/haier/button/self_cleaning.cpp +++ b/esphome/components/haier/button/self_cleaning.cpp @@ -1,9 +1,7 @@ #include "self_cleaning.h" -namespace esphome { -namespace haier { +namespace esphome::haier { void SelfCleaningButton::press_action() { this->parent_->start_self_cleaning(); } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/button/self_cleaning.h b/esphome/components/haier/button/self_cleaning.h index 308fb70f06..9d330e4dfe 100644 --- a/esphome/components/haier/button/self_cleaning.h +++ b/esphome/components/haier/button/self_cleaning.h @@ -3,8 +3,7 @@ #include "esphome/components/button/button.h" #include "../hon_climate.h" -namespace esphome { -namespace haier { +namespace esphome::haier { class SelfCleaningButton : public button::Button, public Parented { public: @@ -14,5 +13,4 @@ class SelfCleaningButton : public button::Button, public Parented { void press_action() override; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/button/steri_cleaning.cpp b/esphome/components/haier/button/steri_cleaning.cpp index 02b723f1a4..8c4f5808b2 100644 --- a/esphome/components/haier/button/steri_cleaning.cpp +++ b/esphome/components/haier/button/steri_cleaning.cpp @@ -1,9 +1,7 @@ #include "steri_cleaning.h" -namespace esphome { -namespace haier { +namespace esphome::haier { void SteriCleaningButton::press_action() { this->parent_->start_steri_cleaning(); } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/button/steri_cleaning.h b/esphome/components/haier/button/steri_cleaning.h index 6cad313fb3..cac02dd267 100644 --- a/esphome/components/haier/button/steri_cleaning.h +++ b/esphome/components/haier/button/steri_cleaning.h @@ -3,8 +3,7 @@ #include "esphome/components/button/button.h" #include "../hon_climate.h" -namespace esphome { -namespace haier { +namespace esphome::haier { class SteriCleaningButton : public button::Button, public Parented { public: @@ -14,5 +13,4 @@ class SteriCleaningButton : public button::Button, public Parented { void press_action() override; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/haier_base.cpp b/esphome/components/haier/haier_base.cpp index 4a06066d3c..74a218263d 100644 --- a/esphome/components/haier/haier_base.cpp +++ b/esphome/components/haier/haier_base.cpp @@ -10,8 +10,7 @@ using namespace esphome::climate; using namespace esphome::uart; -namespace esphome { -namespace haier { +namespace esphome::haier { static const char *const TAG = "haier.climate"; constexpr size_t COMMUNICATION_TIMEOUT_MS = 60000; @@ -418,5 +417,4 @@ void HaierClimateBase::send_message_(const haier_protocol::HaierMessage &command this->last_request_timestamp_ = std::chrono::steady_clock::now(); } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/haier_base.h b/esphome/components/haier/haier_base.h index 0c416623c0..13e8d7548d 100644 --- a/esphome/components/haier/haier_base.h +++ b/esphome/components/haier/haier_base.h @@ -11,8 +11,7 @@ #include "esphome/components/switch/switch.h" #endif -namespace esphome { -namespace haier { +namespace esphome::haier { enum class ActionRequest : uint8_t { SEND_CUSTOM_COMMAND = 0, @@ -177,5 +176,4 @@ class HaierClimateBase : public esphome::Component, ESPPreferenceObject base_rtc_; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/hon_climate.cpp b/esphome/components/haier/hon_climate.cpp index 87b8add2a3..0ad9b00ce4 100644 --- a/esphome/components/haier/hon_climate.cpp +++ b/esphome/components/haier/hon_climate.cpp @@ -9,8 +9,7 @@ using namespace esphome::climate; using namespace esphome::uart; -namespace esphome { -namespace haier { +namespace esphome::haier { static const char *const TAG = "haier.climate"; constexpr size_t SIGNAL_LEVEL_UPDATE_INTERVAL_MS = 10000; @@ -1370,5 +1369,4 @@ bool HonClimate::should_get_big_data_() { return false; } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/hon_climate.h b/esphome/components/haier/hon_climate.h index a0bcdfb548..5b477a5cea 100644 --- a/esphome/components/haier/hon_climate.h +++ b/esphome/components/haier/hon_climate.h @@ -18,8 +18,7 @@ #include "haier_base.h" #include "hon_packet.h" -namespace esphome { -namespace haier { +namespace esphome::haier { enum class CleaningState : uint8_t { NO_CLEANING = 0, @@ -201,5 +200,4 @@ class HonClimate : public HaierClimateBase { SwitchState quiet_mode_state_{SwitchState::OFF}; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/hon_packet.h b/esphome/components/haier/hon_packet.h index 615f93528e..63799f04ba 100644 --- a/esphome/components/haier/hon_packet.h +++ b/esphome/components/haier/hon_packet.h @@ -2,9 +2,7 @@ #include -namespace esphome { -namespace haier { -namespace hon_protocol { +namespace esphome::haier::hon_protocol { enum class VerticalSwingMode : uint8_t { HEALTH_UP = 0x01, @@ -255,6 +253,4 @@ const std::string HON_ALARM_MESSAGES[] = { constexpr size_t HON_ALARM_COUNT = sizeof(HON_ALARM_MESSAGES) / sizeof(HON_ALARM_MESSAGES[0]); -} // namespace hon_protocol -} // namespace haier -} // namespace esphome +} // namespace esphome::haier::hon_protocol diff --git a/esphome/components/haier/logger_handler.cpp b/esphome/components/haier/logger_handler.cpp index f886318097..1c4004cf6c 100644 --- a/esphome/components/haier/logger_handler.cpp +++ b/esphome/components/haier/logger_handler.cpp @@ -1,8 +1,7 @@ #include "logger_handler.h" #include "esphome/core/log.h" -namespace esphome { -namespace haier { +namespace esphome::haier { void esphome_logger(haier_protocol::HaierLogLevel level, const char *tag, const char *message) { switch (level) { @@ -29,5 +28,4 @@ void esphome_logger(haier_protocol::HaierLogLevel level, const char *tag, const void init_haier_protocol_logging() { haier_protocol::set_log_handler(esphome::haier::esphome_logger); }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/logger_handler.h b/esphome/components/haier/logger_handler.h index 2955468f37..192259409f 100644 --- a/esphome/components/haier/logger_handler.h +++ b/esphome/components/haier/logger_handler.h @@ -3,12 +3,10 @@ // HaierProtocol #include -namespace esphome { -namespace haier { +namespace esphome::haier { // This file is called in the code generated by python script // Do not use it directly! void init_haier_protocol_logging(); -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/smartair2_climate.cpp b/esphome/components/haier/smartair2_climate.cpp index 752f4d4f1c..bd5678a425 100644 --- a/esphome/components/haier/smartair2_climate.cpp +++ b/esphome/components/haier/smartair2_climate.cpp @@ -7,8 +7,7 @@ using namespace esphome::climate; using namespace esphome::uart; -namespace esphome { -namespace haier { +namespace esphome::haier { static const char *const TAG = "haier.climate"; constexpr size_t SIGNAL_LEVEL_UPDATE_INTERVAL_MS = 10000; @@ -555,5 +554,4 @@ void Smartair2Climate::set_alternative_swing_control(bool swing_control) { this->use_alternative_swing_control_ = swing_control; } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/smartair2_climate.h b/esphome/components/haier/smartair2_climate.h index 6914d8a1fb..68b0e4a0db 100644 --- a/esphome/components/haier/smartair2_climate.h +++ b/esphome/components/haier/smartair2_climate.h @@ -3,8 +3,7 @@ #include #include "haier_base.h" -namespace esphome { -namespace haier { +namespace esphome::haier { class Smartair2Climate : public HaierClimateBase { public: @@ -36,5 +35,4 @@ class Smartair2Climate : public HaierClimateBase { bool use_alternative_swing_control_; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/smartair2_packet.h b/esphome/components/haier/smartair2_packet.h index 22570ff048..144b7db879 100644 --- a/esphome/components/haier/smartair2_packet.h +++ b/esphome/components/haier/smartair2_packet.h @@ -1,8 +1,6 @@ #pragma once -namespace esphome { -namespace haier { -namespace smartair2_protocol { +namespace esphome::haier::smartair2_protocol { enum class ConditioningMode : uint8_t { AUTO = 0x00, COOL = 0x01, HEAT = 0x02, FAN = 0x03, DRY = 0x04 }; @@ -83,6 +81,4 @@ struct HaierStatus { HaierPacketControl control; }; -} // namespace smartair2_protocol -} // namespace haier -} // namespace esphome +} // namespace esphome::haier::smartair2_protocol diff --git a/esphome/components/haier/switch/beeper.cpp b/esphome/components/haier/switch/beeper.cpp index 1ce64d0848..40b048be5c 100644 --- a/esphome/components/haier/switch/beeper.cpp +++ b/esphome/components/haier/switch/beeper.cpp @@ -1,7 +1,6 @@ #include "beeper.h" -namespace esphome { -namespace haier { +namespace esphome::haier { void BeeperSwitch::write_state(bool state) { if (this->parent_->get_beeper_state() != state) { @@ -10,5 +9,4 @@ void BeeperSwitch::write_state(bool state) { this->publish_state(state); } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/switch/beeper.h b/esphome/components/haier/switch/beeper.h index 7396a7a0dd..2d20f1cd83 100644 --- a/esphome/components/haier/switch/beeper.h +++ b/esphome/components/haier/switch/beeper.h @@ -3,8 +3,7 @@ #include "esphome/components/switch/switch.h" #include "../hon_climate.h" -namespace esphome { -namespace haier { +namespace esphome::haier { class BeeperSwitch : public switch_::Switch, public Parented { public: @@ -14,5 +13,4 @@ class BeeperSwitch : public switch_::Switch, public Parented { void write_state(bool state) override; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/switch/display.cpp b/esphome/components/haier/switch/display.cpp index 5e24843dcf..e34b45985f 100644 --- a/esphome/components/haier/switch/display.cpp +++ b/esphome/components/haier/switch/display.cpp @@ -1,7 +1,6 @@ #include "display.h" -namespace esphome { -namespace haier { +namespace esphome::haier { void DisplaySwitch::write_state(bool state) { if (this->parent_->get_display_state() != state) { @@ -10,5 +9,4 @@ void DisplaySwitch::write_state(bool state) { this->publish_state(state); } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/switch/display.h b/esphome/components/haier/switch/display.h index f93ccfcdb7..9baf3b9fb8 100644 --- a/esphome/components/haier/switch/display.h +++ b/esphome/components/haier/switch/display.h @@ -3,8 +3,7 @@ #include "esphome/components/switch/switch.h" #include "../haier_base.h" -namespace esphome { -namespace haier { +namespace esphome::haier { class DisplaySwitch : public switch_::Switch, public Parented { public: @@ -14,5 +13,4 @@ class DisplaySwitch : public switch_::Switch, public Parented void write_state(bool state) override; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/switch/health_mode.cpp b/esphome/components/haier/switch/health_mode.cpp index 3715759bdd..c8656fe0d4 100644 --- a/esphome/components/haier/switch/health_mode.cpp +++ b/esphome/components/haier/switch/health_mode.cpp @@ -1,7 +1,6 @@ #include "health_mode.h" -namespace esphome { -namespace haier { +namespace esphome::haier { void HealthModeSwitch::write_state(bool state) { if (this->parent_->get_health_mode() != state) { @@ -10,5 +9,4 @@ void HealthModeSwitch::write_state(bool state) { this->publish_state(state); } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/switch/health_mode.h b/esphome/components/haier/switch/health_mode.h index cfd2aa2f22..ec77b1638a 100644 --- a/esphome/components/haier/switch/health_mode.h +++ b/esphome/components/haier/switch/health_mode.h @@ -3,8 +3,7 @@ #include "esphome/components/switch/switch.h" #include "../haier_base.h" -namespace esphome { -namespace haier { +namespace esphome::haier { class HealthModeSwitch : public switch_::Switch, public Parented { public: @@ -14,5 +13,4 @@ class HealthModeSwitch : public switch_::Switch, public Parentedparent_->get_quiet_mode_state() != state) { @@ -10,5 +9,4 @@ void QuietModeSwitch::write_state(bool state) { this->publish_state(state); } -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/haier/switch/quiet_mode.h b/esphome/components/haier/switch/quiet_mode.h index bad5289500..8ef7b5bb89 100644 --- a/esphome/components/haier/switch/quiet_mode.h +++ b/esphome/components/haier/switch/quiet_mode.h @@ -3,8 +3,7 @@ #include "esphome/components/switch/switch.h" #include "../hon_climate.h" -namespace esphome { -namespace haier { +namespace esphome::haier { class QuietModeSwitch : public switch_::Switch, public Parented { public: @@ -14,5 +13,4 @@ class QuietModeSwitch : public switch_::Switch, public Parented { void write_state(bool state) override; }; -} // namespace haier -} // namespace esphome +} // namespace esphome::haier diff --git a/esphome/components/havells_solar/havells_solar.cpp b/esphome/components/havells_solar/havells_solar.cpp index 20dddf39ed..9257a37fd9 100644 --- a/esphome/components/havells_solar/havells_solar.cpp +++ b/esphome/components/havells_solar/havells_solar.cpp @@ -3,8 +3,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace havells_solar { +namespace esphome::havells_solar { static const char *const TAG = "havells_solar"; @@ -164,5 +163,4 @@ void HavellsSolar::dump_config() { LOG_SENSOR(" ", "DCI Of T", this->dci_of_t_sensor_); } -} // namespace havells_solar -} // namespace esphome +} // namespace esphome::havells_solar diff --git a/esphome/components/havells_solar/havells_solar.h b/esphome/components/havells_solar/havells_solar.h index f3ac8fafcf..c54b0dcf14 100644 --- a/esphome/components/havells_solar/havells_solar.h +++ b/esphome/components/havells_solar/havells_solar.h @@ -6,8 +6,7 @@ #include -namespace esphome { -namespace havells_solar { +namespace esphome::havells_solar { class HavellsSolar : public PollingComponent, public modbus::ModbusDevice { public: @@ -113,5 +112,4 @@ class HavellsSolar : public PollingComponent, public modbus::ModbusDevice { sensor::Sensor *dci_of_t_sensor_{nullptr}; }; -} // namespace havells_solar -} // namespace esphome +} // namespace esphome::havells_solar diff --git a/esphome/components/havells_solar/havells_solar_registers.h b/esphome/components/havells_solar/havells_solar_registers.h index 8e1cb3ec7a..4ed797b3e7 100644 --- a/esphome/components/havells_solar/havells_solar_registers.h +++ b/esphome/components/havells_solar/havells_solar_registers.h @@ -1,6 +1,6 @@ #pragma once -namespace esphome { -namespace havells_solar { + +namespace esphome::havells_solar { static const float TWO_DEC_UNIT = 0.01; static const float ONE_DEC_UNIT = 0.1; @@ -45,5 +45,4 @@ static const uint16_t HAVELLS_GFCI_VALUE = 0x002A; static const uint16_t HAVELLS_DCI_OF_R = 0x002B; static const uint16_t HAVELLS_DCI_OF_S = 0x002C; static const uint16_t HAVELLS_DCI_OF_T = 0x002D; -} // namespace havells_solar -} // namespace esphome +} // namespace esphome::havells_solar diff --git a/esphome/components/hbridge/fan/hbridge_fan.cpp b/esphome/components/hbridge/fan/hbridge_fan.cpp index d548128b99..fc2a738e8d 100644 --- a/esphome/components/hbridge/fan/hbridge_fan.cpp +++ b/esphome/components/hbridge/fan/hbridge_fan.cpp @@ -1,8 +1,7 @@ #include "hbridge_fan.h" #include "esphome/core/log.h" -namespace esphome { -namespace hbridge { +namespace esphome::hbridge { static const char *const TAG = "fan.hbridge"; @@ -93,5 +92,4 @@ void HBridgeFan::write_state_() { this->oscillating_->set_state(this->oscillating); } -} // namespace hbridge -} // namespace esphome +} // namespace esphome::hbridge diff --git a/esphome/components/hbridge/fan/hbridge_fan.h b/esphome/components/hbridge/fan/hbridge_fan.h index 997f66ae48..62149d99cd 100644 --- a/esphome/components/hbridge/fan/hbridge_fan.h +++ b/esphome/components/hbridge/fan/hbridge_fan.h @@ -5,8 +5,7 @@ #include "esphome/components/output/float_output.h" #include "esphome/components/fan/fan.h" -namespace esphome { -namespace hbridge { +namespace esphome::hbridge { enum DecayMode { DECAY_MODE_SLOW = 0, @@ -56,5 +55,4 @@ template class BrakeAction : public Action { HBridgeFan *parent_; }; -} // namespace hbridge -} // namespace esphome +} // namespace esphome::hbridge diff --git a/esphome/components/hbridge/light/hbridge_light_output.h b/esphome/components/hbridge/light/hbridge_light_output.h index 4e064d5352..16408f24f1 100644 --- a/esphome/components/hbridge/light/hbridge_light_output.h +++ b/esphome/components/hbridge/light/hbridge_light_output.h @@ -5,8 +5,7 @@ #include "esphome/core/component.h" #include "esphome/core/helpers.h" -namespace esphome { -namespace hbridge { +namespace esphome::hbridge { class HBridgeLightOutput : public Component, public light::LightOutput { public: @@ -68,5 +67,4 @@ class HBridgeLightOutput : public Component, public light::LightOutput { HighFrequencyLoopRequester high_freq_; }; -} // namespace hbridge -} // namespace esphome +} // namespace esphome::hbridge diff --git a/esphome/components/hbridge/switch/hbridge_switch.cpp b/esphome/components/hbridge/switch/hbridge_switch.cpp index 55012fed21..1012a264f2 100644 --- a/esphome/components/hbridge/switch/hbridge_switch.cpp +++ b/esphome/components/hbridge/switch/hbridge_switch.cpp @@ -3,8 +3,7 @@ #include -namespace esphome { -namespace hbridge { +namespace esphome::hbridge { static const char *const TAG = "switch.hbridge"; @@ -89,5 +88,4 @@ void HBridgeSwitch::timer_fn_() { this->timer_running_ = false; } -} // namespace hbridge -} // namespace esphome +} // namespace esphome::hbridge diff --git a/esphome/components/hbridge/switch/hbridge_switch.h b/esphome/components/hbridge/switch/hbridge_switch.h index ce00c6baa2..de867271fe 100644 --- a/esphome/components/hbridge/switch/hbridge_switch.h +++ b/esphome/components/hbridge/switch/hbridge_switch.h @@ -6,8 +6,7 @@ #include -namespace esphome { -namespace hbridge { +namespace esphome::hbridge { enum RelayState : uint8_t { RELAY_STATE_OFF = 0, @@ -46,5 +45,4 @@ class HBridgeSwitch : public switch_::Switch, public Component { bool optimistic_{false}; }; -} // namespace hbridge -} // namespace esphome +} // namespace esphome::hbridge diff --git a/esphome/components/hdc1080/hdc1080.cpp b/esphome/components/hdc1080/hdc1080.cpp index fa293f6fc5..6692345e62 100644 --- a/esphome/components/hdc1080/hdc1080.cpp +++ b/esphome/components/hdc1080/hdc1080.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" -namespace esphome { -namespace hdc1080 { +namespace esphome::hdc1080 { static const char *const TAG = "hdc1080"; @@ -78,5 +77,4 @@ void HDC1080Component::update() { }); } -} // namespace hdc1080 -} // namespace esphome +} // namespace esphome::hdc1080 diff --git a/esphome/components/hdc1080/hdc1080.h b/esphome/components/hdc1080/hdc1080.h index a5bece82c4..1e3bf77788 100644 --- a/esphome/components/hdc1080/hdc1080.h +++ b/esphome/components/hdc1080/hdc1080.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace hdc1080 { +namespace esphome::hdc1080 { class HDC1080Component : public PollingComponent, public i2c::I2CDevice { public: @@ -21,5 +20,4 @@ class HDC1080Component : public PollingComponent, public i2c::I2CDevice { sensor::Sensor *humidity_{nullptr}; }; -} // namespace hdc1080 -} // namespace esphome +} // namespace esphome::hdc1080 diff --git a/esphome/components/hdc2010/hdc2010.cpp b/esphome/components/hdc2010/hdc2010.cpp index 0334b30eec..946cf4898f 100644 --- a/esphome/components/hdc2010/hdc2010.cpp +++ b/esphome/components/hdc2010/hdc2010.cpp @@ -2,8 +2,8 @@ #include "hdc2010.h" // https://github.com/vigsterkr/homebridge-hdc2010/blob/main/src/hdc2010.js // https://github.com/lime-labs/HDC2080-Arduino/blob/master/src/HDC2080.cpp -namespace esphome { -namespace hdc2010 { + +namespace esphome::hdc2010 { static const char *const TAG = "hdc2010"; @@ -93,5 +93,4 @@ float HDC2010Component::read_humidity() { return (float) humidity * 0.001525879f; } -} // namespace hdc2010 -} // namespace esphome +} // namespace esphome::hdc2010 diff --git a/esphome/components/hdc2010/hdc2010.h b/esphome/components/hdc2010/hdc2010.h index 52c00686e6..ad6df3ff48 100644 --- a/esphome/components/hdc2010/hdc2010.h +++ b/esphome/components/hdc2010/hdc2010.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace hdc2010 { +namespace esphome::hdc2010 { class HDC2010Component : public PollingComponent, public i2c::I2CDevice { public: @@ -28,5 +27,4 @@ class HDC2010Component : public PollingComponent, public i2c::I2CDevice { sensor::Sensor *humidity_sensor_{nullptr}; }; -} // namespace hdc2010 -} // namespace esphome +} // namespace esphome::hdc2010 diff --git a/esphome/components/he60r/he60r.cpp b/esphome/components/he60r/he60r.cpp index 47440cc1f7..84edbb2866 100644 --- a/esphome/components/he60r/he60r.cpp +++ b/esphome/components/he60r/he60r.cpp @@ -4,8 +4,7 @@ #include -namespace esphome { -namespace he60r { +namespace esphome::he60r { static const char *const TAG = "he60r.cover"; static const uint8_t QUERY_BYTE = 0x38; @@ -264,5 +263,4 @@ void HE60rCover::recompute_position_() { } } -} // namespace he60r -} // namespace esphome +} // namespace esphome::he60r diff --git a/esphome/components/he60r/he60r.h b/esphome/components/he60r/he60r.h index 02a2b44e66..e7b5c97969 100644 --- a/esphome/components/he60r/he60r.h +++ b/esphome/components/he60r/he60r.h @@ -5,8 +5,7 @@ #include "esphome/components/uart/uart.h" #include "esphome/components/cover/cover.h" -namespace esphome { -namespace he60r { +namespace esphome::he60r { class HE60rCover : public cover::Cover, public Component, public uart::UARTDevice { public: @@ -41,5 +40,4 @@ class HE60rCover : public cover::Cover, public Component, public uart::UARTDevic uint8_t counter_{}; }; -} // namespace he60r -} // namespace esphome +} // namespace esphome::he60r diff --git a/esphome/components/heatpumpir/heatpumpir.cpp b/esphome/components/heatpumpir/heatpumpir.cpp index 11e7672dc1..8e9a2c5298 100644 --- a/esphome/components/heatpumpir/heatpumpir.cpp +++ b/esphome/components/heatpumpir/heatpumpir.cpp @@ -8,8 +8,7 @@ #include "esphome/components/remote_base/remote_base.h" #include "esphome/core/log.h" -namespace esphome { -namespace heatpumpir { +namespace esphome::heatpumpir { // IRSenderESPHome - bridge between ESPHome's remote_transmitter and HeatpumpIR library // Defined here (not in a header) to isolate HeatpumpIR's headers from the rest of ESPHome, @@ -243,7 +242,6 @@ void HeatpumpIRClimate::transmit_state() { swing_h_cmd); } -} // namespace heatpumpir -} // namespace esphome +} // namespace esphome::heatpumpir #endif diff --git a/esphome/components/heatpumpir/heatpumpir.h b/esphome/components/heatpumpir/heatpumpir.h index 6270dd1e5a..a277424df6 100644 --- a/esphome/components/heatpumpir/heatpumpir.h +++ b/esphome/components/heatpumpir/heatpumpir.h @@ -8,8 +8,7 @@ // that conflict with ESPHome. class HeatpumpIR; -namespace esphome { -namespace heatpumpir { +namespace esphome::heatpumpir { // Simple enum to represent protocols. enum Protocol { @@ -126,7 +125,6 @@ class HeatpumpIRClimate : public climate_ir::ClimateIR { float min_temperature_; }; -} // namespace heatpumpir -} // namespace esphome +} // namespace esphome::heatpumpir #endif diff --git a/esphome/components/hitachi_ac344/hitachi_ac344.cpp b/esphome/components/hitachi_ac344/hitachi_ac344.cpp index 69469cab2e..ea211a7a59 100644 --- a/esphome/components/hitachi_ac344/hitachi_ac344.cpp +++ b/esphome/components/hitachi_ac344/hitachi_ac344.cpp @@ -1,7 +1,6 @@ #include "hitachi_ac344.h" -namespace esphome { -namespace hitachi_ac344 { +namespace esphome::hitachi_ac344 { static const char *const TAG = "climate.hitachi_ac344"; @@ -366,5 +365,4 @@ void HitachiClimate::dump_state_(const char action[], uint8_t state[]) { ESP_LOGV(TAG, "%s: %02X %02X %02X", action, state[40], state[41], state[42]); } -} // namespace hitachi_ac344 -} // namespace esphome +} // namespace esphome::hitachi_ac344 diff --git a/esphome/components/hitachi_ac344/hitachi_ac344.h b/esphome/components/hitachi_ac344/hitachi_ac344.h index 0877b83261..b9d776cc59 100644 --- a/esphome/components/hitachi_ac344/hitachi_ac344.h +++ b/esphome/components/hitachi_ac344/hitachi_ac344.h @@ -3,8 +3,7 @@ #include "esphome/core/log.h" #include "esphome/components/climate_ir/climate_ir.h" -namespace esphome { -namespace hitachi_ac344 { +namespace esphome::hitachi_ac344 { const uint16_t HITACHI_AC344_HDR_MARK = 3300; // ac const uint16_t HITACHI_AC344_HDR_SPACE = 1700; // ac @@ -117,5 +116,4 @@ class HitachiClimate : public climate_ir::ClimateIR { void dump_state_(const char action[], uint8_t remote_state[]); }; -} // namespace hitachi_ac344 -} // namespace esphome +} // namespace esphome::hitachi_ac344 diff --git a/esphome/components/hitachi_ac424/hitachi_ac424.cpp b/esphome/components/hitachi_ac424/hitachi_ac424.cpp index 0b3cc99a82..cdf8dda22c 100644 --- a/esphome/components/hitachi_ac424/hitachi_ac424.cpp +++ b/esphome/components/hitachi_ac424/hitachi_ac424.cpp @@ -1,7 +1,6 @@ #include "hitachi_ac424.h" -namespace esphome { -namespace hitachi_ac424 { +namespace esphome::hitachi_ac424 { static const char *const TAG = "climate.hitachi_ac424"; @@ -367,5 +366,4 @@ void HitachiClimate::dump_state_(const char action[], uint8_t state[]) { ESP_LOGV(TAG, "%s: %02X %02X %02X", action, state[40], state[41], state[42]); } -} // namespace hitachi_ac424 -} // namespace esphome +} // namespace esphome::hitachi_ac424 diff --git a/esphome/components/hitachi_ac424/hitachi_ac424.h b/esphome/components/hitachi_ac424/hitachi_ac424.h index 1005aa6df7..ef7f128a5a 100644 --- a/esphome/components/hitachi_ac424/hitachi_ac424.h +++ b/esphome/components/hitachi_ac424/hitachi_ac424.h @@ -3,8 +3,7 @@ #include "esphome/core/log.h" #include "esphome/components/climate_ir/climate_ir.h" -namespace esphome { -namespace hitachi_ac424 { +namespace esphome::hitachi_ac424 { const uint16_t HITACHI_AC424_HDR_MARK = 3416; // ac const uint16_t HITACHI_AC424_HDR_SPACE = 1604; // ac @@ -119,5 +118,4 @@ class HitachiClimate : public climate_ir::ClimateIR { void dump_state_(const char action[], uint8_t remote_state[]); }; -} // namespace hitachi_ac424 -} // namespace esphome +} // namespace esphome::hitachi_ac424 diff --git a/esphome/components/hlw8012/hlw8012.cpp b/esphome/components/hlw8012/hlw8012.cpp index 22f292e47e..c92c76a20a 100644 --- a/esphome/components/hlw8012/hlw8012.cpp +++ b/esphome/components/hlw8012/hlw8012.cpp @@ -1,8 +1,7 @@ #include "hlw8012.h" #include "esphome/core/log.h" -namespace esphome { -namespace hlw8012 { +namespace esphome::hlw8012 { static const char *const TAG = "hlw8012"; @@ -104,5 +103,4 @@ void HLW8012Component::update() { } } -} // namespace hlw8012 -} // namespace esphome +} // namespace esphome::hlw8012 diff --git a/esphome/components/hlw8012/hlw8012.h b/esphome/components/hlw8012/hlw8012.h index 8a13ec07d8..d1d340bf45 100644 --- a/esphome/components/hlw8012/hlw8012.h +++ b/esphome/components/hlw8012/hlw8012.h @@ -7,8 +7,7 @@ #include -namespace esphome { -namespace hlw8012 { +namespace esphome::hlw8012 { enum HLW8012InitialMode { HLW8012_INITIAL_MODE_CURRENT = 0, HLW8012_INITIAL_MODE_VOLTAGE }; @@ -72,5 +71,4 @@ class HLW8012Component : public PollingComponent { float power_multiplier_{0.0f}; }; -} // namespace hlw8012 -} // namespace esphome +} // namespace esphome::hlw8012 diff --git a/esphome/components/hm3301/hm3301.cpp b/esphome/components/hm3301/hm3301.cpp index 9343b47823..f46a6b8580 100644 --- a/esphome/components/hm3301/hm3301.cpp +++ b/esphome/components/hm3301/hm3301.cpp @@ -1,8 +1,7 @@ #include "esphome/core/log.h" #include "hm3301.h" -namespace esphome { -namespace hm3301 { +namespace esphome::hm3301 { static const char *const TAG = "hm3301.sensor"; @@ -94,5 +93,4 @@ uint16_t HM3301Component::get_sensor_value_(const uint8_t *data, uint8_t i) { return (uint16_t) data[i * 2] << 8 | data[i * 2 + 1]; } -} // namespace hm3301 -} // namespace esphome +} // namespace esphome::hm3301 diff --git a/esphome/components/hm3301/hm3301.h b/esphome/components/hm3301/hm3301.h index 6b10a5e237..55e708e34a 100644 --- a/esphome/components/hm3301/hm3301.h +++ b/esphome/components/hm3301/hm3301.h @@ -5,8 +5,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/components/aqi/aqi_calculator_factory.h" -namespace esphome { -namespace hm3301 { +namespace esphome::hm3301 { static const uint8_t SELECT_COMM_CMD = 0x88; @@ -47,5 +46,4 @@ class HM3301Component : public PollingComponent, public i2c::I2CDevice { uint16_t get_sensor_value_(const uint8_t *data, uint8_t i); }; -} // namespace hm3301 -} // namespace esphome +} // namespace esphome::hm3301 diff --git a/esphome/components/hmac_md5/hmac_md5.cpp b/esphome/components/hmac_md5/hmac_md5.cpp index d766a55fab..49a55592d3 100644 --- a/esphome/components/hmac_md5/hmac_md5.cpp +++ b/esphome/components/hmac_md5/hmac_md5.cpp @@ -4,8 +4,7 @@ #ifdef USE_MD5 #include "esphome/core/helpers.h" -namespace esphome { -namespace hmac_md5 { +namespace esphome::hmac_md5 { void HmacMD5::init(const uint8_t *key, size_t len) { uint8_t ipad[64], opad[64]; @@ -53,6 +52,6 @@ bool HmacMD5::equals_bytes(const uint8_t *expected) { return this->ohash_.equals bool HmacMD5::equals_hex(const char *expected) { return this->ohash_.equals_hex(expected); } -} // namespace hmac_md5 -} // namespace esphome +} // namespace esphome::hmac_md5 + #endif diff --git a/esphome/components/hmac_md5/hmac_md5.h b/esphome/components/hmac_md5/hmac_md5.h index fb9479e3af..c2fd7f2800 100644 --- a/esphome/components/hmac_md5/hmac_md5.h +++ b/esphome/components/hmac_md5/hmac_md5.h @@ -5,8 +5,7 @@ #include "esphome/components/md5/md5.h" #include -namespace esphome { -namespace hmac_md5 { +namespace esphome::hmac_md5 { class HmacMD5 { public: @@ -44,6 +43,6 @@ class HmacMD5 { md5::MD5Digest ohash_; }; -} // namespace hmac_md5 -} // namespace esphome +} // namespace esphome::hmac_md5 + #endif diff --git a/esphome/components/hmc5883l/hmc5883l.cpp b/esphome/components/hmc5883l/hmc5883l.cpp index bee5282125..7930df7a38 100644 --- a/esphome/components/hmc5883l/hmc5883l.cpp +++ b/esphome/components/hmc5883l/hmc5883l.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/application.h" -namespace esphome { -namespace hmc5883l { +namespace esphome::hmc5883l { static const char *const TAG = "hmc5883l"; static const uint8_t HMC5883L_ADDRESS = 0x1E; @@ -140,5 +139,4 @@ void HMC5883LComponent::update() { this->heading_sensor_->publish_state(heading); } -} // namespace hmc5883l -} // namespace esphome +} // namespace esphome::hmc5883l diff --git a/esphome/components/hmc5883l/hmc5883l.h b/esphome/components/hmc5883l/hmc5883l.h index b5cf93e62b..4f170d7401 100644 --- a/esphome/components/hmc5883l/hmc5883l.h +++ b/esphome/components/hmc5883l/hmc5883l.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace hmc5883l { +namespace esphome::hmc5883l { enum HMC5883LOversampling { HMC5883L_OVERSAMPLING_1 = 0b000, @@ -65,5 +64,4 @@ class HMC5883LComponent : public PollingComponent, public i2c::I2CDevice { HighFrequencyLoopRequester high_freq_; }; -} // namespace hmc5883l -} // namespace esphome +} // namespace esphome::hmc5883l diff --git a/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.cpp b/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.cpp index b0d9135822..735fb9f5da 100644 --- a/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.cpp +++ b/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.cpp @@ -3,8 +3,7 @@ #include "esphome/core/log.h" #include "esphome/core/string_ref.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { static const char *const TAG = "homeassistant.binary_sensor"; @@ -43,5 +42,4 @@ void HomeassistantBinarySensor::dump_config() { } float HomeassistantBinarySensor::get_setup_priority() const { return setup_priority::AFTER_WIFI; } -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.h b/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.h index 9aec61a370..6d95ea2c60 100644 --- a/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.h +++ b/esphome/components/homeassistant/binary_sensor/homeassistant_binary_sensor.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/binary_sensor/binary_sensor.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { class HomeassistantBinarySensor : public binary_sensor::BinarySensor, public Component { public: @@ -20,5 +19,4 @@ class HomeassistantBinarySensor : public binary_sensor::BinarySensor, public Com bool initial_{true}; }; -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/number/homeassistant_number.cpp b/esphome/components/homeassistant/number/homeassistant_number.cpp index da802b7fe9..965f91d202 100644 --- a/esphome/components/homeassistant/number/homeassistant_number.cpp +++ b/esphome/components/homeassistant/number/homeassistant_number.cpp @@ -5,8 +5,7 @@ #include "esphome/core/log.h" #include "esphome/core/string_ref.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { static const char *const TAG = "homeassistant.number"; @@ -103,5 +102,4 @@ void HomeassistantNumber::control(float value) { api::global_api_server->send_homeassistant_action(resp); } -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/number/homeassistant_number.h b/esphome/components/homeassistant/number/homeassistant_number.h index 275d2d5f03..a1e351fdf4 100644 --- a/esphome/components/homeassistant/number/homeassistant_number.h +++ b/esphome/components/homeassistant/number/homeassistant_number.h @@ -4,8 +4,7 @@ #include "esphome/core/component.h" #include "esphome/core/string_ref.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { class HomeassistantNumber : public number::Number, public Component { public: @@ -25,5 +24,4 @@ class HomeassistantNumber : public number::Number, public Component { const char *entity_id_{nullptr}; }; -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/sensor/homeassistant_sensor.cpp b/esphome/components/homeassistant/sensor/homeassistant_sensor.cpp index 66300ebba5..112795a4ff 100644 --- a/esphome/components/homeassistant/sensor/homeassistant_sensor.cpp +++ b/esphome/components/homeassistant/sensor/homeassistant_sensor.cpp @@ -3,8 +3,7 @@ #include "esphome/core/log.h" #include "esphome/core/string_ref.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { static const char *const TAG = "homeassistant.sensor"; @@ -34,5 +33,4 @@ void HomeassistantSensor::dump_config() { } float HomeassistantSensor::get_setup_priority() const { return setup_priority::AFTER_CONNECTION; } -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/sensor/homeassistant_sensor.h b/esphome/components/homeassistant/sensor/homeassistant_sensor.h index d89fc069ff..afc4935537 100644 --- a/esphome/components/homeassistant/sensor/homeassistant_sensor.h +++ b/esphome/components/homeassistant/sensor/homeassistant_sensor.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/sensor/sensor.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { class HomeassistantSensor : public sensor::Sensor, public Component { public: @@ -19,5 +18,4 @@ class HomeassistantSensor : public sensor::Sensor, public Component { const char *attribute_{nullptr}; }; -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/switch/homeassistant_switch.cpp b/esphome/components/homeassistant/switch/homeassistant_switch.cpp index cc3d582bf3..8a4ea19f2e 100644 --- a/esphome/components/homeassistant/switch/homeassistant_switch.cpp +++ b/esphome/components/homeassistant/switch/homeassistant_switch.cpp @@ -3,8 +3,7 @@ #include "esphome/core/log.h" #include "esphome/core/string_ref.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { static const char *const TAG = "homeassistant.switch"; @@ -60,5 +59,4 @@ void HomeassistantSwitch::write_state(bool state) { api::global_api_server->send_homeassistant_action(resp); } -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/switch/homeassistant_switch.h b/esphome/components/homeassistant/switch/homeassistant_switch.h index c180b7f98a..c6c178c205 100644 --- a/esphome/components/homeassistant/switch/homeassistant_switch.h +++ b/esphome/components/homeassistant/switch/homeassistant_switch.h @@ -3,8 +3,7 @@ #include "esphome/components/switch/switch.h" #include "esphome/core/component.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { class HomeassistantSwitch : public switch_::Switch, public Component { public: @@ -18,5 +17,4 @@ class HomeassistantSwitch : public switch_::Switch, public Component { const char *entity_id_{nullptr}; }; -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp b/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp index 109574e0c8..40d7455ece 100644 --- a/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp +++ b/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp @@ -3,8 +3,7 @@ #include "esphome/core/log.h" #include "esphome/core/string_ref.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { static const char *const TAG = "homeassistant.text_sensor"; @@ -26,5 +25,4 @@ void HomeassistantTextSensor::dump_config() { } } float HomeassistantTextSensor::get_setup_priority() const { return setup_priority::AFTER_CONNECTION; } -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.h b/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.h index 4d66c65a17..8af81cefcb 100644 --- a/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.h +++ b/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.h @@ -3,8 +3,7 @@ #include "esphome/core/component.h" #include "esphome/components/text_sensor/text_sensor.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { class HomeassistantTextSensor : public text_sensor::TextSensor, public Component { public: @@ -19,5 +18,4 @@ class HomeassistantTextSensor : public text_sensor::TextSensor, public Component const char *attribute_{nullptr}; }; -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/time/homeassistant_time.cpp b/esphome/components/homeassistant/time/homeassistant_time.cpp index d039892073..c08bd73d62 100644 --- a/esphome/components/homeassistant/time/homeassistant_time.cpp +++ b/esphome/components/homeassistant/time/homeassistant_time.cpp @@ -1,8 +1,7 @@ #include "homeassistant_time.h" #include "esphome/core/log.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { static const char *const TAG = "homeassistant.time"; @@ -16,5 +15,4 @@ void HomeassistantTime::setup() { global_homeassistant_time = this; } void HomeassistantTime::update() { api::global_api_server->request_time(); } HomeassistantTime *global_homeassistant_time = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/homeassistant/time/homeassistant_time.h b/esphome/components/homeassistant/time/homeassistant_time.h index 455ded2022..77edb50cd0 100644 --- a/esphome/components/homeassistant/time/homeassistant_time.h +++ b/esphome/components/homeassistant/time/homeassistant_time.h @@ -4,8 +4,7 @@ #include "esphome/components/time/real_time_clock.h" #include "esphome/components/api/api_server.h" -namespace esphome { -namespace homeassistant { +namespace esphome::homeassistant { class HomeassistantTime final : public time::RealTimeClock { public: @@ -17,5 +16,4 @@ class HomeassistantTime final : public time::RealTimeClock { extern HomeassistantTime *global_homeassistant_time; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) -} // namespace homeassistant -} // namespace esphome +} // namespace esphome::homeassistant diff --git a/esphome/components/honeywell_hih_i2c/honeywell_hih.cpp b/esphome/components/honeywell_hih_i2c/honeywell_hih.cpp index 904672d136..7f075847fd 100644 --- a/esphome/components/honeywell_hih_i2c/honeywell_hih.cpp +++ b/esphome/components/honeywell_hih_i2c/honeywell_hih.cpp @@ -5,8 +5,7 @@ #include "honeywell_hih.h" #include "esphome/core/log.h" -namespace esphome { -namespace honeywell_hih_i2c { +namespace esphome::honeywell_hih_i2c { static const char *const TAG = "honeywell_hih.i2c"; @@ -91,5 +90,4 @@ void HoneywellHIComponent::dump_config() { LOG_UPDATE_INTERVAL(this); } -} // namespace honeywell_hih_i2c -} // namespace esphome +} // namespace esphome::honeywell_hih_i2c diff --git a/esphome/components/honeywell_hih_i2c/honeywell_hih.h b/esphome/components/honeywell_hih_i2c/honeywell_hih.h index 79140f7399..d9ea6401ce 100644 --- a/esphome/components/honeywell_hih_i2c/honeywell_hih.h +++ b/esphome/components/honeywell_hih_i2c/honeywell_hih.h @@ -5,8 +5,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace honeywell_hih_i2c { +namespace esphome::honeywell_hih_i2c { class HoneywellHIComponent : public PollingComponent, public i2c::I2CDevice { public: @@ -29,5 +28,4 @@ class HoneywellHIComponent : public PollingComponent, public i2c::I2CDevice { void measurement_timeout_(); }; -} // namespace honeywell_hih_i2c -} // namespace esphome +} // namespace esphome::honeywell_hih_i2c diff --git a/esphome/components/honeywellabp/honeywellabp.cpp b/esphome/components/honeywellabp/honeywellabp.cpp index 58c5df230f..8bfc5e4f4f 100644 --- a/esphome/components/honeywellabp/honeywellabp.cpp +++ b/esphome/components/honeywellabp/honeywellabp.cpp @@ -1,8 +1,7 @@ #include "honeywellabp.h" #include "esphome/core/log.h" -namespace esphome { -namespace honeywellabp { +namespace esphome::honeywellabp { static const char *const TAG = "honeywellabp"; @@ -96,5 +95,4 @@ void HONEYWELLABPSensor::set_honeywellabp_max_pressure(float max_pressure) { this->honeywellabp_max_pressure_ = max_pressure; } -} // namespace honeywellabp -} // namespace esphome +} // namespace esphome::honeywellabp diff --git a/esphome/components/honeywellabp/honeywellabp.h b/esphome/components/honeywellabp/honeywellabp.h index 98f6f08c4a..3c31968c49 100644 --- a/esphome/components/honeywellabp/honeywellabp.h +++ b/esphome/components/honeywellabp/honeywellabp.h @@ -6,8 +6,7 @@ #include "esphome/components/spi/spi.h" #include "esphome/core/component.h" -namespace esphome { -namespace honeywellabp { +namespace esphome::honeywellabp { class HONEYWELLABPSensor : public PollingComponent, public spi::SPIDevicecheck_uart_settings(9600, 1, esphome::uart::UART_CONFIG_PARITY_NONE, 8); } -} // namespace hrxl_maxsonar_wr -} // namespace esphome +} // namespace esphome::hrxl_maxsonar_wr diff --git a/esphome/components/hrxl_maxsonar_wr/hrxl_maxsonar_wr.h b/esphome/components/hrxl_maxsonar_wr/hrxl_maxsonar_wr.h index efb8bc5f4b..e98eeea723 100644 --- a/esphome/components/hrxl_maxsonar_wr/hrxl_maxsonar_wr.h +++ b/esphome/components/hrxl_maxsonar_wr/hrxl_maxsonar_wr.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/uart/uart.h" -namespace esphome { -namespace hrxl_maxsonar_wr { +namespace esphome::hrxl_maxsonar_wr { class HrxlMaxsonarWrComponent : public sensor::Sensor, public Component, public uart::UARTDevice { public: @@ -21,5 +20,4 @@ class HrxlMaxsonarWrComponent : public sensor::Sensor, public Component, public std::string buffer_; }; -} // namespace hrxl_maxsonar_wr -} // namespace esphome +} // namespace esphome::hrxl_maxsonar_wr diff --git a/esphome/components/hte501/hte501.cpp b/esphome/components/hte501/hte501.cpp index ef9ef1fabf..67bfb1917e 100644 --- a/esphome/components/hte501/hte501.cpp +++ b/esphome/components/hte501/hte501.cpp @@ -2,8 +2,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace hte501 { +namespace esphome::hte501 { static const char *const TAG = "hte501"; @@ -71,5 +70,4 @@ void HTE501Component::update() { this->status_clear_warning(); }); } -} // namespace hte501 -} // namespace esphome +} // namespace esphome::hte501 diff --git a/esphome/components/hte501/hte501.h b/esphome/components/hte501/hte501.h index 7f29885f49..310073f88b 100644 --- a/esphome/components/hte501/hte501.h +++ b/esphome/components/hte501/hte501.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/core/component.h" -namespace esphome { -namespace hte501 { +namespace esphome::hte501 { /// This class implements support for the hte501 of temperature i2c sensors. class HTE501Component : public PollingComponent, public i2c::I2CDevice { @@ -24,5 +23,4 @@ class HTE501Component : public PollingComponent, public i2c::I2CDevice { enum ErrorCode { NONE = 0, COMMUNICATION_FAILED, CRC_CHECK_FAILED } error_code_{NONE}; }; -} // namespace hte501 -} // namespace esphome +} // namespace esphome::hte501 diff --git a/esphome/components/http_request/ota/automation.h b/esphome/components/http_request/ota/automation.h index 6c50bb9b0d..f6f49b14b1 100644 --- a/esphome/components/http_request/ota/automation.h +++ b/esphome/components/http_request/ota/automation.h @@ -3,8 +3,7 @@ #include "esphome/core/automation.h" -namespace esphome { -namespace http_request { +namespace esphome::http_request { template class OtaHttpRequestComponentFlashAction : public Action { public: @@ -38,5 +37,4 @@ template class OtaHttpRequestComponentFlashAction : public Actio OtaHttpRequestComponent *parent_; }; -} // namespace http_request -} // namespace esphome +} // namespace esphome::http_request diff --git a/esphome/components/http_request/ota/ota_http_request.cpp b/esphome/components/http_request/ota/ota_http_request.cpp index 5dd21c314c..8893b96c65 100644 --- a/esphome/components/http_request/ota/ota_http_request.cpp +++ b/esphome/components/http_request/ota/ota_http_request.cpp @@ -9,8 +9,7 @@ #include "esphome/components/md5/md5.h" #include "esphome/components/watchdog/watchdog.h" -namespace esphome { -namespace http_request { +namespace esphome::http_request { static const char *const TAG = "http_request.ota"; @@ -297,5 +296,4 @@ bool OtaHttpRequestComponent::validate_url_(const std::string &url) { return true; } -} // namespace http_request -} // namespace esphome +} // namespace esphome::http_request diff --git a/esphome/components/http_request/ota/ota_http_request.h b/esphome/components/http_request/ota/ota_http_request.h index 70e4559fa7..a706331d9a 100644 --- a/esphome/components/http_request/ota/ota_http_request.h +++ b/esphome/components/http_request/ota/ota_http_request.h @@ -11,8 +11,7 @@ #include "../http_request.h" -namespace esphome { -namespace http_request { +namespace esphome::http_request { static const uint8_t MD5_SIZE = 32; @@ -56,5 +55,4 @@ class OtaHttpRequestComponent final : public ota::OTAComponent, public Parented< static const uint16_t HTTP_RECV_BUFFER = 256; // the firmware GET chunk size }; -} // namespace http_request -} // namespace esphome +} // namespace esphome::http_request diff --git a/esphome/components/http_request/update/http_request_update.cpp b/esphome/components/http_request/update/http_request_update.cpp index 1c52a28105..57dc86d55c 100644 --- a/esphome/components/http_request/update/http_request_update.cpp +++ b/esphome/components/http_request/update/http_request_update.cpp @@ -6,8 +6,7 @@ #include "esphome/components/json/json_util.h" #include "esphome/components/network/util.h" -namespace esphome { -namespace http_request { +namespace esphome::http_request { // The update function runs in a task only on ESP32s. #ifdef USE_ESP32 @@ -258,5 +257,4 @@ void HttpRequestUpdate::perform(bool force) { this->defer([this]() { this->ota_parent_->flash(); }); } -} // namespace http_request -} // namespace esphome +} // namespace esphome::http_request diff --git a/esphome/components/http_request/update/http_request_update.h b/esphome/components/http_request/update/http_request_update.h index b8350346f9..be9fbf72bf 100644 --- a/esphome/components/http_request/update/http_request_update.h +++ b/esphome/components/http_request/update/http_request_update.h @@ -11,8 +11,7 @@ #include #endif -namespace esphome { -namespace http_request { +namespace esphome::http_request { class HttpRequestUpdate final : public update::UpdateEntity, public PollingComponent, public ota::OTAStateListener { public: @@ -43,5 +42,4 @@ class HttpRequestUpdate final : public update::UpdateEntity, public PollingCompo uint8_t initial_check_remaining_{0}; }; -} // namespace http_request -} // namespace esphome +} // namespace esphome::http_request diff --git a/esphome/components/htu21d/htu21d.cpp b/esphome/components/htu21d/htu21d.cpp index 58a28b213f..8a3b2cb5d5 100644 --- a/esphome/components/htu21d/htu21d.cpp +++ b/esphome/components/htu21d/htu21d.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" -namespace esphome { -namespace htu21d { +namespace esphome::htu21d { static const char *const TAG = "htu21d"; @@ -143,5 +142,4 @@ uint8_t HTU21DComponent::get_heater_level() { return raw_heater & 0xF; } -} // namespace htu21d -} // namespace esphome +} // namespace esphome::htu21d diff --git a/esphome/components/htu21d/htu21d.h b/esphome/components/htu21d/htu21d.h index 594be78326..a111722dc7 100644 --- a/esphome/components/htu21d/htu21d.h +++ b/esphome/components/htu21d/htu21d.h @@ -5,8 +5,7 @@ #include "esphome/components/i2c/i2c.h" #include "esphome/core/automation.h" -namespace esphome { -namespace htu21d { +namespace esphome::htu21d { enum HTU21DSensorModels { HTU21D_SENSOR_MODEL_HTU21D = 0, HTU21D_SENSOR_MODEL_SI7021, HTU21D_SENSOR_MODEL_SHT21 }; @@ -57,5 +56,4 @@ template class SetHeaterAction : public Action, public Pa } }; -} // namespace htu21d -} // namespace esphome +} // namespace esphome::htu21d diff --git a/esphome/components/htu31d/htu31d.cpp b/esphome/components/htu31d/htu31d.cpp index 4bb38a11a2..0b679bf2b7 100644 --- a/esphome/components/htu31d/htu31d.cpp +++ b/esphome/components/htu31d/htu31d.cpp @@ -14,8 +14,7 @@ #include -namespace esphome { -namespace htu31d { +namespace esphome::htu31d { /** Logging prefix */ static const char *const TAG = "htu31d"; @@ -259,5 +258,4 @@ void HTU31DComponent::set_heater_state(bool desired) { } } -} // namespace htu31d -} // namespace esphome +} // namespace esphome::htu31d diff --git a/esphome/components/htu31d/htu31d.h b/esphome/components/htu31d/htu31d.h index 24d85243cc..451918cb3b 100644 --- a/esphome/components/htu31d/htu31d.h +++ b/esphome/components/htu31d/htu31d.h @@ -5,8 +5,7 @@ #include "esphome/core/automation.h" #include "esphome/core/component.h" -namespace esphome { -namespace htu31d { +namespace esphome::htu31d { class HTU31DComponent : public PollingComponent, public i2c::I2CDevice { public: @@ -27,5 +26,4 @@ class HTU31DComponent : public PollingComponent, public i2c::I2CDevice { sensor::Sensor *temperature_{nullptr}; sensor::Sensor *humidity_{nullptr}; }; -} // namespace htu31d -} // namespace esphome +} // namespace esphome::htu31d diff --git a/esphome/components/hx711/hx711.cpp b/esphome/components/hx711/hx711.cpp index f2e3234127..fe2fb4c350 100644 --- a/esphome/components/hx711/hx711.cpp +++ b/esphome/components/hx711/hx711.cpp @@ -2,8 +2,7 @@ #include "esphome/core/helpers.h" #include "esphome/core/log.h" -namespace esphome { -namespace hx711 { +namespace esphome::hx711 { static const char *const TAG = "hx711"; @@ -77,5 +76,4 @@ bool HX711Sensor::read_sensor_(uint32_t *result) { return true; } -} // namespace hx711 -} // namespace esphome +} // namespace esphome::hx711 diff --git a/esphome/components/hx711/hx711.h b/esphome/components/hx711/hx711.h index 37723ee81f..43ab4c0f56 100644 --- a/esphome/components/hx711/hx711.h +++ b/esphome/components/hx711/hx711.h @@ -6,8 +6,7 @@ #include -namespace esphome { -namespace hx711 { +namespace esphome::hx711 { enum HX711Gain : uint8_t { HX711_GAIN_128 = 1, @@ -33,5 +32,4 @@ class HX711Sensor : public sensor::Sensor, public PollingComponent { HX711Gain gain_{HX711_GAIN_128}; }; -} // namespace hx711 -} // namespace esphome +} // namespace esphome::hx711 diff --git a/esphome/components/hydreon_rgxx/hydreon_rgxx.cpp b/esphome/components/hydreon_rgxx/hydreon_rgxx.cpp index 983a0a6649..695a823cb7 100644 --- a/esphome/components/hydreon_rgxx/hydreon_rgxx.cpp +++ b/esphome/components/hydreon_rgxx/hydreon_rgxx.cpp @@ -1,8 +1,7 @@ #include "hydreon_rgxx.h" #include "esphome/core/log.h" -namespace esphome { -namespace hydreon_rgxx { +namespace esphome::hydreon_rgxx { static const char *const TAG = "hydreon_rgxx.sensor"; static const int MAX_DATA_LENGTH_BYTES = 80; @@ -284,5 +283,4 @@ void HydreonRGxxComponent::process_line_() { } } -} // namespace hydreon_rgxx -} // namespace esphome +} // namespace esphome::hydreon_rgxx diff --git a/esphome/components/hydreon_rgxx/hydreon_rgxx.h b/esphome/components/hydreon_rgxx/hydreon_rgxx.h index e3f9798a93..2ae46907c1 100644 --- a/esphome/components/hydreon_rgxx/hydreon_rgxx.h +++ b/esphome/components/hydreon_rgxx/hydreon_rgxx.h @@ -8,8 +8,7 @@ #endif #include "esphome/components/uart/uart.h" -namespace esphome { -namespace hydreon_rgxx { +namespace esphome::hydreon_rgxx { enum RGModel { RG9 = 1, @@ -92,5 +91,4 @@ class HydreonRGxxBinaryComponent : public Component { HydreonRGxxBinaryComponent(HydreonRGxxComponent *parent) {} }; -} // namespace hydreon_rgxx -} // namespace esphome +} // namespace esphome::hydreon_rgxx diff --git a/esphome/components/hyt271/hyt271.cpp b/esphome/components/hyt271/hyt271.cpp index 4c0e3cd96e..7b2c960a5f 100644 --- a/esphome/components/hyt271/hyt271.cpp +++ b/esphome/components/hyt271/hyt271.cpp @@ -2,8 +2,7 @@ #include "esphome/core/log.h" #include "esphome/core/hal.h" -namespace esphome { -namespace hyt271 { +namespace esphome::hyt271 { static const char *const TAG = "hyt271"; @@ -46,5 +45,4 @@ void HYT271Component::update() { this->status_clear_warning(); }); } -} // namespace hyt271 -} // namespace esphome +} // namespace esphome::hyt271 diff --git a/esphome/components/hyt271/hyt271.h b/esphome/components/hyt271/hyt271.h index 19409d830c..d08b3779ad 100644 --- a/esphome/components/hyt271/hyt271.h +++ b/esphome/components/hyt271/hyt271.h @@ -4,8 +4,7 @@ #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" -namespace esphome { -namespace hyt271 { +namespace esphome::hyt271 { class HYT271Component : public PollingComponent, public i2c::I2CDevice { public: @@ -21,5 +20,4 @@ class HYT271Component : public PollingComponent, public i2c::I2CDevice { sensor::Sensor *humidity_{nullptr}; }; -} // namespace hyt271 -} // namespace esphome +} // namespace esphome::hyt271