From 896a32142fe6c4b7897218d6aa2190620e13c356 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Wed, 13 Feb 2019 16:53:38 +0100 Subject: [PATCH] Rename esphomelib to esphome-core (#494) * Rename esphomelib to esphome-core * Only apply for transition effect * Fix merge * Update CMakeLists.txt * Fix merge * Remove examples --- .github/ISSUE_TEMPLATE/bug_report.md | 52 - .github/ISSUE_TEMPLATE/feature_request.md | 21 - .github/ISSUE_TEMPLATE/new-integration.md | 22 - .github/PULL_REQUEST_TEMPLATE.md | 8 +- .travis.yml | 16 - CMakeLists.txt | 108 +- CONTRIBUTING.md | 11 +- README.md | 411 +---- .../custom-bmp180-sensor.cpp | 4 +- .../dht-dallas-sensors/dht-dallas-sensors.cpp | 54 - .../dht-dallas-sensors/dht-dallas-sensors.ino | 2 - examples/fan-example/fan-example.cpp | 32 - examples/fan-example/fan-example.ino | 2 - examples/fastled/fastled.cpp | 8 +- examples/i2c-sensors/i2c-sensors.cpp | 72 - examples/i2c-sensors/i2c-sensors.ino | 2 - examples/lights/lights.cpp | 41 - examples/lights/lights.ino | 2 - examples/livingroom/livingroom.cpp | 4 +- examples/livingroom8266/livingroom8266.cpp | 4 +- examples/neopixelbus/neopixelbus.cpp | 35 - examples/neopixelbus/neopixelbus.ino | 2 - examples/pcf8574/pcf8574.cpp | 28 - examples/pcf8574/pcf8574.ino | 2 - examples/sonoff-b1/sonoff-b1.cpp | 38 - examples/sonoff-b1/sonoff-b1.ino | 2 - .../switch-binarysensor.cpp | 25 - .../switch-binarysensor.ino | 2 - library.json | 6 +- library.properties | 6 +- platformio.ini | 69 +- src/esphome.h | 1 + src/{esphomelib => esphome}/api/api.proto | 2 +- .../api/api_message.cpp | 10 +- src/{esphomelib => esphome}/api/api_message.h | 16 +- .../api/api_server.cpp | 26 +- src/{esphomelib => esphome}/api/api_server.h | 36 +- .../api/basic_messages.cpp | 10 +- .../api/basic_messages.h | 14 +- .../api/command_messages.cpp | 10 +- .../api/command_messages.h | 16 +- .../api/list_entities.cpp | 12 +- .../api/list_entities.h | 18 +- .../api/service_call_message.cpp | 10 +- .../api/service_call_message.h | 18 +- .../api/subscribe_logs.cpp | 10 +- .../api/subscribe_logs.h | 16 +- .../api/subscribe_state.cpp | 10 +- .../api/subscribe_state.h | 22 +- src/{esphomelib => esphome}/api/util.cpp | 10 +- src/{esphomelib => esphome}/api/util.h | 18 +- src/{esphomelib => esphome}/application.cpp | 42 +- src/esphome/application.h | 1317 +++++++++++++++++ src/{esphomelib => esphome}/automation.cpp | 8 +- src/{esphomelib => esphome}/automation.h | 22 +- src/{esphomelib => esphome}/automation.tcc | 6 +- .../binary_sensor/binary_sensor.cpp | 10 +- .../binary_sensor/binary_sensor.h | 24 +- .../binary_sensor/custom_binary_sensor.cpp | 10 +- .../binary_sensor/custom_binary_sensor.h | 16 +- .../esp32_touch_binary_sensor.cpp | 10 +- .../binary_sensor/esp32_touch_binary_sensor.h | 14 +- .../binary_sensor/filter.cpp | 8 +- .../binary_sensor/filter.h | 14 +- .../gpio_binary_sensor_component.cpp | 12 +- .../gpio_binary_sensor_component.h | 16 +- .../homeassistant_binary_sensor.cpp | 12 +- .../homeassistant_binary_sensor.h | 16 +- .../mqtt_binary_sensor_component.cpp | 10 +- .../mqtt_binary_sensor_component.h | 16 +- .../binary_sensor/pn532_component.cpp | 12 +- .../binary_sensor/pn532_component.h | 18 +- .../binary_sensor/rdm6300.cpp | 12 +- .../binary_sensor/rdm6300.h | 16 +- .../binary_sensor/status_binary_sensor.cpp | 16 +- .../binary_sensor/status_binary_sensor.h | 14 +- .../binary_sensor/template_binary_sensor.cpp | 10 +- .../binary_sensor/template_binary_sensor.h | 16 +- src/{esphomelib => esphome}/component.cpp | 14 +- src/{esphomelib => esphome}/component.h | 18 +- src/{esphomelib => esphome}/controller.cpp | 8 +- src/{esphomelib => esphome}/controller.h | 26 +- src/{esphomelib => esphome}/cover/cover.cpp | 8 +- src/{esphomelib => esphome}/cover/cover.h | 20 +- .../cover/mqtt_cover_component.cpp | 10 +- .../cover/mqtt_cover_component.h | 16 +- .../cover/template_cover.cpp | 10 +- .../cover/template_cover.h | 16 +- .../custom_component.cpp | 10 +- .../custom_component.h | 14 +- .../debug_component.cpp | 16 +- src/{esphomelib => esphome}/debug_component.h | 14 +- .../deep_sleep_component.cpp | 14 +- .../deep_sleep_component.h | 18 +- src/{esphomelib => esphome}/defines.h | 22 +- .../display/display.cpp | 20 +- src/{esphomelib => esphome}/display/display.h | 24 +- .../display/lcd_display.cpp | 14 +- .../display/lcd_display.h | 24 +- .../display/max7219.cpp | 14 +- src/{esphomelib => esphome}/display/max7219.h | 22 +- .../display/nextion.cpp | 12 +- src/{esphomelib => esphome}/display/nextion.h | 22 +- .../display/ssd1306.cpp | 10 +- src/{esphomelib => esphome}/display/ssd1306.h | 20 +- .../display/waveshare_epaper.cpp | 11 +- .../display/waveshare_epaper.h | 16 +- .../esp32_ble_beacon.cpp | 12 +- .../esp32_ble_beacon.h | 14 +- .../esp32_ble_tracker.cpp | 16 +- .../esp32_ble_tracker.h | 20 +- src/{esphomelib => esphome}/esp_one_wire.cpp | 10 +- src/{esphomelib => esphome}/esp_one_wire.h | 16 +- src/{esphomelib => esphome}/esphal.cpp | 10 +- src/{esphomelib => esphome}/esphal.h | 14 +- src/{esphomelib => esphome}/espmath.h | 6 +- .../esppreferences.cpp | 10 +- src/{esphomelib => esphome}/esppreferences.h | 16 +- .../ethernet_component.cpp | 12 +- .../ethernet_component.h | 16 +- .../fan/basic_fan_component.cpp | 10 +- .../fan/basic_fan_component.h | 20 +- src/{esphomelib => esphome}/fan/fan_state.cpp | 12 +- src/{esphomelib => esphome}/fan/fan_state.h | 22 +- .../fan/fan_traits.cpp | 8 +- src/{esphomelib => esphome}/fan/fan_traits.h | 12 +- .../fan/mqtt_fan_component.cpp | 10 +- .../fan/mqtt_fan_component.h | 16 +- src/{esphomelib => esphome}/helpers.cpp | 16 +- src/{esphomelib => esphome}/helpers.h | 16 +- src/{esphomelib => esphome}/i2c_component.cpp | 10 +- src/{esphomelib => esphome}/i2c_component.h | 16 +- .../io/pcf8574_component.cpp | 10 +- .../io/pcf8574_component.h | 18 +- .../light/addressable_light.cpp | 14 +- .../light/addressable_light.h | 18 +- .../light/addressable_light.tcc | 10 +- .../light/addressable_light_effect.cpp | 8 +- .../light/addressable_light_effect.h | 16 +- .../light/fast_led_light_output.cpp | 10 +- .../light/fast_led_light_output.h | 22 +- .../light/light_color_values.cpp | 34 +- .../light/light_color_values.h | 14 +- .../light/light_effect.cpp | 14 +- .../light/light_effect.h | 16 +- .../light/light_output_component.cpp | 14 +- .../light/light_output_component.h | 18 +- .../light/light_state.cpp | 20 +- .../light/light_state.h | 28 +- .../light/light_traits.cpp | 8 +- .../light/light_traits.h | 12 +- .../light/light_transformer.cpp | 36 +- .../light/light_transformer.h | 14 +- .../light/mqtt_json_light_component.cpp | 10 +- .../light/mqtt_json_light_component.h | 16 +- .../light/neo_pixel_bus_light_output.h | 24 +- .../light/neo_pixel_bus_light_output.tcc | 12 +- src/{esphomelib => esphome}/log.cpp | 10 +- src/esphome/log.h | 180 +++ src/{esphomelib => esphome}/log_component.cpp | 14 +- src/{esphomelib => esphome}/log_component.h | 24 +- .../mqtt/custom_mqtt_device.cpp | 8 +- .../mqtt/custom_mqtt_device.h | 16 +- .../mqtt/mqtt_client_component.cpp | 14 +- .../mqtt/mqtt_client_component.h | 22 +- .../mqtt/mqtt_component.cpp | 22 +- .../mqtt/mqtt_component.h | 18 +- src/{esphomelib => esphome}/optional.h | 12 +- src/{esphomelib => esphome}/ota_component.cpp | 18 +- src/{esphomelib => esphome}/ota_component.h | 16 +- .../output/binary_output.cpp | 8 +- .../output/binary_output.h | 16 +- .../output/custom_output.cpp | 10 +- .../output/custom_output.h | 16 +- .../output/esp8266_pwm_output.cpp | 12 +- .../output/esp8266_pwm_output.h | 14 +- .../output/float_output.cpp | 12 +- .../output/float_output.h | 16 +- .../output/gpio_binary_output_component.cpp | 12 +- .../output/gpio_binary_output_component.h | 16 +- .../output/ledc_output_component.cpp | 10 +- .../output/ledc_output_component.h | 14 +- .../output/my9231_output_component.cpp | 10 +- .../output/my9231_output_component.h | 14 +- .../output/pca9685_output_component.cpp | 10 +- .../output/pca9685_output_component.h | 16 +- .../power_supply_component.cpp | 14 +- .../power_supply_component.h | 16 +- src/{esphomelib => esphome}/remote/jvc.cpp | 10 +- src/{esphomelib => esphome}/remote/jvc.h | 16 +- src/{esphomelib => esphome}/remote/lg.cpp | 10 +- src/{esphomelib => esphome}/remote/lg.h | 16 +- src/{esphomelib => esphome}/remote/nec.cpp | 10 +- src/{esphomelib => esphome}/remote/nec.h | 16 +- .../remote/panasonic.cpp | 10 +- .../remote/panasonic.h | 16 +- src/{esphomelib => esphome}/remote/raw.cpp | 10 +- src/{esphomelib => esphome}/remote/raw.h | 16 +- .../remote/rc_switch.cpp | 10 +- .../remote/rc_switch.h | 18 +- .../remote/rc_switch_protocol.cpp | 10 +- .../remote/rc_switch_protocol.h | 18 +- .../remote/remote_protocol.cpp | 14 +- .../remote/remote_protocol.h | 16 +- .../remote/remote_receiver.cpp | 26 +- .../remote/remote_receiver.h | 20 +- .../remote/remote_transmitter.cpp | 26 +- .../remote/remote_transmitter.h | 20 +- .../remote/samsung.cpp | 10 +- src/{esphomelib => esphome}/remote/samsung.h | 16 +- src/{esphomelib => esphome}/remote/sony.cpp | 10 +- src/{esphomelib => esphome}/remote/sony.h | 16 +- src/{esphomelib => esphome}/sensor/adc.cpp | 10 +- src/{esphomelib => esphome}/sensor/adc.h | 18 +- .../sensor/ads1115_component.cpp | 10 +- .../sensor/ads1115_component.h | 29 +- .../sensor/apds9960.cpp | 10 +- src/{esphomelib => esphome}/sensor/apds9960.h | 20 +- .../sensor/bh1750_sensor.cpp | 10 +- .../sensor/bh1750_sensor.h | 16 +- .../sensor/bme280_component.cpp | 12 +- .../sensor/bme280_component.h | 16 +- .../sensor/bme680_component.cpp | 10 +- .../sensor/bme680_component.h | 16 +- .../sensor/bmp085_component.cpp | 10 +- .../sensor/bmp085_component.h | 18 +- .../sensor/bmp280_component.cpp | 12 +- .../sensor/bmp280_component.h | 16 +- .../sensor/cse7766.cpp | 10 +- src/{esphomelib => esphome}/sensor/cse7766.h | 20 +- .../sensor/custom_sensor.cpp | 10 +- .../sensor/custom_sensor.h | 16 +- .../sensor/dallas_component.cpp | 14 +- .../sensor/dallas_component.h | 16 +- .../sensor/dht12_component.cpp | 10 +- .../sensor/dht12_component.h | 16 +- .../sensor/dht_component.cpp | 16 +- .../sensor/dht_component.h | 14 +- .../sensor/duty_cycle_sensor.cpp | 10 +- .../sensor/duty_cycle_sensor.h | 14 +- .../sensor/esp32_hall_sensor.cpp | 12 +- .../sensor/esp32_hall_sensor.h | 14 +- src/{esphomelib => esphome}/sensor/filter.cpp | 14 +- src/{esphomelib => esphome}/sensor/filter.h | 16 +- .../sensor/hdc1080_component.cpp | 10 +- .../sensor/hdc1080_component.h | 18 +- .../sensor/hlw8012.cpp | 12 +- src/{esphomelib => esphome}/sensor/hlw8012.h | 18 +- .../sensor/hmc5883l.cpp | 10 +- src/{esphomelib => esphome}/sensor/hmc5883l.h | 16 +- .../sensor/homeassistant_sensor.cpp | 12 +- .../sensor/homeassistant_sensor.h | 16 +- .../sensor/htu21d_component.cpp | 10 +- .../sensor/htu21d_component.h | 23 +- src/{esphomelib => esphome}/sensor/hx711.cpp | 10 +- src/{esphomelib => esphome}/sensor/hx711.h | 14 +- src/{esphomelib => esphome}/sensor/ina219.cpp | 12 +- src/{esphomelib => esphome}/sensor/ina219.h | 18 +- .../sensor/ina3221.cpp | 10 +- src/{esphomelib => esphome}/sensor/ina3221.h | 16 +- .../sensor/max31855_sensor.cpp | 10 +- .../sensor/max31855_sensor.h | 16 +- .../sensor/max6675_sensor.cpp | 10 +- .../sensor/max6675_sensor.h | 16 +- .../sensor/mhz19_component.cpp | 10 +- .../sensor/mhz19_component.h | 18 +- .../sensor/mpu6050_component.cpp | 10 +- .../sensor/mpu6050_component.h | 18 +- .../sensor/mqtt_sensor_component.cpp | 16 +- .../sensor/mqtt_sensor_component.h | 20 +- .../sensor/mqtt_subscribe_sensor.cpp | 12 +- .../sensor/mqtt_subscribe_sensor.h | 16 +- src/{esphomelib => esphome}/sensor/ms5611.cpp | 10 +- src/{esphomelib => esphome}/sensor/ms5611.h | 16 +- .../sensor/pmsx003.cpp | 10 +- src/{esphomelib => esphome}/sensor/pmsx003.h | 20 +- .../sensor/pulse_counter.cpp | 14 +- .../sensor/pulse_counter.h | 16 +- .../sensor/rotary_encoder.cpp | 10 +- .../sensor/rotary_encoder.h | 16 +- src/{esphomelib => esphome}/sensor/sensor.cpp | 10 +- src/{esphomelib => esphome}/sensor/sensor.h | 24 +- .../sensor/sht3xd_component.cpp | 12 +- .../sensor/sht3xd_component.h | 16 +- .../sensor/tcs34725.cpp | 12 +- src/{esphomelib => esphome}/sensor/tcs34725.h | 16 +- .../sensor/template_sensor.cpp | 10 +- .../sensor/template_sensor.h | 16 +- .../sensor/total_daily_energy.cpp | 10 +- .../sensor/total_daily_energy.h | 20 +- .../sensor/tsl2561_sensor.cpp | 10 +- .../sensor/tsl2561_sensor.h | 16 +- .../sensor/ultrasonic_sensor.cpp | 12 +- .../sensor/ultrasonic_sensor.h | 16 +- .../sensor/uptime_sensor.cpp | 10 +- .../sensor/uptime_sensor.h | 14 +- .../sensor/wifi_signal_sensor.cpp | 10 +- .../sensor/wifi_signal_sensor.h | 14 +- src/{esphomelib => esphome}/spi_component.cpp | 12 +- src/{esphomelib => esphome}/spi_component.h | 16 +- src/{esphomelib => esphome}/status_led.cpp | 10 +- src/{esphomelib => esphome}/status_led.h | 16 +- src/{esphomelib => esphome}/stepper/a4988.cpp | 10 +- src/{esphomelib => esphome}/stepper/a4988.h | 18 +- .../stepper/stepper.cpp | 14 +- src/{esphomelib => esphome}/stepper/stepper.h | 16 +- .../stepper/uln2003.cpp | 10 +- src/{esphomelib => esphome}/stepper/uln2003.h | 16 +- .../switch_/custom_switch.cpp | 10 +- .../switch_/custom_switch.h | 16 +- .../switch_/gpio_switch.cpp | 10 +- .../switch_/gpio_switch.h | 18 +- .../switch_/mqtt_switch_component.cpp | 10 +- .../switch_/mqtt_switch_component.h | 18 +- .../switch_/output_switch.cpp | 10 +- .../switch_/output_switch.h | 16 +- .../switch_/restart_switch.cpp | 10 +- .../switch_/restart_switch.h | 14 +- .../switch_/shutdown_switch.cpp | 10 +- .../switch_/shutdown_switch.h | 14 +- .../switch_/switch.cpp | 12 +- src/{esphomelib => esphome}/switch_/switch.h | 20 +- .../switch_/template_switch.cpp | 10 +- .../switch_/template_switch.h | 16 +- .../switch_/uart_switch.cpp | 10 +- .../switch_/uart_switch.h | 16 +- .../text_sensor/custom_text_sensor.cpp | 10 +- .../text_sensor/custom_text_sensor.h | 16 +- .../text_sensor/homeassistant_text_sensor.cpp | 12 +- .../text_sensor/homeassistant_text_sensor.h | 16 +- .../mqtt_subscribe_text_sensor.cpp | 10 +- .../text_sensor/mqtt_subscribe_text_sensor.h | 18 +- .../text_sensor/mqtt_text_sensor.cpp | 10 +- .../text_sensor/mqtt_text_sensor.h | 18 +- .../text_sensor/template_text_sensor.cpp | 10 +- .../text_sensor/template_text_sensor.h | 16 +- .../text_sensor/text_sensor.cpp | 10 +- .../text_sensor/text_sensor.h | 20 +- .../text_sensor/version_text_sensor.cpp | 16 +- .../text_sensor/version_text_sensor.h | 16 +- .../time/homeassistant_time.cpp | 12 +- .../time/homeassistant_time.h | 18 +- .../time/rtc_component.cpp | 48 +- .../time/rtc_component.h | 44 +- .../time/sntp_component.cpp | 14 +- .../time/sntp_component.h | 16 +- .../uart_component.cpp | 12 +- src/{esphomelib => esphome}/uart_component.h | 14 +- src/{esphomelib => esphome}/util.cpp | 20 +- src/{esphomelib => esphome}/util.h | 12 +- src/{esphomelib => esphome}/web_server.cpp | 20 +- src/{esphomelib => esphome}/web_server.h | 24 +- .../wifi_component.cpp | 14 +- src/{esphomelib => esphome}/wifi_component.h | 16 +- src/esphomelib.h | 4 +- src/esphomelib/application.h | 1317 +---------------- src/esphomelib/log.h | 173 --- 357 files changed, 3958 insertions(+), 4870 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/new-integration.md delete mode 100644 examples/dht-dallas-sensors/dht-dallas-sensors.cpp delete mode 100644 examples/dht-dallas-sensors/dht-dallas-sensors.ino delete mode 100644 examples/fan-example/fan-example.cpp delete mode 100644 examples/fan-example/fan-example.ino delete mode 100644 examples/i2c-sensors/i2c-sensors.cpp delete mode 100644 examples/i2c-sensors/i2c-sensors.ino delete mode 100644 examples/lights/lights.cpp delete mode 100644 examples/lights/lights.ino delete mode 100644 examples/neopixelbus/neopixelbus.cpp delete mode 100644 examples/neopixelbus/neopixelbus.ino delete mode 100644 examples/pcf8574/pcf8574.cpp delete mode 100644 examples/pcf8574/pcf8574.ino delete mode 100644 examples/sonoff-b1/sonoff-b1.cpp delete mode 100644 examples/sonoff-b1/sonoff-b1.ino delete mode 100644 examples/switch-binarysensor/switch-binarysensor.cpp delete mode 100644 examples/switch-binarysensor/switch-binarysensor.ino create mode 100644 src/esphome.h rename src/{esphomelib => esphome}/api/api.proto (99%) rename src/{esphomelib => esphome}/api/api_message.cpp (94%) rename src/{esphomelib => esphome}/api/api_message.h (87%) rename src/{esphomelib => esphome}/api/api_server.cpp (98%) rename src/{esphomelib => esphome}/api/api_server.h (90%) rename src/{esphomelib => esphome}/api/basic_messages.cpp (93%) rename src/{esphomelib => esphome}/api/basic_messages.h (86%) rename src/{esphomelib => esphome}/api/command_messages.cpp (97%) rename src/{esphomelib => esphome}/api/command_messages.h (90%) rename src/{esphomelib => esphome}/api/list_entities.cpp (96%) rename src/{esphomelib => esphome}/api/list_entities.h (76%) rename src/{esphomelib => esphome}/api/service_call_message.cpp (91%) rename src/{esphomelib => esphome}/api/service_call_message.h (79%) rename src/{esphomelib => esphome}/api/subscribe_logs.cpp (84%) rename src/{esphomelib => esphome}/api/subscribe_logs.h (61%) rename src/{esphomelib => esphome}/api/subscribe_state.cpp (94%) rename src/{esphomelib => esphome}/api/subscribe_state.h (79%) rename src/{esphomelib => esphome}/api/util.cpp (98%) rename src/{esphomelib => esphome}/api/util.h (89%) rename src/{esphomelib => esphome}/application.cpp (98%) create mode 100644 src/esphome/application.h rename src/{esphomelib => esphome}/automation.cpp (93%) rename src/{esphomelib => esphome}/automation.h (94%) rename src/{esphomelib => esphome}/automation.tcc (98%) rename src/{esphomelib => esphome}/binary_sensor/binary_sensor.cpp (98%) rename src/{esphomelib => esphome}/binary_sensor/binary_sensor.h (93%) rename src/{esphomelib => esphome}/binary_sensor/custom_binary_sensor.cpp (78%) rename src/{esphomelib => esphome}/binary_sensor/custom_binary_sensor.h (55%) rename src/{esphomelib => esphome}/binary_sensor/esp32_touch_binary_sensor.cpp (96%) rename src/{esphomelib => esphome}/binary_sensor/esp32_touch_binary_sensor.h (96%) rename src/{esphomelib => esphome}/binary_sensor/filter.cpp (93%) rename src/{esphomelib => esphome}/binary_sensor/filter.h (87%) rename src/{esphomelib => esphome}/binary_sensor/gpio_binary_sensor_component.cpp (80%) rename src/{esphomelib => esphome}/binary_sensor/gpio_binary_sensor_component.h (71%) rename src/{esphomelib => esphome}/binary_sensor/homeassistant_binary_sensor.cpp (85%) rename src/{esphomelib => esphome}/binary_sensor/homeassistant_binary_sensor.h (58%) rename src/{esphomelib => esphome}/binary_sensor/mqtt_binary_sensor_component.cpp (91%) rename src/{esphomelib => esphome}/binary_sensor/mqtt_binary_sensor_component.h (77%) rename src/{esphomelib => esphome}/binary_sensor/pn532_component.cpp (97%) rename src/{esphomelib => esphome}/binary_sensor/pn532_component.h (82%) rename src/{esphomelib => esphome}/binary_sensor/rdm6300.cpp (93%) rename src/{esphomelib => esphome}/binary_sensor/rdm6300.h (72%) rename src/{esphomelib => esphome}/binary_sensor/status_binary_sensor.cpp (77%) rename src/{esphomelib => esphome}/binary_sensor/status_binary_sensor.h (74%) rename src/{esphomelib => esphome}/binary_sensor/template_binary_sensor.cpp (81%) rename src/{esphomelib => esphome}/binary_sensor/template_binary_sensor.h (58%) rename src/{esphomelib => esphome}/component.cpp (97%) rename src/{esphomelib => esphome}/component.h (96%) rename src/{esphomelib => esphome}/controller.cpp (96%) rename src/{esphomelib => esphome}/controller.h (88%) rename src/{esphomelib => esphome}/cover/cover.cpp (88%) rename src/{esphomelib => esphome}/cover/cover.h (92%) rename src/{esphomelib => esphome}/cover/mqtt_cover_component.cpp (93%) rename src/{esphomelib => esphome}/cover/mqtt_cover_component.h (65%) rename src/{esphomelib => esphome}/cover/template_cover.cpp (92%) rename src/{esphomelib => esphome}/cover/template_cover.h (77%) rename src/{esphomelib => esphome}/custom_component.cpp (70%) rename src/{esphomelib => esphome}/custom_component.h (55%) rename src/{esphomelib => esphome}/debug_component.cpp (94%) rename src/{esphomelib => esphome}/debug_component.h (59%) rename src/{esphomelib => esphome}/deep_sleep_component.cpp (93%) rename src/{esphomelib => esphome}/deep_sleep_component.h (92%) rename src/{esphomelib => esphome}/defines.h (93%) rename src/{esphomelib => esphome}/display/display.cpp (97%) rename src/{esphomelib => esphome}/display/display.h (95%) rename src/{esphomelib => esphome}/display/lcd_display.cpp (97%) rename src/{esphomelib => esphome}/display/lcd_display.h (87%) rename src/{esphomelib => esphome}/display/max7219.cpp (96%) rename src/{esphomelib => esphome}/display/max7219.h (75%) rename src/{esphomelib => esphome}/display/nextion.cpp (97%) rename src/{esphomelib => esphome}/display/nextion.h (86%) rename src/{esphomelib => esphome}/display/ssd1306.cpp (98%) rename src/{esphomelib => esphome}/display/ssd1306.h (85%) rename src/{esphomelib => esphome}/display/waveshare_epaper.cpp (99%) rename src/{esphomelib => esphome}/display/waveshare_epaper.h (90%) rename src/{esphomelib => esphome}/esp32_ble_beacon.cpp (95%) rename src/{esphomelib => esphome}/esp32_ble_beacon.h (82%) rename src/{esphomelib => esphome}/esp32_ble_tracker.cpp (98%) rename src/{esphomelib => esphome}/esp32_ble_tracker.h (96%) rename src/{esphomelib => esphome}/esp_one_wire.cpp (97%) rename src/{esphomelib => esphome}/esp_one_wire.h (86%) rename src/{esphomelib => esphome}/esphal.cpp (95%) rename src/{esphomelib => esphome}/esphal.h (93%) rename src/{esphomelib => esphome}/espmath.h (65%) rename src/{esphomelib => esphome}/esppreferences.cpp (97%) rename src/{esphomelib => esphome}/esppreferences.h (87%) rename src/{esphomelib => esphome}/ethernet_component.cpp (97%) rename src/{esphomelib => esphome}/ethernet_component.h (84%) rename src/{esphomelib => esphome}/fan/basic_fan_component.cpp (94%) rename src/{esphomelib => esphome}/fan/basic_fan_component.h (83%) rename src/{esphomelib => esphome}/fan/fan_state.cpp (94%) rename src/{esphomelib => esphome}/fan/fan_state.h (92%) rename src/{esphomelib => esphome}/fan/fan_traits.cpp (81%) rename src/{esphomelib => esphome}/fan/fan_traits.h (80%) rename src/{esphomelib => esphome}/fan/mqtt_fan_component.cpp (97%) rename src/{esphomelib => esphome}/fan/mqtt_fan_component.h (85%) rename src/{esphomelib => esphome}/helpers.cpp (98%) rename src/{esphomelib => esphome}/helpers.h (97%) rename src/{esphomelib => esphome}/i2c_component.cpp (98%) rename src/{esphomelib => esphome}/i2c_component.h (97%) rename src/{esphomelib => esphome}/io/pcf8574_component.cpp (96%) rename src/{esphomelib => esphome}/io/pcf8574_component.h (91%) rename src/{esphomelib => esphome}/light/addressable_light.cpp (93%) rename src/{esphomelib => esphome}/light/addressable_light.h (93%) rename src/{esphomelib => esphome}/light/addressable_light.tcc (98%) rename src/{esphomelib => esphome}/light/addressable_light_effect.cpp (98%) rename src/{esphomelib => esphome}/light/addressable_light_effect.h (92%) rename src/{esphomelib => esphome}/light/fast_led_light_output.cpp (96%) rename src/{esphomelib => esphome}/light/fast_led_light_output.h (96%) rename src/{esphomelib => esphome}/light/light_color_values.cpp (88%) rename src/{esphomelib => esphome}/light/light_color_values.h (93%) rename src/{esphomelib => esphome}/light/light_effect.cpp (94%) rename src/{esphomelib => esphome}/light/light_effect.h (88%) rename src/{esphomelib => esphome}/light/light_output_component.cpp (94%) rename src/{esphomelib => esphome}/light/light_output_component.h (87%) rename src/{esphomelib => esphome}/light/light_state.cpp (98%) rename src/{esphomelib => esphome}/light/light_state.h (95%) rename src/{esphomelib => esphome}/light/light_traits.cpp (89%) rename src/{esphomelib => esphome}/light/light_traits.h (78%) rename src/{esphomelib => esphome}/light/light_transformer.cpp (91%) rename src/{esphomelib => esphome}/light/light_transformer.h (87%) rename src/{esphomelib => esphome}/light/mqtt_json_light_component.cpp (92%) rename src/{esphomelib => esphome}/light/mqtt_json_light_component.h (65%) rename src/{esphomelib => esphome}/light/neo_pixel_bus_light_output.h (85%) rename src/{esphomelib => esphome}/light/neo_pixel_bus_light_output.tcc (97%) rename src/{esphomelib => esphome}/log.cpp (83%) create mode 100644 src/esphome/log.h rename src/{esphomelib => esphome}/log_component.cpp (94%) rename src/{esphomelib => esphome}/log_component.h (85%) rename src/{esphomelib => esphome}/mqtt/custom_mqtt_device.cpp (89%) rename src/{esphomelib => esphome}/mqtt/custom_mqtt_device.h (96%) rename src/{esphomelib => esphome}/mqtt/mqtt_client_component.cpp (98%) rename src/{esphomelib => esphome}/mqtt/mqtt_client_component.h (96%) rename src/{esphomelib => esphome}/mqtt/mqtt_component.cpp (93%) rename src/{esphomelib => esphome}/mqtt/mqtt_component.h (94%) rename src/{esphomelib => esphome}/optional.h (97%) rename src/{esphomelib => esphome}/ota_component.cpp (97%) rename src/{esphomelib => esphome}/ota_component.h (93%) rename src/{esphomelib => esphome}/output/binary_output.cpp (87%) rename src/{esphomelib => esphome}/output/binary_output.h (91%) rename src/{esphomelib => esphome}/output/custom_output.cpp (78%) rename src/{esphomelib => esphome}/output/custom_output.h (64%) rename src/{esphomelib => esphome}/output/esp8266_pwm_output.cpp (88%) rename src/{esphomelib => esphome}/output/esp8266_pwm_output.h (84%) rename src/{esphomelib => esphome}/output/float_output.cpp (84%) rename src/{esphomelib => esphome}/output/float_output.h (90%) rename src/{esphomelib => esphome}/output/gpio_binary_output_component.cpp (78%) rename src/{esphomelib => esphome}/output/gpio_binary_output_component.h (78%) rename src/{esphomelib => esphome}/output/ledc_output_component.cpp (92%) rename src/{esphomelib => esphome}/output/ledc_output_component.h (84%) rename src/{esphomelib => esphome}/output/my9231_output_component.cpp (97%) rename src/{esphomelib => esphome}/output/my9231_output_component.h (90%) rename src/{esphomelib => esphome}/output/pca9685_output_component.cpp (97%) rename src/{esphomelib => esphome}/output/pca9685_output_component.h (89%) rename src/{esphomelib => esphome}/power_supply_component.cpp (91%) rename src/{esphomelib => esphome}/power_supply_component.h (91%) rename src/{esphomelib => esphome}/remote/jvc.cpp (93%) rename src/{esphomelib => esphome}/remote/jvc.h (73%) rename src/{esphomelib => esphome}/remote/lg.cpp (94%) rename src/{esphomelib => esphome}/remote/lg.h (75%) rename src/{esphomelib => esphome}/remote/nec.cpp (95%) rename src/{esphomelib => esphome}/remote/nec.h (76%) rename src/{esphomelib => esphome}/remote/panasonic.cpp (94%) rename src/{esphomelib => esphome}/remote/panasonic.h (75%) rename src/{esphomelib => esphome}/remote/raw.cpp (94%) rename src/{esphomelib => esphome}/remote/raw.h (75%) rename src/{esphomelib => esphome}/remote/rc_switch.cpp (98%) rename src/{esphomelib => esphome}/remote/rc_switch.h (92%) rename src/{esphomelib => esphome}/remote/rc_switch_protocol.cpp (97%) rename src/{esphomelib => esphome}/remote/rc_switch_protocol.h (83%) rename src/{esphomelib => esphome}/remote/remote_protocol.cpp (79%) rename src/{esphomelib => esphome}/remote/remote_protocol.h (70%) rename src/{esphomelib => esphome}/remote/remote_receiver.cpp (96%) rename src/{esphomelib => esphome}/remote/remote_receiver.h (90%) rename src/{esphomelib => esphome}/remote/remote_transmitter.cpp (96%) rename src/{esphomelib => esphome}/remote/remote_transmitter.h (92%) rename src/{esphomelib => esphome}/remote/samsung.cpp (93%) rename src/{esphomelib => esphome}/remote/samsung.h (73%) rename src/{esphomelib => esphome}/remote/sony.cpp (94%) rename src/{esphomelib => esphome}/remote/sony.h (75%) rename src/{esphomelib => esphome}/sensor/adc.cpp (94%) rename src/{esphomelib => esphome}/sensor/adc.h (84%) rename src/{esphomelib => esphome}/sensor/ads1115_component.cpp (97%) rename src/{esphomelib => esphome}/sensor/ads1115_component.h (79%) rename src/{esphomelib => esphome}/sensor/apds9960.cpp (98%) rename src/{esphomelib => esphome}/sensor/apds9960.h (88%) rename src/{esphomelib => esphome}/sensor/bh1750_sensor.cpp (94%) rename src/{esphomelib => esphome}/sensor/bh1750_sensor.h (83%) rename src/{esphomelib => esphome}/sensor/bme280_component.cpp (98%) rename src/{esphomelib => esphome}/sensor/bme280_component.h (93%) rename src/{esphomelib => esphome}/sensor/bme680_component.cpp (99%) rename src/{esphomelib => esphome}/sensor/bme680_component.h (94%) rename src/{esphomelib => esphome}/sensor/bmp085_component.cpp (97%) rename src/{esphomelib => esphome}/sensor/bmp085_component.h (85%) rename src/{esphomelib => esphome}/sensor/bmp280_component.cpp (97%) rename src/{esphomelib => esphome}/sensor/bmp280_component.h (92%) rename src/{esphomelib => esphome}/sensor/cse7766.cpp (97%) rename src/{esphomelib => esphome}/sensor/cse7766.h (78%) rename src/{esphomelib => esphome}/sensor/custom_sensor.cpp (75%) rename src/{esphomelib => esphome}/sensor/custom_sensor.h (55%) rename src/{esphomelib => esphome}/sensor/dallas_component.cpp (97%) rename src/{esphomelib => esphome}/sensor/dallas_component.h (93%) rename src/{esphomelib => esphome}/sensor/dht12_component.cpp (94%) rename src/{esphomelib => esphome}/sensor/dht12_component.h (77%) rename src/{esphomelib => esphome}/sensor/dht_component.cpp (95%) rename src/{esphomelib => esphome}/sensor/dht_component.h (88%) rename src/{esphomelib => esphome}/sensor/duty_cycle_sensor.cpp (93%) rename src/{esphomelib => esphome}/sensor/duty_cycle_sensor.h (76%) rename src/{esphomelib => esphome}/sensor/esp32_hall_sensor.cpp (81%) rename src/{esphomelib => esphome}/sensor/esp32_hall_sensor.h (64%) rename src/{esphomelib => esphome}/sensor/filter.cpp (97%) rename src/{esphomelib => esphome}/sensor/filter.h (96%) rename src/{esphomelib => esphome}/sensor/hdc1080_component.cpp (94%) rename src/{esphomelib => esphome}/sensor/hdc1080_component.h (81%) rename src/{esphomelib => esphome}/sensor/hlw8012.cpp (96%) rename src/{esphomelib => esphome}/sensor/hlw8012.h (86%) rename src/{esphomelib => esphome}/sensor/hmc5883l.cpp (97%) rename src/{esphomelib => esphome}/sensor/hmc5883l.h (85%) rename src/{esphomelib => esphome}/sensor/homeassistant_sensor.cpp (83%) rename src/{esphomelib => esphome}/sensor/homeassistant_sensor.h (59%) rename src/{esphomelib => esphome}/sensor/htu21d_component.cpp (94%) rename src/{esphomelib => esphome}/sensor/htu21d_component.h (70%) rename src/{esphomelib => esphome}/sensor/hx711.cpp (93%) rename src/{esphomelib => esphome}/sensor/hx711.h (76%) rename src/{esphomelib => esphome}/sensor/ina219.cpp (97%) rename src/{esphomelib => esphome}/sensor/ina219.h (82%) rename src/{esphomelib => esphome}/sensor/ina3221.cpp (97%) rename src/{esphomelib => esphome}/sensor/ina3221.h (85%) rename src/{esphomelib => esphome}/sensor/max31855_sensor.cpp (95%) rename src/{esphomelib => esphome}/sensor/max31855_sensor.h (69%) rename src/{esphomelib => esphome}/sensor/max6675_sensor.cpp (92%) rename src/{esphomelib => esphome}/sensor/max6675_sensor.h (69%) rename src/{esphomelib => esphome}/sensor/mhz19_component.cpp (94%) rename src/{esphomelib => esphome}/sensor/mhz19_component.h (73%) rename src/{esphomelib => esphome}/sensor/mpu6050_component.cpp (97%) rename src/{esphomelib => esphome}/sensor/mpu6050_component.h (82%) rename src/{esphomelib => esphome}/sensor/mqtt_sensor_component.cpp (89%) rename src/{esphomelib => esphome}/sensor/mqtt_sensor_component.h (80%) rename src/{esphomelib => esphome}/sensor/mqtt_subscribe_sensor.cpp (82%) rename src/{esphomelib => esphome}/sensor/mqtt_subscribe_sensor.h (59%) rename src/{esphomelib => esphome}/sensor/ms5611.cpp (96%) rename src/{esphomelib => esphome}/sensor/ms5611.h (79%) rename src/{esphomelib => esphome}/sensor/pmsx003.cpp (98%) rename src/{esphomelib => esphome}/sensor/pmsx003.h (86%) rename src/{esphomelib => esphome}/sensor/pulse_counter.cpp (96%) rename src/{esphomelib => esphome}/sensor/pulse_counter.h (91%) rename src/{esphomelib => esphome}/sensor/rotary_encoder.cpp (97%) rename src/{esphomelib => esphome}/sensor/rotary_encoder.h (89%) rename src/{esphomelib => esphome}/sensor/sensor.cpp (98%) rename src/{esphomelib => esphome}/sensor/sensor.h (96%) rename src/{esphomelib => esphome}/sensor/sht3xd_component.cpp (96%) rename src/{esphomelib => esphome}/sensor/sht3xd_component.h (85%) rename src/{esphomelib => esphome}/sensor/tcs34725.cpp (97%) rename src/{esphomelib => esphome}/sensor/tcs34725.h (88%) rename src/{esphomelib => esphome}/sensor/template_sensor.cpp (82%) rename src/{esphomelib => esphome}/sensor/template_sensor.h (62%) rename src/{esphomelib => esphome}/sensor/total_daily_energy.cpp (93%) rename src/{esphomelib => esphome}/sensor/total_daily_energy.h (69%) rename src/{esphomelib => esphome}/sensor/tsl2561_sensor.cpp (97%) rename src/{esphomelib => esphome}/sensor/tsl2561_sensor.h (90%) rename src/{esphomelib => esphome}/sensor/ultrasonic_sensor.cpp (93%) rename src/{esphomelib => esphome}/sensor/ultrasonic_sensor.h (92%) rename src/{esphomelib => esphome}/sensor/uptime_sensor.cpp (89%) rename src/{esphomelib => esphome}/sensor/uptime_sensor.h (69%) rename src/{esphomelib => esphome}/sensor/wifi_signal_sensor.cpp (84%) rename src/{esphomelib => esphome}/sensor/wifi_signal_sensor.h (66%) rename src/{esphomelib => esphome}/spi_component.cpp (95%) rename src/{esphomelib => esphome}/spi_component.h (81%) rename src/{esphomelib => esphome}/status_led.cpp (86%) rename src/{esphomelib => esphome}/status_led.h (62%) rename src/{esphomelib => esphome}/stepper/a4988.cpp (90%) rename src/{esphomelib => esphome}/stepper/a4988.h (63%) rename src/{esphomelib => esphome}/stepper/stepper.cpp (89%) rename src/{esphomelib => esphome}/stepper/stepper.h (90%) rename src/{esphomelib => esphome}/stepper/uln2003.cpp (94%) rename src/{esphomelib => esphome}/stepper/uln2003.h (75%) rename src/{esphomelib => esphome}/switch_/custom_switch.cpp (75%) rename src/{esphomelib => esphome}/switch_/custom_switch.h (57%) rename src/{esphomelib => esphome}/switch_/gpio_switch.cpp (93%) rename src/{esphomelib => esphome}/switch_/gpio_switch.h (73%) rename src/{esphomelib => esphome}/switch_/mqtt_switch_component.cpp (92%) rename src/{esphomelib => esphome}/switch_/mqtt_switch_component.h (69%) rename src/{esphomelib => esphome}/switch_/output_switch.cpp (83%) rename src/{esphomelib => esphome}/switch_/output_switch.h (69%) rename src/{esphomelib => esphome}/switch_/restart_switch.cpp (79%) rename src/{esphomelib => esphome}/switch_/restart_switch.h (63%) rename src/{esphomelib => esphome}/switch_/shutdown_switch.cpp (82%) rename src/{esphomelib => esphome}/switch_/shutdown_switch.h (62%) rename src/{esphomelib => esphome}/switch_/switch.cpp (92%) rename src/{esphomelib => esphome}/switch_/switch.h (95%) rename src/{esphomelib => esphome}/switch_/template_switch.cpp (93%) rename src/{esphomelib => esphome}/switch_/template_switch.h (77%) rename src/{esphomelib => esphome}/switch_/uart_switch.cpp (81%) rename src/{esphomelib => esphome}/switch_/uart_switch.h (60%) rename src/{esphomelib => esphome}/text_sensor/custom_text_sensor.cpp (77%) rename src/{esphomelib => esphome}/text_sensor/custom_text_sensor.h (55%) rename src/{esphomelib => esphome}/text_sensor/homeassistant_text_sensor.cpp (78%) rename src/{esphomelib => esphome}/text_sensor/homeassistant_text_sensor.h (56%) rename src/{esphomelib => esphome}/text_sensor/mqtt_subscribe_text_sensor.cpp (83%) rename src/{esphomelib => esphome}/text_sensor/mqtt_subscribe_text_sensor.h (56%) rename src/{esphomelib => esphome}/text_sensor/mqtt_text_sensor.cpp (89%) rename src/{esphomelib => esphome}/text_sensor/mqtt_text_sensor.h (65%) rename src/{esphomelib => esphome}/text_sensor/template_text_sensor.cpp (82%) rename src/{esphomelib => esphome}/text_sensor/template_text_sensor.h (61%) rename src/{esphomelib => esphome}/text_sensor/text_sensor.cpp (89%) rename src/{esphomelib => esphome}/text_sensor/text_sensor.h (86%) rename src/{esphomelib => esphome}/text_sensor/version_text_sensor.cpp (68%) rename src/{esphomelib => esphome}/text_sensor/version_text_sensor.h (59%) rename src/{esphomelib => esphome}/time/homeassistant_time.cpp (88%) rename src/{esphomelib => esphome}/time/homeassistant_time.h (63%) rename src/{esphomelib => esphome}/time/rtc_component.cpp (84%) rename src/{esphomelib => esphome}/time/rtc_component.h (78%) rename src/{esphomelib => esphome}/time/sntp_component.cpp (90%) rename src/{esphomelib => esphome}/time/sntp_component.h (78%) rename src/{esphomelib => esphome}/uart_component.cpp (98%) rename src/{esphomelib => esphome}/uart_component.h (91%) rename src/{esphomelib => esphome}/util.cpp (84%) rename src/{esphomelib => esphome}/util.h (75%) rename src/{esphomelib => esphome}/web_server.cpp (97%) rename src/{esphomelib => esphome}/web_server.h (90%) rename src/{esphomelib => esphome}/wifi_component.cpp (99%) rename src/{esphomelib => esphome}/wifi_component.h (96%) delete mode 100644 src/esphomelib/log.h diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 21a13a37..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - - - -**Operating environment/Installation (Hass.io/Docker/pip/etc.):** - - -**ESP (ESP32/ESP8266/Board/Sonoff):** - - -**Affected component:** - - - -**Description of problem:** - - -**Problem-relevant YAML-configuration entries:** -```yaml -PASTE YAML FILE HERE -``` - -**Traceback (if applicable):** - -``` - -``` - -**Additional information:** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 8077d5f9..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- - - - -**Is your feature request related to a problem/use-case? Please describe.** - - -**Describe the solution you'd like** - - -**Additional context** - diff --git a/.github/ISSUE_TEMPLATE/new-integration.md b/.github/ISSUE_TEMPLATE/new-integration.md deleted file mode 100644 index b258c05a..00000000 --- a/.github/ISSUE_TEMPLATE/new-integration.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: New integration -about: Suggest a new integration for esphomelib - ---- - - - -**What new integration would you wish to have?** - - -**If possible, provide a link to an existing library for the integration:** - -**Please describe your use case for this integration and alternatives you've tried:** - - -**Additional context:** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 662510c1..7cfff8a0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,11 +3,13 @@ **Related issue (if applicable):** fixes -**Pull request in [esphomeyaml](https://github.com/OttoWinter/esphomeyaml) with YAML changes (if applicable):** OttoWinter/esphomeyaml# -**Pull request in [esphomedocs](https://github.com/OttoWinter/esphomedocs) with documentation (if applicable):** OttoWinter/esphomedocs# +**Pull request in [esphome](https://github.com/esphome/esphome) with python changes (if applicable):** esphome/esphome# +**Pull request in [esphome-docs](https://github.com/esphome/esphome-docs) with documentation (if applicable):** esphome/esphome-docs# ## Checklist: + - [ ] The code change is tested and works locally. + - [ ] The code change follows the [standards](https://esphome.io/guides/contributing.html#contributing-to-esphome-core) If user exposed functionality or configuration variables are added/changed: - - [ ] Documentation added/updated in [esphomedocs](https://github.com/OttoWinter/esphomedocs). + - [ ] Documentation added/updated in [esphome-docs](https://github.com/esphome/esphome-docs). diff --git a/.travis.yml b/.travis.yml index 44393942..604b8d1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,21 +18,5 @@ matrix: - env: BUILD_TARGET=livingroom - env: BUILD_TARGET=livingroom8266 - env: BUILD_TARGET=custombmp180 - - env: BUILD_TARGET=dht-dallas-sensors - if: branch = dev AND type = push - - env: BUILD_TARGET=switch-binarysensor - if: branch = dev AND type = push - - env: BUILD_TARGET=fan-example - if: branch = dev AND type = push - - env: BUILD_TARGET=lights - if: branch = dev AND type = push - - env: BUILD_TARGET=i2c-sensors - if: branch = dev AND type = push - - env: BUILD_TARGET=pcf8574 - if: branch = dev AND type = push - env: BUILD_TARGET=fastled if: branch = dev AND type = push - - env: BUILD_TARGET=neopixelbus - if: branch = dev AND type = push - - env: BUILD_TARGET=sonoff-b1 - if: branch = dev AND type = push diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ed301bd..6c181edb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,54 +1,54 @@ -cmake_minimum_required(VERSION 3.2) -project(esphomelib) - -include(CMakeListsPrivate.txt) - -add_custom_target( - PLATFORMIO_BUILD ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPLOAD ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_CLEAN ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_TEST ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion test - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_PROGRAM ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPLOADFS ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_UPDATE_ALL ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion update - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - PLATFORMIO_REBUILD_PROJECT_INDEX ALL - COMMAND ${PLATFORMIO_CMD} -f -c clion init --ide clion - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_executable(${PROJECT_NAME} ${SRC_LIST}) +cmake_minimum_required(VERSION 3.2) +project(esphome-core) + +include(CMakeListsPrivate.txt) + +add_custom_target( + PLATFORMIO_BUILD ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPLOAD ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_CLEAN ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_TEST ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion test + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_PROGRAM ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPLOADFS ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_UPDATE_ALL ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion update + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + PLATFORMIO_REBUILD_PROJECT_INDEX ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion init --ide clion + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_executable(${PROJECT_NAME} ${SRC_LIST}) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 50cf0eae..a188d518 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,15 +1,14 @@ -# Contributing to esphomelib +# Contributing to ESPHome Core -esphomelib is the C++ framework that powers the whole esphomelib project. +ESPHome-Core is the C++ framework that powers the whole ESPHome project. -For a detailed guide, please see https://esphomelib.com/esphomeyaml/guides/contributing.html#contributing-to-esphomelib +For a detailed guide, please see https://esphome.io/eguides/contributing.html#contributing-to-esphomelib Things to note when contributing: - Please test your changes :) - If a new feature is added or an existing user-facing feature is changed, you should also - update the [docs](https://github.com/OttoWinter/esphomedocs). See [contributing to esphomedocs](https://esphomelib.com/esphomeyaml/guides/contributing.html#contributing-to-esphomedocs) + update the [docs](https://github.com/esphome/esphome-docs). See [contributing to esphome-docs](https://esphome.io/guides/contributing.html#contributing-to-esphomedocs) for more information. - - Please also create a YAML counterpart of new features in [esphomeyaml](https://github.com/OttoWinter/esphomeyaml) so that more users - can profit from it. + - Please also create a YAML counterpart of new features in [esphome](https://github.com/esphome/esphome). - Sometimes I will let pull requests linger because I'm not 100% sure about them. Please feel free to ping me after some time. diff --git a/README.md b/README.md index 398d578b..ddc399b9 100644 --- a/README.md +++ b/README.md @@ -1,408 +1,11 @@ -# esphomelib [![Build Status](https://travis-ci.org/OttoWinter/esphomelib.svg?branch=master)](https://travis-ci.org/OttoWinter/esphomelib) [![Discord Chat](https://img.shields.io/discord/429907082951524364.svg)](https://discord.gg/KhAMKrd) [![GitHub release](https://img.shields.io/github/release/OttoWinter/esphomelib.svg)](https://GitHub.com/OttoWinter/esphomelib/releases/) +# ESPHome-Core [![Build Status](https://travis-ci.org/OttoWinter/esphomelib.svg?branch=master)](https://travis-ci.org/OttoWinter/esphomelib) [![Discord Chat](https://img.shields.io/discord/429907082951524364.svg)](https://discord.gg/KhAMKrd) [![GitHub release](https://img.shields.io/github/release/OttoWinter/esphomelib.svg)](https://GitHub.com/OttoWinter/esphomelib/releases/) +[![https://esphome.io/_images/](https://esphome.io/_images/logo-core.png)](https://esphome.io/) -**esphomelib** is a library designed to greatly simplify your firmware code for ESP32/ESP8266-based devices with full -seamless [Home Assistant](https://www.home-assistant.io) integration (with automatic MQTT discovery!) so that you can focus on creating the hardware, -not the software. +This is the source of the C++ library that powers [ESPHome](https://esphome.io/) -## See [esphomeyaml](https://github.com/OttoWinter/esphomeyaml) for an easy way to use esphomelib +For issues, please go to [the issue tracker](https://github.com/esphome/issues/issues). +For feature requests, please see [feature requests](https://github.com/esphome/feature-requests/issues). -## Example -For example, the software for a device with an RGB light using the internal PWM and a -[DHT22](https://www.adafruit.com/product/385) temperature sensor can be as simple as this: - -```cpp -#include "esphomelib.h" - -using namespace esphomelib; - -void setup() { - App.set_name("livingroom"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_ota()->start_safe_mode(); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - App.init_web_server(); - - auto *red = App.make_ledc_output(32); // on pin 32, only available with ESP32 - auto *green = App.make_ledc_output(33); - auto *blue = App.make_ledc_output(34); - App.make_rgb_light("Livingroom Light", red, green, blue); - - App.make_dht_sensor("Livingroom Temperature", "Livingroom Humidity", 12); - - App.setup(); -} - -void loop() { - App.loop(); -} -``` - -And voilà 🎉 - esphomelib will now automatically manage everything such as logging to MQTT, Home Assistant MQTT -discovery, OTA updates, light effects/transitions, WiFi reconnects, etc etc. for you - amazing, right? - -If you have [MQTT Discovery](#home-assistant-configuration) enabled in Home Assistant, all the components defined here -will even show up in the front end without adding anything to your configuration file. - -## Powerful Core - -It doesn't stop there. If you, for some reason, want to customize the default options for a component, just call the -corresponding methods, almost all options are customizable. And if there's an unsupported device, simply create -a `Component` for it and esphomelib will take care of the MQTT stuff. You will even be able to use all of your -existing Arduino libraries! If you create a component, please then also consider creating a pull request so that -others won't have to re-implement everything again. - -esphomelib is built on a powerful core. Every object in esphomelib that interacts with a device, peripheral, or MQTT, -is a `Component` - and every one of those has its own independent lifecycle with the `setup()` and `loop()` options -you may know from Arduino. All the components are managed by the `Application` instance, which also has many -helper methods to easily create and add components. - -Moreover, esphomelib is very good at abstracting different components, so that the front-end parts that report values, -can easily be used with different back-end components/sensors. For example, an esphomelib light doesn't care how -RGB values are written to hardware and you can easily implement your own PWM output while reusing the entire -front-end code. - -If esphomelib doesn't have a sensor or device you'd really like, creating a custom component is very -easy: [Custom Sensor Component](https://github.com/OttoWinter/esphomelib/wiki/Custom-Sensor-Component). - -## API documentation - -You can find a documentation for the API of this project at [esphomelib.com](http://esphomelib.com/api/). - -## Getting Started - -### Setting Up Development Environment - -#### PlatformIO - -esphomelib is made for use with [platformio](http://platformio.org/), an advanced ecosystem for microcontroller -development. To get started with coding esphomelib applications, you first have to -[install the atom-based platformio IDE](http://platformio.org/platformio-ide) or for advanced users, -[install the command line version of platformio](http://docs.platformio.org/en/latest/installation.html). - -Then create a new project for an [ESP32-based board](http://docs.platformio.org/en/latest/platforms/espressif32.html#boards) -(for example, `nodemcu-32s`). Then open up the newly created `platformio.ini` file and insert - -```ini -; ... -platform = espressif32 -board = nodemcu-32s -framework = arduino -lib_deps = esphomelib -``` - -... or for [ESP8266-based boards](http://docs.platformio.org/en/latest/platforms/espressif8266.html#boards): - -```ini -; ... -platform = espressif8266 -board = nodemcuv2 -framework = arduino -lib_deps = esphomelib -``` - -Finally, create a new source file in the `src/` folder (for example `main.cpp`) and start coding with esphomelib. - -#### Arduino IDE - - -##### Installing the esphomelib library - -1. Download the latest release from https://github.com/OttoWinter/esphomelib/releases -2. (In the Arduino IDE) **Sketch > Include Library > Add .ZIP Library... >** select the downloaded file **> Open** - -##### Installing library dependencies - -Repeat the above steps with the following libraries: -- https://github.com/marvinroger/async-mqtt-client/archive/master.zip -- https://github.com/OttoWinter/ArduinoJson/releases -- https://github.com/FastLED/FastLED/releases -- https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip -- https://github.com/me-no-dev/AsyncTCP/archive/master.zip (only needed for ESP32) -- https://github.com/me-no-dev/ESPAsyncTCP/archive/master.zip (only needed for ESP8266) - -After installing esphomelib, you will find a variety of example sketches under **File > Examples > esphomelib**. - -### Bare Bones - -Before adding all the desired components to your code, there are a few things you need to set up first. - -Begin with including the library and setting the C++ namespace. - -```cpp -#include "esphomelib.h" - -using namespace esphomelib; -``` - -Next, set the name of your node (here "livingroom") with `App.set_name()`. This is required if you plan on using MQTT. -Then initialize the log so you can debug your code on the serial port with baud rate 115200. -Additionally, important log messages will also be published on MQTT with the topic `/debug` -(here `livingroom/debug`) by default. - -Following after that you'll want to setup all the connectivity stuff, like WiFi, MQTT, and OTA with the respective -methods in your `Application` instance. - -Note: MQTT will automatically determine the topics it publishes/subscribes to. All state/command topics will, -by default, be set to `livingroom/...` (e.g. `lightroom/light/livingroom_light/state`), birth messages/last will -testaments are sent to `livingroom/state`, and discovery will automatically happen with the base topic `homeassistant/`. - -```cpp -void setup() { - App.set_name("livingroom"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_ota()->start_safe_mode(); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - // ... - -``` - -Last, all you need to do is add your components. Then call `App.setup()` **at the end of** `setup()` - do the same -with `loop()` - -```cpp - App.setup(); -} - -void loop() { - App.loop(); -} -``` - -### Adding Components - -In order to create a clear separation between front-end (like MQTT) and back-end (peripherals), every time you add -a device, you'll actually want to add two components: a base component (such as `SensorComponent`) and the -corresponding `MQTTComponent`. Note: many methods in `Application` do this automatically, so you won't have to worry -about this unless you use custom components. - -In the following section, we'll go through how you would go about adding/initializing the main built-in components -of esphomelib. - -#### Light - -To add lights to your device, you'll only really need to do two things: Create the channels for output and setup -the light component. - -First, create a `OutputComponent`. This is basically just a component that the light will write brightness values to. -Each channel, i.e. the RGB channels, will have its own output and you can easily switch between different types of -outputs. For example, to use the internal LEDC PWM peripheral, just use the following code to create an output -component on pin 32: - -```cpp -auto *red = App.make_ledc_output(32); -``` - -Additionally, you can use `make_atx()` to automatically switch on a power supply when a channel is switched high. - -Next, use the `make_binary_light()`, `make_monochromatic_light()`, and `make_rgb_light()` methods with a friendly name -(which will be displayed in Home Assistant) and the channels, to create the light component. - -```cpp -App.make_rgb_light("Livingroom Light", red, green, blue); -App.make_monochromatic_light("Table Lamp", table_lamp); -App.make_binary_light("Livingroom Standing Lamp", standing_lamp); -``` - -> Lights will automatically store their state in non-volatile memory so that lights can restore the color and -> brightness if the board is restarted 🎉 - -#### Sensor - -Adding a sensor is quite easy in esphomelib. For example, to add a DHT22, just use the `make_dht_sensor()` with -the GPIO pin and the friendly names for the temperature and humidity. - -Dallas ds18b20 sensors are almost equally easy. Just setup the sensor hub on a pin with `make_dallas_component()` and -then use that to get sensors with `get_sensor_by_address()` or `get_sensor_by_index()` and register them with `make_mqtt_sensor_for()`. - -Every sensor (or technically every `MQTTSensorComponent`) can have a smoothing filter and a value offset. By default, -all sensors created with the methods in the `Application` instance automatically take the average of the last few -values and report that to the outside world - to disable this, use the `disable_filter()` method. - -#### Switch - -To create a simple GPIO switch that can control a high/low device on a pin, just use the following code with your -pin and friendly name. - -```cpp -App.make_simple_gpio_switch(32, "Livingroom Dehumidifier"); -``` - -Another feature esphomelib offers is infrared transmitter support. This way, you can control all devices using remote -controls yourself. First, you'll need to find the IR codes of the remote - maybe try the enormous -[LIRC database](http://lirc.sourceforge.net/remotes/) if you quickly want to find the codes for your remote. Then adapt -the following code to your needs (and repeat from the second line for each channel): - -```cpp -auto *ir = App.make_ir_transmitter(32); // switch out 32 for your IR pin -auto *channel = ir->create_transmitter(SendData::from_panasonic(0x4004, 0x100BCBD).repeat(25)); // use the other functions in SendData for other codes. -App.make_mqtt_switch_for("Panasonic TV On", channel); -``` - -That's it. - -#### Binary Sensor - -To create a simple GPIO binary sensor, that reports the state of a GPIO pin, use `make_gpio_binary_sensor()` -with the friendly name of the binary sensor, a [device class](https://www.home-assistant.io/components/binary_sensor/), -and the GPIO pin like this: - -```cpp -App.make_gpio_binary_sensor(36, "Cabinet Motion", binary_sensor::device_class::MOTION); -``` - -#### Fan - -Fans can be created by first calling `App.make_fan("Friendly Name")` and then using the return value -to set the output channels. See [`examples/fan-example.cpp`](examples/fan-example.cpp) for an example. - -## Home Assistant Configuration - -To use an **esphomelib** component with Home Assistant, [MQTT discovery](https://www.home-assistant.io/docs/mqtt/discovery/) -must be enabled with the topic `homeassistant/` (the default). - -```yaml -mqtt: - broker: 192.168.0.2 # Change this to your broker - discovery: True -``` - -## Current Features - -* Powerful core that allows for easy creation of new, custom components -* Automatic WiFi handling (reconnects, etc.) -* Automatic MQTT handling (birth messages, last will testaments, reconnects, etc.) -* Powerful, (colored - yay 🌈) logging to Serial **and** MQTT. -* Over the Air (OTA) updates - * OTA "safe mode". esphomelib will automatically detect boot loops and automatically - switch to a safe mode where only OTA is enabled if needed. -* Home Assistant automatic MQTT discovery -* Binary Sensors -* Switches -* Fans -* Dallas DS18b20 temperature sensors -* DHT11/DHT22 temperature/humidity sensors (with "DHT" library) -* DHT12 over the I²C bus -* Lights - - Binary/Brightness-only/RGB/RGBW - - Transitions/Flashes - - Effects (easy to add custom ones) -* IR Transmitters (with ESP32 remote control peripheral) -* ESP32: LEDC peripheral PWM output -* ESP8266 Software PWM -* PCA9685 PWM output (with "PCA9685" library) -* Power supply Mode - Automatically switch a power supply on/off when it's needed. -* ADS1115 I²C ADC sensor (experimental) -* BMP085 temperature and pressure I²C sensor -* BMP180/BME280 temperature, pressure and humidity I²C sensor -* BME680 temperature, pressure, humidity and gas I²C sensor -* HTU21D, HDC1080 and HDC1080 temperature and humidity I²C sensor -* BH1750 brightness I²C sensor - -## Planned features - -* Improve documentation -* Refine default options (like sensor update intervals) -* FastLED support -* Covers -* Status LED -* More light effects -* Multiple WiFi Networks -* **Suggestions?** Feel free to create an issue and tag it with feature request. - -## Advanced Options - -### Disable MQTT Logging - -The second argument to `init_log()` denotes the MQTT topic that logs will be written to, providing a disabled Optional -disables MQTT Logging. - -```cpp -App.init_log(115200, optional()); -``` - -### Logging - -esphomelib features a powerful logging engine that automatically pushes logs to Serial and MQTT. -To use this in your own code, simply define a TAG, and use `ESP_LOGx` -(from [esp-idf](https://esp-idf.readthedocs.io/en/v2.1.1/api-reference/system/log.html), this has been back-ported -to ESP8266 too): - -```cpp -static const char *TAG = "main"; - -// in your code: -ESP_LOGV(TAG, "This is a verbose message."); -ESP_LOGD(TAG, "This is a debug message."); -ESP_LOGI(TAG, "This is an informational message."); -ESP_LOGW(TAG, "This is a warning message."); -``` - -There are several log levels available: - * **Verbose** (This is mostly for esphomelib development) - * **Debug (Default)** (Includes useful information when setting up your project) - * **Info** (Only important messages are published here; nothing periodic) - * **Warning** (Warnings about invalid sensor values, ...) - * **Error** (Only error messages that stop esphomelib from working correctly) - -To change the global log level, include the following in your `platform.ini` (and change verbose to the log level -you want): - -```ini -build_flags = - -DESPHOMELIB_LOG_LEVEL=ESPHOMELIB_LOG_LEVEL_VERBOSE -``` - -Next, if you're using MQTT logging, simply subscribe to the debug topic and see all the beautifully color-coded log -messages scroll by: - -```bash -# for example if using mosquitto and name is livingroom -mosquitto_sub -h 192.168.178.42 -u USERNAME -P PASSWORD -t livingroom/debug -``` - -> Note: use `set_global_log_level()` and `set_log_level` in `LogComponent` to adjust the global and -> tag-specific log levels, respectively, for more fine-grained control. But also make sure to update the `build_flags` -> to a low enough log level because `build_flags` defines which log messages are even included in your App. - -When using the `platformio device monitor [...]` command, try adding the `--raw` argument - this will apply color to -log messages in your terminal. - -### Setting custom MQTT topics - -If esphomelib's default MQTT topics don't suit your needs, you can override them. For this, there are two options: - -#### 1. Set the global MQTT topic prefix. - -By default, all MQTT topics are named with the application name (see `set_name()`), for example `livingroom/...`. -However, if you want to use your own MQTT topic prefixes like `home/livingroom/node1/...`, this is possible: - -```cpp -auto *mqtt = App.init_mqtt(...); -// topic prefix should *not* include trailing "/" -mqtt->set_topic_prefix("home/livingroom/node1"); -``` - -#### 2. Customize the MQTT topics of a MQTTComponent - -Customizing the MQTT state/command topics of a single `MQTTComponent` is also possible. Simply call -`set_custom_*_topic()` on your `MQTTComponent` like this: - -```cpp -auto dht = App.make_dht_sensor(12, "Livingroom Temperature", "Livingroom Humidity"); -dht.mqtt_temperature->set_custom_state_topic("home/livingroom/node1/temperature/state"); -``` - -### OTA Updates - -If you call `App.init_ota()` during `setup()`, esphomelib will continuously listen for over-the-air updates. -To push an OTA update to your device, simply add `upload_port = `*`IP_OF_YOUR_ESP`* to your `platform.ini`. -Then do the upload as you would do normally via serial. You might want to [set a static IP](#static-ips) for your ESP32. - -> Note: OTA is, by default, enabled without any authentication. If you're on a public WiFi network, it's highly -> encouraged to set a passphrase using the `set_auth_*()` methods on the object returned by `init_ota()`. Then also -> include `upload_flags = -a `*`PASSPHRASE`* in your `platformio.ini`. +> Note: Starting with 1.10.0 using ESPHome-Core directly through C++ is no longer officially +> supported. Please use the YAML syntax with ESPHome. diff --git a/examples/custom-bmp180-sensor/custom-bmp180-sensor.cpp b/examples/custom-bmp180-sensor/custom-bmp180-sensor.cpp index ef482ce2..dd64d359 100644 --- a/examples/custom-bmp180-sensor/custom-bmp180-sensor.cpp +++ b/examples/custom-bmp180-sensor/custom-bmp180-sensor.cpp @@ -3,10 +3,10 @@ // See for more information // -#include "esphomelib/application.h" +#include "esphome.h" #include -using namespace esphomelib; +using namespace esphome; // SIMPLE EXAMPLE: just pressure class BMP180Sensor : public sensor::PollingSensorComponent { diff --git a/examples/dht-dallas-sensors/dht-dallas-sensors.cpp b/examples/dht-dallas-sensors/dht-dallas-sensors.cpp deleted file mode 100644 index 1c38aac6..00000000 --- a/examples/dht-dallas-sensors/dht-dallas-sensors.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include - -using namespace esphomelib; - -void setup() { - App.set_name("outside"); - App.init_log(); - - auto *wifi = App.init_wifi(); - // *all* parameters have to be declared in *exact order*, as defined in declared structures. - // otherwise, compiler will complain with "sorry, unimplemented: non-trivial designated initializers not supported" - auto ap = WiFiAP(); - ap.set_ssid("MySSID"); - ap.set_password("MyPassword"); - ap.set_manual_ip(ManualIP{ - .static_ip = IPAddress(192, 168, 178, 42), - .gateway = IPAddress(192, 168, 178, 1), - .subnet = IPAddress(255, 255, 255, 0) - }); - wifi->add_sta(ap); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - auto *ota = App.init_ota(); - ota->set_auth_plaintext_password("PASSWORD"); // set an optional password - ota->set_port(3232); // This is the default for ESP32 - ota->start_safe_mode(); - - auto *dallas = App.make_dallas_component(15); - - App.register_sensor(dallas->get_sensor_by_address("Ambient Temperature", 0xfe0000031f1eaf29)); - App.register_sensor(dallas->get_sensor_by_address("Heatpump Temperature", 0x710000031f0e7e28)); - - auto dht = App.make_dht_sensor("Outside Temperature", "Outside Humidity", 12); - dht.dht->get_temperature_sensor()->set_filters({ - // Take average of 30 last values; report average on every 20th value - new sensor::SlidingWindowMovingAverageFilter(30, 20), - // Convert to Fahrenheit - new sensor::LambdaFilter([](float celsius) -> optional { - return celsius * 9.0/5.0 + 32.0; - }), - }); - dht.dht->get_temperature_sensor()->set_unit_of_measurement("°F"); - - // Built-in Analog to Digital converter, can be used to measure things like luminosity. - App.make_adc_sensor("Analog Voltage", 13); - - // Ultrasonic sensor like HC-SR04, can be used to measure distance. - App.make_ultrasonic_sensor("Ultrasonic Sensor", 23, 22); - - App.setup(); -} - -void loop() { - App.loop(); -} diff --git a/examples/dht-dallas-sensors/dht-dallas-sensors.ino b/examples/dht-dallas-sensors/dht-dallas-sensors.ino deleted file mode 100644 index 136c2b60..00000000 --- a/examples/dht-dallas-sensors/dht-dallas-sensors.ino +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank -// See other tab for the code diff --git a/examples/fan-example/fan-example.cpp b/examples/fan-example/fan-example.cpp deleted file mode 100644 index ba6e8872..00000000 --- a/examples/fan-example/fan-example.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - -using namespace esphomelib; - -void setup() { - App.set_name("livingroom-fan"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - App.init_ota()->start_safe_mode(); - - auto binary_fan = App.make_fan("Binary Fan"); - binary_fan.output->set_binary(App.make_gpio_output(32)); - - auto speed_fan = App.make_fan("Speed Fan"); - // 0.0 -> off speed - // 0.33 -> low speed - // 0.66 -> medium speed - // 1.0 -> high speed - speed_fan.output->set_speed(App.make_ledc_output(33), 0.33, 0.66, 1.0); - - auto oscillating_fan = App.make_fan("Oscillating Fan"); - oscillating_fan.output->set_binary(App.make_gpio_output(34)); - oscillating_fan.output->set_oscillation(App.make_gpio_output(35)); - - App.setup(); -} - -void loop() { - App.loop(); -} diff --git a/examples/fan-example/fan-example.ino b/examples/fan-example/fan-example.ino deleted file mode 100644 index 136c2b60..00000000 --- a/examples/fan-example/fan-example.ino +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank -// See other tab for the code diff --git a/examples/fastled/fastled.cpp b/examples/fastled/fastled.cpp index 4e6fb409..1abc97ec 100644 --- a/examples/fastled/fastled.cpp +++ b/examples/fastled/fastled.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include -using namespace esphomelib; -using namespace esphomelib::light; +using namespace esphome; +using namespace esphome::light; /// Custom FastLED effect - Note: this will only work with FastLED lights class CustomLightEffect : public AddressableLightEffect { diff --git a/examples/i2c-sensors/i2c-sensors.cpp b/examples/i2c-sensors/i2c-sensors.cpp deleted file mode 100644 index 39bdf362..00000000 --- a/examples/i2c-sensors/i2c-sensors.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// This class shows you how you can use various i2c sensors with esphomelib - -#include - -using namespace esphomelib; - -void setup() { - App.set_name("outside"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - App.init_ota()->start_safe_mode(); - - // This is required to set up the i2c bus. 21 is SDA pin and 22 is SCL pin. - // Alternatively, you can just writ App.init_i2c(); to use the default i2c - // pins on your board. - // You only need to call this once. - App.init_i2c(21, 22); - - // 0x48 is the default address when address pin is pulled low. - auto *ads1115 = App.make_ads1115_component(0x48); - App.register_sensor(ads1115->get_sensor("ADS1115 Voltage #1", sensor::ADS1115_MULTIPLEXER_P0_N1, sensor::ADS1115_GAIN_6P144)); - App.register_sensor(ads1115->get_sensor("ADS1115 Voltage #2", sensor::ADS1115_MULTIPLEXER_P0_NG, sensor::ADS1115_GAIN_1P024)); - App.make_bmp085_sensor("BMP085 Temperature", "BMP085 Pressure"); - App.make_htu21d_sensor("HTU21D Temperature", "HTU21D Humidity"); - App.make_hdc1080_sensor("HDC1080 Temperature", "HDC1080 Humidity"); - - auto *mpu6050 = App.make_mpu6050_sensor(); - App.register_sensor(mpu6050->make_accel_x_sensor("MPU6050 Accel X")); - App.register_sensor(mpu6050->make_accel_y_sensor("MPU6050 Accel Y")); - App.register_sensor(mpu6050->make_accel_z_sensor("MPU6050 Accel Z")); - App.register_sensor(mpu6050->make_gyro_x_sensor("MPU6050 Gyro X")); - App.register_sensor(mpu6050->make_gyro_y_sensor("MPU6050 Gyro Y")); - App.register_sensor(mpu6050->make_gyro_z_sensor("MPU6050 Gyro Z")); - App.register_sensor(mpu6050->make_temperature_sensor("MPU6050 Temperature")); - - auto tsl2561 = App.make_tsl2561_sensor("TSL2561 Illuminance Sensor"); - // Set the time the sensor will take for value accumulation, default is 402 ms. - tsl2561.tsl2561->set_integration_time(sensor::TSL2561_INTEGRATION_14MS); - // Set a higher gain for low light conditions, default is 1x. - tsl2561.tsl2561->set_gain(sensor::TSL2561_GAIN_16X); - - auto bh1750 = App.make_bh1750_sensor("BH1750 Illuminance"); - // Default resolution is 0.5 LX. - bh1750.bh1750->set_resolution(sensor::BH1750_RESOLUTION_1P0_LX); - - auto bme280 = App.make_bme280_sensor("BME280 Temperature", "BME280 Pressure", "BME280 Humidity"); - // Set infinite impulse response filter, default is OFF. - bme280.bme280->set_iir_filter(sensor::BME280_IIR_FILTER_4X); - // Set over value sampling, default is 16x. - bme280.bme280->set_temperature_oversampling(sensor::BME280_OVERSAMPLING_16X); - bme280.bme280->set_humidity_oversampling(sensor::BME280_OVERSAMPLING_4X); - bme280.bme280->set_pressure_oversampling(sensor::BME280_OVERSAMPLING_16X); - - auto bme680 = App.make_bme680_sensor("BME680 Temperature", "BME680 Pressure", "BME680 Humidity", "BME680 Gas Resistance"); - // Default is no iir filter. - bme680.bme680->set_iir_filter(sensor::BME680_IIR_FILTER_15X); - // Set heater to 200°C for 100ms, default is OFF. - bme680.bme680->set_heater(200, 100); - - App.make_sht3xd_sensor("SHT31D Temperature", "SHT31D Humidity"); - - App.make_dht12_sensor("DHT12 Temperature", "DHT12 Humidity"); - - App.setup(); -} - -void loop() { - App.loop(); - delay(10); // this keeps the ESP32/ESP8266 from wasting power. -} diff --git a/examples/i2c-sensors/i2c-sensors.ino b/examples/i2c-sensors/i2c-sensors.ino deleted file mode 100644 index 136c2b60..00000000 --- a/examples/i2c-sensors/i2c-sensors.ino +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank -// See other tab for the code diff --git a/examples/lights/lights.cpp b/examples/lights/lights.cpp deleted file mode 100644 index 5d0dfa7a..00000000 --- a/examples/lights/lights.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include - -using namespace esphomelib; - -static const char *TAG = "main"; - -void setup() { - App.set_name("lights"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - auto *ota = App.init_ota(); - // Set a plaintext password, alternatively use an MD5 hash for maximum security (set_auth_password_hash) - ota->set_auth_plaintext_password("VERY_SECURE"); - ota->start_safe_mode(); - - // Define a power supply, this will automatically be switched on when the RGBW lights require power. - auto *power_supply = App.make_power_supply(GPIOOutputPin(13, OUTPUT, true)); // on pin 13, output pinMode and inverted. - // alternatively if you don't want to invert the pin, just - // auto *power_supply = App.make_power_supply(13); - - App.init_i2c(14, 27, 400000); // the last parameter (frequency) is only available on the ESP32. - auto *pca9685 = App.make_pca9685_component(500.0f); - auto *red = pca9685->create_channel(0, power_supply, 0.75f); // channel 0, with power supply and 75% power. - auto *green = pca9685->create_channel(1, power_supply, 1.0f); - auto *blue = pca9685->create_channel(2, power_supply, 1.0f); - auto *white = pca9685->create_channel(3, power_supply, 1.0f); - App.make_rgbw_light("RGBW Lights", red, green, blue, white); - - App.make_binary_light("Desk Lamp", App.make_gpio_output(15)); - - // LEDC is only available on ESP32! - App.make_monochromatic_light("Kitchen Lights", App.make_ledc_output(16)); // supports brightness - - App.setup(); -} - -void loop() { - App.loop(); -} diff --git a/examples/lights/lights.ino b/examples/lights/lights.ino deleted file mode 100644 index 136c2b60..00000000 --- a/examples/lights/lights.ino +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank -// See other tab for the code diff --git a/examples/livingroom/livingroom.cpp b/examples/livingroom/livingroom.cpp index 87e7459a..28bae474 100644 --- a/examples/livingroom/livingroom.cpp +++ b/examples/livingroom/livingroom.cpp @@ -1,6 +1,6 @@ -#include +#include -using namespace esphomelib; +using namespace esphome; void setup() { App.set_name("livingroom"); diff --git a/examples/livingroom8266/livingroom8266.cpp b/examples/livingroom8266/livingroom8266.cpp index f7054a7e..0a283f25 100644 --- a/examples/livingroom8266/livingroom8266.cpp +++ b/examples/livingroom8266/livingroom8266.cpp @@ -1,6 +1,6 @@ -#include +#include -using namespace esphomelib; +using namespace esphome; void setup() { App.set_name("livingroom"); diff --git a/examples/neopixelbus/neopixelbus.cpp b/examples/neopixelbus/neopixelbus.cpp deleted file mode 100644 index 3764156d..00000000 --- a/examples/neopixelbus/neopixelbus.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -using namespace esphomelib; - -uint16_t pixel_count = 30; -uint8_t pixel_pin = 2; -// in Neo800KbpsMethod (dma) the pixel_pin is not used and is always PIN 2 (RX) -NeoPixelBus strip(pixel_count, pixel_pin); - -void setup() { - App.set_name("neopixelbus"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - App.init_ota()->start_safe_mode(); - - auto neopixel = App.make_neo_pixel_bus_rgbw_light("NeoPixelBus SK 6812 Light"); - neopixel.output->set_pixel_order(light::ESPNeoPixelOrder::GRBW); - neopixel.output->add_leds(&strip); - neopixel.state->set_default_transition_length(800); - - neopixel.state->add_effects({ - new light::RandomLightEffect("Random"), - new light::AddressableColorWipeEffect("Color Wipe"), - new light::AddressableRainbowLightEffect("Rainbow"), - }); - - App.setup(); -} - -void loop() { - App.loop(); - delay(16); -} diff --git a/examples/neopixelbus/neopixelbus.ino b/examples/neopixelbus/neopixelbus.ino deleted file mode 100644 index 136c2b60..00000000 --- a/examples/neopixelbus/neopixelbus.ino +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank -// See other tab for the code diff --git a/examples/pcf8574/pcf8574.cpp b/examples/pcf8574/pcf8574.cpp deleted file mode 100644 index 63d32ffa..00000000 --- a/examples/pcf8574/pcf8574.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -using namespace esphomelib; - -void setup() { - App.set_name("pcf8574"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - App.init_ota()->start_safe_mode(); - - App.init_i2c(SDA, SCL, true); - - auto *pcf8574 = App.make_pcf8574_component(0x21); - App.make_gpio_binary_sensor("PCF pin 0 sensor", pcf8574->make_input_pin(0, INPUT)); - App.make_gpio_binary_sensor("PCF pin 1 sensor", pcf8574->make_input_pin(1, INPUT_PULLUP)); - - App.make_gpio_switch("PCF pin 4 switch", pcf8574->make_output_pin(4)); - auto *out = App.make_gpio_output(pcf8574->make_output_pin(5)); - App.make_binary_light("PCF pin 5 light", out); - - App.setup(); -} - -void loop() { - App.loop(); -} diff --git a/examples/pcf8574/pcf8574.ino b/examples/pcf8574/pcf8574.ino deleted file mode 100644 index 136c2b60..00000000 --- a/examples/pcf8574/pcf8574.ino +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank -// See other tab for the code diff --git a/examples/sonoff-b1/sonoff-b1.cpp b/examples/sonoff-b1/sonoff-b1.cpp deleted file mode 100644 index decbd759..00000000 --- a/examples/sonoff-b1/sonoff-b1.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace esphomelib; - -static const char *TAG = "main"; - -static const float cold_white_mireds = 1000000 / 6500; // 6500 K -static const float warm_white_mireds = 1000000 / 2800; // 2800 K - -void setup() { - App.set_name("sonoff_b1"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - auto *ota = App.init_ota(); - // Set a plaintext password, alternatively use an MD5 hash for maximum security (set_auth_password_hash) - ota->set_auth_plaintext_password("VERY_SECURE"); - ota->start_safe_mode(); - - auto *my9231 = App.make_my9231_component(GPIOOutputPin(12), - GPIOOutputPin(14)); - my9231->set_num_channels(6); // two MY9231 chips with each 3 channels - my9231->set_num_chips(2); - auto *blue = my9231->create_channel(0); - auto *red = my9231->create_channel(1); - auto *green = my9231->create_channel(2); - auto *warm_white = my9231->create_channel(4); - auto *cold_white = my9231->create_channel(5); - App.make_rgbww_light("Sonoff B1", cold_white_mireds, warm_white_mireds, - red, green, blue, cold_white, warm_white); - - App.setup(); -} - -void loop() { - App.loop(); -} diff --git a/examples/sonoff-b1/sonoff-b1.ino b/examples/sonoff-b1/sonoff-b1.ino deleted file mode 100644 index 136c2b60..00000000 --- a/examples/sonoff-b1/sonoff-b1.ino +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank -// See other tab for the code diff --git a/examples/switch-binarysensor/switch-binarysensor.cpp b/examples/switch-binarysensor/switch-binarysensor.cpp deleted file mode 100644 index c4acb3f3..00000000 --- a/examples/switch-binarysensor/switch-binarysensor.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -using namespace esphomelib; - -static const char *TAG = "main"; - -void setup() { - App.set_name("ir"); - App.init_log(); - - App.init_wifi("YOUR_SSID", "YOUR_PASSWORD"); - App.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD"); - App.init_ota()->start_safe_mode(); - - App.make_gpio_switch("Dehumidifier", 33); - ESP_LOGV(TAG, "Humidifier created."); - - App.make_gpio_binary_sensor("Cabinet Motion", 36, "motion"); - - App.setup(); -} - -void loop() { - App.loop(); -} diff --git a/examples/switch-binarysensor/switch-binarysensor.ino b/examples/switch-binarysensor/switch-binarysensor.ino deleted file mode 100644 index 136c2b60..00000000 --- a/examples/switch-binarysensor/switch-binarysensor.ino +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank -// See other tab for the code diff --git a/library.json b/library.json index 4c93d120..04bbb193 100644 --- a/library.json +++ b/library.json @@ -1,10 +1,10 @@ { - "name": "esphomelib", + "name": "esphome-core", "keywords": "esp32, home-assistant, ir, ledc, mqtt, iot", - "description": "esphomelib is a library designed to greatly simplify your firmware code for ESP32-based devices with full MQTT and Home Assistant support.", + "description": "ESPHome - Reimagining DIY Home Automation.", "repository": { "type": "git", - "url": "https://github.com/OttoWinter/esphomelib.git" + "url": "https://github.com/esphome/esphome-core.git" }, "version": "1.11.0-dev", "authors": [ diff --git a/library.properties b/library.properties index a7517c42..ad1f1da7 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,9 @@ -name=esphomelib +name=esphome-core version=1.11.0-dev author=Otto Winter maintainer=Otto Winter -sentence=esphomelib is a library designed to greatly simplify your firmware code for ESP32-based devices with full MQTT and Home Assistant support. +sentence=ESPHome - Reimagining DIY Home Automation. paragraph= category=Other -url=https://github.com/OttoWinter/esphomelib +url=https://github.com/esphome/esphome-core architectures=esp32,esp8266 diff --git a/platformio.ini b/platformio.ini index 18e7072f..b7bc158f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,4 +1,4 @@ -; This file is here for developing esphomelib, as a user you don't need this. +; This file is here for developing esphome-core [platformio] env_default = livingroom @@ -32,38 +32,6 @@ lib_deps = ${common.lib_deps} build_flags = ${common.build_flags} -DUSE_NEW_OTA -DUSE_ETHERNET src_filter = ${common.src_filter} + -[env:dht-dallas-sensors] -platform = espressif32@1.6.0 -board = nodemcu-32s -framework = arduino -lib_deps = ${common.lib_deps} -build_flags = ${common.build_flags} -src_filter = ${common.src_filter} + - -[env:switch-binarysensor] -platform = espressif32@1.6.0 -board = nodemcu-32s -framework = arduino -lib_deps = ${common.lib_deps} -build_flags = ${common.build_flags} -src_filter = ${common.src_filter} + - -[env:fan-example] -platform = espressif32@1.6.0 -board = nodemcu-32s -framework = arduino -lib_deps = ${common.lib_deps} -build_flags = ${common.build_flags} -src_filter = ${common.src_filter} + - -[env:lights] -platform = espressif32@1.6.0 -board = nodemcu-32s -framework = arduino -lib_deps = ${common.lib_deps} -build_flags = ${common.build_flags} -src_filter = ${common.src_filter} + - [env:livingroom8266] platform = espressif8266@1.8.0 board = nodemcuv2 @@ -82,43 +50,10 @@ lib_deps = build_flags = ${common.build_flags} src_filter = ${common.src_filter} + -[env:i2c-sensors] -platform = espressif32@1.6.0 -board = nodemcu-32s -framework = arduino -lib_deps = ${common.lib_deps} -build_flags = ${common.build_flags} -src_filter = ${common.src_filter} + - -[env:pcf8574] -platform = espressif32@1.6.0 -board = nodemcu-32s -framework = arduino -lib_deps = ${common.lib_deps} -build_flags = ${common.build_flags} -src_filter = ${common.src_filter} + - [env:fastled] -platform = espressif32@1.6.0 +platform = espressif32@1.5.0 board = nodemcu-32s framework = arduino lib_deps = ${common.lib_deps} build_flags = ${common.build_flags} src_filter = ${common.src_filter} + - -[env:sonoff-b1] -platform = espressif8266@1.8.0 -board = esp01_1m -board_build.flash_mode = dout -framework = arduino -lib_deps = ${common.lib_deps} -build_flags = ${common.build_flags} -src_filter = ${common.src_filter} + - -[env:neopixelbus] -platform = espressif32@1.6.0 -board = nodemcu-32s -framework = arduino -lib_deps = ${common.lib_deps} -build_flags = ${common.build_flags} -src_filter = ${common.src_filter} + diff --git a/src/esphome.h b/src/esphome.h new file mode 100644 index 00000000..66a442f2 --- /dev/null +++ b/src/esphome.h @@ -0,0 +1 @@ +#include "esphome/application.h" diff --git a/src/esphomelib/api/api.proto b/src/esphome/api/api.proto similarity index 99% rename from src/esphomelib/api/api.proto rename to src/esphome/api/api.proto index 789ea10c..ffad3b1a 100644 --- a/src/esphomelib/api/api.proto +++ b/src/esphome/api/api.proto @@ -92,7 +92,7 @@ message DeviceInfoResponse { // A string describing the date of compilation, this is generated by the compiler // and therefore may not be in the same format all the time. - // If the user isn't using esphomeyaml, this will also not be set. + // If the user isn't using ESPHome, this will also not be set. string compilation_time = 5; // The model of the board. For example NodeMCU diff --git a/src/esphomelib/api/api_message.cpp b/src/esphome/api/api_message.cpp similarity index 94% rename from src/esphomelib/api/api_message.cpp rename to src/esphome/api/api_message.cpp index e44c753d..489215ae 100644 --- a/src/esphomelib/api/api_message.cpp +++ b/src/esphome/api/api_message.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/api_message.h" -#include "esphomelib/log.h" +#include "esphome/api/api_message.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -100,6 +100,6 @@ void APIMessage::decode(uint8_t *buffer, size_t length) { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/api_message.h b/src/esphome/api/api_message.h similarity index 87% rename from src/esphomelib/api/api_message.h rename to src/esphome/api/api_message.h index ceb534b7..1ba75cc0 100644 --- a/src/esphomelib/api/api_message.h +++ b/src/esphome/api/api_message.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_API_API_MESSAGE_H -#define ESPHOMELIB_API_API_MESSAGE_H +#ifndef ESPHOME_API_API_MESSAGE_H +#define ESPHOME_API_API_MESSAGE_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/component.h" -#include "esphomelib/api/util.h" +#include "esphome/component.h" +#include "esphome/api/util.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -74,8 +74,8 @@ class APIMessage { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API -#endif //ESPHOMELIB_API_API_MESSAGE_H +#endif //ESPHOME_API_API_MESSAGE_H diff --git a/src/esphomelib/api/api_server.cpp b/src/esphome/api/api_server.cpp similarity index 98% rename from src/esphomelib/api/api_server.cpp rename to src/esphome/api/api_server.cpp index 8ca81072..5603eda0 100644 --- a/src/esphomelib/api/api_server.cpp +++ b/src/esphome/api/api_server.cpp @@ -1,18 +1,18 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/api_server.h" -#include "esphomelib/api/basic_messages.h" -#include "esphomelib/log.h" -#include "esphomelib/application.h" -#include "esphomelib/util.h" -#include "esphomelib/deep_sleep_component.h" -#include "esphomelib/time/homeassistant_time.h" +#include "esphome/api/api_server.h" +#include "esphome/api/basic_messages.h" +#include "esphome/log.h" +#include "esphome/application.h" +#include "esphome/util.h" +#include "esphome/deep_sleep_component.h" +#include "esphome/time/homeassistant_time.h" #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -504,7 +504,7 @@ void APIConnection::on_hello_request_(const HelloRequest &req) { buffer.encode_uint32(2, 0); // string server_info = 3; - buffer.encode_string(3, get_app_name() + " (esphomelib v" ESPHOMELIB_VERSION ")"); + buffer.encode_string(3, get_app_name() + " (esphome v" ESPHOME_VERSION ")"); bool success = this->send_buffer(APIMessageType::HELLO_RESPONSE); if (!success) { this->fatal_error_(); @@ -569,8 +569,8 @@ void APIConnection::on_device_info_request_(const DeviceInfoRequest &req) { buffer.encode_string(2, get_app_name()); // string mac_address = 3; buffer.encode_string(3, get_mac_address_pretty()); - // string esphomelib_version = 4; - buffer.encode_string(4, ESPHOMELIB_VERSION); + // string esphome_version = 4; + buffer.encode_string(4, ESPHOME_VERSION); // string compilation_time = 5; buffer.encode_string(5, get_app_compilation_time()); #ifdef ARDUINO_BOARD @@ -1013,6 +1013,6 @@ void APIConnection::send_time_request() { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/api_server.h b/src/esphome/api/api_server.h similarity index 90% rename from src/esphomelib/api/api_server.h rename to src/esphome/api/api_server.h index e972c175..120cbc6c 100644 --- a/src/esphomelib/api/api_server.h +++ b/src/esphome/api/api_server.h @@ -1,21 +1,21 @@ -#ifndef ESPHOMELIB_HOMEASSISTANT_API_SERVER_H -#define ESPHOMELIB_HOMEASSISTANT_API_SERVER_H +#ifndef ESPHOME_HOMEASSISTANT_API_SERVER_H +#define ESPHOME_HOMEASSISTANT_API_SERVER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/component.h" -#include "esphomelib/controller.h" -#include "esphomelib/api/util.h" -#include "esphomelib/api/api_message.h" -#include "esphomelib/api/basic_messages.h" -#include "esphomelib/api/list_entities.h" -#include "esphomelib/api/subscribe_state.h" -#include "esphomelib/api/subscribe_logs.h" -#include "esphomelib/api/command_messages.h" -#include "esphomelib/api/service_call_message.h" -#include "esphomelib/log.h" +#include "esphome/component.h" +#include "esphome/controller.h" +#include "esphome/api/util.h" +#include "esphome/api/api_message.h" +#include "esphome/api/basic_messages.h" +#include "esphome/api/list_entities.h" +#include "esphome/api/subscribe_state.h" +#include "esphome/api/subscribe_logs.h" +#include "esphome/api/command_messages.h" +#include "esphome/api/service_call_message.h" +#include "esphome/log.h" #ifdef ARDUINO_ARCH_ESP32 #include @@ -24,7 +24,7 @@ #include #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -128,7 +128,7 @@ class APIConnection { InitialStateIterator initial_state_iterator_; bool state_subscription_{false}; - int log_subscription_{ESPHOMELIB_LOG_LEVEL_NONE}; + int log_subscription_{ESPHOME_LOG_LEVEL_NONE}; uint32_t last_traffic_; bool sent_ping_{false}; bool service_call_subscription_{false}; @@ -242,8 +242,8 @@ void HomeAssistantServiceCallAction::play(T x) { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API -#endif //ESPHOMELIB_HOMEASSISTANT_API_SERVER_H +#endif //ESPHOME_HOMEASSISTANT_API_SERVER_H diff --git a/src/esphomelib/api/basic_messages.cpp b/src/esphome/api/basic_messages.cpp similarity index 93% rename from src/esphomelib/api/basic_messages.cpp rename to src/esphome/api/basic_messages.cpp index 6a49622c..589abed7 100644 --- a/src/esphomelib/api/basic_messages.cpp +++ b/src/esphome/api/basic_messages.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/basic_messages.h" -#include "esphomelib/log.h" +#include "esphome/api/basic_messages.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -87,6 +87,6 @@ APIMessageType PingResponse::message_type() const { } } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/basic_messages.h b/src/esphome/api/basic_messages.h similarity index 86% rename from src/esphomelib/api/basic_messages.h rename to src/esphome/api/basic_messages.h index 1800702d..9dda5cec 100644 --- a/src/esphomelib/api/basic_messages.h +++ b/src/esphome/api/basic_messages.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_API_BASIC_MESSAGES_H -#define ESPHOMELIB_API_BASIC_MESSAGES_H +#ifndef ESPHOME_API_BASIC_MESSAGES_H +#define ESPHOME_API_BASIC_MESSAGES_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/api_message.h" +#include "esphome/api/api_message.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -64,8 +64,8 @@ class PingResponse : public APIMessage { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API -#endif //ESPHOMELIB_API_BASIC_MESSAGES_H +#endif //ESPHOME_API_BASIC_MESSAGES_H diff --git a/src/esphomelib/api/command_messages.cpp b/src/esphome/api/command_messages.cpp similarity index 97% rename from src/esphomelib/api/command_messages.cpp rename to src/esphome/api/command_messages.cpp index 4520b2c4..ce964206 100644 --- a/src/esphomelib/api/command_messages.cpp +++ b/src/esphome/api/command_messages.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/command_messages.h" -#include "esphomelib/log.h" +#include "esphome/api/command_messages.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -304,6 +304,6 @@ bool SwitchCommandRequest::get_state() const { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/command_messages.h b/src/esphome/api/command_messages.h similarity index 90% rename from src/esphomelib/api/command_messages.h rename to src/esphome/api/command_messages.h index c61a7326..5b4bb698 100644 --- a/src/esphomelib/api/command_messages.h +++ b/src/esphome/api/command_messages.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_API_COMMAND_MESSAGES_H -#define ESPHOMELIB_API_COMMAND_MESSAGES_H +#ifndef ESPHOME_API_COMMAND_MESSAGES_H +#define ESPHOME_API_COMMAND_MESSAGES_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/component.h" -#include "esphomelib/api/api_message.h" +#include "esphome/component.h" +#include "esphome/api/api_message.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -107,8 +107,8 @@ class SwitchCommandRequest : public APIMessage { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API -#endif //ESPHOMELIB_API_COMMAND_MESSAGES_H +#endif //ESPHOME_API_COMMAND_MESSAGES_H diff --git a/src/esphomelib/api/list_entities.cpp b/src/esphome/api/list_entities.cpp similarity index 96% rename from src/esphomelib/api/list_entities.cpp rename to src/esphome/api/list_entities.cpp index 4caf4e37..ca648f59 100644 --- a/src/esphomelib/api/list_entities.cpp +++ b/src/esphome/api/list_entities.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/list_entities.h" -#include "esphomelib/util.h" -#include "esphomelib/log.h" +#include "esphome/api/list_entities.h" +#include "esphome/util.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -139,6 +139,6 @@ APIMessageType ListEntitiesRequest::message_type() const { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/list_entities.h b/src/esphome/api/list_entities.h similarity index 76% rename from src/esphomelib/api/list_entities.h rename to src/esphome/api/list_entities.h index 2d8d8fb9..720d925c 100644 --- a/src/esphomelib/api/list_entities.h +++ b/src/esphome/api/list_entities.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_LIST_ENTITIES_H -#define ESPHOMELIB_LIST_ENTITIES_H +#ifndef ESPHOME_LIST_ENTITIES_H +#define ESPHOME_LIST_ENTITIES_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/component.h" -#include "esphomelib/api/api_message.h" +#include "esphome/component.h" +#include "esphome/api/api_message.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -50,10 +50,10 @@ class ListEntitiesIterator : public ComponentIterator { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/api/api_server.h" +#include "esphome/api/api_server.h" #endif //USE_API -#endif //ESPHOMELIB_LIST_ENTITIES_H +#endif //ESPHOME_LIST_ENTITIES_H diff --git a/src/esphomelib/api/service_call_message.cpp b/src/esphome/api/service_call_message.cpp similarity index 91% rename from src/esphomelib/api/service_call_message.cpp rename to src/esphome/api/service_call_message.cpp index a5984638..9671c4ea 100644 --- a/src/esphomelib/api/service_call_message.cpp +++ b/src/esphome/api/service_call_message.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/service_call_message.h" -#include "esphomelib/log.h" +#include "esphome/api/service_call_message.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -59,6 +59,6 @@ KeyValuePair::KeyValuePair(const std::string &key, const std::string &value) : k } } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/service_call_message.h b/src/esphome/api/service_call_message.h similarity index 79% rename from src/esphomelib/api/service_call_message.h rename to src/esphome/api/service_call_message.h index 5713a32d..c1aaad78 100644 --- a/src/esphomelib/api/service_call_message.h +++ b/src/esphome/api/service_call_message.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_API_SERVICE_CALL_MESSAGE_H -#define ESPHOMELIB_API_SERVICE_CALL_MESSAGE_H +#ifndef ESPHOME_API_SERVICE_CALL_MESSAGE_H +#define ESPHOME_API_SERVICE_CALL_MESSAGE_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/helpers.h" -#include "esphomelib/automation.h" -#include "esphomelib/api/api_message.h" +#include "esphome/helpers.h" +#include "esphome/automation.h" +#include "esphome/api/api_message.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -61,8 +61,8 @@ class ServiceCallResponse : public APIMessage { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API -#endif //ESPHOMELIB_API_SERVICE_CALL_MESSAGE_H +#endif //ESPHOME_API_SERVICE_CALL_MESSAGE_H diff --git a/src/esphomelib/api/subscribe_logs.cpp b/src/esphome/api/subscribe_logs.cpp similarity index 84% rename from src/esphomelib/api/subscribe_logs.cpp rename to src/esphome/api/subscribe_logs.cpp index 01022976..dc40c6d2 100644 --- a/src/esphomelib/api/subscribe_logs.cpp +++ b/src/esphome/api/subscribe_logs.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/subscribe_logs.h" -#include "esphomelib/log.h" +#include "esphome/api/subscribe_logs.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -38,6 +38,6 @@ void SubscribeLogsRequest::set_dump_config(bool dump_config) { } } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/subscribe_logs.h b/src/esphome/api/subscribe_logs.h similarity index 61% rename from src/esphomelib/api/subscribe_logs.h rename to src/esphome/api/subscribe_logs.h index 3ce59e0a..6b0609e0 100644 --- a/src/esphomelib/api/subscribe_logs.h +++ b/src/esphome/api/subscribe_logs.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_API_SUBSCRIBE_LOGS_H -#define ESPHOMELIB_API_SUBSCRIBE_LOGS_H +#ifndef ESPHOME_API_SUBSCRIBE_LOGS_H +#define ESPHOME_API_SUBSCRIBE_LOGS_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/component.h" -#include "esphomelib/api/api_message.h" +#include "esphome/component.h" +#include "esphome/api/api_message.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -27,8 +27,8 @@ class SubscribeLogsRequest : public APIMessage { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API -#endif //ESPHOMELIB_API_SUBSCRIBE_LOGS_H +#endif //ESPHOME_API_SUBSCRIBE_LOGS_H diff --git a/src/esphomelib/api/subscribe_state.cpp b/src/esphome/api/subscribe_state.cpp similarity index 94% rename from src/esphomelib/api/subscribe_state.cpp rename to src/esphome/api/subscribe_state.cpp index c6536aae..c9bfcfbb 100644 --- a/src/esphomelib/api/subscribe_state.cpp +++ b/src/esphome/api/subscribe_state.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/subscribe_state.h" -#include "esphomelib/log.h" +#include "esphome/api/subscribe_state.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -94,6 +94,6 @@ APIMessageType SubscribeHomeAssistantStatesRequest::message_type() const { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/subscribe_state.h b/src/esphome/api/subscribe_state.h similarity index 79% rename from src/esphomelib/api/subscribe_state.h rename to src/esphome/api/subscribe_state.h index 7a06ac49..09182355 100644 --- a/src/esphomelib/api/subscribe_state.h +++ b/src/esphome/api/subscribe_state.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_SUBSCRIBE_STATE_H -#define ESPHOMELIB_SUBSCRIBE_STATE_H +#ifndef ESPHOME_SUBSCRIBE_STATE_H +#define ESPHOME_SUBSCRIBE_STATE_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/component.h" -#include "esphomelib/controller.h" -#include "esphomelib/api/util.h" -#include "esphomelib/api/api_message.h" +#include "esphome/component.h" +#include "esphome/controller.h" +#include "esphome/api/util.h" +#include "esphome/api/api_message.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -67,10 +67,10 @@ class HomeAssistantStateResponse : public APIMessage { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/api/api_server.h" +#include "esphome/api/api_server.h" #endif //USE_API -#endif //ESPHOMELIB_SUBSCRIBE_STATE_H +#endif //ESPHOME_SUBSCRIBE_STATE_H diff --git a/src/esphomelib/api/util.cpp b/src/esphome/api/util.cpp similarity index 98% rename from src/esphomelib/api/util.cpp rename to src/esphome/api/util.cpp index a796570b..98e9bc34 100644 --- a/src/esphomelib/api/util.cpp +++ b/src/esphome/api/util.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/api/util.h" -#include "esphomelib/log.h" +#include "esphome/api/util.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -334,6 +334,6 @@ bool ComponentIterator::on_begin() { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API diff --git a/src/esphomelib/api/util.h b/src/esphome/api/util.h similarity index 89% rename from src/esphomelib/api/util.h rename to src/esphome/api/util.h index a88bd968..c39660f2 100644 --- a/src/esphomelib/api/util.h +++ b/src/esphome/api/util.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_API_UTIL_H -#define ESPHOMELIB_API_UTIL_H +#ifndef ESPHOME_API_UTIL_H +#define ESPHOME_API_UTIL_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_API -#include "esphomelib/helpers.h" -#include "esphomelib/component.h" -#include "esphomelib/controller.h" +#include "esphome/helpers.h" +#include "esphome/component.h" +#include "esphome/controller.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace api { @@ -111,8 +111,8 @@ class ComponentIterator { } // namespace api -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_API -#endif //ESPHOMELIB_API_UTIL_H +#endif //ESPHOME_API_UTIL_H diff --git a/src/esphomelib/application.cpp b/src/esphome/application.cpp similarity index 98% rename from src/esphomelib/application.cpp rename to src/esphome/application.cpp index fcca5a03..235a021c 100644 --- a/src/esphomelib/application.cpp +++ b/src/esphome/application.cpp @@ -1,52 +1,52 @@ -#include "esphomelib/application.h" +#include "esphome/application.h" #include #include -#include "esphomelib/log.h" -#include "esphomelib/espmath.h" -#include "esphomelib/esppreferences.h" +#include "esphome/log.h" +#include "esphome/espmath.h" +#include "esphome/esppreferences.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN #ifdef USE_MQTT -using namespace esphomelib::mqtt; +using namespace esphome::mqtt; #endif #ifdef USE_BINARY_SENSOR -using namespace esphomelib::binary_sensor; +using namespace esphome::binary_sensor; #endif #ifdef USE_SENSOR -using namespace esphomelib::sensor; +using namespace esphome::sensor; #endif #ifdef USE_OUTPUT -using namespace esphomelib::output; +using namespace esphome::output; #endif #ifdef USE_LIGHT -using namespace esphomelib::light; +using namespace esphome::light; #endif #ifdef USE_FAN -using namespace esphomelib::fan; +using namespace esphome::fan; #endif #ifdef USE_SWITCH -using namespace esphomelib::switch_; +using namespace esphome::switch_; #endif #ifdef USE_IO -using namespace esphomelib::io; +using namespace esphome::io; #endif #ifdef USE_COVER -using namespace esphomelib::cover; +using namespace esphome::cover; #endif #ifdef USE_REMOTE -using namespace esphomelib::remote; +using namespace esphome::remote; #endif #ifdef USE_TIME -using namespace esphomelib::time; +using namespace esphome::time; #endif #ifdef USE_TEXT_SENSOR -using namespace esphomelib::text_sensor; +using namespace esphome::text_sensor; #endif #ifdef USE_STEPPER -using namespace esphomelib::stepper; +using namespace esphome::stepper; #endif static const char *TAG = "application"; @@ -93,9 +93,9 @@ void Application::setup() { void Application::dump_config() { if (this->compilation_time_.empty()) { - ESP_LOGI(TAG, "You're running esphomelib v" ESPHOMELIB_VERSION); + ESP_LOGI(TAG, "esphome-core version " ESPHOME_VERSION); } else { - ESP_LOGI(TAG, "You're running esphomelib v" ESPHOMELIB_VERSION " compiled on %s", this->compilation_time_.c_str()); + ESP_LOGI(TAG, "esphome-core version " ESPHOME_VERSION " compiled on %s", this->compilation_time_.c_str()); } for (uint32_t i = 0; i < this->components_.size(); i++) { @@ -1280,4 +1280,4 @@ stepper::ULN2003 *Application::make_uln2003(const GPIOOutputPin &pin_a, const GP Application App; // NOLINT -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphome/application.h b/src/esphome/application.h new file mode 100644 index 00000000..23fa359a --- /dev/null +++ b/src/esphome/application.h @@ -0,0 +1,1317 @@ +#ifndef ESPHOME_APPLICATION_H +#define ESPHOME_APPLICATION_H + +#include +#include "esphome/defines.h" +#include "esphome/api/api_server.h" +#include "esphome/automation.h" +#include "esphome/component.h" +#include "esphome/controller.h" +#include "esphome/custom_component.h" +#include "esphome/debug_component.h" +#include "esphome/deep_sleep_component.h" +#include "esphome/esp32_ble_beacon.h" +#include "esphome/esp32_ble_tracker.h" +#include "esphome/esp_one_wire.h" +#include "esphome/esphal.h" +#include "esphome/esppreferences.h" +#include "esphome/ethernet_component.h" +#include "esphome/i2c_component.h" +#include "esphome/log.h" +#include "esphome/log_component.h" +#include "esphome/ota_component.h" +#include "esphome/power_supply_component.h" +#include "esphome/spi_component.h" +#include "esphome/status_led.h" +#include "esphome/uart_component.h" +#include "esphome/web_server.h" +#include "esphome/wifi_component.h" +#include "esphome/binary_sensor/binary_sensor.h" +#include "esphome/binary_sensor/custom_binary_sensor.h" +#include "esphome/binary_sensor/esp32_touch_binary_sensor.h" +#include "esphome/binary_sensor/filter.h" +#include "esphome/binary_sensor/gpio_binary_sensor_component.h" +#include "esphome/binary_sensor/homeassistant_binary_sensor.h" +#include "esphome/binary_sensor/mqtt_binary_sensor_component.h" +#include "esphome/binary_sensor/pn532_component.h" +#include "esphome/binary_sensor/rdm6300.h" +#include "esphome/binary_sensor/status_binary_sensor.h" +#include "esphome/binary_sensor/template_binary_sensor.h" +#include "esphome/cover/cover.h" +#include "esphome/cover/mqtt_cover_component.h" +#include "esphome/cover/template_cover.h" +#include "esphome/display/display.h" +#include "esphome/display/lcd_display.h" +#include "esphome/display/max7219.h" +#include "esphome/display/nextion.h" +#include "esphome/display/ssd1306.h" +#include "esphome/display/waveshare_epaper.h" +#include "esphome/fan/basic_fan_component.h" +#include "esphome/fan/fan_state.h" +#include "esphome/fan/mqtt_fan_component.h" +#include "esphome/io/pcf8574_component.h" +#include "esphome/light/addressable_light_effect.h" +#include "esphome/light/fast_led_light_output.h" +#include "esphome/light/light_color_values.h" +#include "esphome/light/light_effect.h" +#include "esphome/light/light_output_component.h" +#include "esphome/light/light_state.h" +#include "esphome/light/mqtt_json_light_component.h" +#include "esphome/light/neo_pixel_bus_light_output.h" +#include "esphome/mqtt/custom_mqtt_device.h" +#include "esphome/mqtt/mqtt_client_component.h" +#include "esphome/mqtt/mqtt_component.h" +#include "esphome/output/binary_output.h" +#include "esphome/output/custom_output.h" +#include "esphome/output/esp8266_pwm_output.h" +#include "esphome/output/float_output.h" +#include "esphome/output/gpio_binary_output_component.h" +#include "esphome/output/ledc_output_component.h" +#include "esphome/output/pca9685_output_component.h" +#include "esphome/output/my9231_output_component.h" +#include "esphome/remote/jvc.h" +#include "esphome/remote/lg.h" +#include "esphome/remote/nec.h" +#include "esphome/remote/panasonic.h" +#include "esphome/remote/raw.h" +#include "esphome/remote/rc_switch.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" +#include "esphome/remote/samsung.h" +#include "esphome/remote/sony.h" +#include "esphome/sensor/adc.h" +#include "esphome/sensor/ads1115_component.h" +#include "esphome/sensor/apds9960.h" +#include "esphome/sensor/bh1750_sensor.h" +#include "esphome/sensor/bme280_component.h" +#include "esphome/sensor/bme680_component.h" +#include "esphome/sensor/bmp085_component.h" +#include "esphome/sensor/bmp280_component.h" +#include "esphome/sensor/cse7766.h" +#include "esphome/sensor/custom_sensor.h" +#include "esphome/sensor/dallas_component.h" +#include "esphome/sensor/dht12_component.h" +#include "esphome/sensor/dht_component.h" +#include "esphome/sensor/duty_cycle_sensor.h" +#include "esphome/sensor/esp32_hall_sensor.h" +#include "esphome/sensor/filter.h" +#include "esphome/sensor/hdc1080_component.h" +#include "esphome/sensor/hlw8012.h" +#include "esphome/sensor/hmc5883l.h" +#include "esphome/sensor/homeassistant_sensor.h" +#include "esphome/sensor/htu21d_component.h" +#include "esphome/sensor/hx711.h" +#include "esphome/sensor/ina219.h" +#include "esphome/sensor/ina3221.h" +#include "esphome/sensor/max31855_sensor.h" +#include "esphome/sensor/max6675_sensor.h" +#include "esphome/sensor/mhz19_component.h" +#include "esphome/sensor/mpu6050_component.h" +#include "esphome/sensor/mqtt_sensor_component.h" +#include "esphome/sensor/mqtt_subscribe_sensor.h" +#include "esphome/sensor/ms5611.h" +#include "esphome/sensor/pmsx003.h" +#include "esphome/sensor/pulse_counter.h" +#include "esphome/sensor/rotary_encoder.h" +#include "esphome/sensor/sensor.h" +#include "esphome/sensor/sht3xd_component.h" +#include "esphome/sensor/tcs34725.h" +#include "esphome/sensor/template_sensor.h" +#include "esphome/sensor/total_daily_energy.h" +#include "esphome/sensor/tsl2561_sensor.h" +#include "esphome/sensor/ultrasonic_sensor.h" +#include "esphome/sensor/uptime_sensor.h" +#include "esphome/sensor/wifi_signal_sensor.h" +#include "esphome/stepper/a4988.h" +#include "esphome/stepper/stepper.h" +#include "esphome/stepper/uln2003.h" +#include "esphome/switch_/custom_switch.h" +#include "esphome/switch_/gpio_switch.h" +#include "esphome/switch_/mqtt_switch_component.h" +#include "esphome/switch_/output_switch.h" +#include "esphome/switch_/restart_switch.h" +#include "esphome/switch_/shutdown_switch.h" +#include "esphome/switch_/switch.h" +#include "esphome/switch_/template_switch.h" +#include "esphome/switch_/uart_switch.h" +#include "esphome/text_sensor/custom_text_sensor.h" +#include "esphome/text_sensor/homeassistant_text_sensor.h" +#include "esphome/text_sensor/mqtt_subscribe_text_sensor.h" +#include "esphome/text_sensor/mqtt_text_sensor.h" +#include "esphome/text_sensor/template_text_sensor.h" +#include "esphome/text_sensor/text_sensor.h" +#include "esphome/text_sensor/version_text_sensor.h" +#include "esphome/time/rtc_component.h" +#include "esphome/time/sntp_component.h" +#include "esphome/time/homeassistant_time.h" + +ESPHOME_NAMESPACE_BEGIN + +/// This is the class that combines all components. +class Application { + public: + /** Set the name of the item that is running this app. + * + * Note: This will automatically be converted to lowercase_underscore. + * + * @param name The name of your app. + */ + void set_name(const std::string &name); + + /** Initialize the logging engine. + * + * @param baud_rate The serial baud rate. Set to 0 to disable UART debugging. + * @param tx_buffer_size The size of the printf buffer. + * @param hw_serial The hardware serial UART used for logging. + * @return The created and initialized LogComponent. + */ + LogComponent *init_log(uint32_t baud_rate = 115200, + size_t tx_buffer_size = 512, + UARTSelection uart = UART_SELECTION_UART0); + + /** Initialize the WiFi engine in client mode. + * + * Note: for advanced options, such as manual ip, use the return value. + * + * @param ssid The ssid of the network you want to connect to. + * @param password The password of your network. Leave empty for no password + * @return The WiFiComponent. + */ + WiFiComponent *init_wifi(const std::string &ssid, const std::string &password = ""); + + /// Initialize the WiFi engine with no initial mode. Use this if you just want an Access Point. + WiFiComponent *init_wifi(); + +#ifdef USE_ETHERNET + EthernetComponent *init_ethernet(); +#endif + +#ifdef USE_OTA + /** Initialize Over-the-Air updates. + * + * @return The OTAComponent. Use this to set advanced settings. + */ + OTAComponent *init_ota(); +#endif + +#ifdef USE_MQTT + /** Initialize the MQTT client. + * + * @param address The address of your server. + * @param port The port of your server. + * @param username The username. + * @param password The password. Empty for no password. + * @return The MQTTClient. Use this to set advanced settings. + */ + mqtt::MQTTClientComponent *init_mqtt(const std::string &address, uint16_t port, + const std::string &username, const std::string &password); + + /** Initialize the MQTT client. + * + * @param address The address of your server. + * @param username The username. + * @param password The password. Empty for no password. + * @return The MQTTClient. Use this to set advanced settings. + */ + mqtt::MQTTClientComponent *init_mqtt(const std::string &address, + const std::string &username, const std::string &password); +#endif + +#ifdef USE_I2C + /** Initialize the i2c bus on the provided SDA and SCL pins for use with other components. + * + * SDA/SCL pins default to the values defined by the Arduino framework and are usually + * GPIO4 and GPIO5 on the ESP8266 (D2 and D1 on NodeMCU). And for the ESP32 it defaults to + * GPIO21 and GPIO22 for SDA and SCL, respectively. + * + * @param sda_pin The SDA pin the i2c bus is connected to. + * @param scl_pin The SCL pin the i2c bus is connected to. + * @param scan If a scan of connected i2c devices should be done at startup. + */ + I2CComponent *init_i2c(uint8_t sda_pin = SDA, uint8_t scl_pin = SCL, bool scan = false); +#endif + +#ifdef USE_UART + UARTComponent *init_uart(uint32_t baud_rate = 9600); +#endif + +#ifdef USE_SPI + SPIComponent *init_spi(const GPIOOutputPin &clk, const GPIOInputPin &miso, const GPIOOutputPin &mosi); + + SPIComponent *init_spi(const GPIOOutputPin &clk); +#endif + +#ifdef USE_WEB_SERVER + /** Initialize the web server. Note that this will take up quite a bit of flash space and + * RAM of the node. Especially on ESP8266 boards this can quickly cause memory problems. + * + * @param port The port of the web server, defaults to 80. + * @return The WebServer object, use this for advanced settings. + */ + WebServer *init_web_server(uint16_t port = 80); +#endif + +#ifdef USE_API + api::APIServer *init_api_server(); +#endif + +#ifdef USE_ESP32_BLE_TRACKER + /** Setup an ESP32 BLE Tracker Hub. + * + * Only one of these should be created. Individual sensors can be created using make_device() on + * the return value. + * + * Note that this component is currently not completely stable (probably due to some issues in the + * esp-idf core that are being worked on). Enabling this integration will increase the created binary + * size by up to 500kB, can cause seemingly random reboots/resets and only can discover a small + * number of devices at the moment. + * + * @return An ESP32BLETracker instance, use this to create individual trackers as binary sensors. + */ + ESP32BLETracker *make_esp32_ble_tracker(); +#endif + +#ifdef USE_ESP32_BLE_BEACON + ESP32BLEBeacon *make_esp32_ble_beacon(const std::array &uuid); +#endif + +#ifdef USE_STATUS_LED + StatusLEDComponent *make_status_led(const GPIOOutputPin &pin); +#endif + +#ifdef USE_DISPLAY + display::Font *make_font(std::vector &&glyphs, int baseline, int bottom); + + display::Image *make_image(const uint8_t *data_start, int width, int height); +#endif + +#ifdef USE_MAX7219 + display::MAX7219Component *make_max7219(SPIComponent *parent, + const GPIOOutputPin &cs, + uint32_t update_interval = 1000); +#endif + +#ifdef USE_LCD_DISPLAY_PCF8574 + display::PCF8574LCDDisplay *make_pcf8574_lcd_display(uint8_t columns, + uint8_t rows, + uint8_t address = 0x3F, + uint32_t update_interval = 1000); +#endif + +#ifdef USE_LCD_DISPLAY + display::GPIOLCDDisplay *make_gpio_lcd_display(uint8_t columns, uint8_t rows, uint32_t update_interval = 1000); +#endif + +#ifdef USE_SSD1306 +#ifdef USE_SPI + display::SPISSD1306 *make_spi_ssd1306(SPIComponent *parent, + const GPIOOutputPin &cs, + const GPIOOutputPin &dc, + uint32_t update_interval = 5000); +#endif +#ifdef USE_I2C + display::I2CSSD1306 *make_i2c_ssd1306(uint32_t update_interval = 5000); +#endif +#endif + +#ifdef USE_WAVESHARE_EPAPER + display::WaveshareEPaperTypeA *make_waveshare_epaper_type_a(SPIComponent *parent, + const GPIOOutputPin &cs, + const GPIOOutputPin &dc_pin, + display::WaveshareEPaperTypeAModel model, + uint32_t update_interval = 10000); + + display::WaveshareEPaper *make_waveshare_epaper_type_b(SPIComponent *parent, + const GPIOOutputPin &cs, + const GPIOOutputPin &dc_pin, + display::WaveshareEPaperTypeBModel model, + uint32_t update_interval = 10000); +#endif + +#ifdef USE_NEXTION + display::Nextion *make_nextion(UARTComponent *parent, uint32_t update_interval = 5000); +#endif + + template + GlobalVariableComponent *make_global_variable(); + + template + GlobalVariableComponent *make_global_variable(T initial_value); + + + + + + + + + /* _ _ _______ ____ __ __ _______ _____ ____ _ _ + * /\ | | | |__ __/ __ \| \/ | /\|__ __|_ _/ __ \| \ | | + * / \ | | | | | | | | | | \ / | / \ | | | || | | | \| | + * / /\ \| | | | | | | | | | |\/| | / /\ \ | | | || | | | . ` | + * / ____ \ |__| | | | | |__| | | | |/ ____ \| | _| || |__| | |\ | + * /_/ \_\____/ |_| \____/|_| |_/_/ \_\_| |_____\____/|_| \_| + */ + + template + Automation *make_automation(Trigger *trigger); + + StartupTrigger *make_startup_trigger(); + + ShutdownTrigger *make_shutdown_trigger(); + + + + + + + + /* ____ ___ _ _ _ ______ __ ____ _____ _ _ ____ ___ ____ + * | __ |_ _| \ | | / \ | _ \ \ / / / ___|| ____| \ | / ___| / _ \| _ \ + * | _ \| || \| | / _ \ | |_) \ V / \___ \| _| | \| \___ \| | | | |_) | + * | |_) | || |\ |/ ___ \| _ < | | ___) | |___| |\ |___) | |_| | _ < + * |____|___|_| \_/_/ \_|_| \_\|_| |____/|_____|_| \_|____/ \___/|_| \_\ + */ +#ifdef USE_BINARY_SENSOR + /// Register a binary sensor and set it up for the front-end. + void register_binary_sensor(binary_sensor::BinarySensor *binary_sensor); +#endif + +#ifdef USE_GPIO_BINARY_SENSOR + /** Create a simple GPIO binary sensor. + * + * Note: advanced options such as inverted input are available in the return value. + * + * @param friendly_name The friendly name that should be advertised. Leave empty for no automatic discovery. + * @param pin The GPIO pin. + * @param device_class The Home Assistant device_class. + */ + binary_sensor::GPIOBinarySensorComponent *make_gpio_binary_sensor(const std::string &friendly_name, + const GPIOInputPin &pin, + const std::string &device_class = ""); +#endif + +#ifdef USE_STATUS_BINARY_SENSOR + /** Create a simple binary sensor that reports the online/offline state of the node. + * + * Uses the MQTT last will and birth message feature. If the values for these features are custom, you need + * to override them using the return value of this function. + * + * @param friendly_name The friendly name advertised via MQTT discovery. + */ + binary_sensor::StatusBinarySensor *make_status_binary_sensor(const std::string &friendly_name); +#endif + +#ifdef USE_ESP32_TOUCH_BINARY_SENSOR + /** Setup an ESP32TouchComponent to detect touches on certain pins of the ESP32 using the built-in touch peripheral. + * + * First set up the global hub using this method. Then create individual binary sensors using the make_touch_pad + * function on the return type. + * + * @return The new ESP32TouchComponent. Use this to create the binary sensors. + */ + binary_sensor::ESP32TouchComponent *make_esp32_touch_component(); +#endif + +#ifdef USE_TEMPLATE_BINARY_SENSOR + binary_sensor::TemplateBinarySensor *make_template_binary_sensor(const std::string &name); +#endif + +#ifdef USE_REMOTE_RECEIVER + remote::RemoteReceiverComponent *make_remote_receiver_component(const GPIOInputPin &output); +#endif + +#ifdef USE_PN532 + binary_sensor::PN532Component *make_pn532_component(SPIComponent *parent, const GPIOOutputPin &cs, + uint32_t update_interval = 1000); +#endif + +#ifdef USE_RDM6300 + binary_sensor::RDM6300Component *make_rdm6300_component(UARTComponent *parent); +#endif + +#ifdef USE_CUSTOM_BINARY_SENSOR + binary_sensor::CustomBinarySensorConstructor *make_custom_binary_sensor(const std::function()> &init); +#endif + + + + + + + + + + /* ____ _____ _ _ ____ ___ ____ + * / ___|| ____| \ | / ___| / _ \| _ \ + * \___ \| _| | \| \___ \| | | | |_) | + * ___) | |___| |\ |___) | |_| | _ < + * |____/|_____|_| \_|____/ \___/|_| \_\ + */ +#ifdef USE_SENSOR + /// Register a sensor and create a MQTT Sensor if the MQTT client is set up + void register_sensor(sensor::Sensor *sensor); +#endif + +#ifdef USE_TEXT_SENSOR + /// Register a text sensor and create a MQTT Sensor if the MQTT client is set up + void register_text_sensor(text_sensor::TextSensor *sensor); +#endif + +#ifdef USE_DHT_SENSOR + /** Create a DHT sensor component. + * + * Note: This method automatically applies a SlidingWindowMovingAverageFilter. + * + * @param temperature_friendly_name The name the temperature sensor should be advertised as. Leave empty for no + * automatic discovery. + * @param humidity_friendly_name The name the humidity sensor should be advertised as. Leave empty for no + * automatic discovery. + * @param pin The pin the DHT sensor is connected to. + * @param update_interval The interval (in ms) the sensor should be checked. + * @return The components. Use this for advanced settings. + */ + sensor::DHTComponent *make_dht_sensor(const std::string &temperature_friendly_name, + const std::string &humidity_friendly_name, + const GPIOOutputPin &pin, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_DALLAS_SENSOR + sensor::DallasComponent *make_dallas_component(ESPOneWire *one_wire, uint32_t update_interval = 60000); + + sensor::DallasComponent *make_dallas_component(const GPIOOutputPin &pin, uint32_t update_interval = 60000); +#endif + +#ifdef USE_PULSE_COUNTER_SENSOR + /** Create an ESP32 Pulse Counter component. + * + * The pulse counter peripheral will automatically all pulses on pin in the background. Every + * check_interval ms the amount of pulses will be retrieved and the difference to the last value + * will be reported via MQTT as a sensor. + * + * @param pin The pin the pulse counter should count pulses on. + * @param friendly_name The name the sensor should be advertised as. + * @param update_interval The interval in ms the sensor should be checked. + * @return The components. Use this for advanced settings. + */ + sensor::PulseCounterSensorComponent *make_pulse_counter_sensor(const std::string &friendly_name, + const GPIOInputPin &pin, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_ADC_SENSOR + /** Create an ADC Sensor component. + * + * Every check_interval ms, the value from the specified pin (only A0 on ESP8266, 32-39 for ESP32), + * and converts it into the volt unit. On the ESP32 you can additionally specify a channel attenuation + * using the return value of this function. pinMode can also be set using the return value. + * + * @param pin The pin the ADC should sense on. + * @param friendly_name The name the sensor should be advertised as. + * @param update_interval The interval in ms the sensor should be checked. + * @return The components. Use this for advanced settings. + */ + sensor::ADCSensorComponent *make_adc_sensor(const std::string &friendly_name, + uint8_t pin, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_ADS1115_SENSOR + /** Create an ADS1115 component hub. From this hub you can then create individual sensors using `get_sensor()`. + * + * Note that you should have i2c setup for this component to work. To setup i2c call `App.init_i2c(SDA_PIN, SCL_PIN);` + * before `App.setup()`. + * + * @param address The i2c address of the ADS1115. See ADS1115Component::set_address for possible values. + * @return The ADS1115Component hub. Use this to set advanced setting and create the actual sensors. + */ + sensor::ADS1115Component *make_ads1115_component(uint8_t address); +#endif + +#ifdef USE_BMP085_SENSOR + /** Create an BMP085/BMP180/BMP280 i2c temperature+pressure sensor. + * + * Be sure to initialize i2c before calling `App.setup()` in order for this to work. Do so + * with `App.init_i2c(SDA_PIN, SCL_PIN);`. + * + * @param temperature_friendly_name The friendly name the temperature should be advertised as. + * @param pressure_friendly_name The friendly name the pressure should be advertised as. + * @param update_interval The interval in ms to update the sensor values. + */ + sensor::BMP085Component *make_bmp085_sensor(const std::string &temperature_friendly_name, + const std::string &pressure_friendly_name, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_HTU21D_SENSOR + + /** Create a HTU21D i2c-based temperature+humidity highly accurate sensor. + * + * Be sure to initialize i2c before calling `App.setup` in order for this to work. Do so + * with `App.init_i2c(SDA_PIN, SCL_PIN);`. + * + * @param temperature_friendly_name The friendly name the temperature sensor should be advertised as. + * @param humidity_friendly_name The friendly name the humidity sensor should be advertised as. + * @param update_interval The interval in ms to update the sensor values. + */ + sensor::HTU21DComponent *make_htu21d_sensor(const std::string &temperature_friendly_name, + const std::string &humidity_friendly_name, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_HDC1080_SENSOR + /** Create a HDC1080 i2c-based temperature+humidity sensor. + * + * Be sure to initialize i2c before calling `App.setup` in order for this to work. Do so + * with `App.init_i2c(SDA_PIN, SCL_PIN);`. + * + * @param temperature_friendly_name The friendly name the temperature sensor should be advertised as. + * @param humidity_friendly_name The friendly name the humidity sensor should be advertised as. + * @param update_interval The interval in ms to update the sensor values. + */ + sensor::HDC1080Component *make_hdc1080_sensor(const std::string &temperature_friendly_name, + const std::string &humidity_friendly_name, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_ULTRASONIC_SENSOR + /** Create an Ultrasonic range sensor. + * + * This can for example be an HC-SR04 ultrasonic sensor. It sends out a short ultrasonic wave and listens + * for an echo. The time between the sending and receiving is then (with some maths) converted to a measurement + * in meters. You need to specify the trigger pin (where to short pulse will be sent to) and the echo pin + * (where we're waiting for the echo). Note that in order to not block indefinitely if we don't receive an + * echo, this class has a default timeout of around 2m. You can change that using the return value of this + * function. + * + * @param friendly_name The friendly name for this sensor advertised to Home Assistant. + * @param trigger_pin The pin the short pulse will be sent to, can be integer or GPIOOutputPin. + * @param echo_pin The pin we wait that we wait on for the echo, can be integer or GPIOInputPin. + * @param update_interval The time in ms between updates, defaults to 5 seconds. + */ + sensor::UltrasonicSensorComponent *make_ultrasonic_sensor(const std::string &friendly_name, + const GPIOOutputPin &trigger_pin, + const GPIOInputPin &echo_pin, + uint32_t update_interval = 5000); +#endif + +#ifdef USE_WIFI_SIGNAL_SENSOR + sensor::WiFiSignalSensor *make_wifi_signal_sensor(const std::string &name, uint32_t update_interval = 60000); +#endif + +#ifdef USE_MPU6050 + /** Create a MPU6050 Accelerometer+Gyroscope+Temperature sensor hub. + * + * This integration can be used to get accurate accelerometer readings and uncalibrated gyroscope + * values (in degrees per second). If you need the latter with calibration applied, your best bet + * it to just copy the source and do it yourself, as calibration must be performed while the sensor + * is at rest and this property can not be asserted for all use cases. + * + * @param address The address of the device, defaults to 0x68. + * @param update_interval The interval in ms to update the sensor values. + * @return An MPU6050Component, use this to create the individual sensors and register them with `register_sensor`. + */ + sensor::MPU6050Component *make_mpu6050_sensor(uint8_t address = 0x68, uint32_t update_interval = 60000); +#endif + +#ifdef USE_TSL2561 + /** Create a TSL2561 accurate ambient light sensor. + * + * This i2c-based device can provide very precise illuminance readings with great accuracy regarding the human + * eye response to the brightness level. By default, this sensor uses the i2c address 0x39, but you can change it + * with `set_address` later using the return value of this function (address 0x29 if '0' shorted on board, address + * 0x49 if '1' shorted on board). + * + * The sensor values that are pushed out will be the transformed illuminance values in lx taking using the + * internal IR and Full Spectrum photodiodes. + * + * Additionally, you can specify the time the sensor takes for accumulating the values (higher is better for + * lower light conditions, defaults to 402ms - the max) and a gain that should be used for the ADCs (defaults to + * 1x). Finally, this integration is energy efficient and only turns on the sensor when the values are read out. + * + * @param name The friendly name how the sensor should be advertised. + * @param address The address of this i2c device. + * @param update_interval The interval in ms to update the sensor values. + */ + sensor::TSL2561Sensor *make_tsl2561_sensor(const std::string &name, uint8_t address = 0x23, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_BH1750 + /** Create a BH1750 ambient light sensor. + * + * This i2c-based provides ambient light readings in lx with resolutions of 4LX, 1LX and 0.5LX (the default). + * To change the resolution, call set_resolution on the return value of this function. + * + * By default, this sensor uses the i2c address 0x23 (the default if ADDR is pulled low). If the ADDR pin + * is pulled high (above 0.7VCC), then you can manually set the address to 0x5C using set_address. + * + * @param name The friendly name that this sensor should be advertised as. + * @param address The address of this i2c device. + * @param update_interval The interval in ms to update the sensor values. + * @return The BH1750Sensor + MQTT sensor pair, use this for advanced settings. + */ + sensor::BH1750Sensor *make_bh1750_sensor(const std::string &name, uint8_t address = 0x23, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_BME280 + /** Create a BME280 Temperature+Pressure+Humidity i2c sensor. + * + * @param temperature_name The friendly name the temperature sensor should be advertised as. + * @param pressure_name The friendly name the pressure sensor should be advertised as. + * @param humidity_name The friendly name the humidity sensor should be advertised as. + * @param address The i2c address of the sensor. Defaults to 0x77 (SDO to V_DDIO), can also be 0x76. + * @param update_interval The interval in ms to update the sensor values. + */ + sensor::BME280Component *make_bme280_sensor(const std::string &temperature_name, const std::string &pressure_name, + const std::string &humidity_name, + uint8_t address = 0x77, uint32_t update_interval = 60000); +#endif + +#ifdef USE_BMP280 + /** Create a BMP280 Temperature+Pressure i2c sensor. + * + * @param temperature_name The friendly name the temperature sensor should be advertised as. + * @param pressure_name The friendly name the pressure sensor should be advertised as. + * @param address The i2c address of the sensor. Defaults to 0x77 (SDO to V_DDIO), can also be 0x76. + * @param update_interval The interval in ms to update the sensor values. + */ + sensor::BMP280Component *make_bmp280_sensor(const std::string &temperature_name, const std::string &pressure_name, + uint8_t address = 0x77, uint32_t update_interval = 60000); +#endif + +#ifdef USE_BME680 + sensor::BME680Component *make_bme680_sensor(const std::string &temperature_name, const std::string &pressure_name, + const std::string &humidity_name, const std::string &gas_resistance_name, + uint8_t address = 0x76, uint32_t update_interval = 60000); +#endif + +#ifdef USE_SHT3XD + sensor::SHT3XDComponent *make_sht3xd_sensor(const std::string &temperature_name, const std::string &humidity_name, + uint8_t address = 0x44, uint32_t update_interval = 60000); +#endif + +#ifdef USE_DHT12_SENSOR + sensor::DHT12Component *make_dht12_sensor(const std::string &temperature_name, const std::string &humidity_name, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_ROTARY_ENCODER_SENSOR + /** Create a continuous rotary encoder sensor with a digital signal. + * + * It will keep track of how far the encoder has been turned using the signals from the two required pins A & B. + * There's also support for a third "index" pin. Each time this pin is pulled high, the counter will reset to 0. + * + * Additionally, you can specify a resolution for the rotary encoder. By default, the encoder will only increment + * the counter once a full cycle of A&B signals has been detected to prevent triggers from noise. You can change + * this behavior using the set_resolution method. + * + * The output value of this rotary encoder is a raw integer step value. Use filters + * to convert this raw value to something sensible like degrees. Next, this sensor pushes its state on every detected + * counter change. + * + * Read https://playground.arduino.cc/Main/RotaryEncoders to see how they work. + * + * @param name The name of the rotary encoder. + * @param pin_a The first pin of the sensor. + * @param pin_b The second pin of the sensor. + */ + sensor::RotaryEncoderSensor *make_rotary_encoder_sensor(const std::string &name, + const GPIOInputPin &pin_a, + const GPIOInputPin &pin_b); +#endif + +#ifdef USE_TEMPLATE_SENSOR + sensor::TemplateSensor *make_template_sensor(const std::string &name, uint32_t update_interval = 60000); +#endif + +#ifdef USE_MAX31855_SENSOR + sensor::MAX31855Sensor *make_max31855_sensor(const std::string &name, SPIComponent *spi_bus, const GPIOOutputPin &cs, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_MAX6675_SENSOR + sensor::MAX6675Sensor *make_max6675_sensor(const std::string &name, SPIComponent *spi_bus, const GPIOOutputPin &cs, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_ESP32_HALL_SENSOR + sensor::ESP32HallSensor *make_esp32_hall_sensor(const std::string &name, uint32_t update_interval = 60000); +#endif + +#ifdef USE_DUTY_CYCLE_SENSOR + sensor::DutyCycleSensor *make_duty_cycle_sensor(const std::string &name, const GPIOInputPin &pin, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_MHZ19 + sensor::MHZ19Component *make_mhz19_sensor(UARTComponent *parent, const std::string &co2_name, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_UPTIME_SENSOR + sensor::UptimeSensor *make_uptime_sensor(const std::string &name, uint32_t update_interval = 60000); +#endif + +#ifdef USE_INA219 + sensor::INA219Component *make_ina219(float shunt_resistance_ohm, float max_current_a, float max_voltage_v, + uint8_t address = 0x40, uint32_t update_interval = 60000); +#endif + +#ifdef USE_INA3221 + sensor::INA3221Component *make_ina3221(uint8_t address = 0x40, uint32_t update_interval = 60000); +#endif + +#ifdef USE_HMC5883L + sensor::HMC5883LComponent *make_hmc5883l(uint32_t update_interval = 60000); +#endif + +#ifdef USE_HX711 + sensor::HX711Sensor *make_hx711_sensor(const std::string &name, const GPIOInputPin &dout, const GPIOOutputPin &sck, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_MS5611 + sensor::MS5611Component *make_ms5611_sensor(const std::string &temperature_name, const std::string &pressure_name, + uint32_t update_interval = 60000); +#endif + +#ifdef USE_TCS34725 + sensor::TCS34725Component *make_tcs34725(uint32_t update_interval = 60000); +#endif + +#ifdef USE_SNTP_COMPONENT + time::SNTPComponent *make_sntp_component(); +#endif + +#ifdef USE_HOMEASSISTANT_TIME + time::HomeAssistantTime *make_homeassistant_time_component(); +#endif + +#ifdef USE_HLW8012 + sensor::HLW8012Component *make_hlw8012(const GPIOOutputPin &sel_pin, uint8_t cf_pin, uint8_t cf1_pin, uint32_t update_interval = 60000); +#endif + +#ifdef USE_MQTT_SUBSCRIBE_SENSOR + sensor::MQTTSubscribeSensor *make_mqtt_subscribe_sensor(const std::string &name, std::string topic); +#endif + +#ifdef USE_HOMEASSISTANT_SENSOR + sensor::HomeassistantSensor *make_homeassistant_sensor(const std::string &name, std::string entity_id); +#endif + +#ifdef USE_HOMEASSISTANT_BINARY_SENSOR + binary_sensor::HomeassistantBinarySensor *make_homeassistant_binary_sensor(const std::string &name, std::string entity_id); +#endif + +#ifdef USE_CSE7766 + sensor::CSE7766Component *make_cse7766(UARTComponent *parent, uint32_t update_interval = 60000); +#endif + + +#ifdef USE_MQTT_SUBSCRIBE_TEXT_SENSOR + text_sensor::MQTTSubscribeTextSensor *make_mqtt_subscribe_text_sensor(const std::string &name, std::string topic); +#endif + +#ifdef USE_HOMEASSISTANT_TEXT_SENSOR + text_sensor::HomeassistantTextSensor *make_homeassistant_text_sensor(const std::string &name, std::string entity_id); +#endif + +#ifdef USE_VERSION_TEXT_SENSOR + text_sensor::VersionTextSensor *make_version_text_sensor(const std::string &name); +#endif + +#ifdef USE_TEMPLATE_TEXT_SENSOR + text_sensor::TemplateTextSensor *make_template_text_sensor(const std::string &name, uint32_t update_interval = 60000); +#endif + +#ifdef USE_PMSX003 + sensor::PMSX003Component *make_pmsx003(UARTComponent *parent, sensor::PMSX003Type type); +#endif + +#ifdef USE_TOTAL_DAILY_ENERGY_SENSOR + sensor::TotalDailyEnergy *make_total_daily_energy_sensor(const std::string &name, time::RealTimeClockComponent *time, + sensor::Sensor *parent); +#endif + +#ifdef USE_APDS9960 + sensor::APDS9960 *make_apds9960(uint32_t update_interval = 60000); +#endif + + +#ifdef USE_CUSTOM_SENSOR + sensor::CustomSensorConstructor *make_custom_sensor(const std::function()> &init); +#endif + + + + + + /* ___ _ _ _____ ____ _ _ _____ + * / _ \| | | |_ _| _ \| | | |_ _| + * | | | | | | | | | | |_) | | | | | | + * | |_| | |_| | | | | __/| |_| | | | + * \___/ \___/ |_| |_| \___/ |_| + */ +#ifdef USE_OUTPUT + /** Create a power supply component that will automatically switch on and off. + * + * @param pin The pin the power supply is connected to. + * @param enable_time The time (in ms) the power supply needs until it can provide high power when powering on. + * @param keep_on_time The time (in ms) the power supply should stay on when it is not used. + * @return The PowerSupplyComponent. + */ + PowerSupplyComponent *make_power_supply(const GPIOOutputPin &pin, uint32_t enable_time = 20, + uint32_t keep_on_time = 10000); +#endif + +#ifdef USE_LEDC_OUTPUT + /** Create a ESP32 LEDC channel. + * + * @param pin The pin. + * @param frequency The PWM frequency. + * @param bit_depth The LEDC bit depth. + * @return The LEDC component. Use this for advanced settings. + */ + output::LEDCOutputComponent *make_ledc_output(uint8_t pin, float frequency = 1000.0f, uint8_t bit_depth = 12); +#endif + +#ifdef USE_PCA9685_OUTPUT + /** Create a PCA9685 component. + * + * @param frequency The PWM frequency. + * @return The PCA9685 component. Use this for advanced settings. + */ + output::PCA9685OutputComponent *make_pca9685_component(float frequency); +#endif + +#ifdef USE_GPIO_OUTPUT + /** Create a simple binary GPIO output component. + * + * Note: This is *only* a binary output component, not a switch that will be exposed + * in Home Assistant. See make_simple_gpio_switch for a switch. + * + * @param pin The GPIO pin. + * @return The GPIOBinaryOutputComponent. Use this for advanced settings. + */ + output::GPIOBinaryOutputComponent *make_gpio_output(const GPIOOutputPin &pin); +#endif + +#ifdef USE_ESP8266_PWM_OUTPUT + /** Create an ESP8266 software PWM channel. + * + * Warning: This is a *software* PWM and therefore can have noticeable flickering. Additionally, + * this software PWM can't output values higher than 80%. + * + * @param pin The pin for this PWM output, supported pins are 0-16. + * @return The PWM output channel, use this for advanced settings and using it with lights. + */ + output::ESP8266PWMOutput *make_esp8266_pwm_output(GPIOOutputPin pin_); +#endif + +#ifdef USE_MY9231_OUTPUT + /** Create a MY9231 component. + * + * @param pin_di The pin which DI is connected to. + * @param pin_dcki The pin which DCKI is connected to. + * @return The MY9231 component. Use this for advanced settings. + */ + output::MY9231OutputComponent *make_my9231_component(const GPIOOutputPin &pin_di, + const GPIOOutputPin &pin_dcki); +#endif + + + + + + + /* _ ___ ____ _ _ _____ + * | | |_ _/ ___| | | |_ _| + * | | | | | _| |_| | | | + * | |___ | | |_| | _ | | | + * |_____|___\____|_| |_| |_| + */ +#ifdef USE_LIGHT + /// Register a light. + void register_light(light::LightState *state); + + struct MakeLight { + light::LightOutput *output; + light::LightState *state; + }; + + MakeLight make_light_for_light_output(const std::string &name, light::LightOutput *output); + + /** Create a binary light. + * + * @param friendly_name The name the light should be advertised as. Leave empty for no automatic discovery. + * @param binary The binary output channel. + * @return The components for this light. Use this for advanced settings. + */ + MakeLight make_binary_light(const std::string &friendly_name, output::BinaryOutput *binary); + + /** Create a monochromatic light. + * + * @param friendly_name The name the light should be advertised as. Leave empty for no automatic discovery. + * @param mono The output channel. + * @return The components for this light. Use this for advanced settings. + */ + MakeLight make_monochromatic_light(const std::string &friendly_name, output::FloatOutput *mono); + + /** Create a RGB light. + * + * @param friendly_name The name the light should be advertised as. Leave empty for no automatic discovery. + * @param red The red output channel. + * @param green The green output channel. + * @param blue The blue output channel. + * @return The components for this light. Use this for advanced settings. + */ + MakeLight make_rgb_light(const std::string &friendly_name, + output::FloatOutput *red, output::FloatOutput *green, output::FloatOutput *blue); + + /** Create a RGBW light. + * + * @param friendly_name The name the light should be advertised as. Leave empty for no automatic discovery. + * @param red The red output channel. + * @param green The green output channel. + * @param blue The blue output channel. + * @param white The white output channel. + * @return The components for this light. Use this for advanced settings. + */ + MakeLight make_rgbw_light(const std::string &friendly_name, + output::FloatOutput *red, output::FloatOutput *green, output::FloatOutput *blue, + output::FloatOutput *white); + + MakeLight make_rgbww_light(const std::string &friendly_name, + float cold_white_mireds, + float warm_white_mireds, + output::FloatOutput *red, + output::FloatOutput *green, + output::FloatOutput *blue, + output::FloatOutput *cold_white, + output::FloatOutput *warm_white); + + MakeLight make_cwww_light(const std::string &friendly_name, + float cold_white_mireds, + float warm_white_mireds, + output::FloatOutput *cold_white, + output::FloatOutput *warm_white); +#endif + +#ifdef USE_FAST_LED_LIGHT + struct MakeFastLEDLight { + light::FastLEDLightOutputComponent *fast_led; + light::LightState *state; + }; + + /// Create an FastLED light. + MakeFastLEDLight make_fast_led_light(const std::string &name); +#endif + +#ifdef USE_NEO_PIXEL_BUS_LIGHT + template + struct MakeNeoPixelBusLight { + light::NeoPixelBusLightOutputBase *output; + light::LightState *state; + }; + + /// Create an RGB NeoPixelBus light. + template + MakeNeoPixelBusLight make_neo_pixel_bus_rgb_light(const std::string &name); + + /// Create an RGBW NeoPixelBus light. + template + MakeNeoPixelBusLight make_neo_pixel_bus_rgbw_light(const std::string &name); +#endif + + + + + + /* ______ _____ _____ ____ _ _ + * / ___\ \ / |_ _|_ _/ ___| | | | + * \___ \\ \ /\ / / | | | || | | |_| | + * ___) |\ V V / | | | || |___| _ | + * |____/ \_/\_/ |___| |_| \____|_| |_| + */ +#ifdef USE_SWITCH + /// Register a Switch internally, creating a MQTT Switch if the MQTT client is set up + void register_switch(switch_::Switch *switch_); +#endif + +#ifdef USE_GPIO_SWITCH + /** Create a simple GPIO switch that can be toggled on/off and appears in the frontend. + * + * @param pin The pin used for this switch. Can be integer or GPIOOutputPin. + * @param friendly_name The friendly name advertised to Home Assistant for this switch- + */ + switch_::GPIOSwitch *make_gpio_switch(const std::string &friendly_name, const GPIOOutputPin &pin); +#endif + +#ifdef USE_RESTART_SWITCH + /// Make a simple switch that restarts the device with the provided friendly name. + switch_::RestartSwitch *make_restart_switch(const std::string &friendly_name); +#endif + +#ifdef USE_SHUTDOWN_SWITCH + /// Make a simple switch that shuts the node down indefinitely. + switch_::ShutdownSwitch *make_shutdown_switch(const std::string &friendly_name); +#endif + +#ifdef USE_OUTPUT_SWITCH + /// Make an output switch that exposes a binary output as a switch + switch_::OutputSwitch *make_output_switch(const std::string &friendly_name, output::BinaryOutput *output); +#endif + +#ifdef USE_TEMPLATE_SWITCH + switch_::TemplateSwitch *make_template_switch(const std::string &name); +#endif + +#ifdef USE_REMOTE_TRANSMITTER + remote::RemoteTransmitterComponent *make_remote_transmitter_component(const GPIOOutputPin &output); +#endif + +#ifdef USE_UART_SWITCH + switch_::UARTSwitch *make_uart_switch(UARTComponent *parent, const std::string &name, const std::vector &data); +#endif + +#ifdef USE_CUSTOM_SWITCH + switch_::CustomSwitchConstructor *make_custom_switch(const std::function()> &init); +#endif + + + + + + + /* _____ _ _ _ + * | ___/ \ | \ | | + * | |_ / _ \ | \| | + * | _/ ___ \| |\ | + * |_|/_/ \_|_| \_| + */ +#ifdef USE_FAN + /// Register a fan internally. + void register_fan(fan::FanState *state); + + struct MakeFan { + fan::BasicFanComponent *output; + fan::FanState *state; + }; + + /** Create and connect a Fan with the specified friendly name. + * + * @param friendly_name The friendly name of the Fan to advertise. + * @return A FanStruct, use the output field to set your output channels. + */ + MakeFan make_fan(const std::string &friendly_name); +#endif + + + + + + + /* _____ ______ ________ _____ + * / ____/ __ \ \ / / ____| __ \ + * | | | | | \ \ / /| |__ | |__) | + * | | | | | |\ \/ / | __| | _ / + * | |___| |__| | \ / | |____| | \ \ + * \_____\____/ \/ |______|_| \_\ + */ +#ifdef USE_COVER + void register_cover(cover::Cover *cover); +#endif + +#ifdef USE_TEMPLATE_COVER + cover::TemplateCover *make_template_cover(const std::string &name); +#endif + + +#ifdef USE_A4988 + stepper::A4988 *make_a4988(const GPIOOutputPin &step_pin, const GPIOOutputPin &dir_pin); +#endif + +#ifdef USE_ULN2003 + stepper::ULN2003 *make_uln2003(const GPIOOutputPin &pin_a, const GPIOOutputPin &pin_b, + const GPIOOutputPin &pin_c, const GPIOOutputPin &pin_d); +#endif + + + + + + + + /* _ _ _____ _ ____ _____ ____ ____ + * | | | | ____| | | _ \| ____| _ \/ ___| + * | |_| | _| | | | |_) | _| | |_) \___ \ + * | _ | |___| |___| __/| |___| _ < ___) | + * |_| |_|_____|_____|_| |_____|_| \_|____/ + */ +#ifdef USE_DEBUG_COMPONENT + DebugComponent *make_debug_component(); +#endif + +#ifdef USE_DEEP_SLEEP + DeepSleepComponent *make_deep_sleep_component(); +#endif + +#ifdef USE_PCF8574 + /** Create a PCF8574/PCF8575 port expander component. + * + * This component will allow you to emulate GPIOInputPin and GPIOOutputPin instances that + * are used within ESPHome. You can therefore simply pass the result of calling + * `make_pin` on the component to any method accepting GPIOInputPin or GPIOOutputPin. + * + * Optionally, this component also has support for the 16-channel PCF8575 port expander. + * To use the PCF8575, set the pcf8575 in this helper function. + * + * @param address The i2c address to use for this port expander. Defaults to 0x21. + * @param pcf8575 If this is an PCF8575. Defaults to PCF8574. + * @return The PCF8574Component instance to get individual pins. + */ + io::PCF8574Component *make_pcf8574_component(uint8_t address = 0x21, bool pcf8575 = false); +#endif + + /// Register the component in this Application instance. + template + C *register_component(C *c); + + template + C *register_controller(C *c); + + /// Set up all the registered components. Call this at the end of your setup() function. + void setup(); + + /// Make a loop iteration. Call this in your loop() function. + void loop(); + + WiFiComponent *get_wifi() const; +#ifdef USE_MQTT + mqtt::MQTTClientComponent *get_mqtt_client() const; +#endif + + /// Get the name of this Application set by set_name(). + const std::string &get_name() const; + + bool is_fully_setup() const; + + /** Tell ESPHome when your project was last compiled. This is used to show + * a message like "You're running ESPHome v1.9.0 compiled on Oct 10 2018, 16:42:00" + * + * To use this method in code, put the following before App.setup(): + * + * ```cpp + * App.set_compilation_datetime(__DATE__ ", " __TIME__); + * ``` + * + * @param str The string of the time of compilation. + */ + void set_compilation_datetime(const char *str); + + const std::string &get_compilation_time() const; + + /** Set the target interval with which to run the loop() calls. + * If the loop() method takes longer than the target interval, ESPHome won't + * sleep in loop(), but if the time spent in loop() is small than the target, ESPHome + * will delay at the end of the App.loop() method. + * + * This is done to conserve power: In most use-cases, high-speed loop() calls are not required + * and degrade power consumption. + * + * Each component can request a high frequency loop execution by using the HighFrequencyLoopRequester + * helper in helpers.h + * + * @param loop_interval The interval in milliseconds to run the core loop at. Defaults to 16 milliseconds. + */ + void set_loop_interval(uint32_t loop_interval); + + void dump_config(); + void schedule_dump_config(); + + protected: + void register_component_(Component *comp); + + std::vector components_{}; + std::vector controllers_{}; +#ifdef USE_MQTT + mqtt::MQTTClientComponent *mqtt_client_{nullptr}; +#endif + WiFiComponent *wifi_{nullptr}; + + std::string name_; + std::string compilation_time_; + uint32_t application_state_{COMPONENT_STATE_CONSTRUCTION}; + uint32_t last_loop_{0}; + uint32_t loop_interval_{16}; +#ifdef USE_I2C + I2CComponent *i2c_{nullptr}; +#endif + bool dump_config_scheduled_{false}; +}; + +/// Global storage of Application pointer - only one Application can exist. +extern Application App; + +template +C *Application::register_component(C *c) { + static_assert(std::is_base_of::value, "Only Component subclasses can be registered"); + this->register_component_((Component *) c); + return c; +} + +template +C *Application::register_controller(C *c) { + static_assert(std::is_base_of::value, "Only Controller subclasses can be registered"); + Controller *controller = c; + this->controllers_.push_back(controller); + return c; +} + +template +Automation *Application::make_automation(Trigger *trigger) { + return new Automation(trigger); +} + +template +GlobalVariableComponent *Application::make_global_variable() { + return this->register_component(new GlobalVariableComponent()); +} + +template +GlobalVariableComponent *Application::make_global_variable(T initial_value) { + return this->register_component(new GlobalVariableComponent(initial_value)); +} + +#ifdef USE_NEO_PIXEL_BUS_LIGHT +template +Application::MakeNeoPixelBusLight Application::make_neo_pixel_bus_rgb_light(const std::string &name) { + auto *neo_pixel = this->register_component(new light::NeoPixelRGBLightOutput()); + auto make = this->make_light_for_light_output(name, neo_pixel); + + return MakeNeoPixelBusLight { + .output = neo_pixel, + .state = make.state, + }; +} +template +Application::MakeNeoPixelBusLight Application::make_neo_pixel_bus_rgbw_light(const std::string &name) { + auto *neo_pixel = this->register_component(new light::NeoPixelRGBWLightOutput()); + auto make = this->make_light_for_light_output(name, neo_pixel); + + return MakeNeoPixelBusLight { + .output = neo_pixel, + .state = make.state, + }; +} +#endif + +ESPHOME_NAMESPACE_END + +/// namespace alias for backwards-compatability +namespace esphomelib = esphome; + +#endif //ESPHOME_APPLICATION_H diff --git a/src/esphomelib/automation.cpp b/src/esphome/automation.cpp similarity index 93% rename from src/esphomelib/automation.cpp rename to src/esphome/automation.cpp index f16a90f1..3a505125 100644 --- a/src/esphomelib/automation.cpp +++ b/src/esphome/automation.cpp @@ -1,7 +1,7 @@ -#include "esphomelib/automation.h" -#include "esphomelib/espmath.h" +#include "esphome/automation.h" +#include "esphome/espmath.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN void Trigger::trigger() { if (this->parent_ == nullptr) @@ -77,5 +77,5 @@ void Script::stop() { this->parent_->stop(); } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/automation.h b/src/esphome/automation.h similarity index 94% rename from src/esphomelib/automation.h rename to src/esphome/automation.h index 2d4723a2..d93b0571 100644 --- a/src/esphomelib/automation.h +++ b/src/esphome/automation.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_AUTOMATION_H -#define ESPHOMELIB_AUTOMATION_H +#ifndef ESPHOME_AUTOMATION_H +#define ESPHOME_AUTOMATION_H #include -#include "esphomelib/espmath.h" -#include "esphomelib/component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/defines.h" -#include "esphomelib/esppreferences.h" +#include "esphome/espmath.h" +#include "esphome/component.h" +#include "esphome/helpers.h" +#include "esphome/defines.h" +#include "esphome/esppreferences.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN using NoArg = bool; @@ -297,8 +297,8 @@ class GlobalVariableComponent : public Component { ESPPreferenceObject rtc_; }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/automation.tcc" +#include "esphome/automation.tcc" -#endif //ESPHOMELIB_AUTOMATION_H +#endif //ESPHOME_AUTOMATION_H diff --git a/src/esphomelib/automation.tcc b/src/esphome/automation.tcc similarity index 98% rename from src/esphomelib/automation.tcc rename to src/esphome/automation.tcc index 92ad97da..44c258e6 100644 --- a/src/esphomelib/automation.tcc +++ b/src/esphome/automation.tcc @@ -1,6 +1,6 @@ -#include "esphomelib/automation.h" +#include "esphome/automation.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN template bool AndCondition::check(T x) { @@ -337,4 +337,4 @@ void WhileAction::stop() { this->stop_next(); } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/binary_sensor/binary_sensor.cpp b/src/esphome/binary_sensor/binary_sensor.cpp similarity index 98% rename from src/esphomelib/binary_sensor/binary_sensor.cpp rename to src/esphome/binary_sensor/binary_sensor.cpp index c687fe91..b7b3c7c2 100644 --- a/src/esphomelib/binary_sensor/binary_sensor.cpp +++ b/src/esphome/binary_sensor/binary_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BINARY_SENSOR -#include "esphomelib/binary_sensor/binary_sensor.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/binary_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -290,6 +290,6 @@ StateTrigger::StateTrigger(BinarySensor *parent) { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/binary_sensor.h b/src/esphome/binary_sensor/binary_sensor.h similarity index 93% rename from src/esphomelib/binary_sensor/binary_sensor.h rename to src/esphome/binary_sensor/binary_sensor.h index df8863a9..e92adb43 100644 --- a/src/esphomelib/binary_sensor/binary_sensor.h +++ b/src/esphome/binary_sensor/binary_sensor.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_BINARY_SENSOR_BINARY_SENSOR_H -#define ESPHOMELIB_BINARY_SENSOR_BINARY_SENSOR_H +#ifndef ESPHOME_BINARY_SENSOR_BINARY_SENSOR_H +#define ESPHOME_BINARY_SENSOR_BINARY_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BINARY_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/automation.h" -#include "esphomelib/binary_sensor/filter.h" +#include "esphome/component.h" +#include "esphome/helpers.h" +#include "esphome/automation.h" +#include "esphome/binary_sensor/filter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -86,7 +86,7 @@ class BinarySensor : public Nameable { ESPDEPRECATED(".value is deprecated, please use .state instead") bool value; }; - /// Manually set the Home Assistant device class (see esphomelib::binary_sensor::device_class) + /// Manually set the Home Assistant device class (see binary_sensor::device_class) void set_device_class(const std::string &device_class); /// Get the device class for this binary sensor, using the manual override if specified. @@ -257,10 +257,10 @@ BinarySensorPublishAction *BinarySensor::make_binary_sensor_publish_action() } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/binary_sensor/mqtt_binary_sensor_component.h" +#include "esphome/binary_sensor/mqtt_binary_sensor_component.h" #endif //USE_BINARY_SENSOR -#endif //ESPHOMELIB_BINARY_SENSOR_BINARY_SENSOR_H +#endif //ESPHOME_BINARY_SENSOR_BINARY_SENSOR_H diff --git a/src/esphomelib/binary_sensor/custom_binary_sensor.cpp b/src/esphome/binary_sensor/custom_binary_sensor.cpp similarity index 78% rename from src/esphomelib/binary_sensor/custom_binary_sensor.cpp rename to src/esphome/binary_sensor/custom_binary_sensor.cpp index 0dc10d5c..64620fef 100644 --- a/src/esphomelib/binary_sensor/custom_binary_sensor.cpp +++ b/src/esphome/binary_sensor/custom_binary_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_BINARY_SENSOR -#include "esphomelib/binary_sensor/custom_binary_sensor.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/custom_binary_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -25,6 +25,6 @@ void CustomBinarySensorConstructor::dump_config() { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/custom_binary_sensor.h b/src/esphome/binary_sensor/custom_binary_sensor.h similarity index 55% rename from src/esphomelib/binary_sensor/custom_binary_sensor.h rename to src/esphome/binary_sensor/custom_binary_sensor.h index a96d27cf..91989f5f 100644 --- a/src/esphomelib/binary_sensor/custom_binary_sensor.h +++ b/src/esphome/binary_sensor/custom_binary_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_BINARY_SENSOR_CUSTOM_BINARY_SENSOR_H -#define ESPHOMELIB_BINARY_SENSOR_CUSTOM_BINARY_SENSOR_H +#ifndef ESPHOME_BINARY_SENSOR_CUSTOM_BINARY_SENSOR_H +#define ESPHOME_BINARY_SENSOR_CUSTOM_BINARY_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_BINARY_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/component.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -26,8 +26,8 @@ class CustomBinarySensorConstructor : public Component { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_BINARY_SENSOR -#endif //ESPHOMELIB_BINARY_SENSOR_CUSTOM_BINARY_SENSOR_H +#endif //ESPHOME_BINARY_SENSOR_CUSTOM_BINARY_SENSOR_H diff --git a/src/esphomelib/binary_sensor/esp32_touch_binary_sensor.cpp b/src/esphome/binary_sensor/esp32_touch_binary_sensor.cpp similarity index 96% rename from src/esphomelib/binary_sensor/esp32_touch_binary_sensor.cpp rename to src/esphome/binary_sensor/esp32_touch_binary_sensor.cpp index bd60a5c5..5460cd32 100644 --- a/src/esphomelib/binary_sensor/esp32_touch_binary_sensor.cpp +++ b/src/esphome/binary_sensor/esp32_touch_binary_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP32_TOUCH_BINARY_SENSOR -#include "esphomelib/binary_sensor/esp32_touch_binary_sensor.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/esp32_touch_binary_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -158,6 +158,6 @@ uint16_t ESP32TouchBinarySensor::get_threshold() const { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP32_TOUCH_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/esp32_touch_binary_sensor.h b/src/esphome/binary_sensor/esp32_touch_binary_sensor.h similarity index 96% rename from src/esphomelib/binary_sensor/esp32_touch_binary_sensor.h rename to src/esphome/binary_sensor/esp32_touch_binary_sensor.h index cbad9a4d..d7bbc9df 100644 --- a/src/esphomelib/binary_sensor/esp32_touch_binary_sensor.h +++ b/src/esphome/binary_sensor/esp32_touch_binary_sensor.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_BINARY_SENSOR_ESP32_TOUCH_BINARY_SENSOR_H -#define ESPHOMELIB_BINARY_SENSOR_ESP32_TOUCH_BINARY_SENSOR_H +#ifndef ESPHOME_BINARY_SENSOR_ESP32_TOUCH_BINARY_SENSOR_H +#define ESPHOME_BINARY_SENSOR_ESP32_TOUCH_BINARY_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP32_TOUCH_BINARY_SENSOR -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -201,8 +201,8 @@ class ESP32TouchBinarySensor : public BinarySensor { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP32_TOUCH_BINARY_SENSOR -#endif //ESPHOMELIB_BINARY_SENSOR_ESP32_TOUCH_BINARY_SENSOR_H +#endif //ESPHOME_BINARY_SENSOR_ESP32_TOUCH_BINARY_SENSOR_H diff --git a/src/esphomelib/binary_sensor/filter.cpp b/src/esphome/binary_sensor/filter.cpp similarity index 93% rename from src/esphomelib/binary_sensor/filter.cpp rename to src/esphome/binary_sensor/filter.cpp index 7755bb3a..4af294d6 100644 --- a/src/esphomelib/binary_sensor/filter.cpp +++ b/src/esphome/binary_sensor/filter.cpp @@ -1,10 +1,10 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BINARY_SENSOR -#include "esphomelib/binary_sensor/filter.h" +#include "esphome/binary_sensor/filter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -81,6 +81,6 @@ optional UniqueFilter::new_value(bool value, bool is_initial) { } } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/filter.h b/src/esphome/binary_sensor/filter.h similarity index 87% rename from src/esphomelib/binary_sensor/filter.h rename to src/esphome/binary_sensor/filter.h index 698dd6f0..bdc7e394 100644 --- a/src/esphomelib/binary_sensor/filter.h +++ b/src/esphome/binary_sensor/filter.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_FILTER_H -#define ESPHOMELIB_FILTER_H +#ifndef ESPHOME_FILTER_H +#define ESPHOME_FILTER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BINARY_SENSOR -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -78,8 +78,8 @@ class UniqueFilter : public Filter { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BINARY_SENSOR -#endif //ESPHOMELIB_FILTER_H +#endif //ESPHOME_FILTER_H diff --git a/src/esphomelib/binary_sensor/gpio_binary_sensor_component.cpp b/src/esphome/binary_sensor/gpio_binary_sensor_component.cpp similarity index 80% rename from src/esphomelib/binary_sensor/gpio_binary_sensor_component.cpp rename to src/esphome/binary_sensor/gpio_binary_sensor_component.cpp index 310b3063..ec564107 100644 --- a/src/esphomelib/binary_sensor/gpio_binary_sensor_component.cpp +++ b/src/esphome/binary_sensor/gpio_binary_sensor_component.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_GPIO_BINARY_SENSOR -#include "esphomelib/binary_sensor/gpio_binary_sensor_component.h" -#include "esphomelib/esphal.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/gpio_binary_sensor_component.h" +#include "esphome/esphal.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -37,6 +37,6 @@ GPIOBinarySensorComponent::GPIOBinarySensorComponent(const std::string &name, GP } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_GPIO_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/gpio_binary_sensor_component.h b/src/esphome/binary_sensor/gpio_binary_sensor_component.h similarity index 71% rename from src/esphomelib/binary_sensor/gpio_binary_sensor_component.h rename to src/esphome/binary_sensor/gpio_binary_sensor_component.h index 2227eec1..0b7b32ac 100644 --- a/src/esphomelib/binary_sensor/gpio_binary_sensor_component.h +++ b/src/esphome/binary_sensor/gpio_binary_sensor_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_BINARY_SENSOR_GPIO_BINARY_SENSOR_COMPONENT_H -#define ESPHOMELIB_BINARY_SENSOR_GPIO_BINARY_SENSOR_COMPONENT_H +#ifndef ESPHOME_BINARY_SENSOR_GPIO_BINARY_SENSOR_COMPONENT_H +#define ESPHOME_BINARY_SENSOR_GPIO_BINARY_SENSOR_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_GPIO_BINARY_SENSOR -#include "esphomelib/binary_sensor/binary_sensor.h" -#include "esphomelib/esphal.h" +#include "esphome/binary_sensor/binary_sensor.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -41,8 +41,8 @@ class GPIOBinarySensorComponent : public BinarySensor, public Component { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_GPIO_BINARY_SENSOR -#endif //ESPHOMELIB_BINARY_SENSOR_GPIO_BINARY_SENSOR_COMPONENT_H +#endif //ESPHOME_BINARY_SENSOR_GPIO_BINARY_SENSOR_COMPONENT_H diff --git a/src/esphomelib/binary_sensor/homeassistant_binary_sensor.cpp b/src/esphome/binary_sensor/homeassistant_binary_sensor.cpp similarity index 85% rename from src/esphomelib/binary_sensor/homeassistant_binary_sensor.cpp rename to src/esphome/binary_sensor/homeassistant_binary_sensor.cpp index 1ad1a93f..b3b1fae9 100644 --- a/src/esphomelib/binary_sensor/homeassistant_binary_sensor.cpp +++ b/src/esphome/binary_sensor/homeassistant_binary_sensor.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HOMEASSISTANT_BINARY_SENSOR -#include "esphomelib/binary_sensor/homeassistant_binary_sensor.h" -#include "esphomelib/api/api_server.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/homeassistant_binary_sensor.h" +#include "esphome/api/api_server.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -43,6 +43,6 @@ HomeassistantBinarySensor::HomeassistantBinarySensor(const std::string &name, co } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HOMEASSISTANT_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/homeassistant_binary_sensor.h b/src/esphome/binary_sensor/homeassistant_binary_sensor.h similarity index 58% rename from src/esphomelib/binary_sensor/homeassistant_binary_sensor.h rename to src/esphome/binary_sensor/homeassistant_binary_sensor.h index 1c5271f3..bbe12ef4 100644 --- a/src/esphomelib/binary_sensor/homeassistant_binary_sensor.h +++ b/src/esphome/binary_sensor/homeassistant_binary_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_HOMEASSISTANT_BINARY_SENSOR_H -#define ESPHOMELIB_HOMEASSISTANT_BINARY_SENSOR_H +#ifndef ESPHOME_HOMEASSISTANT_BINARY_SENSOR_H +#define ESPHOME_HOMEASSISTANT_BINARY_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HOMEASSISTANT_BINARY_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/component.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -24,8 +24,8 @@ class HomeassistantBinarySensor : public BinarySensor, public Component { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HOMEASSISTANT_BINARY_SENSOR -#endif //ESPHOMELIB_HOMEASSISTANT_BINARY_SENSOR_H +#endif //ESPHOME_HOMEASSISTANT_BINARY_SENSOR_H diff --git a/src/esphomelib/binary_sensor/mqtt_binary_sensor_component.cpp b/src/esphome/binary_sensor/mqtt_binary_sensor_component.cpp similarity index 91% rename from src/esphomelib/binary_sensor/mqtt_binary_sensor_component.cpp rename to src/esphome/binary_sensor/mqtt_binary_sensor_component.cpp index 63fac9e5..9dfcd33f 100644 --- a/src/esphomelib/binary_sensor/mqtt_binary_sensor_component.cpp +++ b/src/esphome/binary_sensor/mqtt_binary_sensor_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_BINARY_SENSOR -#include "esphomelib/binary_sensor/mqtt_binary_sensor_component.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/mqtt_binary_sensor_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -65,6 +65,6 @@ void MQTTBinarySensorComponent::set_is_status(bool status) { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/mqtt_binary_sensor_component.h b/src/esphome/binary_sensor/mqtt_binary_sensor_component.h similarity index 77% rename from src/esphomelib/binary_sensor/mqtt_binary_sensor_component.h rename to src/esphome/binary_sensor/mqtt_binary_sensor_component.h index a7db6b3c..6fdde977 100644 --- a/src/esphomelib/binary_sensor/mqtt_binary_sensor_component.h +++ b/src/esphome/binary_sensor/mqtt_binary_sensor_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_BINARY_SENSOR_MQTT_BINARY_SENSOR_COMPONENT_H -#define ESPHOMELIB_BINARY_SENSOR_MQTT_BINARY_SENSOR_COMPONENT_H +#ifndef ESPHOME_BINARY_SENSOR_MQTT_BINARY_SENSOR_COMPONENT_H +#define ESPHOME_BINARY_SENSOR_MQTT_BINARY_SENSOR_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_BINARY_SENSOR -#include "esphomelib/binary_sensor/binary_sensor.h" -#include "esphomelib/mqtt/mqtt_component.h" +#include "esphome/binary_sensor/binary_sensor.h" +#include "esphome/mqtt/mqtt_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -53,8 +53,8 @@ class MQTTBinarySensorComponent : public mqtt::MQTTComponent { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_BINARY_SENSOR -#endif //ESPHOMELIB_BINARY_SENSOR_MQTT_BINARY_SENSOR_COMPONENT_H +#endif //ESPHOME_BINARY_SENSOR_MQTT_BINARY_SENSOR_COMPONENT_H diff --git a/src/esphomelib/binary_sensor/pn532_component.cpp b/src/esphome/binary_sensor/pn532_component.cpp similarity index 97% rename from src/esphomelib/binary_sensor/pn532_component.cpp rename to src/esphome/binary_sensor/pn532_component.cpp index f008b89e..26d94472 100644 --- a/src/esphomelib/binary_sensor/pn532_component.cpp +++ b/src/esphome/binary_sensor/pn532_component.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PN532 -#include "esphomelib/binary_sensor/pn532_component.h" -#include "esphomelib/log.h" -#include "esphomelib/application.h" +#include "esphome/binary_sensor/pn532_component.h" +#include "esphome/log.h" +#include "esphome/application.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -283,6 +283,6 @@ void PN532Trigger::process(uint8_t *uid, uint8_t uid_length) { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PN532 diff --git a/src/esphomelib/binary_sensor/pn532_component.h b/src/esphome/binary_sensor/pn532_component.h similarity index 82% rename from src/esphomelib/binary_sensor/pn532_component.h rename to src/esphome/binary_sensor/pn532_component.h index 4b64ffef..cb7e7af0 100644 --- a/src/esphomelib/binary_sensor/pn532_component.h +++ b/src/esphome/binary_sensor/pn532_component.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_PN_532_COMPONENT_H -#define ESPHOMELIB_PN_532_COMPONENT_H +#ifndef ESPHOME_PN_532_COMPONENT_H +#define ESPHOME_PN_532_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PN532 #include -#include "esphomelib/component.h" -#include "esphomelib/binary_sensor/binary_sensor.h" -#include "esphomelib/spi_component.h" +#include "esphome/component.h" +#include "esphome/binary_sensor/binary_sensor.h" +#include "esphome/spi_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -73,8 +73,8 @@ class PN532Trigger : public Trigger { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PN532 -#endif //ESPHOMELIB_PN_532_COMPONENT_H +#endif //ESPHOME_PN_532_COMPONENT_H diff --git a/src/esphomelib/binary_sensor/rdm6300.cpp b/src/esphome/binary_sensor/rdm6300.cpp similarity index 93% rename from src/esphomelib/binary_sensor/rdm6300.cpp rename to src/esphome/binary_sensor/rdm6300.cpp index 0401197f..93bc10f1 100644 --- a/src/esphomelib/binary_sensor/rdm6300.cpp +++ b/src/esphome/binary_sensor/rdm6300.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_RDM6300 -#include "esphomelib/binary_sensor/rdm6300.h" -#include "esphomelib/application.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/rdm6300.h" +#include "esphome/application.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -100,6 +100,6 @@ bool RDM6300BinarySensor::process(uint32_t id) { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_RDM6300 diff --git a/src/esphomelib/binary_sensor/rdm6300.h b/src/esphome/binary_sensor/rdm6300.h similarity index 72% rename from src/esphomelib/binary_sensor/rdm6300.h rename to src/esphome/binary_sensor/rdm6300.h index 4d0cd470..2a70e533 100644 --- a/src/esphomelib/binary_sensor/rdm6300.h +++ b/src/esphome/binary_sensor/rdm6300.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_RDM_6300_H -#define ESPHOMELIB_RDM_6300_H +#ifndef ESPHOME_RDM_6300_H +#define ESPHOME_RDM_6300_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_RDM6300 -#include "esphomelib/uart_component.h" -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/uart_component.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -42,8 +42,8 @@ class RDM6300BinarySensor : public BinarySensor { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_RDM6300 -#endif //ESPHOMELIB_RDM_6300_H +#endif //ESPHOME_RDM_6300_H diff --git a/src/esphomelib/binary_sensor/status_binary_sensor.cpp b/src/esphome/binary_sensor/status_binary_sensor.cpp similarity index 77% rename from src/esphomelib/binary_sensor/status_binary_sensor.cpp rename to src/esphome/binary_sensor/status_binary_sensor.cpp index d77dad71..10add189 100644 --- a/src/esphomelib/binary_sensor/status_binary_sensor.cpp +++ b/src/esphome/binary_sensor/status_binary_sensor.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_STATUS_BINARY_SENSOR -#include "esphomelib/binary_sensor/status_binary_sensor.h" -#include "esphomelib/mqtt/mqtt_client_component.h" -#include "esphomelib/wifi_component.h" -#include "esphomelib/util.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/status_binary_sensor.h" +#include "esphome/mqtt/mqtt_client_component.h" +#include "esphome/wifi_component.h" +#include "esphome/util.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -49,6 +49,6 @@ void StatusBinarySensor::dump_config() { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_STATUS_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/status_binary_sensor.h b/src/esphome/binary_sensor/status_binary_sensor.h similarity index 74% rename from src/esphomelib/binary_sensor/status_binary_sensor.h rename to src/esphome/binary_sensor/status_binary_sensor.h index de736006..dad08967 100644 --- a/src/esphomelib/binary_sensor/status_binary_sensor.h +++ b/src/esphome/binary_sensor/status_binary_sensor.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_STATUS_BINARY_SENSOR_H -#define ESPHOMELIB_STATUS_BINARY_SENSOR_H +#ifndef ESPHOME_STATUS_BINARY_SENSOR_H +#define ESPHOME_STATUS_BINARY_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_STATUS_BINARY_SENSOR -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -37,8 +37,8 @@ class StatusBinarySensor : public BinarySensor, public Component { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_STATUS_BINARY_SENSOR -#endif //ESPHOMELIB_STATUS_BINARY_SENSOR_H +#endif //ESPHOME_STATUS_BINARY_SENSOR_H diff --git a/src/esphomelib/binary_sensor/template_binary_sensor.cpp b/src/esphome/binary_sensor/template_binary_sensor.cpp similarity index 81% rename from src/esphomelib/binary_sensor/template_binary_sensor.cpp rename to src/esphome/binary_sensor/template_binary_sensor.cpp index 5f372d24..e962b76b 100644 --- a/src/esphomelib/binary_sensor/template_binary_sensor.cpp +++ b/src/esphome/binary_sensor/template_binary_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_BINARY_SENSOR -#include "esphomelib/binary_sensor/template_binary_sensor.h" -#include "esphomelib/log.h" +#include "esphome/binary_sensor/template_binary_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -36,7 +36,7 @@ void TemplateBinarySensor::dump_config() { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_BINARY_SENSOR diff --git a/src/esphomelib/binary_sensor/template_binary_sensor.h b/src/esphome/binary_sensor/template_binary_sensor.h similarity index 58% rename from src/esphomelib/binary_sensor/template_binary_sensor.h rename to src/esphome/binary_sensor/template_binary_sensor.h index eadf9445..fe89ade5 100644 --- a/src/esphomelib/binary_sensor/template_binary_sensor.h +++ b/src/esphome/binary_sensor/template_binary_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_BINARY_SENSOR_TEMPLATE_BINARY_SENSOR_H -#define ESPHOMELIB_BINARY_SENSOR_TEMPLATE_BINARY_SENSOR_H +#ifndef ESPHOME_BINARY_SENSOR_TEMPLATE_BINARY_SENSOR_H +#define ESPHOME_BINARY_SENSOR_TEMPLATE_BINARY_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_BINARY_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/component.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace binary_sensor { @@ -29,8 +29,8 @@ class TemplateBinarySensor : public Component, public BinarySensor { } // namespace binary_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_BINARY_SENSOR -#endif //ESPHOMELIB_BINARY_SENSOR_TEMPLATE_BINARY_SENSOR_H +#endif //ESPHOME_BINARY_SENSOR_TEMPLATE_BINARY_SENSOR_H diff --git a/src/esphomelib/component.cpp b/src/esphome/component.cpp similarity index 97% rename from src/esphomelib/component.cpp rename to src/esphome/component.cpp index f26ac3e8..ec25280a 100644 --- a/src/esphomelib/component.cpp +++ b/src/esphome/component.cpp @@ -1,11 +1,11 @@ #include -#include "esphomelib/component.h" +#include "esphome/component.h" -#include "esphomelib/esphal.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" +#include "esphome/esphal.h" +#include "esphome/log.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "component"; @@ -128,7 +128,7 @@ void Component::loop_internal() { const uint32_t now = millis(); TimeFunction *tf = &this->time_functions_[i]; if (tf->should_run(now)) { -#ifdef ESPHOMELIB_LOG_HAS_VERY_VERBOSE +#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE const char *type = tf->type == TimeFunction::INTERVAL ? "interval" : (tf->type == TimeFunction::TIMEOUT ? "timeout" : "defer"); ESP_LOGVV(TAG, "Running %s '%s':%u with interval=%u last_execution=%u (now=%u)", type, tf->name.c_str(), i, tf->interval, tf->last_execution, now); @@ -301,4 +301,4 @@ bool Component::TimeFunction::should_run(uint32_t now) const { return this->interval != 4294967295UL && now - this->last_execution > this->interval; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/component.h b/src/esphome/component.h similarity index 96% rename from src/esphomelib/component.h rename to src/esphome/component.h index 0b785808..f33d170a 100644 --- a/src/esphomelib/component.h +++ b/src/esphome/component.h @@ -1,12 +1,12 @@ -#ifndef ESPHOMELIB_COMPONENT_H -#define ESPHOMELIB_COMPONENT_H +#ifndef ESPHOME_COMPONENT_H +#define ESPHOME_COMPONENT_H #include #include -#include "esphomelib/defines.h" -#include "esphomelib/helpers.h" +#include "esphome/defines.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN /// default setup priorities for components of different types. namespace setup_priority { @@ -36,9 +36,9 @@ extern uint32_t global_state; #define LOG_UPDATE_INTERVAL(this) ESP_LOGCONFIG(TAG, " Update Interval: %u ms", this->get_update_interval()); -/** The base class for all esphomelib components. +/** The base class for all ESPHome components. * - * esphomelib uses components to separate code for self-contained units such as + * ESPHome uses components to separate code for self-contained units such as * peripheral devices in order to keep the library clean and simple. Each component * should be registered in the Application instance via add_component. The application * will then call the component's setup() and loop() methods at the appropriate time. @@ -291,6 +291,6 @@ class Nameable { bool internal_{false}; }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_COMPONENT_H +#endif //ESPHOME_COMPONENT_H diff --git a/src/esphomelib/controller.cpp b/src/esphome/controller.cpp similarity index 96% rename from src/esphomelib/controller.cpp rename to src/esphome/controller.cpp index 5320f2db..e7849b17 100644 --- a/src/esphomelib/controller.cpp +++ b/src/esphome/controller.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/controller.h" +#include "esphome/controller.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN #ifdef USE_BINARY_SENSOR void Controller::register_binary_sensor(binary_sensor::BinarySensor *obj) { } -void StoringController::register_binary_sensor(esphomelib::binary_sensor::BinarySensor *obj) { +void StoringController::register_binary_sensor(binary_sensor::BinarySensor *obj) { this->binary_sensors_.push_back(obj); } @@ -161,4 +161,4 @@ void StoringUpdateListenerController::register_text_sensor(text_sensor::TextSens } #endif -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/controller.h b/src/esphome/controller.h similarity index 88% rename from src/esphomelib/controller.h rename to src/esphome/controller.h index b314f6be..95806c74 100644 --- a/src/esphomelib/controller.h +++ b/src/esphome/controller.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_CONTROLLER_H -#define ESPHOMELIB_CONTROLLER_H +#ifndef ESPHOME_CONTROLLER_H +#define ESPHOME_CONTROLLER_H -#include "esphomelib/binary_sensor/binary_sensor.h" -#include "esphomelib/fan/fan_state.h" -#include "esphomelib/light/light_state.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/switch_/switch.h" -#include "esphomelib/cover/cover.h" -#include "esphomelib/text_sensor/text_sensor.h" -#include "esphomelib/defines.h" +#include "esphome/binary_sensor/binary_sensor.h" +#include "esphome/fan/fan_state.h" +#include "esphome/light/light_state.h" +#include "esphome/sensor/sensor.h" +#include "esphome/switch_/switch.h" +#include "esphome/cover/cover.h" +#include "esphome/text_sensor/text_sensor.h" +#include "esphome/defines.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN /// Controllers allow an object to be notified of every component that's added to the Application. class Controller { @@ -162,6 +162,6 @@ class StoringUpdateListenerController : public StoringController { #endif }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_CONTROLLER_H +#endif //ESPHOME_CONTROLLER_H diff --git a/src/esphomelib/cover/cover.cpp b/src/esphome/cover/cover.cpp similarity index 88% rename from src/esphomelib/cover/cover.cpp rename to src/esphome/cover/cover.cpp index c82b9d2b..01f92f5b 100644 --- a/src/esphomelib/cover/cover.cpp +++ b/src/esphome/cover/cover.cpp @@ -1,10 +1,10 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_COVER -#include "esphomelib/cover/cover.h" +#include "esphome/cover/cover.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace cover { @@ -51,6 +51,6 @@ void Cover::set_mqtt(MQTTCoverComponent *mqtt) { } // namespace cover -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_COVER diff --git a/src/esphomelib/cover/cover.h b/src/esphome/cover/cover.h similarity index 92% rename from src/esphomelib/cover/cover.h rename to src/esphome/cover/cover.h index 630ae4d3..06bf2502 100644 --- a/src/esphomelib/cover/cover.h +++ b/src/esphome/cover/cover.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_COVER_COVER_H -#define ESPHOMELIB_COVER_COVER_H +#ifndef ESPHOME_COVER_COVER_H +#define ESPHOME_COVER_COVER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_COVER -#include "esphomelib/component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/automation.h" +#include "esphome/component.h" +#include "esphome/helpers.h" +#include "esphome/automation.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace cover { @@ -205,10 +205,10 @@ CoverPublishAction *Cover::make_cover_publish_action() { } // namespace cover -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/cover/mqtt_cover_component.h" +#include "esphome/cover/mqtt_cover_component.h" #endif //USE_COVER -#endif //ESPHOMELIB_COVER_COVER_H +#endif //ESPHOME_COVER_COVER_H diff --git a/src/esphomelib/cover/mqtt_cover_component.cpp b/src/esphome/cover/mqtt_cover_component.cpp similarity index 93% rename from src/esphomelib/cover/mqtt_cover_component.cpp rename to src/esphome/cover/mqtt_cover_component.cpp index 64bfcaa9..da6447bb 100644 --- a/src/esphomelib/cover/mqtt_cover_component.cpp +++ b/src/esphome/cover/mqtt_cover_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_COVER -#include "esphomelib/cover/mqtt_cover_component.h" -#include "esphomelib/log.h" +#include "esphome/cover/mqtt_cover_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace cover { @@ -73,6 +73,6 @@ bool MQTTCoverComponent::publish_state(cover::CoverState state) { } // namespace cover -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_COVER diff --git a/src/esphomelib/cover/mqtt_cover_component.h b/src/esphome/cover/mqtt_cover_component.h similarity index 65% rename from src/esphomelib/cover/mqtt_cover_component.h rename to src/esphome/cover/mqtt_cover_component.h index 555bd8c9..42306a97 100644 --- a/src/esphomelib/cover/mqtt_cover_component.h +++ b/src/esphome/cover/mqtt_cover_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_COVER_MQTT_COVER_COMPONENT_H -#define ESPHOMELIB_COVER_MQTT_COVER_COMPONENT_H +#ifndef ESPHOME_COVER_MQTT_COVER_COMPONENT_H +#define ESPHOME_COVER_MQTT_COVER_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_COVER -#include "esphomelib/mqtt/mqtt_component.h" -#include "esphomelib/cover/cover.h" +#include "esphome/mqtt/mqtt_component.h" +#include "esphome/cover/cover.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace cover { @@ -35,8 +35,8 @@ class MQTTCoverComponent : public mqtt::MQTTComponent { } // namespace cover -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_COVER -#endif //ESPHOMELIB_COVER_MQTT_COVER_COMPONENT_H +#endif //ESPHOME_COVER_MQTT_COVER_COMPONENT_H diff --git a/src/esphomelib/cover/template_cover.cpp b/src/esphome/cover/template_cover.cpp similarity index 92% rename from src/esphomelib/cover/template_cover.cpp rename to src/esphome/cover/template_cover.cpp index dc6f43a3..119e20f7 100644 --- a/src/esphomelib/cover/template_cover.cpp +++ b/src/esphome/cover/template_cover.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_COVER -#include "esphomelib/cover/template_cover.h" -#include "esphomelib/log.h" +#include "esphome/cover/template_cover.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace cover { @@ -81,6 +81,6 @@ void TemplateCover::dump_config() { } // namespace cover -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_COVER diff --git a/src/esphomelib/cover/template_cover.h b/src/esphome/cover/template_cover.h similarity index 77% rename from src/esphomelib/cover/template_cover.h rename to src/esphome/cover/template_cover.h index 967ba622..71a0ca1a 100644 --- a/src/esphomelib/cover/template_cover.h +++ b/src/esphome/cover/template_cover.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_COVER_TEMPLATE_COVER_H -#define ESPHOMELIB_COVER_TEMPLATE_COVER_H +#ifndef ESPHOME_COVER_TEMPLATE_COVER_H +#define ESPHOME_COVER_TEMPLATE_COVER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_COVER -#include "esphomelib/cover/cover.h" -#include "esphomelib/automation.h" +#include "esphome/cover/cover.h" +#include "esphome/automation.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace cover { @@ -43,8 +43,8 @@ class TemplateCover : public Cover, public Component { } // namespace cover -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_COVER -#endif //ESPHOMELIB_COVER_TEMPLATE_COVER_H +#endif //ESPHOME_COVER_TEMPLATE_COVER_H diff --git a/src/esphomelib/custom_component.cpp b/src/esphome/custom_component.cpp similarity index 70% rename from src/esphomelib/custom_component.cpp rename to src/esphome/custom_component.cpp index 83d02660..5122262c 100644 --- a/src/esphomelib/custom_component.cpp +++ b/src/esphome/custom_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_COMPONENT -#include "esphomelib/custom_component.h" -#include "esphomelib/application.h" +#include "esphome/custom_component.h" +#include "esphome/application.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN CustomComponentConstructor::CustomComponentConstructor(const std::function()> &init) { this->components_ = init(); @@ -19,7 +19,7 @@ Component *CustomComponentConstructor::get_component(int i) { return this->components_[i]; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_COMPONENT diff --git a/src/esphomelib/custom_component.h b/src/esphome/custom_component.h similarity index 55% rename from src/esphomelib/custom_component.h rename to src/esphome/custom_component.h index a0823a0d..f951d1e2 100644 --- a/src/esphomelib/custom_component.h +++ b/src/esphome/custom_component.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_CUSTOM_COMPONENT_H -#define ESPHOMELIB_CUSTOM_COMPONENT_H +#ifndef ESPHOME_CUSTOM_COMPONENT_H +#define ESPHOME_CUSTOM_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_COMPONENT -#include "esphomelib/component.h" +#include "esphome/component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN class CustomComponentConstructor { public: @@ -19,8 +19,8 @@ class CustomComponentConstructor { std::vector components_; }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_COMPONENT -#endif //ESPHOMELIB_CUSTOM_COMPONENT_H +#endif //ESPHOME_CUSTOM_COMPONENT_H diff --git a/src/esphomelib/debug_component.cpp b/src/esphome/debug_component.cpp similarity index 94% rename from src/esphomelib/debug_component.cpp rename to src/esphome/debug_component.cpp index 12200199..a5273281 100644 --- a/src/esphomelib/debug_component.cpp +++ b/src/esphome/debug_component.cpp @@ -1,28 +1,28 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DEBUG_COMPONENT -#include "esphomelib/debug_component.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" +#include "esphome/debug_component.h" +#include "esphome/log.h" +#include "esphome/helpers.h" #include #ifdef ARDUINO_ARCH_ESP32 #include #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "debug"; void DebugComponent::setup() { -#ifndef ESPHOMELIB_LOG_HAS_DEBUG +#ifndef ESPHOME_LOG_HAS_DEBUG ESP_LOGE(TAG, "Debug Component requires debug log level!"); this->status_set_error(); return; #endif - ESP_LOGD(TAG, "esphomelib version %s", ESPHOMELIB_VERSION); + ESP_LOGD(TAG, "ESPHome Core version %s", ESPHOME_VERSION); this->free_heap_ = ESP.getFreeHeap(); ESP_LOGD(TAG, "Free Heap Size: %u bytes", this->free_heap_); @@ -141,6 +141,6 @@ float DebugComponent::get_setup_priority() const { return setup_priority::LATE; // display debug info via MQTT } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DEBUG_COMPONENT diff --git a/src/esphomelib/debug_component.h b/src/esphome/debug_component.h similarity index 59% rename from src/esphomelib/debug_component.h rename to src/esphome/debug_component.h index 8b5c82ad..087c46d6 100644 --- a/src/esphomelib/debug_component.h +++ b/src/esphome/debug_component.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_DEBUG_COMPONENT_H -#define ESPHOMELIB_DEBUG_COMPONENT_H +#ifndef ESPHOME_DEBUG_COMPONENT_H +#define ESPHOME_DEBUG_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DEBUG_COMPONENT -#include "esphomelib/component.h" +#include "esphome/component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN /// The debug component prints out debug information like free heap size on startup. class DebugComponent : public Component { @@ -19,8 +19,8 @@ class DebugComponent : public Component { uint32_t free_heap_{}; }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DEBUG_COMPONENT -#endif //ESPHOMELIB_DEBUG_COMPONENT_H +#endif //ESPHOME_DEBUG_COMPONENT_H diff --git a/src/esphomelib/deep_sleep_component.cpp b/src/esphome/deep_sleep_component.cpp similarity index 93% rename from src/esphomelib/deep_sleep_component.cpp rename to src/esphome/deep_sleep_component.cpp index 66841549..bfcff762 100644 --- a/src/esphomelib/deep_sleep_component.cpp +++ b/src/esphome/deep_sleep_component.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DEEP_SLEEP #include -#include "esphomelib/deep_sleep_component.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" -#include "esphomelib/ota_component.h" +#include "esphome/deep_sleep_component.h" +#include "esphome/log.h" +#include "esphome/helpers.h" +#include "esphome/ota_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "deep_sleep"; @@ -109,6 +109,6 @@ void DeepSleepComponent::prevent_deep_sleep() { this->prevent_ = true; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DEEP_SLEEP diff --git a/src/esphomelib/deep_sleep_component.h b/src/esphome/deep_sleep_component.h similarity index 92% rename from src/esphomelib/deep_sleep_component.h rename to src/esphome/deep_sleep_component.h index d980ba8a..642986b5 100644 --- a/src/esphomelib/deep_sleep_component.h +++ b/src/esphome/deep_sleep_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_DEEP_SLEEP_COMPONENT_H -#define ESPHOMELIB_DEEP_SLEEP_COMPONENT_H +#ifndef ESPHOME_DEEP_SLEEP_COMPONENT_H +#define ESPHOME_DEEP_SLEEP_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DEEP_SLEEP -#include "esphomelib/component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/automation.h" +#include "esphome/component.h" +#include "esphome/helpers.h" +#include "esphome/automation.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN #ifdef ARDUINO_ARCH_ESP32 @@ -143,8 +143,8 @@ PreventDeepSleepAction *DeepSleepComponent::make_prevent_deep_sleep_action() return new PreventDeepSleepAction(this); } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DEEP_SLEEP -#endif //ESPHOMELIB_DEEP_SLEEP_COMPONENT_H +#endif //ESPHOME_DEEP_SLEEP_COMPONENT_H diff --git a/src/esphomelib/defines.h b/src/esphome/defines.h similarity index 93% rename from src/esphomelib/defines.h rename to src/esphome/defines.h index 7649baf4..7dc2dcff 100644 --- a/src/esphomelib/defines.h +++ b/src/esphome/defines.h @@ -1,23 +1,23 @@ -#ifndef ESPHOMELIB_DEFINES_H -#define ESPHOMELIB_DEFINES_H +#ifndef ESPHOME_DEFINES_H +#define ESPHOME_DEFINES_H -#define ESPHOMELIB_VERSION "1.11.0-dev" +#define ESPHOME_VERSION "1.11.0-dev" #define HOT __attribute__ ((hot)) #define ESPDEPRECATED(msg) __attribute__((deprecated(msg))) #define ALWAYS_INLINE __attribute__((always_inline)) #ifndef DOXYGEN - #define ESPHOMELIB_NAMESPACE_BEGIN namespace esphomelib { - #define ESPHOMELIB_NAMESPACE_END } - #define ESPHOMELIB_NAMESPACE esphomelib + #define ESPHOME_NAMESPACE_BEGIN namespace esphome { + #define ESPHOME_NAMESPACE_END } + #define ESPHOME_NAMESPACE esphome #else - #define ESPHOMELIB_NAMESPACE_BEGIN /##/ - #define ESPHOMELIB_NAMESPACE_END /##/ - #define ESPHOMELIB_NAMESPACE + #define ESPHOME_NAMESPACE_BEGIN /##/ + #define ESPHOME_NAMESPACE_END /##/ + #define ESPHOME_NAMESPACE #endif -#ifndef ESPHOMEYAML_USE +#ifndef ESPHOME_USE #define USE_OTA #define USE_I2C #define USE_BINARY_SENSOR @@ -268,4 +268,4 @@ #endif #endif -#endif //ESPHOMELIB_DEFINES_H +#endif //ESPHOME_DEFINES_H diff --git a/src/esphomelib/display/display.cpp b/src/esphome/display/display.cpp similarity index 97% rename from src/esphomelib/display/display.cpp rename to src/esphome/display/display.cpp index 53e3bd26..f326baf3 100644 --- a/src/esphomelib/display/display.cpp +++ b/src/esphome/display/display.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DISPLAY -#include "esphomelib/display/display.h" -#include "esphomelib/log.h" -#include "esphomelib/espmath.h" +#include "esphome/display/display.h" +#include "esphome/log.h" +#include "esphome/espmath.h" #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN const uint8_t COLOR_OFF = 0; const uint8_t COLOR_ON = 1; @@ -305,19 +305,19 @@ void DisplayBuffer::do_update() { } #ifdef USE_TIME void DisplayBuffer::strftime(int x, int y, Font *font, int color, TextAlign align, const char *format, - time::EsphomelibTime time) { + time::ESPTime time) { char buffer[64]; size_t ret = time.strftime(buffer, sizeof(buffer), format); if (ret > 0) this->print(x, y, font, color, align, buffer); } -void DisplayBuffer::strftime(int x, int y, Font *font, int color, const char *format, time::EsphomelibTime time) { +void DisplayBuffer::strftime(int x, int y, Font *font, int color, const char *format, time::ESPTime time) { this->strftime(x, y, font, color, TextAlign::TOP_LEFT, format, time); } -void DisplayBuffer::strftime(int x, int y, Font *font, TextAlign align, const char *format, time::EsphomelibTime time) { +void DisplayBuffer::strftime(int x, int y, Font *font, TextAlign align, const char *format, time::ESPTime time) { this->strftime(x, y, font, COLOR_ON, align, format, time); } -void DisplayBuffer::strftime(int x, int y, Font *font, const char *format, time::EsphomelibTime time) { +void DisplayBuffer::strftime(int x, int y, Font *font, const char *format, time::ESPTime time) { this->strftime(x, y, font, COLOR_ON, TextAlign::TOP_LEFT, format, time); } #endif @@ -440,6 +440,6 @@ Image::Image(const uint8_t *data_start, int width, int height) } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DISPLAY diff --git a/src/esphomelib/display/display.h b/src/esphome/display/display.h similarity index 95% rename from src/esphomelib/display/display.h rename to src/esphome/display/display.h index 658d4f02..2406c1df 100644 --- a/src/esphomelib/display/display.h +++ b/src/esphome/display/display.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_DISPLAY_H -#define ESPHOMELIB_DISPLAY_H +#ifndef ESPHOME_DISPLAY_H +#define ESPHOME_DISPLAY_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DISPLAY -#include "esphomelib/helpers.h" -#include "esphomelib/time/rtc_component.h" +#include "esphome/helpers.h" +#include "esphome/time/rtc_component.h" #include #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN // outside of display namespace so that users don't need to write display::TextAlign::TOP_LEFT /** TextAlign is used to tell the display class how to position a piece of text. By default @@ -223,7 +223,7 @@ class DisplayBuffer { * @param format The strftime format to use. * @param time The time to format. */ - void strftime(int x, int y, Font *font, int color, TextAlign align, const char *format, time::EsphomelibTime time) __attribute__ ((format (strftime, 7, 0))); + void strftime(int x, int y, Font *font, int color, TextAlign align, const char *format, time::ESPTime time) __attribute__ ((format (strftime, 7, 0))); /** Evaluate the strftime-format `format` and print the result with the top left at [x,y] with `font`. * @@ -234,7 +234,7 @@ class DisplayBuffer { * @param format The strftime format to use. * @param time The time to format. */ - void strftime(int x, int y, Font *font, int color, const char *format, time::EsphomelibTime time) __attribute__ ((format (strftime, 6, 0))); + void strftime(int x, int y, Font *font, int color, const char *format, time::ESPTime time) __attribute__ ((format (strftime, 6, 0))); /** Evaluate the strftime-format `format` and print the result with the anchor point at [x,y] with `font`. * @@ -245,7 +245,7 @@ class DisplayBuffer { * @param format The strftime format to use. * @param time The time to format. */ - void strftime(int x, int y, Font *font, TextAlign align, const char *format, time::EsphomelibTime time) __attribute__ ((format (strftime, 6, 0))); + void strftime(int x, int y, Font *font, TextAlign align, const char *format, time::ESPTime time) __attribute__ ((format (strftime, 6, 0))); /** Evaluate the strftime-format `format` and print the result with the top left at [x,y] with `font`. * @@ -255,7 +255,7 @@ class DisplayBuffer { * @param format The strftime format to use. * @param time The time to format. */ - void strftime(int x, int y, Font *font, const char *format, time::EsphomelibTime time) __attribute__ ((format (strftime, 5, 0))); + void strftime(int x, int y, Font *font, const char *format, time::ESPTime time) __attribute__ ((format (strftime, 5, 0))); #endif /// Draw the `image` with the top-left corner at [x,y] to the screen. @@ -362,8 +362,8 @@ class Image { } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DISPLAY -#endif //ESPHOMELIB_DISPLAY_H +#endif //ESPHOME_DISPLAY_H diff --git a/src/esphomelib/display/lcd_display.cpp b/src/esphome/display/lcd_display.cpp similarity index 97% rename from src/esphomelib/display/lcd_display.cpp rename to src/esphome/display/lcd_display.cpp index 211a4526..12e3d456 100644 --- a/src/esphomelib/display/lcd_display.cpp +++ b/src/esphome/display/lcd_display.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LCD_DISPLAY -#include "esphomelib/display/lcd_display.h" -#include "esphomelib/log.h" +#include "esphome/display/lcd_display.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -167,13 +167,13 @@ void LCDDisplay::set_writer(lcd_writer_t &&writer) { this->writer_ = std::move(writer); } #ifdef USE_TIME -void LCDDisplay::strftime(uint8_t column, uint8_t row, const char *format, time::EsphomelibTime time) { +void LCDDisplay::strftime(uint8_t column, uint8_t row, const char *format, time::ESPTime time) { char buffer[64]; size_t ret = time.strftime(buffer, sizeof(buffer), format); if (ret > 0) this->print(column, row, buffer); } -void LCDDisplay::strftime(const char *format, time::EsphomelibTime time) { +void LCDDisplay::strftime(const char *format, time::ESPTime time) { this->strftime(0, 0, format, time); } #endif @@ -317,6 +317,6 @@ PCF8574LCDDisplay::PCF8574LCDDisplay(I2CComponent *parent, uint8_t columns, uint } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LCD_DISPLAY diff --git a/src/esphomelib/display/lcd_display.h b/src/esphome/display/lcd_display.h similarity index 87% rename from src/esphomelib/display/lcd_display.h rename to src/esphome/display/lcd_display.h index 11a5b05e..19d46412 100644 --- a/src/esphomelib/display/lcd_display.h +++ b/src/esphome/display/lcd_display.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_LCD_DISPLAY_H -#define ESPHOMELIB_LCD_DISPLAY_H +#ifndef ESPHOME_LCD_DISPLAY_H +#define ESPHOME_LCD_DISPLAY_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LCD_DISPLAY -#include "esphomelib/component.h" -#include "esphomelib/esphal.h" -#include "esphomelib/i2c_component.h" -#include "esphomelib/time/rtc_component.h" +#include "esphome/component.h" +#include "esphome/esphal.h" +#include "esphome/i2c_component.h" +#include "esphome/time/rtc_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -44,9 +44,9 @@ class LCDDisplay : public PollingComponent { #ifdef USE_TIME /// Evaluate the strftime-format and print the text at the specified column and row. - void strftime(uint8_t column, uint8_t row, const char *format, time::EsphomelibTime time) __attribute__ ((format (strftime, 4, 0))); + void strftime(uint8_t column, uint8_t row, const char *format, time::ESPTime time) __attribute__ ((format (strftime, 4, 0))); /// Evaluate the strftime-format and print the text at column=0 and row=0. - void strftime(const char *format, time::EsphomelibTime time) __attribute__ ((format (strftime, 2, 0))); + void strftime(const char *format, time::ESPTime time) __attribute__ ((format (strftime, 2, 0))); #endif protected: @@ -104,8 +104,8 @@ class PCF8574LCDDisplay : public LCDDisplay, public I2CDevice { } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LCD_DISPLAY -#endif //ESPHOMELIB_LCD_DISPLAY_H +#endif //ESPHOME_LCD_DISPLAY_H diff --git a/src/esphomelib/display/max7219.cpp b/src/esphome/display/max7219.cpp similarity index 96% rename from src/esphomelib/display/max7219.cpp rename to src/esphome/display/max7219.cpp index dab6fcab..336af086 100644 --- a/src/esphomelib/display/max7219.cpp +++ b/src/esphome/display/max7219.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MAX7219 -#include "esphomelib/display/max7219.h" -#include "esphomelib/log.h" +#include "esphome/display/max7219.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -233,20 +233,20 @@ void MAX7219Component::set_num_chips(uint8_t num_chips) { } #ifdef USE_TIME -uint8_t MAX7219Component::strftime(uint8_t pos, const char *format, time::EsphomelibTime time) { +uint8_t MAX7219Component::strftime(uint8_t pos, const char *format, time::ESPTime time) { char buffer[64]; size_t ret = time.strftime(buffer, sizeof(buffer), format); if (ret > 0) return this->print(pos, buffer); return 0; } -uint8_t MAX7219Component::strftime(const char *format, time::EsphomelibTime time) { +uint8_t MAX7219Component::strftime(const char *format, time::ESPTime time) { return this->strftime(0, format, time); } #endif } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MAX7219 diff --git a/src/esphomelib/display/max7219.h b/src/esphome/display/max7219.h similarity index 75% rename from src/esphomelib/display/max7219.h rename to src/esphome/display/max7219.h index f96f1a3a..ccf719d6 100644 --- a/src/esphomelib/display/max7219.h +++ b/src/esphome/display/max7219.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_DISPLAY_MAX7219_H -#define ESPHOMELIB_DISPLAY_MAX7219_H +#ifndef ESPHOME_DISPLAY_MAX7219_H +#define ESPHOME_DISPLAY_MAX7219_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MAX7219 -#include "esphomelib/helpers.h" -#include "esphomelib/spi_component.h" -#include "esphomelib/time/rtc_component.h" +#include "esphome/helpers.h" +#include "esphome/spi_component.h" +#include "esphome/time/rtc_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -50,10 +50,10 @@ class MAX7219Component : public PollingComponent, public SPIDevice { #ifdef USE_TIME /// Evaluate the strftime-format and print the result at the given position. - uint8_t strftime(uint8_t pos, const char *format, time::EsphomelibTime time) __attribute__ ((format (strftime, 3, 0))); + uint8_t strftime(uint8_t pos, const char *format, time::ESPTime time) __attribute__ ((format (strftime, 3, 0))); /// Evaluate the strftime-format and print the result at position 0. - uint8_t strftime(const char *format, time::EsphomelibTime time) __attribute__ ((format (strftime, 2, 0))); + uint8_t strftime(const char *format, time::ESPTime time) __attribute__ ((format (strftime, 2, 0))); #endif protected: @@ -69,8 +69,8 @@ class MAX7219Component : public PollingComponent, public SPIDevice { } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MAX7219 -#endif //ESPHOMELIB_DISPLAY_MAX7219_H +#endif //ESPHOME_DISPLAY_MAX7219_H diff --git a/src/esphomelib/display/nextion.cpp b/src/esphome/display/nextion.cpp similarity index 97% rename from src/esphomelib/display/nextion.cpp rename to src/esphome/display/nextion.cpp index e540f1f0..4a297867 100644 --- a/src/esphomelib/display/nextion.cpp +++ b/src/esphome/display/nextion.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_NEXTION -#include "esphomelib/display/nextion.h" -#include "esphomelib/log.h" +#include "esphome/display/nextion.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -226,7 +226,7 @@ void Nextion::loop() { } } #ifdef USE_TIME -void Nextion::set_nextion_rtc_time(time::EsphomelibTime time) { +void Nextion::set_nextion_rtc_time(time::ESPTime time) { this->send_command_printf_("rtc0=%u", time.year); this->send_command_printf_("rtc1=%u", time.month); this->send_command_printf_("rtc2=%u", time.day_of_month); @@ -268,6 +268,6 @@ NextionTouchComponent::NextionTouchComponent(const std::string &name, uint8_t pa } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_NEXTION diff --git a/src/esphomelib/display/nextion.h b/src/esphome/display/nextion.h similarity index 86% rename from src/esphomelib/display/nextion.h rename to src/esphome/display/nextion.h index e3228bca..908617c6 100644 --- a/src/esphomelib/display/nextion.h +++ b/src/esphome/display/nextion.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_DISPLAY_NEXTION_H -#define ESPHOMELIB_DISPLAY_NEXTION_H +#ifndef ESPHOME_DISPLAY_NEXTION_H +#define ESPHOME_DISPLAY_NEXTION_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_NEXTION -#include "esphomelib/component.h" -#include "esphomelib/uart_component.h" -#include "esphomelib/time/rtc_component.h" -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/component.h" +#include "esphome/uart_component.h" +#include "esphome/time/rtc_component.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -31,7 +31,7 @@ class Nextion : public PollingComponent, public UARTDevice { void set_component_coordinates(const char *component, int x, int y); void set_component_font(const char *component, uint8_t font_id); #ifdef USE_TIME - void set_nextion_rtc_time(time::EsphomelibTime time); + void set_nextion_rtc_time(time::ESPTime time); #endif void goto_page(const char *page); @@ -77,8 +77,8 @@ class NextionTouchComponent : public binary_sensor::BinarySensor { } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_NEXTION -#endif //ESPHOMELIB_DISPLAY_NEXTION_H +#endif //ESPHOME_DISPLAY_NEXTION_H diff --git a/src/esphomelib/display/ssd1306.cpp b/src/esphome/display/ssd1306.cpp similarity index 98% rename from src/esphomelib/display/ssd1306.cpp rename to src/esphome/display/ssd1306.cpp index d8cd5db0..eb2cdb8f 100644 --- a/src/esphomelib/display/ssd1306.cpp +++ b/src/esphome/display/ssd1306.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SSD1306 -#include "esphomelib/display/ssd1306.h" -#include "esphomelib/log.h" +#include "esphome/display/ssd1306.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -355,6 +355,6 @@ I2CSSD1306::I2CSSD1306(I2CComponent *parent, uint32_t update_interval) } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SSD1306 diff --git a/src/esphomelib/display/ssd1306.h b/src/esphome/display/ssd1306.h similarity index 85% rename from src/esphomelib/display/ssd1306.h rename to src/esphome/display/ssd1306.h index 52907239..ebc422f0 100644 --- a/src/esphomelib/display/ssd1306.h +++ b/src/esphome/display/ssd1306.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_SSD_1306_H -#define ESPHOMELIB_SSD_1306_H +#ifndef ESPHOME_SSD_1306_H +#define ESPHOME_SSD_1306_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SSD1306 -#include "esphomelib/component.h" -#include "esphomelib/i2c_component.h" -#include "esphomelib/spi_component.h" -#include "esphomelib/display/display.h" +#include "esphome/component.h" +#include "esphome/i2c_component.h" +#include "esphome/spi_component.h" +#include "esphome/display/display.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -99,8 +99,8 @@ class I2CSSD1306 : public SSD1306, public I2CDevice { } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SSD1306 -#endif //ESPHOMELIB_SSD_1306_H +#endif //ESPHOME_SSD_1306_H diff --git a/src/esphomelib/display/waveshare_epaper.cpp b/src/esphome/display/waveshare_epaper.cpp similarity index 99% rename from src/esphomelib/display/waveshare_epaper.cpp rename to src/esphome/display/waveshare_epaper.cpp index ba41a219..0425260c 100644 --- a/src/esphomelib/display/waveshare_epaper.cpp +++ b/src/esphome/display/waveshare_epaper.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_WAVESHARE_EPAPER -#include "esphomelib/display/waveshare_epaper.h" -#include "esphomelib/log.h" +#include "esphome/display/waveshare_epaper.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -33,7 +33,6 @@ static const uint8_t WAVESHARE_EPAPER_COMMAND_SET_RAM_X_ADDRESS_COUNTER = 0x4E; static const uint8_t WAVESHARE_EPAPER_COMMAND_SET_RAM_Y_ADDRESS_COUNTER = 0x4F; static const uint8_t WAVESHARE_EPAPER_COMMAND_TERMINATE_FRAME_READ_WRITE = 0xFF; -// TODO: Consider modifying this to work better for esphomelib's use cases // not in .text section since only 30 bytes static const uint8_t FULL_UPDATE_LUT[30] = { 0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22, @@ -685,6 +684,6 @@ void WaveshareEPaper7P5In::dump_config() { } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_WAVESHARE_EPAPER diff --git a/src/esphomelib/display/waveshare_epaper.h b/src/esphome/display/waveshare_epaper.h similarity index 90% rename from src/esphomelib/display/waveshare_epaper.h rename to src/esphome/display/waveshare_epaper.h index 6415087a..ebfefbc6 100644 --- a/src/esphomelib/display/waveshare_epaper.h +++ b/src/esphome/display/waveshare_epaper.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_WAVESHARE_E_PAPER_H -#define ESPHOMELIB_WAVESHARE_E_PAPER_H +#ifndef ESPHOME_WAVESHARE_E_PAPER_H +#define ESPHOME_WAVESHARE_E_PAPER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_WAVESHARE_EPAPER -#include "esphomelib/spi_component.h" -#include "esphomelib/display/display.h" +#include "esphome/spi_component.h" +#include "esphome/display/display.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace display { @@ -128,8 +128,8 @@ class WaveshareEPaper7P5In : public WaveshareEPaper { } // namespace display -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_WAVESHARE_EPAPER -#endif //ESPHOMELIB_WAVESHARE_E_PAPER_H +#endif //ESPHOME_WAVESHARE_E_PAPER_H diff --git a/src/esphomelib/esp32_ble_beacon.cpp b/src/esphome/esp32_ble_beacon.cpp similarity index 95% rename from src/esphomelib/esp32_ble_beacon.cpp rename to src/esphome/esp32_ble_beacon.cpp index 27c19253..df4f0d99 100644 --- a/src/esphomelib/esp32_ble_beacon.cpp +++ b/src/esphome/esp32_ble_beacon.cpp @@ -1,18 +1,18 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP32_BLE_BEACON -#include "esphomelib/esp32_ble_beacon.h" -#include "esphomelib/log.h" +#include "esphome/esp32_ble_beacon.h" +#include "esphome/log.h" #include #include #include #include #include #include -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "esp32_ble_beacon"; @@ -145,6 +145,6 @@ void ESP32BLEBeacon::set_minor(uint16_t minor) { ESP32BLEBeacon *global_esp32_ble_beacon = nullptr; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP32_BLE_BEACON diff --git a/src/esphomelib/esp32_ble_beacon.h b/src/esphome/esp32_ble_beacon.h similarity index 82% rename from src/esphomelib/esp32_ble_beacon.h rename to src/esphome/esp32_ble_beacon.h index 8a69ca91..dd5fd8a3 100644 --- a/src/esphomelib/esp32_ble_beacon.h +++ b/src/esphome/esp32_ble_beacon.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_ESP_32_BLE_BEACON_H -#define ESPHOMELIB_ESP_32_BLE_BEACON_H +#ifndef ESPHOME_ESP_32_BLE_BEACON_H +#define ESPHOME_ESP_32_BLE_BEACON_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP32_BLE_BEACON -#include "esphomelib/component.h" +#include "esphome/component.h" #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN typedef struct { uint8_t flags[3]; @@ -53,8 +53,8 @@ class ESP32BLEBeacon : public Component { extern ESP32BLEBeacon *global_esp32_ble_beacon; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP32_BLE_BEACON -#endif //ESPHOMELIB_ESP_32_BLE_BEACON_H +#endif //ESPHOME_ESP_32_BLE_BEACON_H diff --git a/src/esphomelib/esp32_ble_tracker.cpp b/src/esphome/esp32_ble_tracker.cpp similarity index 98% rename from src/esphomelib/esp32_ble_tracker.cpp rename to src/esphome/esp32_ble_tracker.cpp index 2f09c812..c9d24ba2 100644 --- a/src/esphomelib/esp32_ble_tracker.cpp +++ b/src/esphome/esp32_ble_tracker.cpp @@ -1,8 +1,8 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP32_BLE_TRACKER -#include "esphomelib/esp32_ble_tracker.h" +#include "esphome/esp32_ble_tracker.h" #include #include #include @@ -10,9 +10,9 @@ #include #include #include -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN // bt_trace.h #undef TAG @@ -175,7 +175,7 @@ void ESP32BLETracker::start_scan(bool first) { // Values determined empirically, higher scan intervals and lower scan windows make the ESP more stable // Ideally, these values should both be quite low, especially scan window. 0x10/0x10 is the esp-idf // default and works quite well. 0x100/0x50 discovers a few less BLE broadcast packets but is a lot - // more stable (order of several hours). The old esphomelib default (1600/1600) was terrible with + // more stable (order of several hours). The old ESPHome default (1600/1600) was terrible with // crashes every few minutes this->scan_params_.scan_interval = 0x100; this->scan_params_.scan_window = 0x50; @@ -434,7 +434,7 @@ bool ESP32BLETracker::parse_already_discovered_(const ESPBTDevice &device) { } this->already_discovered_.push_back(address); -#ifdef ESPHOMELIB_LOG_HAS_DEBUG +#ifdef ESPHOME_LOG_HAS_DEBUG ESP_LOGD(TAG, "Found device %s RSSI=%d", device.address_str().c_str(), device.get_rssi()); const char *address_type_s; @@ -541,7 +541,7 @@ void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_e this->rssi_ = param.rssi; this->parse_adv(param); -#ifdef ESPHOMELIB_LOG_HAS_VERY_VERBOSE +#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE ESP_LOGVV(TAG, "Parse Result:"); const char *address_type = ""; switch (this->address_type_) { @@ -908,6 +908,6 @@ XiaomiSensor *XiaomiDevice::make_battery_level_sensor(const std::string &name) { } XiaomiDevice::XiaomiDevice(ESP32BLETracker *parent, uint64_t address) : parent_(parent), address_(address) {} -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP32_BLE_TRACKER diff --git a/src/esphomelib/esp32_ble_tracker.h b/src/esphome/esp32_ble_tracker.h similarity index 96% rename from src/esphomelib/esp32_ble_tracker.h rename to src/esphome/esp32_ble_tracker.h index 41105878..f7c496fc 100644 --- a/src/esphomelib/esp32_ble_tracker.h +++ b/src/esphome/esp32_ble_tracker.h @@ -1,20 +1,20 @@ -#ifndef ESPHOMELIB_ESP32_BLE_TRACKER_H -#define ESPHOMELIB_ESP32_BLE_TRACKER_H +#ifndef ESPHOME_ESP32_BLE_TRACKER_H +#define ESPHOME_ESP32_BLE_TRACKER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP32_BLE_TRACKER -#include "esphomelib/component.h" -#include "esphomelib/binary_sensor/binary_sensor.h" -#include "esphomelib/sensor/sensor.h" +#include "esphome/component.h" +#include "esphome/binary_sensor/binary_sensor.h" +#include "esphome/sensor/sensor.h" #include #include #include #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN class ESP32BLEPresenceDevice; class ESP32BLERSSISensor; @@ -24,7 +24,7 @@ class ESPBTDevice; /** The ESP32BLETracker class is a hub for all ESP32 Bluetooth Low Energy devices. * * The implementation uses a lightweight version of the amazing ESP32 BLE Arduino library by - * Neil Kolban. This was done because the ble library was quite huge and esphomelib would only + * Neil Kolban. This was done because the ble library was quite huge and ESPHome would only * ever use a small part of it anyway. Still though, when this component is used, the required * flash size increases by a lot (about 500kB). As the BLE stack uses humongous amounts of * stack size, this component creates a separate FreeRTOS task to handle all BLE stuff with @@ -273,8 +273,8 @@ class ESPBTDevice { extern ESP32BLETracker *global_esp32_ble_tracker; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP32_BLE_TRACKER -#endif //ESPHOMELIB_ESP32_BLE_TRACKER_H +#endif //ESPHOME_ESP32_BLE_TRACKER_H diff --git a/src/esphomelib/esp_one_wire.cpp b/src/esphome/esp_one_wire.cpp similarity index 97% rename from src/esphomelib/esp_one_wire.cpp rename to src/esphome/esp_one_wire.cpp index 7559bb34..12e0df48 100644 --- a/src/esphomelib/esp_one_wire.cpp +++ b/src/esphome/esp_one_wire.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ONE_WIRE -#include "esphomelib/esp_one_wire.h" -#include "esphomelib/helpers.h" +#include "esphome/esp_one_wire.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN const uint8_t ONE_WIRE_ROM_SELECT = 0x55; const int ONE_WIRE_ROM_SEARCH = 0xF0; @@ -213,6 +213,6 @@ GPIOPin *ESPOneWire::get_pin() { return this->pin_; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ONE_WIRE diff --git a/src/esphomelib/esp_one_wire.h b/src/esphome/esp_one_wire.h similarity index 86% rename from src/esphomelib/esp_one_wire.h rename to src/esphome/esp_one_wire.h index 1d935eca..2d8ca3b6 100644 --- a/src/esphomelib/esp_one_wire.h +++ b/src/esphome/esp_one_wire.h @@ -1,19 +1,19 @@ -#ifndef ESPHOMELIB_ONE_WIRE_H -#define ESPHOMELIB_ONE_WIRE_H +#ifndef ESPHOME_ONE_WIRE_H +#define ESPHOME_ONE_WIRE_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ONE_WIRE -#include "esphomelib/esphal.h" +#include "esphome/esphal.h" #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN extern const uint8_t ONE_WIRE_ROM_SELECT; extern const int ONE_WIRE_ROM_SEARCH; -/** This is esphomelib's own (minimal) implementation of 1-Wire that improves timing for ESP boards +/** This is ESPHome's own (minimal) implementation of 1-Wire that improves timing for ESP boards * * It's more or less the same as Arduino's internal library but uses some fancy C++ and 64 bit * unsigned integers to make our lives easier. @@ -78,8 +78,8 @@ class ESPOneWire { }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ONE_WIRE -#endif //ESPHOMELIB_ONE_WIRE_H +#endif //ESPHOME_ONE_WIRE_H diff --git a/src/esphomelib/esphal.cpp b/src/esphome/esphal.cpp similarity index 95% rename from src/esphomelib/esphal.cpp rename to src/esphome/esphal.cpp index 9e7ebc44..59bb41fd 100644 --- a/src/esphomelib/esphal.cpp +++ b/src/esphome/esphal.cpp @@ -1,8 +1,8 @@ -#include "esphomelib/esphal.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" +#include "esphome/esphal.h" +#include "esphome/helpers.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "esphal"; @@ -109,4 +109,4 @@ GPIOOutputPin::GPIOOutputPin(uint8_t pin, uint8_t mode, bool inverted) GPIOInputPin::GPIOInputPin(uint8_t pin, uint8_t mode, bool inverted) : GPIOPin(pin, mode, inverted) {} -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/esphal.h b/src/esphome/esphal.h similarity index 93% rename from src/esphomelib/esphal.h rename to src/esphome/esphal.h index 660ef2f5..9c55c4dd 100644 --- a/src/esphomelib/esphal.h +++ b/src/esphome/esphal.h @@ -1,5 +1,5 @@ -#ifndef ESPHOMELIB_ESPHAL_H -#define ESPHOMELIB_ESPHAL_H +#ifndef ESPHOME_ESPHAL_H +#define ESPHOME_ESPHAL_H #ifdef ARDUINO_ARCH_ESP32 #include @@ -7,8 +7,8 @@ #ifdef ARDUINO_ARCH_ESP8266 #include "Arduino.h" #endif -#include "esphomelib/espmath.h" -#include "esphomelib/defines.h" +#include "esphome/espmath.h" +#include "esphome/defines.h" #ifdef bool #undef bool @@ -20,7 +20,7 @@ #undef false #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN #define LOG_PIN(prefix, pin) if (pin != nullptr) {ESP_LOGCONFIG(TAG, prefix LOG_PIN_PATTERN, LOG_PIN_ARGS(pin));} #define LOG_PIN_PATTERN "GPIO%u (Mode: %s%s)" @@ -96,6 +96,6 @@ class GPIOInputPin : public GPIOPin { GPIOInputPin(uint8_t pin, uint8_t mode = INPUT, bool inverted = false); // NOLINT }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_ESPHAL_H +#endif //ESPHOME_ESPHAL_H diff --git a/src/esphomelib/espmath.h b/src/esphome/espmath.h similarity index 65% rename from src/esphomelib/espmath.h rename to src/esphome/espmath.h index fd4dcfdd..8a208833 100644 --- a/src/esphomelib/espmath.h +++ b/src/esphome/espmath.h @@ -1,5 +1,5 @@ -#ifndef ESPHOMELIB_ESPMATH_H -#define ESPHOMELIB_ESPMATH_H +#ifndef ESPHOME_ESPMATH_H +#define ESPHOME_ESPMATH_H #include "Arduino.h" @@ -21,4 +21,4 @@ #include "math.h" -#endif //ESPHOMELIB_ESPMATH_H +#endif //ESPHOME_ESPMATH_H diff --git a/src/esphomelib/esppreferences.cpp b/src/esphome/esppreferences.cpp similarity index 97% rename from src/esphomelib/esppreferences.cpp rename to src/esphome/esppreferences.cpp index 4798aa83..75b0e2c7 100644 --- a/src/esphomelib/esppreferences.cpp +++ b/src/esphome/esppreferences.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/esppreferences.h" +#include "esphome/esppreferences.h" #include -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" +#include "esphome/log.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "preferences"; @@ -190,4 +190,4 @@ bool ESPPreferenceObject::is_initialized() const { ESPPreferences global_preferences; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/esppreferences.h b/src/esphome/esppreferences.h similarity index 87% rename from src/esphomelib/esppreferences.h rename to src/esphome/esppreferences.h index 2098a249..0cb3e7ea 100644 --- a/src/esphomelib/esppreferences.h +++ b/src/esphome/esppreferences.h @@ -1,5 +1,5 @@ -#ifndef ESPHOMELIB_ESPPREFERENCES_H -#define ESPHOMELIB_ESPPREFERENCES_H +#ifndef ESPHOME_ESPPREFERENCES_H +#define ESPHOME_ESPPREFERENCES_H #include @@ -7,10 +7,10 @@ #include #endif -#include "esphomelib/espmath.h" -#include "esphomelib/defines.h" +#include "esphome/espmath.h" +#include "esphome/defines.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN class ESPPreferenceObject { public: @@ -74,7 +74,7 @@ class ESPPreferences { extern ESPPreferences global_preferences; template -ESPPreferenceObject esphomelib::ESPPreferences::make_preference(uint32_t type) { +ESPPreferenceObject ESPPreferences::make_preference(uint32_t type) { return this->make_preference((sizeof(T) + 3) / 4, type); } @@ -97,6 +97,6 @@ bool ESPPreferenceObject::load(T *dest) { return true; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_ESPPREFERENCES_H +#endif //ESPHOME_ESPPREFERENCES_H diff --git a/src/esphomelib/ethernet_component.cpp b/src/esphome/ethernet_component.cpp similarity index 97% rename from src/esphomelib/ethernet_component.cpp rename to src/esphome/ethernet_component.cpp index 2ab3eb76..4abedb06 100644 --- a/src/esphomelib/ethernet_component.cpp +++ b/src/esphome/ethernet_component.cpp @@ -1,10 +1,10 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ETHERNET -#include "esphomelib/ethernet_component.h" -#include "esphomelib/log.h" -#include "esphomelib/util.h" +#include "esphome/ethernet_component.h" +#include "esphome/log.h" +#include "esphome/util.h" #include #include @@ -15,7 +15,7 @@ // tcpip_adapter_init() extern void tcpipInit(); -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "ethernet"; @@ -268,6 +268,6 @@ void EthernetComponent::set_use_address(const std::string &use_address) { this->use_address_ = use_address; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ETHERNET diff --git a/src/esphomelib/ethernet_component.h b/src/esphome/ethernet_component.h similarity index 84% rename from src/esphomelib/ethernet_component.h rename to src/esphome/ethernet_component.h index 850afc9f..36b4ca15 100644 --- a/src/esphomelib/ethernet_component.h +++ b/src/esphome/ethernet_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_ETHERNET_COMPONENT_H -#define ESPHOMELIB_ETHERNET_COMPONENT_H +#ifndef ESPHOME_ETHERNET_COMPONENT_H +#define ESPHOME_ETHERNET_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ETHERNET -#include "esphomelib/component.h" -#include "esphomelib/wifi_component.h" +#include "esphome/component.h" +#include "esphome/wifi_component.h" #include "esp_eth.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN enum EthernetType { ETHERNET_TYPE_LAN8720 = 0, @@ -65,8 +65,8 @@ class EthernetComponent : public Component { extern EthernetComponent *global_eth_component; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ETHERNET -#endif //ESPHOMELIB_ETHERNET_COMPONENT_H +#endif //ESPHOME_ETHERNET_COMPONENT_H diff --git a/src/esphomelib/fan/basic_fan_component.cpp b/src/esphome/fan/basic_fan_component.cpp similarity index 94% rename from src/esphomelib/fan/basic_fan_component.cpp rename to src/esphome/fan/basic_fan_component.cpp index 6fa60ff6..b16b0127 100644 --- a/src/esphomelib/fan/basic_fan_component.cpp +++ b/src/esphome/fan/basic_fan_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_FAN -#include "esphomelib/fan/basic_fan_component.h" -#include "esphomelib/log.h" +#include "esphome/fan/basic_fan_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace fan { @@ -97,6 +97,6 @@ float BasicFanComponent::get_setup_priority() const { } // namespace fan -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_FAN diff --git a/src/esphomelib/fan/basic_fan_component.h b/src/esphome/fan/basic_fan_component.h similarity index 83% rename from src/esphomelib/fan/basic_fan_component.h rename to src/esphome/fan/basic_fan_component.h index 293e77d7..582aa2aa 100644 --- a/src/esphomelib/fan/basic_fan_component.h +++ b/src/esphome/fan/basic_fan_component.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_FAN_BASIC_FAN_COMPONENT_H -#define ESPHOMELIB_FAN_BASIC_FAN_COMPONENT_H +#ifndef ESPHOME_FAN_BASIC_FAN_COMPONENT_H +#define ESPHOME_FAN_BASIC_FAN_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_FAN -#include "esphomelib/component.h" -#include "esphomelib/output/binary_output.h" -#include "esphomelib/output/float_output.h" -#include "esphomelib/fan/fan_state.h" +#include "esphome/component.h" +#include "esphome/output/binary_output.h" +#include "esphome/output/float_output.h" +#include "esphome/fan/fan_state.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace fan { @@ -61,8 +61,8 @@ class BasicFanComponent : public Component { } // namespace fan -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_FAN -#endif //ESPHOMELIB_FAN_BASIC_FAN_COMPONENT_H +#endif //ESPHOME_FAN_BASIC_FAN_COMPONENT_H diff --git a/src/esphomelib/fan/fan_state.cpp b/src/esphome/fan/fan_state.cpp similarity index 94% rename from src/esphomelib/fan/fan_state.cpp rename to src/esphome/fan/fan_state.cpp index 0c63943f..980ac7eb 100644 --- a/src/esphomelib/fan/fan_state.cpp +++ b/src/esphome/fan/fan_state.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_FAN -#include "esphomelib/fan/fan_state.h" -#include "esphomelib/esppreferences.h" -#include "esphomelib/log.h" +#include "esphome/fan/fan_state.h" +#include "esphome/esppreferences.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace fan { @@ -139,6 +139,6 @@ FanState::StateCall &FanState::StateCall::set_speed(const char *speed) { } // namespace fan -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_FAN diff --git a/src/esphomelib/fan/fan_state.h b/src/esphome/fan/fan_state.h similarity index 92% rename from src/esphomelib/fan/fan_state.h rename to src/esphome/fan/fan_state.h index 34e65116..d8d85bda 100644 --- a/src/esphomelib/fan/fan_state.h +++ b/src/esphome/fan/fan_state.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_FAN_FAN_STATE_H -#define ESPHOMELIB_FAN_FAN_STATE_H +#ifndef ESPHOME_FAN_FAN_STATE_H +#define ESPHOME_FAN_FAN_STATE_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_FAN -#include "esphomelib/component.h" -#include "esphomelib/automation.h" -#include "esphomelib/esppreferences.h" -#include "esphomelib/fan/fan_traits.h" +#include "esphome/component.h" +#include "esphome/automation.h" +#include "esphome/esppreferences.h" +#include "esphome/fan/fan_traits.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace fan { @@ -201,10 +201,10 @@ ToggleAction *FanState::make_toggle_action() { } // namespace fan -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/fan/mqtt_fan_component.h" +#include "esphome/fan/mqtt_fan_component.h" #endif //USE_FAN -#endif //ESPHOMELIB_FAN_FAN_STATE_H +#endif //ESPHOME_FAN_FAN_STATE_H diff --git a/src/esphomelib/fan/fan_traits.cpp b/src/esphome/fan/fan_traits.cpp similarity index 81% rename from src/esphomelib/fan/fan_traits.cpp rename to src/esphome/fan/fan_traits.cpp index 96ec916c..0448b55c 100644 --- a/src/esphomelib/fan/fan_traits.cpp +++ b/src/esphome/fan/fan_traits.cpp @@ -1,10 +1,10 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_FAN -#include "esphomelib/fan/fan_traits.h" +#include "esphome/fan/fan_traits.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace fan { @@ -28,6 +28,6 @@ void FanTraits::set_speed(bool speed) { } // namespace fan -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_FAN diff --git a/src/esphomelib/fan/fan_traits.h b/src/esphome/fan/fan_traits.h similarity index 80% rename from src/esphomelib/fan/fan_traits.h rename to src/esphome/fan/fan_traits.h index 54c991f4..87484b92 100644 --- a/src/esphomelib/fan/fan_traits.h +++ b/src/esphome/fan/fan_traits.h @@ -1,11 +1,11 @@ -#ifndef ESPHOMELIB_FAN_FAN_TRAITS_H -#define ESPHOMELIB_FAN_FAN_TRAITS_H +#ifndef ESPHOME_FAN_FAN_TRAITS_H +#define ESPHOME_FAN_FAN_TRAITS_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_FAN -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace fan { @@ -33,8 +33,8 @@ class FanTraits { } // namespace fan -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_FAN -#endif //ESPHOMELIB_FAN_FAN_TRAITS_H +#endif //ESPHOME_FAN_FAN_TRAITS_H diff --git a/src/esphomelib/fan/mqtt_fan_component.cpp b/src/esphome/fan/mqtt_fan_component.cpp similarity index 97% rename from src/esphomelib/fan/mqtt_fan_component.cpp rename to src/esphome/fan/mqtt_fan_component.cpp index 6c29ca1a..c26cbb48 100644 --- a/src/esphomelib/fan/mqtt_fan_component.cpp +++ b/src/esphome/fan/mqtt_fan_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_FAN -#include "esphomelib/fan/mqtt_fan_component.h" -#include "esphomelib/log.h" +#include "esphome/fan/mqtt_fan_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace fan { @@ -167,6 +167,6 @@ bool MQTTFanComponent::publish_state() { } // namespace fan -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_FAN diff --git a/src/esphomelib/fan/mqtt_fan_component.h b/src/esphome/fan/mqtt_fan_component.h similarity index 85% rename from src/esphomelib/fan/mqtt_fan_component.h rename to src/esphome/fan/mqtt_fan_component.h index 9fcc731b..86aeaf17 100644 --- a/src/esphomelib/fan/mqtt_fan_component.h +++ b/src/esphome/fan/mqtt_fan_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_FAN_MQTT_FAN_COMPONENT_H -#define ESPHOMELIB_FAN_MQTT_FAN_COMPONENT_H +#ifndef ESPHOME_FAN_MQTT_FAN_COMPONENT_H +#define ESPHOME_FAN_MQTT_FAN_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_FAN -#include "esphomelib/mqtt/mqtt_component.h" -#include "esphomelib/fan/fan_state.h" +#include "esphome/mqtt/mqtt_component.h" +#include "esphome/fan/fan_state.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace fan { @@ -58,8 +58,8 @@ class MQTTFanComponent : public mqtt::MQTTComponent { } // namespace fan -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_FAN -#endif //ESPHOMELIB_FAN_MQTT_FAN_COMPONENT_H +#endif //ESPHOME_FAN_MQTT_FAN_COMPONENT_H diff --git a/src/esphomelib/helpers.cpp b/src/esphome/helpers.cpp similarity index 98% rename from src/esphomelib/helpers.cpp rename to src/esphome/helpers.cpp index 3dee418b..d32a738d 100644 --- a/src/esphomelib/helpers.cpp +++ b/src/esphome/helpers.cpp @@ -7,14 +7,14 @@ #include #endif -#include "esphomelib/espmath.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" -#include "esphomelib/esphal.h" -#include "esphomelib/espmath.h" -#include "esphomelib/status_led.h" +#include "esphome/espmath.h" +#include "esphome/helpers.h" +#include "esphome/log.h" +#include "esphome/esphal.h" +#include "esphome/espmath.h" +#include "esphome/status_led.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "helpers"; @@ -547,4 +547,4 @@ bool HighFrequencyLoopRequester::is_high_frequency() { return high_freq_num_requests > 0; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/helpers.h b/src/esphome/helpers.h similarity index 97% rename from src/esphomelib/helpers.h rename to src/esphome/helpers.h index c66e442f..a8d6e8aa 100644 --- a/src/esphomelib/helpers.h +++ b/src/esphome/helpers.h @@ -1,5 +1,5 @@ -#ifndef ESPHOMELIB_HELPERS_H -#define ESPHOMELIB_HELPERS_H +#ifndef ESPHOME_HELPERS_H +#define ESPHOME_HELPERS_H #include #include @@ -8,9 +8,9 @@ #include #include -#include "esphomelib/esphal.h" -#include "esphomelib/defines.h" -#include "esphomelib/optional.h" +#include "esphome/esphal.h" +#include "esphome/defines.h" +#include "esphome/optional.h" #ifndef JSON_BUFFER_SIZE #define JSON_BUFFER_SIZE (JSON_OBJECT_SIZE(16)) @@ -20,7 +20,7 @@ #include #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN /// Callback function typedef for parsing JsonObjects. using json_parse_t = std::function; @@ -418,6 +418,6 @@ bool Deduplicator::has_value() const { return this->has_value_; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_HELPERS_H +#endif //ESPHOME_HELPERS_H diff --git a/src/esphomelib/i2c_component.cpp b/src/esphome/i2c_component.cpp similarity index 98% rename from src/esphomelib/i2c_component.cpp rename to src/esphome/i2c_component.cpp index dcce057b..e956dee3 100644 --- a/src/esphomelib/i2c_component.cpp +++ b/src/esphome/i2c_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_I2C -#include "esphomelib/i2c_component.h" -#include "esphomelib/log.h" +#include "esphome/i2c_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "i2c"; @@ -227,6 +227,6 @@ void I2CDevice::set_parent(I2CComponent *parent) { uint8_t next_i2c_bus_num_ = 0; #endif -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_I2C diff --git a/src/esphomelib/i2c_component.h b/src/esphome/i2c_component.h similarity index 97% rename from src/esphomelib/i2c_component.h rename to src/esphome/i2c_component.h index 058ecf68..2fb9bc23 100644 --- a/src/esphomelib/i2c_component.h +++ b/src/esphome/i2c_component.h @@ -1,18 +1,18 @@ -#ifndef ESPHOMELIB_I2C_COMPONENT_H -#define ESPHOMELIB_I2C_COMPONENT_H +#ifndef ESPHOME_I2C_COMPONENT_H +#define ESPHOME_I2C_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_I2C -#include "esphomelib/component.h" +#include "esphome/component.h" #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN #define LOG_I2C_DEVICE(this) ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->address_); -/** The I2CComponent is the base of esphomelib's i2c communication. +/** The I2CComponent is the base of ESPHome's i2c communication. * * It handles setting up the bus (with pins, clock frequency) and provides nice helper functions to * make reading from the i2c bus easier (see read_bytes, write_bytes) and safe (with read timeouts). @@ -214,8 +214,8 @@ class I2CDevice { I2CComponent *parent_; }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_I2C -#endif //ESPHOMELIB_I2C_COMPONENT_H +#endif //ESPHOME_I2C_COMPONENT_H diff --git a/src/esphomelib/io/pcf8574_component.cpp b/src/esphome/io/pcf8574_component.cpp similarity index 96% rename from src/esphomelib/io/pcf8574_component.cpp rename to src/esphome/io/pcf8574_component.cpp index bb00f368..6cf95427 100644 --- a/src/esphomelib/io/pcf8574_component.cpp +++ b/src/esphome/io/pcf8574_component.cpp @@ -2,14 +2,14 @@ // - https://github.com/skywodd/pcf8574_arduino_library/ // - http://www.ti.com/lit/ds/symlink/pcf8574.pdf -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PCF8574 -#include "esphomelib/io/pcf8574_component.h" -#include "esphomelib/log.h" +#include "esphome/io/pcf8574_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace io { @@ -162,6 +162,6 @@ void PCF8574GPIOOutputPin::pin_mode(uint8_t mode) { } // namespace io -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PCF8574 diff --git a/src/esphomelib/io/pcf8574_component.h b/src/esphome/io/pcf8574_component.h similarity index 91% rename from src/esphomelib/io/pcf8574_component.h rename to src/esphome/io/pcf8574_component.h index db3958d1..02d6f2c8 100644 --- a/src/esphomelib/io/pcf8574_component.h +++ b/src/esphome/io/pcf8574_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_PCF_8574_COMPONENT_H -#define ESPHOMELIB_PCF_8574_COMPONENT_H +#ifndef ESPHOME_PCF_8574_COMPONENT_H +#define ESPHOME_PCF_8574_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PCF8574 -#include "esphomelib/component.h" -#include "esphomelib/esphal.h" -#include "esphomelib/i2c_component.h" +#include "esphome/component.h" +#include "esphome/esphal.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace io { @@ -112,8 +112,8 @@ class PCF8574GPIOOutputPin : public GPIOOutputPin { } // namespace io -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PCF8574 -#endif //ESPHOMELIB_PCF_8574_COMPONENT_H +#endif //ESPHOME_PCF_8574_COMPONENT_H diff --git a/src/esphomelib/light/addressable_light.cpp b/src/esphome/light/addressable_light.cpp similarity index 93% rename from src/esphomelib/light/addressable_light.cpp rename to src/esphome/light/addressable_light.cpp index 543f06f8..a56e208c 100644 --- a/src/esphomelib/light/addressable_light.cpp +++ b/src/esphome/light/addressable_light.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/addressable_light.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" +#include "esphome/light/addressable_light.h" +#include "esphome/log.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -134,6 +134,6 @@ void AddressableLight::set_effect_active(bool effect_active) { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //USE_LIGHT \ No newline at end of file +#endif //USE_LIGHT diff --git a/src/esphomelib/light/addressable_light.h b/src/esphome/light/addressable_light.h similarity index 93% rename from src/esphomelib/light/addressable_light.h rename to src/esphome/light/addressable_light.h index bb54371f..f8062445 100644 --- a/src/esphomelib/light/addressable_light.h +++ b/src/esphome/light/addressable_light.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_LIGHT_ADDRESSABLE_LIGHT_H -#define ESPHOMELIB_LIGHT_ADDRESSABLE_LIGHT_H +#ifndef ESPHOME_LIGHT_ADDRESSABLE_LIGHT_H +#define ESPHOME_LIGHT_ADDRESSABLE_LIGHT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/helpers.h" -#include "esphomelib/light/light_state.h" +#include "esphome/helpers.h" +#include "esphome/light/light_state.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -150,10 +150,10 @@ class AddressableLight : public LightOutput { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/light/addressable_light.tcc" +#include "esphome/light/addressable_light.tcc" #endif //USE_LIGHT -#endif //ESPHOMELIB_LIGHT_ADDRESSABLE_LIGHT_H +#endif //ESPHOME_LIGHT_ADDRESSABLE_LIGHT_H diff --git a/src/esphomelib/light/addressable_light.tcc b/src/esphome/light/addressable_light.tcc similarity index 98% rename from src/esphomelib/light/addressable_light.tcc rename to src/esphome/light/addressable_light.tcc index efaef981..f8a0216a 100644 --- a/src/esphomelib/light/addressable_light.tcc +++ b/src/esphome/light/addressable_light.tcc @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/addressable_light.h" -#include "esphomelib/helpers.h" +#include "esphome/light/addressable_light.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -312,6 +312,6 @@ ESPHSVColor::ESPHSVColor(uint8_t hue, uint8_t saturation, uint8_t value) } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT diff --git a/src/esphomelib/light/addressable_light_effect.cpp b/src/esphome/light/addressable_light_effect.cpp similarity index 98% rename from src/esphomelib/light/addressable_light_effect.cpp rename to src/esphome/light/addressable_light_effect.cpp index b668805e..16f3e0bb 100644 --- a/src/esphomelib/light/addressable_light_effect.cpp +++ b/src/esphome/light/addressable_light_effect.cpp @@ -1,10 +1,10 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/addressable_light_effect.h" +#include "esphome/light/addressable_light_effect.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -363,6 +363,6 @@ void AddressableFlickerEffect::set_intensity(float intensity) { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT diff --git a/src/esphomelib/light/addressable_light_effect.h b/src/esphome/light/addressable_light_effect.h similarity index 92% rename from src/esphomelib/light/addressable_light_effect.h rename to src/esphome/light/addressable_light_effect.h index c4972325..f3f2a008 100644 --- a/src/esphomelib/light/addressable_light_effect.h +++ b/src/esphome/light/addressable_light_effect.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_LIGHT_ADDRESSABLE_LIGHT_EFFECT_H -#define ESPHOMELIB_LIGHT_ADDRESSABLE_LIGHT_EFFECT_H +#ifndef ESPHOME_LIGHT_ADDRESSABLE_LIGHT_EFFECT_H +#define ESPHOME_LIGHT_ADDRESSABLE_LIGHT_EFFECT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/light_effect.h" -#include "esphomelib/light/addressable_light.h" +#include "esphome/light/light_effect.h" +#include "esphome/light/addressable_light.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -137,8 +137,8 @@ class AddressableFlickerEffect : public AddressableLightEffect { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT -#endif //ESPHOMELIB_LIGHT_ADDRESSABLE_LIGHT_EFFECT_H +#endif //ESPHOME_LIGHT_ADDRESSABLE_LIGHT_EFFECT_H diff --git a/src/esphomelib/light/fast_led_light_output.cpp b/src/esphome/light/fast_led_light_output.cpp similarity index 96% rename from src/esphomelib/light/fast_led_light_output.cpp rename to src/esphome/light/fast_led_light_output.cpp index 0b4f8d1c..d0f41ed2 100644 --- a/src/esphomelib/light/fast_led_light_output.cpp +++ b/src/esphome/light/fast_led_light_output.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_FAST_LED_LIGHT -#include "esphomelib/light/fast_led_light_output.h" -#include "esphomelib/log.h" +#include "esphome/light/fast_led_light_output.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -139,6 +139,6 @@ void FastLEDLightOutputComponent::clear_effect_data() { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_FAST_LED_LIGHT diff --git a/src/esphomelib/light/fast_led_light_output.h b/src/esphome/light/fast_led_light_output.h similarity index 96% rename from src/esphomelib/light/fast_led_light_output.h rename to src/esphome/light/fast_led_light_output.h index 141160a9..023e51bb 100644 --- a/src/esphomelib/light/fast_led_light_output.h +++ b/src/esphome/light/fast_led_light_output.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_LIGHT_FAST_LED_LIGHT_OUTPUT_H -#define ESPHOMELIB_LIGHT_FAST_LED_LIGHT_OUTPUT_H +#ifndef ESPHOME_LIGHT_FAST_LED_LIGHT_OUTPUT_H +#define ESPHOME_LIGHT_FAST_LED_LIGHT_OUTPUT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_FAST_LED_LIGHT -#include "esphomelib/power_supply_component.h" -#include "esphomelib/light/light_state.h" -#include "esphomelib/light/addressable_light.h" -#include "esphomelib/helpers.h" +#include "esphome/power_supply_component.h" +#include "esphome/light/light_state.h" +#include "esphome/light/addressable_light.h" +#include "esphome/helpers.h" #define FASTLED_ESP8266_RAW_PIN_ORDER #define FASTLED_ESP32_RAW_PIN_ORDER @@ -19,7 +19,7 @@ #include "FastLED.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -27,7 +27,7 @@ namespace light { * * To do this, it uses the FastLED library. The API for setting up the different * types of lights FastLED supports is intentionally kept as close to FastLEDs defaults - * as possible. To use FastLED lights with esphomelib, first set up the component using + * as possible. To use FastLED lights with ESPHome, first set up the component using * the helper in Application, then add the LEDs using the `add_leds` helper functions. * * These add_leds helpers can, however, only be called once on a FastLEDLightOutput. Also, @@ -351,8 +351,8 @@ class FastLEDLightOutputComponent : public Component, public AddressableLight { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_FAST_LED_LIGHT -#endif //ESPHOMELIB_LIGHT_FAST_LED_LIGHT_OUTPUT_H +#endif //ESPHOME_LIGHT_FAST_LED_LIGHT_OUTPUT_H diff --git a/src/esphomelib/light/light_color_values.cpp b/src/esphome/light/light_color_values.cpp similarity index 88% rename from src/esphomelib/light/light_color_values.cpp rename to src/esphome/light/light_color_values.cpp index 0867c0b4..7c1c8e1d 100644 --- a/src/esphomelib/light/light_color_values.cpp +++ b/src/esphome/light/light_color_values.cpp @@ -1,23 +1,23 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/light_color_values.h" +#include "esphome/light/light_color_values.h" #include #include -#include "esphomelib/helpers.h" -#include "esphomelib/component.h" -#include "esphomelib/log.h" -#include "esphomelib/espmath.h" -#include "esphomelib/esppreferences.h" +#include "esphome/helpers.h" +#include "esphome/component.h" +#include "esphome/log.h" +#include "esphome/espmath.h" +#include "esphome/esppreferences.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { -#ifdef ESPHOMELIB_LOG_HAS_VERBOSE +#ifdef ESPHOME_LOG_HAS_VERBOSE static const char *TAG = "light.light_color_values"; #endif @@ -80,13 +80,13 @@ LightColorValues::LightColorValues() LightColorValues LightColorValues::lerp(const LightColorValues &start, const LightColorValues &end, float completion) { LightColorValues v; - v.set_state(esphomelib::lerp(start.get_state(), end.get_state(), completion)); - v.set_brightness(esphomelib::lerp(start.get_brightness(), end.get_brightness(), completion)); - v.set_red(esphomelib::lerp(start.get_red(), end.get_red(), completion)); - v.set_green(esphomelib::lerp(start.get_green(), end.get_green(), completion)); - v.set_blue(esphomelib::lerp(start.get_blue(), end.get_blue(), completion)); - v.set_white(esphomelib::lerp(start.get_white(), end.get_white(), completion)); - v.set_color_temperature(esphomelib::lerp(start.get_color_temperature(), end.get_color_temperature(), completion)); + v.set_state(esphome::lerp(start.get_state(), end.get_state(), completion)); + v.set_brightness(esphome::lerp(start.get_brightness(), end.get_brightness(), completion)); + v.set_red(esphome::lerp(start.get_red(), end.get_red(), completion)); + v.set_green(esphome::lerp(start.get_green(), end.get_green(), completion)); + v.set_blue(esphome::lerp(start.get_blue(), end.get_blue(), completion)); + v.set_white(esphome::lerp(start.get_white(), end.get_white(), completion)); + v.set_color_temperature(esphome::lerp(start.get_color_temperature(), end.get_color_temperature(), completion)); return v; } @@ -229,6 +229,6 @@ bool LightColorValues::is_on() const { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT diff --git a/src/esphomelib/light/light_color_values.h b/src/esphome/light/light_color_values.h similarity index 93% rename from src/esphomelib/light/light_color_values.h rename to src/esphome/light/light_color_values.h index 37377c13..964191b2 100644 --- a/src/esphomelib/light/light_color_values.h +++ b/src/esphome/light/light_color_values.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_LIGHT_LIGHT_COLOR_VALUES_H -#define ESPHOMELIB_LIGHT_LIGHT_COLOR_VALUES_H +#ifndef ESPHOME_LIGHT_LIGHT_COLOR_VALUES_H +#define ESPHOME_LIGHT_LIGHT_COLOR_VALUES_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT #include #include -#include "esphomelib/light/light_traits.h" +#include "esphome/light/light_traits.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -122,8 +122,8 @@ class LightColorValues { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT -#endif //ESPHOMELIB_LIGHT_LIGHT_COLOR_VALUES_H +#endif //ESPHOME_LIGHT_LIGHT_COLOR_VALUES_H diff --git a/src/esphomelib/light/light_effect.cpp b/src/esphome/light/light_effect.cpp similarity index 94% rename from src/esphomelib/light/light_effect.cpp rename to src/esphome/light/light_effect.cpp index c44a8e87..cab2c9b2 100644 --- a/src/esphomelib/light/light_effect.cpp +++ b/src/esphome/light/light_effect.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/light_effect.h" -#include "esphomelib/helpers.h" -#include "esphomelib/esphal.h" -#include "esphomelib/log.h" +#include "esphome/light/light_effect.h" +#include "esphome/helpers.h" +#include "esphome/esphal.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -127,6 +127,6 @@ FlickerLightEffect::FlickerLightEffect(const std::string &name) : LightEffect(na } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT diff --git a/src/esphomelib/light/light_effect.h b/src/esphome/light/light_effect.h similarity index 88% rename from src/esphomelib/light/light_effect.h rename to src/esphome/light/light_effect.h index 0e9cbe71..ad4ebcab 100644 --- a/src/esphomelib/light/light_effect.h +++ b/src/esphome/light/light_effect.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_LIGHT_LIGHT_EFFECT_H -#define ESPHOMELIB_LIGHT_LIGHT_EFFECT_H +#ifndef ESPHOME_LIGHT_LIGHT_EFFECT_H +#define ESPHOME_LIGHT_LIGHT_EFFECT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT #include -#include "esphomelib/light/light_traits.h" -#include "esphomelib/light/light_state.h" +#include "esphome/light/light_traits.h" +#include "esphome/light/light_state.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -104,8 +104,8 @@ class FlickerLightEffect : public LightEffect { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT -#endif //ESPHOMELIB_LIGHT_LIGHT_EFFECT_H +#endif //ESPHOME_LIGHT_LIGHT_EFFECT_H diff --git a/src/esphomelib/light/light_output_component.cpp b/src/esphome/light/light_output_component.cpp similarity index 94% rename from src/esphomelib/light/light_output_component.cpp rename to src/esphome/light/light_output_component.cpp index 34fe97bb..a9f15a4b 100644 --- a/src/esphomelib/light/light_output_component.cpp +++ b/src/esphome/light/light_output_component.cpp @@ -1,17 +1,17 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/light_output_component.h" +#include "esphome/light/light_output_component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" +#include "esphome/helpers.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { -using esphomelib::output::FloatOutput; +using output::FloatOutput; LightTraits BinaryLightOutput::get_traits() { return {false, false, false, false}; @@ -124,6 +124,6 @@ RGBWWLightOutput::RGBWWLightOutput(float cold_white_mireds, } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT diff --git a/src/esphomelib/light/light_output_component.h b/src/esphome/light/light_output_component.h similarity index 87% rename from src/esphomelib/light/light_output_component.h rename to src/esphome/light/light_output_component.h index f7a9eab5..111365e0 100644 --- a/src/esphomelib/light/light_output_component.h +++ b/src/esphome/light/light_output_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_LIGHT_LIGHT_OUTPUT_COMPONENT_H -#define ESPHOMELIB_LIGHT_LIGHT_OUTPUT_COMPONENT_H +#ifndef ESPHOME_LIGHT_LIGHT_OUTPUT_COMPONENT_H +#define ESPHOME_LIGHT_LIGHT_OUTPUT_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/component.h" -#include "esphomelib/output/float_output.h" -#include "esphomelib/light/light_state.h" +#include "esphome/component.h" +#include "esphome/output/float_output.h" +#include "esphome/light/light_state.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -103,8 +103,8 @@ class RGBWWLightOutput : public LightOutput { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT -#endif //ESPHOMELIB_LIGHT_LIGHT_OUTPUT_COMPONENT_H +#endif //ESPHOME_LIGHT_LIGHT_OUTPUT_COMPONENT_H diff --git a/src/esphomelib/light/light_state.cpp b/src/esphome/light/light_state.cpp similarity index 98% rename from src/esphomelib/light/light_state.cpp rename to src/esphome/light/light_state.cpp index c11c32ab..1e976d71 100644 --- a/src/esphomelib/light/light_state.cpp +++ b/src/esphome/light/light_state.cpp @@ -1,17 +1,17 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/light_state.h" +#include "esphome/light/light_state.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" -#include "esphomelib/esphal.h" -#include "esphomelib/light/light_transformer.h" -#include "esphomelib/light/light_effect.h" -#include "esphomelib/esppreferences.h" +#include "esphome/helpers.h" +#include "esphome/log.h" +#include "esphome/esphal.h" +#include "esphome/light/light_transformer.h" +#include "esphome/light/light_effect.h" +#include "esphome/esppreferences.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -536,6 +536,6 @@ void LightOutput::setup_state(LightState *state) { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT diff --git a/src/esphomelib/light/light_state.h b/src/esphome/light/light_state.h similarity index 95% rename from src/esphomelib/light/light_state.h rename to src/esphome/light/light_state.h index dfeb40b5..861104cf 100644 --- a/src/esphomelib/light/light_state.h +++ b/src/esphome/light/light_state.h @@ -1,21 +1,21 @@ -#ifndef ESPHOMELIB_LIGHT_LIGHT_STATE_H -#define ESPHOMELIB_LIGHT_LIGHT_STATE_H +#ifndef ESPHOME_LIGHT_LIGHT_STATE_H +#define ESPHOME_LIGHT_LIGHT_STATE_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT #include #include -#include "esphomelib/light/light_color_values.h" -#include "esphomelib/light/light_effect.h" -#include "esphomelib/light/light_transformer.h" -#include "esphomelib/component.h" -#include "esphomelib/automation.h" -#include "esphomelib/helpers.h" -#include "esphomelib/esppreferences.h" +#include "esphome/light/light_color_values.h" +#include "esphome/light/light_effect.h" +#include "esphome/light/light_transformer.h" +#include "esphome/component.h" +#include "esphome/automation.h" +#include "esphome/helpers.h" +#include "esphome/esppreferences.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -392,10 +392,10 @@ void TurnOnAction::play(T x) { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/light/mqtt_json_light_component.h" +#include "esphome/light/mqtt_json_light_component.h" #endif //USE_LIGHT -#endif //ESPHOMELIB_LIGHT_LIGHT_STATE_H +#endif //ESPHOME_LIGHT_LIGHT_STATE_H diff --git a/src/esphomelib/light/light_traits.cpp b/src/esphome/light/light_traits.cpp similarity index 89% rename from src/esphomelib/light/light_traits.cpp rename to src/esphome/light/light_traits.cpp index d42990a6..f11c5dff 100644 --- a/src/esphomelib/light/light_traits.cpp +++ b/src/esphome/light/light_traits.cpp @@ -1,10 +1,10 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/light_traits.h" +#include "esphome/light/light_traits.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -44,6 +44,6 @@ void LightTraits::set_max_mireds(float max_mireds) { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT diff --git a/src/esphomelib/light/light_traits.h b/src/esphome/light/light_traits.h similarity index 78% rename from src/esphomelib/light/light_traits.h rename to src/esphome/light/light_traits.h index b1bc1b47..c6268ce8 100644 --- a/src/esphomelib/light/light_traits.h +++ b/src/esphome/light/light_traits.h @@ -1,11 +1,11 @@ -#ifndef ESPHOMELIB_LIGHT_LIGHT_TRAITS_H -#define ESPHOMELIB_LIGHT_LIGHT_TRAITS_H +#ifndef ESPHOME_LIGHT_LIGHT_TRAITS_H +#define ESPHOME_LIGHT_LIGHT_TRAITS_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -36,8 +36,8 @@ class LightTraits { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT -#endif //ESPHOMELIB_LIGHT_LIGHT_TRAITS_H +#endif //ESPHOME_LIGHT_LIGHT_TRAITS_H diff --git a/src/esphomelib/light/light_transformer.cpp b/src/esphome/light/light_transformer.cpp similarity index 91% rename from src/esphomelib/light/light_transformer.cpp rename to src/esphome/light/light_transformer.cpp index a5caab76..75761934 100644 --- a/src/esphomelib/light/light_transformer.cpp +++ b/src/esphome/light/light_transformer.cpp @@ -1,15 +1,15 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/light_transformer.h" +#include "esphome/light/light_transformer.h" -#include "esphomelib/helpers.h" -#include "esphomelib/component.h" -#include "esphomelib/log.h" -#include "esphomelib/esphal.h" +#include "esphome/helpers.h" +#include "esphome/component.h" +#include "esphome/log.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -25,14 +25,7 @@ LightTransformer::LightTransformer(uint32_t start_time, uint32_t length, const LightColorValues &start_values, const LightColorValues &target_values) : start_time_( start_time), length_(length), start_values_(start_values), target_values_(target_values) { - // When turning light on from off state, use colors from new. - if (!this->start_values_.is_on() && this->target_values_.is_on()) { - this->start_values_.set_red(target_values.get_red()); - this->start_values_.set_green(target_values.get_green()); - this->start_values_.set_blue(target_values.get_blue()); - this->start_values_.set_white(target_values.get_white()); - this->start_values_.set_color_temperature(target_values.get_color_temperature()); - } + } bool LightTransformer::is_finished() { @@ -60,7 +53,16 @@ LightTransitionTransformer::LightTransitionTransformer(uint32_t start_time, uint32_t length, const LightColorValues &start_values, const LightColorValues &target_values) : - LightTransformer(start_time, length, start_values, target_values) {} + LightTransformer(start_time, length, start_values, target_values) { + // When turning light on from off state, use colors from new. + if (!this->start_values_.is_on() && this->target_values_.is_on()) { + this->start_values_.set_red(target_values.get_red()); + this->start_values_.set_green(target_values.get_green()); + this->start_values_.set_blue(target_values.get_blue()); + this->start_values_.set_white(target_values.get_white()); + this->start_values_.set_color_temperature(target_values.get_color_temperature()); + } +} bool LightTransitionTransformer::is_continuous() { return true; } @@ -83,6 +85,6 @@ bool LightFlashTransformer::is_continuous() { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT diff --git a/src/esphomelib/light/light_transformer.h b/src/esphome/light/light_transformer.h similarity index 87% rename from src/esphomelib/light/light_transformer.h rename to src/esphome/light/light_transformer.h index 4904b710..1b45105a 100644 --- a/src/esphomelib/light/light_transformer.h +++ b/src/esphome/light/light_transformer.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_LIGHT_LIGHT_TRANSFORMER_H -#define ESPHOMELIB_LIGHT_LIGHT_TRANSFORMER_H +#ifndef ESPHOME_LIGHT_LIGHT_TRANSFORMER_H +#define ESPHOME_LIGHT_LIGHT_TRANSFORMER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LIGHT -#include "esphomelib/light/light_color_values.h" +#include "esphome/light/light_color_values.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -74,8 +74,8 @@ class LightFlashTransformer : public LightTransformer { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LIGHT -#endif //ESPHOMELIB_LIGHT_LIGHT_TRANSFORMER_H +#endif //ESPHOME_LIGHT_LIGHT_TRANSFORMER_H diff --git a/src/esphomelib/light/mqtt_json_light_component.cpp b/src/esphome/light/mqtt_json_light_component.cpp similarity index 92% rename from src/esphomelib/light/mqtt_json_light_component.cpp rename to src/esphome/light/mqtt_json_light_component.cpp index 418f2d7d..5ddfd78a 100644 --- a/src/esphomelib/light/mqtt_json_light_component.cpp +++ b/src/esphome/light/mqtt_json_light_component.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_LIGHT -#include "esphomelib/light/mqtt_json_light_component.h" +#include "esphome/light/mqtt_json_light_component.h" -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -74,6 +74,6 @@ void MQTTJSONLightComponent::dump_config() { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_LIGHT diff --git a/src/esphomelib/light/mqtt_json_light_component.h b/src/esphome/light/mqtt_json_light_component.h similarity index 65% rename from src/esphomelib/light/mqtt_json_light_component.h rename to src/esphome/light/mqtt_json_light_component.h index bd9cfaf3..cfcf1e0f 100644 --- a/src/esphomelib/light/mqtt_json_light_component.h +++ b/src/esphome/light/mqtt_json_light_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_LIGHT_MQTT_JSON_LIGHT_COMPONENT -#define ESPHOMELIB_LIGHT_MQTT_JSON_LIGHT_COMPONENT +#ifndef ESPHOME_LIGHT_MQTT_JSON_LIGHT_COMPONENT +#define ESPHOME_LIGHT_MQTT_JSON_LIGHT_COMPONENT -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_LIGHT -#include "esphomelib/mqtt/mqtt_component.h" -#include "esphomelib/light/light_state.h" +#include "esphome/mqtt/mqtt_component.h" +#include "esphome/light/light_state.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -39,8 +39,8 @@ class MQTTJSONLightComponent : public mqtt::MQTTComponent { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_LIGHT -#endif //ESPHOMELIB_LIGHT_MQTT_JSON_LIGHT_COMPONENT +#endif //ESPHOME_LIGHT_MQTT_JSON_LIGHT_COMPONENT diff --git a/src/esphomelib/light/neo_pixel_bus_light_output.h b/src/esphome/light/neo_pixel_bus_light_output.h similarity index 85% rename from src/esphomelib/light/neo_pixel_bus_light_output.h rename to src/esphome/light/neo_pixel_bus_light_output.h index ae7380fd..7cb26e82 100644 --- a/src/esphomelib/light/neo_pixel_bus_light_output.h +++ b/src/esphome/light/neo_pixel_bus_light_output.h @@ -1,17 +1,17 @@ -#ifndef ESPHOMELIB_LIGHT_NEO_PIXEL_BUS_LIGHT_OUTPUT_H -#define ESPHOMELIB_LIGHT_NEO_PIXEL_BUS_LIGHT_OUTPUT_H +#ifndef ESPHOME_LIGHT_NEO_PIXEL_BUS_LIGHT_OUTPUT_H +#define ESPHOME_LIGHT_NEO_PIXEL_BUS_LIGHT_OUTPUT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_NEO_PIXEL_BUS_LIGHT -#include "esphomelib/helpers.h" -#include "esphomelib/light/light_state.h" -#include "esphomelib/light/addressable_light.h" -#include "esphomelib/power_supply_component.h" +#include "esphome/helpers.h" +#include "esphome/light/light_state.h" +#include "esphome/light/addressable_light.h" +#include "esphome/power_supply_component.h" #include "NeoPixelBus.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace light { @@ -46,7 +46,7 @@ enum class ESPNeoPixelOrder { * * To do this, it uses the NeoPixelBus library. The API for setting up the different * types of lights NeoPixelBus supports is intentionally kept as close to NeoPixelBus defaults - * as possible. To use NeoPixelBus lights with esphomelib, first set up the component using + * as possible. To use NeoPixelBus lights with ESPHome, first set up the component using * the helper in Application, then add the LEDs using the `add_leds` helper functions. * * These add_leds helpers can, however, only be called once on a NeoPixelBusLightOutputComponent. @@ -121,10 +121,10 @@ class NeoPixelRGBWLightOutput : public NeoPixelBusLightOutputBase::get_traits() { } // namespace light -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_NEO_PIXEL_BUS_LIGHT diff --git a/src/esphomelib/log.cpp b/src/esphome/log.cpp similarity index 83% rename from src/esphomelib/log.cpp rename to src/esphome/log.cpp index c54feed0..e1e9a252 100644 --- a/src/esphomelib/log.cpp +++ b/src/esphome/log.cpp @@ -1,6 +1,6 @@ -#include "esphomelib/log.h" +#include "esphome/log.h" -#include "esphomelib/log_component.h" +#include "esphome/log_component.h" int HOT esp_log_printf_(int level, const char *tag, const char *format, ...) { va_list arg; @@ -20,7 +20,7 @@ int HOT esp_log_printf_(int level, const char *tag, const __FlashStringHelper *f #endif int HOT esp_log_vprintf_(int level, const char *tag, const char *format, va_list args) { - auto *log = esphomelib::global_log_component; + auto *log = esphome::global_log_component; if (log == nullptr) return 0; @@ -29,7 +29,7 @@ int HOT esp_log_vprintf_(int level, const char *tag, const char *format, va_list #ifdef USE_STORE_LOG_STR_IN_FLASH int HOT esp_log_vprintf_(int level, const char *tag, const __FlashStringHelper *format, va_list args) { - auto *log = esphomelib::global_log_component; + auto *log = esphome::global_log_component; if (log == nullptr) return 0; @@ -38,7 +38,7 @@ int HOT esp_log_vprintf_(int level, const char *tag, const __FlashStringHelper * #endif int HOT esp_idf_log_vprintf_(const char *format, va_list args) { - auto *log = esphomelib::global_log_component; + auto *log = esphome::global_log_component; if (log == nullptr) return 0; diff --git a/src/esphome/log.h b/src/esphome/log.h new file mode 100644 index 00000000..6cf6dc57 --- /dev/null +++ b/src/esphome/log.h @@ -0,0 +1,180 @@ +#ifndef ESPHOME_LOG_H +#define ESPHOME_LOG_H + +#include +#include +#include +#include "esphome/defines.h" +#ifdef USE_STORE_LOG_STR_IN_FLASH + #include "WString.h" +#endif + +// avoid esp-idf redefining our macros +#include "esphome/esphal.h" + +#ifdef ARDUINO_ARCH_ESP32 + #include "esp_err.h" +#endif + +#define ESPHOME_LOG_LEVEL_NONE 0 +#define ESPHOME_LOG_LEVEL_ERROR 1 +#define ESPHOME_LOG_LEVEL_WARN 2 +#define ESPHOME_LOG_LEVEL_INFO 3 +#define ESPHOME_LOG_LEVEL_DEBUG 4 +#define ESPHOME_LOG_LEVEL_VERBOSE 5 +#define ESPHOME_LOG_LEVEL_VERY_VERBOSE 6 + +#ifndef ESPHOME_LOG_LEVEL + #define ESPHOME_LOG_LEVEL ESPHOME_LOG_LEVEL_DEBUG +#endif + +#define ESPHOME_LOG_COLOR_BLACK "30" +#define ESPHOME_LOG_COLOR_RED "31" //ERROR +#define ESPHOME_LOG_COLOR_GREEN "32" //INFO +#define ESPHOME_LOG_COLOR_YELLOW "33" //WARNING +#define ESPHOME_LOG_COLOR_BLUE "34" +#define ESPHOME_LOG_COLOR_MAGENTA "35" //CONFIG +#define ESPHOME_LOG_COLOR_CYAN "36" //DEBUG +#define ESPHOME_LOG_COLOR_GRAY "37" //VERBOSE +#define ESPHOME_LOG_COLOR_WHITE "38" +#define ESPHOME_LOG_SECRET_BEGIN "\033[5m" +#define ESPHOME_LOG_SECRET_END "\033[6m" +#define LOG_SECRET(x) ESPHOME_LOG_SECRET_BEGIN x ESPHOME_LOG_SECRET_END + +#define ESPHOME_LOG_COLOR(COLOR) "\033[0;" COLOR "m" +#define ESPHOME_LOG_BOLD(COLOR) "\033[1;" COLOR "m" + +#ifndef ESPHOME_LOG_NO_COLORS + #define ESPHOME_LOG_COLOR_E ESPHOME_LOG_BOLD(ESPHOME_LOG_COLOR_RED) + #define ESPHOME_LOG_COLOR_W ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_YELLOW) + #define ESPHOME_LOG_COLOR_I ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_GREEN) + #define ESPHOME_LOG_COLOR_C ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_MAGENTA) + #define ESPHOME_LOG_COLOR_D ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_CYAN) + #define ESPHOME_LOG_COLOR_V ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_GRAY) + #define ESPHOME_LOG_COLOR_VV ESPHOME_LOG_COLOR(ESPHOME_LOG_COLOR_WHITE) + #define ESPHOME_LOG_RESET_COLOR "\033[0m" +#else + #define ESPHOME_LOG_COLOR_E + #define ESPHOME_LOG_COLOR_W + #define ESPHOME_LOG_COLOR_I + #define ESPHOME_LOG_COLOR_C + #define ESPHOME_LOG_COLOR_D + #define ESPHOME_LOG_COLOR_V + #define ESPHOME_LOG_COLOR_VV + #define ESPHOME_LOG_RESET_COLOR +#endif + +int esp_log_printf_(int level, const char *tag, const char *format, ...) __attribute__ ((format (printf, 3, 4))); +#ifdef USE_STORE_LOG_STR_IN_FLASH + int esp_log_printf_(int level, const char *tag, const __FlashStringHelper *format, ...); +#endif +int esp_log_vprintf_(int level, const char *tag, const char *format, va_list args); +#ifdef USE_STORE_LOG_STR_IN_FLASH + int esp_log_vprintf_(int level, const char *tag, const __FlashStringHelper *format, va_list args); +#endif +int esp_idf_log_vprintf_(const char *format, va_list args); + +#ifdef USE_STORE_LOG_STR_IN_FLASH + #define ESPHOME_LOG_FORMAT(tag, letter, format) F(ESPHOME_LOG_COLOR_ ## letter "[" #letter "][%s:%03u]: " format ESPHOME_LOG_RESET_COLOR), tag, __LINE__ +#else + #define ESPHOME_LOG_FORMAT(tag, letter, format) ESPHOME_LOG_COLOR_ ## letter "[" #letter "][%s:%03u]: " format ESPHOME_LOG_RESET_COLOR, tag, __LINE__ +#endif + +#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE + #define esph_log_vv(tag, format, ...) esp_log_printf_(ESPHOME_LOG_LEVEL_VERY_VERBOSE, tag, ESPHOME_LOG_FORMAT(tag, VV, format), ##__VA_ARGS__) + + #define ESPHOME_LOG_HAS_VERY_VERBOSE +#else + #define esph_log_vv(tag, format, ...) +#endif + +#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE + #define esph_log_v(tag, format, ...) esp_log_printf_(ESPHOME_LOG_LEVEL_VERBOSE, tag, ESPHOME_LOG_FORMAT(tag, V, format), ##__VA_ARGS__) + + #define ESPHOME_LOG_HAS_VERBOSE +#else + #define esph_log_v(tag, format, ...) +#endif + +#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG + #define esph_log_d(tag, format, ...) esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, ESPHOME_LOG_FORMAT(tag, D, format), ##__VA_ARGS__) + + #define esph_log_config(tag, format, ...) esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, ESPHOME_LOG_FORMAT(tag, C, format), ##__VA_ARGS__) + + #define ESPHOME_LOG_HAS_DEBUG + #define ESPHOME_LOG_HAS_CONFIG +#else + #define esph_log_d(tag, format, ...) + + #define esph_log_config(tag, format, ...) +#endif + +#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_INFO + #define esph_log_i(tag, format, ...) esp_log_printf_(ESPHOME_LOG_LEVEL_INFO, tag, ESPHOME_LOG_FORMAT(tag, I, format), ##__VA_ARGS__) + + #define ESPHOME_LOG_HAS_INFO +#else + #define esph_log_i(tag, format, ...) +#endif + +#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_WARN + #define esph_log_w(tag, format, ...) esp_log_printf_(ESPHOME_LOG_LEVEL_WARN, tag, ESPHOME_LOG_FORMAT(tag, W, format), ##__VA_ARGS__) + + #define ESPHOME_LOG_HAS_WARN +#else + #define esph_log_w(tag, format, ...) +#endif + +#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_ERROR + #define esph_log_e(tag, format, ...) esp_log_printf_(ESPHOME_LOG_LEVEL_ERROR, tag, ESPHOME_LOG_FORMAT(tag, E, format), ##__VA_ARGS__) + + #define ESPHOME_LOG_HAS_ERROR +#else + #define esph_log_e(tag, format, ...) +#endif + +#ifdef ESP_LOGE + #undef ESP_LOGE +#endif +#ifdef ESP_LOGW + #undef ESP_LOGW +#endif +#ifdef ESP_LOGI + #undef ESP_LOGI +#endif +#ifdef ESP_LOGD + #undef ESP_LOGD +#endif +#ifdef ESP_LOGV + #undef ESP_LOGV +#endif + +#define ESP_LOGE(tag, ...) esph_log_e(tag, __VA_ARGS__) +#define LOG_E(tag, ...) ESP_LOGE(tag, __VA__ARGS__) +#define ESP_LOGW(tag, ...) esph_log_w(tag, __VA_ARGS__) +#define LOG_W(tag, ...) ESP_LOGW(tag, __VA__ARGS__) +#define ESP_LOGI(tag, ...) esph_log_i(tag, __VA_ARGS__) +#define LOG_I(tag, ...) ESP_LOGI(tag, __VA__ARGS__) +#define ESP_LOGD(tag, ...) esph_log_d(tag, __VA_ARGS__) +#define LOG_D(tag, ...) ESP_LOGD(tag, __VA__ARGS__) +#define ESP_LOGCONFIG(tag, ...) esph_log_config(tag, __VA_ARGS__) +#define LOG_CONFIG(tag, ...) ESP_LOGCONFIG(tag, __VA__ARGS__) +#define ESP_LOGV(tag, ...) esph_log_v(tag, __VA_ARGS__) +#define LOG_V(tag, ...) ESP_LOGV(tag, __VA__ARGS__) +#define ESP_LOGVV(tag, ...) esph_log_vv(tag, __VA_ARGS__) +#define LOG_VV(tag, ...) ESP_LOGVV(tag, __VA__ARGS__) + +#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" +#define BYTE_TO_BINARY(byte) \ + ((byte) & 0x80 ? '1' : '0'), \ + ((byte) & 0x40 ? '1' : '0'), \ + ((byte) & 0x20 ? '1' : '0'), \ + ((byte) & 0x10 ? '1' : '0'), \ + ((byte) & 0x08 ? '1' : '0'), \ + ((byte) & 0x04 ? '1' : '0'), \ + ((byte) & 0x02 ? '1' : '0'), \ + ((byte) & 0x01 ? '1' : '0') +#define YESNO(b) ((b) ? "YES" : "NO") +#define ONOFF(b) ((b) ? "ON" : "OFF") + +#endif //ESPHOME_LOG_H diff --git a/src/esphomelib/log_component.cpp b/src/esphome/log_component.cpp similarity index 94% rename from src/esphomelib/log_component.cpp rename to src/esphome/log_component.cpp index 1702439d..8f7cd77c 100644 --- a/src/esphomelib/log_component.cpp +++ b/src/esphome/log_component.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/log_component.h" +#include "esphome/log_component.h" #ifdef ARDUINO_ARCH_ESP32 #include #endif #include -#include "esphomelib/mqtt/mqtt_client_component.h" -#include "esphomelib/log.h" +#include "esphome/mqtt/mqtt_client_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "logger"; @@ -105,12 +105,12 @@ void LogComponent::pre_setup() { global_log_component = this; #ifdef ARDUINO_ARCH_ESP32 esp_log_set_vprintf(esp_idf_log_vprintf_); - if (this->global_log_level_ >= ESPHOMELIB_LOG_LEVEL_VERBOSE) { + if (this->global_log_level_ >= ESPHOME_LOG_LEVEL_VERBOSE) { esp_log_level_set("*", ESP_LOG_VERBOSE); } #endif #ifdef ARDUINO_ARCH_ESP8266 - if (this->global_log_level_ >= ESPHOMELIB_LOG_LEVEL_VERBOSE) { + if (this->global_log_level_ >= ESPHOME_LOG_LEVEL_VERBOSE) { if (this->baud_rate_ > 0) this->hw_serial_->setDebugOutput(true); } @@ -167,4 +167,4 @@ int LogComponent::get_global_log_level() const { LogComponent *global_log_component = nullptr; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/log_component.h b/src/esphome/log_component.h similarity index 85% rename from src/esphomelib/log_component.h rename to src/esphome/log_component.h index cddce6a2..3f3975df 100644 --- a/src/esphomelib/log_component.h +++ b/src/esphome/log_component.h @@ -1,5 +1,5 @@ -#ifndef ESPHOMELIB_LOG_COMPONENT_H -#define ESPHOMELIB_LOG_COMPONENT_H +#ifndef ESPHOME_LOG_COMPONENT_H +#define ESPHOME_LOG_COMPONENT_H #include #include @@ -9,13 +9,13 @@ #include #include -#include "esphomelib/component.h" -#include "esphomelib/mqtt/mqtt_component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" -#include "esphomelib/defines.h" +#include "esphome/component.h" +#include "esphome/mqtt/mqtt_component.h" +#include "esphome/helpers.h" +#include "esphome/log.h" +#include "esphome/defines.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN /** Enum for logging UART selection * @@ -56,7 +56,7 @@ class LogComponent : public Component { /// Get the UART used by the logger. UARTSelection get_uart() const; - /// Set the global log level. Note: Use the ESPHOMELIB_LOG_LEVEL define to also remove the logs from the build. + /// Set the global log level. Note: Use the ESPHOME_LOG_LEVEL define to also remove the logs from the build. void set_global_log_level(int log_level); int get_global_log_level() const; @@ -87,9 +87,9 @@ class LogComponent : public Component { protected: uint32_t baud_rate_; std::vector tx_buffer_; + int global_log_level_{ESPHOME_LOG_LEVEL}; UARTSelection uart_{UART_SELECTION_UART0}; HardwareSerial *hw_serial_{nullptr}; - int global_log_level_{ESPHOMELIB_LOG_LEVEL}; struct LogLevelOverride { std::string tag; int level; @@ -100,6 +100,6 @@ class LogComponent : public Component { extern LogComponent *global_log_component; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_LOG_COMPONENT_H +#endif //ESPHOME_LOG_COMPONENT_H diff --git a/src/esphomelib/mqtt/custom_mqtt_device.cpp b/src/esphome/mqtt/custom_mqtt_device.cpp similarity index 89% rename from src/esphomelib/mqtt/custom_mqtt_device.cpp rename to src/esphome/mqtt/custom_mqtt_device.cpp index 50259598..3166124b 100644 --- a/src/esphomelib/mqtt/custom_mqtt_device.cpp +++ b/src/esphome/mqtt/custom_mqtt_device.cpp @@ -1,10 +1,10 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_CUSTOM_COMPONENT -#include "esphomelib/mqtt/custom_mqtt_device.h" +#include "esphome/mqtt/custom_mqtt_device.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace mqtt { @@ -32,6 +32,6 @@ bool CustomMQTTDevice::is_connected() { } // namespace mqtt -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_CUSTOM_COMPONENT diff --git a/src/esphomelib/mqtt/custom_mqtt_device.h b/src/esphome/mqtt/custom_mqtt_device.h similarity index 96% rename from src/esphomelib/mqtt/custom_mqtt_device.h rename to src/esphome/mqtt/custom_mqtt_device.h index 7120cc96..b78e4504 100644 --- a/src/esphomelib/mqtt/custom_mqtt_device.h +++ b/src/esphome/mqtt/custom_mqtt_device.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_MQTT_CUSTOM_MQTT_DEVICE_H -#define ESPHOMELIB_MQTT_CUSTOM_MQTT_DEVICE_H +#ifndef ESPHOME_MQTT_CUSTOM_MQTT_DEVICE_H +#define ESPHOME_MQTT_CUSTOM_MQTT_DEVICE_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_CUSTOM_COMPONENT -#include "esphomelib/component.h" -#include "esphomelib/mqtt/mqtt_client_component.h" +#include "esphome/component.h" +#include "esphome/mqtt/mqtt_client_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace mqtt { @@ -220,8 +220,8 @@ void CustomMQTTDevice::subscribe_json(const std::string &topic, void(T::*callbac } // namespace mqtt -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_CUSTOM_COMPONENT -#endif //ESPHOMELIB_MQTT_CUSTOM_MQTT_DEVICE_H +#endif //ESPHOME_MQTT_CUSTOM_MQTT_DEVICE_H diff --git a/src/esphomelib/mqtt/mqtt_client_component.cpp b/src/esphome/mqtt/mqtt_client_component.cpp similarity index 98% rename from src/esphomelib/mqtt/mqtt_client_component.cpp rename to src/esphome/mqtt/mqtt_client_component.cpp index b02dea20..3e94d415 100644 --- a/src/esphomelib/mqtt/mqtt_client_component.cpp +++ b/src/esphome/mqtt/mqtt_client_component.cpp @@ -1,18 +1,18 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT -#include "esphomelib/mqtt/mqtt_client_component.h" +#include "esphome/mqtt/mqtt_client_component.h" -#include "esphomelib/log.h" -#include "esphomelib/util.h" -#include "esphomelib/log_component.h" +#include "esphome/log.h" +#include "esphome/util.h" +#include "esphome/log_component.h" #include "lwip/err.h" #include "lwip/dns.h" static const char *TAG = "mqtt.client"; -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace mqtt { @@ -633,6 +633,6 @@ float MQTTMessageTrigger::get_setup_priority() const { } // namespace mqtt -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT diff --git a/src/esphomelib/mqtt/mqtt_client_component.h b/src/esphome/mqtt/mqtt_client_component.h similarity index 96% rename from src/esphomelib/mqtt/mqtt_client_component.h rename to src/esphome/mqtt/mqtt_client_component.h index 7b301564..453fc985 100644 --- a/src/esphomelib/mqtt/mqtt_client_component.h +++ b/src/esphome/mqtt/mqtt_client_component.h @@ -1,7 +1,7 @@ -#ifndef ESPHOMELIB_MQTT_MQTT_CLIENT_COMPONENT_H -#define ESPHOMELIB_MQTT_MQTT_CLIENT_COMPONENT_H +#ifndef ESPHOME_MQTT_MQTT_CLIENT_COMPONENT_H +#define ESPHOME_MQTT_MQTT_CLIENT_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT @@ -11,13 +11,13 @@ #include #include -#include "esphomelib/component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/automation.h" -#include "esphomelib/log.h" +#include "esphome/component.h" +#include "esphome/helpers.h" +#include "esphome/automation.h" +#include "esphome/log.h" #include "lwip/ip_addr.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace mqtt { @@ -273,7 +273,7 @@ class MQTTClientComponent : public Component { }; std::string topic_prefix_{}; MQTTMessage log_message_; - int log_level_{ESPHOMELIB_LOG_LEVEL}; + int log_level_{ESPHOME_LOG_LEVEL}; std::vector subscriptions_; AsyncMqttClient mqtt_client_; @@ -399,8 +399,8 @@ MQTTPublishAction *MQTTClientComponent::make_publish_action() { } // namespace mqtt -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT -#endif //ESPHOMELIB_MQTT_MQTT_CLIENT_COMPONENT_H +#endif //ESPHOME_MQTT_MQTT_CLIENT_COMPONENT_H diff --git a/src/esphomelib/mqtt/mqtt_component.cpp b/src/esphome/mqtt/mqtt_component.cpp similarity index 93% rename from src/esphomelib/mqtt/mqtt_component.cpp rename to src/esphome/mqtt/mqtt_component.cpp index af40903e..7d0ad9d9 100644 --- a/src/esphomelib/mqtt/mqtt_component.cpp +++ b/src/esphome/mqtt/mqtt_component.cpp @@ -1,22 +1,22 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT -#include "esphomelib/mqtt/mqtt_component.h" +#include "esphome/mqtt/mqtt_component.h" #include #include -#include "esphomelib/mqtt/mqtt_client_component.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" -#include "esphomelib/util.h" +#include "esphome/mqtt/mqtt_client_component.h" +#include "esphome/log.h" +#include "esphome/helpers.h" +#include "esphome/util.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace mqtt { -#ifdef ESPHOMELIB_LOG_HAS_VERBOSE +#ifdef ESPHOME_LOG_HAS_VERBOSE static const char *TAG = "mqtt.component"; #endif @@ -114,9 +114,9 @@ bool MQTTComponent::send_discovery_() { device_info["identifiers"] = get_mac_address(); device_info["name"] = node_name; if (get_app_compilation_time().empty()) { - device_info["sw_version"] = "esphomelib v" ESPHOMELIB_VERSION; + device_info["sw_version"] = "esphome v" ESPHOME_VERSION; } else { - device_info["sw_version"] = "esphomelib v" ESPHOMELIB_VERSION " " + get_app_compilation_time(); + device_info["sw_version"] = "esphome v" ESPHOME_VERSION " " + get_app_compilation_time(); } #ifdef ARDUINO_BOARD device_info["model"] = ARDUINO_BOARD; @@ -230,6 +230,6 @@ bool MQTTComponent::is_connected() const { } // namespace mqtt -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT diff --git a/src/esphomelib/mqtt/mqtt_component.h b/src/esphome/mqtt/mqtt_component.h similarity index 94% rename from src/esphomelib/mqtt/mqtt_component.h rename to src/esphome/mqtt/mqtt_component.h index fe5370b0..5cb5e27c 100644 --- a/src/esphomelib/mqtt/mqtt_component.h +++ b/src/esphome/mqtt/mqtt_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_MQTT_MQTT_COMPONENT_H -#define ESPHOMELIB_MQTT_MQTT_COMPONENT_H +#ifndef ESPHOME_MQTT_MQTT_COMPONENT_H +#define ESPHOME_MQTT_MQTT_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT -#include "esphomelib/component.h" -#include "esphomelib/mqtt/mqtt_client_component.h" +#include "esphome/component.h" +#include "esphome/mqtt/mqtt_client_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace mqtt { @@ -36,7 +36,7 @@ struct SendDiscoveryConfig { * 2. Override component_type() to return the appropriate component type such as "light" or "sensor". * 3. Subscribe to command topics using subscribe() or subscribe_json() during setup(). * - * In order to best separate the front- and back-end of esphomelib, all sub-classes should + * In order to best separate the front- and back-end of ESPHome, all sub-classes should * only parse/send MQTT messages and interact with back-end components via callbacks to ensure * a clean separation. */ @@ -166,8 +166,8 @@ class MQTTComponent : public Component { } // namespace mqtt -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT -#endif //ESPHOMELIB_MQTT_MQTT_COMPONENT_H +#endif //ESPHOME_MQTT_MQTT_COMPONENT_H diff --git a/src/esphomelib/optional.h b/src/esphome/optional.h similarity index 97% rename from src/esphomelib/optional.h rename to src/esphome/optional.h index 72e4833c..e498d29f 100644 --- a/src/esphomelib/optional.h +++ b/src/esphome/optional.h @@ -15,12 +15,12 @@ // // Modified by Otto Winter on 18.05.18 -#ifndef ESPHOMELIB_OPTIONAL_H -#define ESPHOMELIB_OPTIONAL_H +#ifndef ESPHOME_OPTIONAL_H +#define ESPHOME_OPTIONAL_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN // type for nullopt @@ -311,6 +311,6 @@ inline optional make_optional(T const &v) { return optional(v); } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_OPTIONAL_H +#endif //ESPHOME_OPTIONAL_H diff --git a/src/esphomelib/ota_component.cpp b/src/esphome/ota_component.cpp similarity index 97% rename from src/esphomelib/ota_component.cpp rename to src/esphome/ota_component.cpp index b0d38296..99b3eeb9 100644 --- a/src/esphomelib/ota_component.cpp +++ b/src/esphome/ota_component.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OTA -#include "esphomelib/ota_component.h" -#include "esphomelib/log.h" -#include "esphomelib/esppreferences.h" -#include "esphomelib/helpers.h" -#include "esphomelib/status_led.h" -#include "esphomelib/util.h" +#include "esphome/ota_component.h" +#include "esphome/log.h" +#include "esphome/esppreferences.h" +#include "esphome/helpers.h" +#include "esphome/status_led.h" +#include "esphome/util.h" #include #ifndef USE_NEW_OTA @@ -20,7 +20,7 @@ #endif #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "ota"; @@ -521,6 +521,6 @@ void OTAComponent::clean_rtc() { this->write_rtc_(0); } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OTA diff --git a/src/esphomelib/ota_component.h b/src/esphome/ota_component.h similarity index 93% rename from src/esphomelib/ota_component.h rename to src/esphome/ota_component.h index 59e8a43e..4be79200 100644 --- a/src/esphomelib/ota_component.h +++ b/src/esphome/ota_component.h @@ -1,12 +1,12 @@ -#ifndef ESPHOMELIB_OTA_COMPONENT_H -#define ESPHOMELIB_OTA_COMPONENT_H +#ifndef ESPHOME_OTA_COMPONENT_H +#define ESPHOME_OTA_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OTA -#include "esphomelib/component.h" -#include "esphomelib/esppreferences.h" +#include "esphome/component.h" +#include "esphome/esppreferences.h" #include #include @@ -17,7 +17,7 @@ #define OTA_DEFAULT_PORT 8266 #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN #ifdef USE_NEW_OTA enum OTAResponseTypes { @@ -138,8 +138,8 @@ class OTAComponent : public Component { ESPPreferenceObject rtc_; }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OTA -#endif //ESPHOMELIB_OTA_COMPONENT_H +#endif //ESPHOME_OTA_COMPONENT_H diff --git a/src/esphomelib/output/binary_output.cpp b/src/esphome/output/binary_output.cpp similarity index 87% rename from src/esphomelib/output/binary_output.cpp rename to src/esphome/output/binary_output.cpp index 9355c749..793bc3aa 100644 --- a/src/esphomelib/output/binary_output.cpp +++ b/src/esphome/output/binary_output.cpp @@ -1,10 +1,10 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OUTPUT -#include "esphomelib/output/binary_output.h" +#include "esphome/output/binary_output.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -37,6 +37,6 @@ void BinaryOutput::turn_off() { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OUTPUT diff --git a/src/esphomelib/output/binary_output.h b/src/esphome/output/binary_output.h similarity index 91% rename from src/esphomelib/output/binary_output.h rename to src/esphome/output/binary_output.h index 6fb511c5..ad7c5006 100644 --- a/src/esphomelib/output/binary_output.h +++ b/src/esphome/output/binary_output.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_OUTPUT_BINARY_OUTPUT_H -#define ESPHOMELIB_OUTPUT_BINARY_OUTPUT_H +#ifndef ESPHOME_OUTPUT_BINARY_OUTPUT_H +#define ESPHOME_OUTPUT_BINARY_OUTPUT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OUTPUT -#include "esphomelib/automation.h" -#include "esphomelib/power_supply_component.h" +#include "esphome/automation.h" +#include "esphome/power_supply_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -118,8 +118,8 @@ TurnOnAction *BinaryOutput::make_turn_on_action() { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OUTPUT -#endif //ESPHOMELIB_OUTPUT_BINARY_OUTPUT_H +#endif //ESPHOME_OUTPUT_BINARY_OUTPUT_H diff --git a/src/esphomelib/output/custom_output.cpp b/src/esphome/output/custom_output.cpp similarity index 78% rename from src/esphomelib/output/custom_output.cpp rename to src/esphome/output/custom_output.cpp index 7b66e8ef..e80fb6a4 100644 --- a/src/esphomelib/output/custom_output.cpp +++ b/src/esphome/output/custom_output.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_OUTPUT -#include "esphomelib/output/custom_output.h" -#include "esphomelib/log.h" +#include "esphome/output/custom_output.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -23,6 +23,6 @@ FloatOutput *CustomFloatOutputConstructor::get_output(int i) { } } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_OUTPUT diff --git a/src/esphomelib/output/custom_output.h b/src/esphome/output/custom_output.h similarity index 64% rename from src/esphomelib/output/custom_output.h rename to src/esphome/output/custom_output.h index a64cc1da..cd88e631 100644 --- a/src/esphomelib/output/custom_output.h +++ b/src/esphome/output/custom_output.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_OUTPUT_CUSTOM_OUTPUT_H -#define ESPHOMELIB_OUTPUT_CUSTOM_OUTPUT_H +#ifndef ESPHOME_OUTPUT_CUSTOM_OUTPUT_H +#define ESPHOME_OUTPUT_CUSTOM_OUTPUT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_OUTPUT -#include "esphomelib/output/binary_output.h" -#include "esphomelib/output/float_output.h" +#include "esphome/output/binary_output.h" +#include "esphome/output/float_output.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -34,8 +34,8 @@ class CustomFloatOutputConstructor { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_OUTPUT -#endif //ESPHOMELIB_OUTPUT_CUSTOM_OUTPUT_H +#endif //ESPHOME_OUTPUT_CUSTOM_OUTPUT_H diff --git a/src/esphomelib/output/esp8266_pwm_output.cpp b/src/esphome/output/esp8266_pwm_output.cpp similarity index 88% rename from src/esphomelib/output/esp8266_pwm_output.cpp rename to src/esphome/output/esp8266_pwm_output.cpp index f5ee1d53..c17da7e6 100644 --- a/src/esphomelib/output/esp8266_pwm_output.cpp +++ b/src/esphome/output/esp8266_pwm_output.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP8266_PWM_OUTPUT -#include "esphomelib/output/esp8266_pwm_output.h" -#include "esphomelib/espmath.h" -#include "esphomelib/log.h" +#include "esphome/output/esp8266_pwm_output.h" +#include "esphome/espmath.h" +#include "esphome/log.h" #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -59,6 +59,6 @@ void ESP8266PWMOutput::set_frequency(float frequency) { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP8266_PWM_OUTPUT diff --git a/src/esphomelib/output/esp8266_pwm_output.h b/src/esphome/output/esp8266_pwm_output.h similarity index 84% rename from src/esphomelib/output/esp8266_pwm_output.h rename to src/esphome/output/esp8266_pwm_output.h index 96178fb2..f748b3b4 100644 --- a/src/esphomelib/output/esp8266_pwm_output.h +++ b/src/esphome/output/esp8266_pwm_output.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_ESP_8266_PWM_OUTPUT_H -#define ESPHOMELIB_ESP_8266_PWM_OUTPUT_H +#ifndef ESPHOME_ESP_8266_PWM_OUTPUT_H +#define ESPHOME_ESP_8266_PWM_OUTPUT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP8266_PWM_OUTPUT -#include "esphomelib/output/float_output.h" +#include "esphome/output/float_output.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -50,8 +50,8 @@ class ESP8266PWMOutput : public FloatOutput, public Component { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP8266_PWM_OUTPUT -#endif //ESPHOMELIB_ESP_8266_PWM_OUTPUT_H +#endif //ESPHOME_ESP_8266_PWM_OUTPUT_H diff --git a/src/esphomelib/output/float_output.cpp b/src/esphome/output/float_output.cpp similarity index 84% rename from src/esphomelib/output/float_output.cpp rename to src/esphome/output/float_output.cpp index 62628210..b9f18f34 100644 --- a/src/esphomelib/output/float_output.cpp +++ b/src/esphome/output/float_output.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OUTPUT -#include "esphomelib/output/float_output.h" +#include "esphome/output/float_output.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" +#include "esphome/helpers.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -47,6 +47,6 @@ void FloatOutput::write_state(bool state) { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OUTPUT diff --git a/src/esphomelib/output/float_output.h b/src/esphome/output/float_output.h similarity index 90% rename from src/esphomelib/output/float_output.h rename to src/esphome/output/float_output.h index 0d00d815..346f3bd8 100644 --- a/src/esphomelib/output/float_output.h +++ b/src/esphome/output/float_output.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_OUTPUT_FLOAT_OUTPUT_H -#define ESPHOMELIB_OUTPUT_FLOAT_OUTPUT_H +#ifndef ESPHOME_OUTPUT_FLOAT_OUTPUT_H +#define ESPHOME_OUTPUT_FLOAT_OUTPUT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OUTPUT -#include "esphomelib/output/binary_output.h" -#include "esphomelib/component.h" +#include "esphome/output/binary_output.h" +#include "esphome/component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -93,8 +93,8 @@ SetLevelAction *FloatOutput::make_set_level_action() { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OUTPUT -#endif //ESPHOMELIB_OUTPUT_FLOAT_OUTPUT_H +#endif //ESPHOME_OUTPUT_FLOAT_OUTPUT_H diff --git a/src/esphomelib/output/gpio_binary_output_component.cpp b/src/esphome/output/gpio_binary_output_component.cpp similarity index 78% rename from src/esphomelib/output/gpio_binary_output_component.cpp rename to src/esphome/output/gpio_binary_output_component.cpp index a1c0a0b8..c485026e 100644 --- a/src/esphomelib/output/gpio_binary_output_component.cpp +++ b/src/esphome/output/gpio_binary_output_component.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_GPIO_OUTPUT -#include "esphomelib/output/gpio_binary_output_component.h" +#include "esphome/output/gpio_binary_output_component.h" -#include "esphomelib/esphal.h" -#include "esphomelib/log.h" +#include "esphome/esphal.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -39,6 +39,6 @@ GPIOBinaryOutputComponent::GPIOBinaryOutputComponent(GPIOPin *pin) } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_GPIO_OUTPUT diff --git a/src/esphomelib/output/gpio_binary_output_component.h b/src/esphome/output/gpio_binary_output_component.h similarity index 78% rename from src/esphomelib/output/gpio_binary_output_component.h rename to src/esphome/output/gpio_binary_output_component.h index 04834fde..07ac1349 100644 --- a/src/esphomelib/output/gpio_binary_output_component.h +++ b/src/esphome/output/gpio_binary_output_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_OUTPUT_GPIO_BINARY_OUTPUT_COMPONENT_H -#define ESPHOMELIB_OUTPUT_GPIO_BINARY_OUTPUT_COMPONENT_H +#ifndef ESPHOME_OUTPUT_GPIO_BINARY_OUTPUT_COMPONENT_H +#define ESPHOME_OUTPUT_GPIO_BINARY_OUTPUT_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_GPIO_OUTPUT -#include "esphomelib/output/binary_output.h" -#include "esphomelib/esphal.h" +#include "esphome/output/binary_output.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -48,8 +48,8 @@ class GPIOBinaryOutputComponent : public BinaryOutput, public Component { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_GPIO_OUTPUT -#endif //ESPHOMELIB_OUTPUT_GPIO_BINARY_OUTPUT_COMPONENT_H +#endif //ESPHOME_OUTPUT_GPIO_BINARY_OUTPUT_COMPONENT_H diff --git a/src/esphomelib/output/ledc_output_component.cpp b/src/esphome/output/ledc_output_component.cpp similarity index 92% rename from src/esphomelib/output/ledc_output_component.cpp rename to src/esphome/output/ledc_output_component.cpp index a4511e94..05889698 100644 --- a/src/esphomelib/output/ledc_output_component.cpp +++ b/src/esphome/output/ledc_output_component.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LEDC_OUTPUT -#include "esphomelib/output/ledc_output_component.h" +#include "esphome/output/ledc_output_component.h" #include -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -79,6 +79,6 @@ uint8_t next_ledc_channel = 0; } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LEDC_OUTPUT diff --git a/src/esphomelib/output/ledc_output_component.h b/src/esphome/output/ledc_output_component.h similarity index 84% rename from src/esphomelib/output/ledc_output_component.h rename to src/esphome/output/ledc_output_component.h index bde96d1e..d3c3ac16 100644 --- a/src/esphomelib/output/ledc_output_component.h +++ b/src/esphome/output/ledc_output_component.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_OUTPUT_LEDC_OUTPUT_COMPONENT_H -#define ESPHOMELIB_OUTPUT_LEDC_OUTPUT_COMPONENT_H +#ifndef ESPHOME_OUTPUT_LEDC_OUTPUT_COMPONENT_H +#define ESPHOME_OUTPUT_LEDC_OUTPUT_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_LEDC_OUTPUT -#include "esphomelib/output/float_output.h" +#include "esphome/output/float_output.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -60,8 +60,8 @@ extern uint8_t next_ledc_channel; } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_LEDC_OUTPUT -#endif //ESPHOMELIB_OUTPUT_LEDC_OUTPUT_COMPONENT_H +#endif //ESPHOME_OUTPUT_LEDC_OUTPUT_COMPONENT_H diff --git a/src/esphomelib/output/my9231_output_component.cpp b/src/esphome/output/my9231_output_component.cpp similarity index 97% rename from src/esphomelib/output/my9231_output_component.cpp rename to src/esphome/output/my9231_output_component.cpp index 1b832c37..3dc201a1 100644 --- a/src/esphomelib/output/my9231_output_component.cpp +++ b/src/esphome/output/my9231_output_component.cpp @@ -1,14 +1,14 @@ // Based on: // - https://github.com/xoseperez/my92xx -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MY9231_OUTPUT -#include "esphomelib/log.h" -#include "esphomelib/output/my9231_output_component.h" +#include "esphome/log.h" +#include "esphome/output/my9231_output_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -187,6 +187,6 @@ void MY9231OutputComponent::Channel::write_state(float state) { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif // USE_MY9231_OUTPUT diff --git a/src/esphomelib/output/my9231_output_component.h b/src/esphome/output/my9231_output_component.h similarity index 90% rename from src/esphomelib/output/my9231_output_component.h rename to src/esphome/output/my9231_output_component.h index 450679c5..65e8d07b 100644 --- a/src/esphomelib/output/my9231_output_component.h +++ b/src/esphome/output/my9231_output_component.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_OUTPUT_MY9231_OUTPUT_COMPONENT_H -#define ESPHOMELIB_OUTPUT_MY9231_OUTPUT_COMPONENT_H +#ifndef ESPHOME_OUTPUT_MY9231_OUTPUT_COMPONENT_H +#define ESPHOME_OUTPUT_MY9231_OUTPUT_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MY9231_OUTPUT -#include "esphomelib/output/float_output.h" +#include "esphome/output/float_output.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -94,8 +94,8 @@ class MY9231OutputComponent : public Component { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif // USE_MY9231_OUTPUT -#endif // ESPHOMELIB_OUTPUT_MY9231_OUTPUT_COMPONENT_H +#endif // ESPHOME_OUTPUT_MY9231_OUTPUT_COMPONENT_H diff --git a/src/esphomelib/output/pca9685_output_component.cpp b/src/esphome/output/pca9685_output_component.cpp similarity index 97% rename from src/esphomelib/output/pca9685_output_component.cpp rename to src/esphome/output/pca9685_output_component.cpp index 319581cb..d74fbf87 100644 --- a/src/esphomelib/output/pca9685_output_component.cpp +++ b/src/esphome/output/pca9685_output_component.cpp @@ -2,15 +2,15 @@ // - https://github.com/NachtRaveVL/PCA9685-Arduino // - https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PCA9685_OUTPUT -#include "esphomelib/output/pca9685_output_component.h" +#include "esphome/output/pca9685_output_component.h" -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -187,6 +187,6 @@ void PCA9685OutputComponent::Channel::write_state(float state) { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PCA9685_OUTPUT diff --git a/src/esphomelib/output/pca9685_output_component.h b/src/esphome/output/pca9685_output_component.h similarity index 89% rename from src/esphomelib/output/pca9685_output_component.h rename to src/esphome/output/pca9685_output_component.h index 50e8dc0e..9e7c697e 100644 --- a/src/esphomelib/output/pca9685_output_component.h +++ b/src/esphome/output/pca9685_output_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_OUTPUT_PCA9685_OUTPUT_COMPONENT_H -#define ESPHOMELIB_OUTPUT_PCA9685_OUTPUT_COMPONENT_H +#ifndef ESPHOME_OUTPUT_PCA9685_OUTPUT_COMPONENT_H +#define ESPHOME_OUTPUT_PCA9685_OUTPUT_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PCA9685_OUTPUT -#include "esphomelib/output/float_output.h" -#include "esphomelib/i2c_component.h" +#include "esphome/output/float_output.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace output { @@ -83,8 +83,8 @@ class PCA9685OutputComponent : public Component, public I2CDevice { } // namespace output -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PCA9685_OUTPUT -#endif //ESPHOMELIB_OUTPUT_PCA9685_OUTPUT_COMPONENT_H +#endif //ESPHOME_OUTPUT_PCA9685_OUTPUT_COMPONENT_H diff --git a/src/esphomelib/power_supply_component.cpp b/src/esphome/power_supply_component.cpp similarity index 91% rename from src/esphomelib/power_supply_component.cpp rename to src/esphome/power_supply_component.cpp index 04b9af94..71156443 100644 --- a/src/esphomelib/power_supply_component.cpp +++ b/src/esphome/power_supply_component.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OUTPUT -#include "esphomelib/power_supply_component.h" +#include "esphome/power_supply_component.h" -#include "esphomelib/esphal.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" +#include "esphome/esphal.h" +#include "esphome/log.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "power_supply"; @@ -87,6 +87,6 @@ void PowerSupplyComponent::unrequest_high_power() { } } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OUTPUT diff --git a/src/esphomelib/power_supply_component.h b/src/esphome/power_supply_component.h similarity index 91% rename from src/esphomelib/power_supply_component.h rename to src/esphome/power_supply_component.h index 74b88bb4..9dd2af6e 100644 --- a/src/esphomelib/power_supply_component.h +++ b/src/esphome/power_supply_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_POWER_SUPPLY_COMPONENT_H -#define ESPHOMELIB_POWER_SUPPLY_COMPONENT_H +#ifndef ESPHOME_POWER_SUPPLY_COMPONENT_H +#define ESPHOME_POWER_SUPPLY_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OUTPUT -#include "esphomelib/component.h" -#include "esphomelib/esphal.h" +#include "esphome/component.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN /** This class represents an power supply. * @@ -78,8 +78,8 @@ class PowerSupplyComponent : public Component { int16_t active_requests_{0}; // use signed integer to make catching negative requests easier. }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OUTPUT -#endif //ESPHOMELIB_POWER_SUPPLY_COMPONENT_H +#endif //ESPHOME_POWER_SUPPLY_COMPONENT_H diff --git a/src/esphomelib/remote/jvc.cpp b/src/esphome/remote/jvc.cpp similarity index 93% rename from src/esphomelib/remote/jvc.cpp rename to src/esphome/remote/jvc.cpp index 2ae2b1e4..e63677f4 100644 --- a/src/esphomelib/remote/jvc.cpp +++ b/src/esphome/remote/jvc.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/jvc.h" -#include "esphomelib/log.h" +#include "esphome/remote/jvc.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -90,6 +90,6 @@ bool JVCDumper::dump(RemoteReceiveData *data) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/jvc.h b/src/esphome/remote/jvc.h similarity index 73% rename from src/esphomelib/remote/jvc.h rename to src/esphome/remote/jvc.h index 88bdfca2..7a10c4bf 100644 --- a/src/esphomelib/remote/jvc.h +++ b/src/esphome/remote/jvc.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_REMOTE_JVC_H -#define ESPHOMELIB_REMOTE_JVC_H +#ifndef ESPHOME_REMOTE_JVC_H +#define ESPHOME_REMOTE_JVC_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -48,8 +48,8 @@ class JVCDumper : public RemoteReceiveDumper { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE -#endif //ESPHOMELIB_REMOTE_JVC_H +#endif //ESPHOME_REMOTE_JVC_H diff --git a/src/esphomelib/remote/lg.cpp b/src/esphome/remote/lg.cpp similarity index 94% rename from src/esphomelib/remote/lg.cpp rename to src/esphome/remote/lg.cpp index 07de5c07..830c6cf0 100644 --- a/src/esphomelib/remote/lg.cpp +++ b/src/esphome/remote/lg.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/lg.h" -#include "esphomelib/log.h" +#include "esphome/remote/lg.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -104,6 +104,6 @@ bool LGDumper::dump(RemoteReceiveData *data) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/lg.h b/src/esphome/remote/lg.h similarity index 75% rename from src/esphomelib/remote/lg.h rename to src/esphome/remote/lg.h index 2e8d7265..5761e145 100644 --- a/src/esphomelib/remote/lg.h +++ b/src/esphome/remote/lg.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_REMOTE_LG_H -#define ESPHOMELIB_REMOTE_LG_H +#ifndef ESPHOME_REMOTE_LG_H +#define ESPHOME_REMOTE_LG_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -49,8 +49,8 @@ class LGDumper : public RemoteReceiveDumper { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE -#endif //ESPHOMELIB_REMOTE_LG_H +#endif //ESPHOME_REMOTE_LG_H diff --git a/src/esphomelib/remote/nec.cpp b/src/esphome/remote/nec.cpp similarity index 95% rename from src/esphomelib/remote/nec.cpp rename to src/esphome/remote/nec.cpp index 005f2941..603d16cb 100644 --- a/src/esphomelib/remote/nec.cpp +++ b/src/esphome/remote/nec.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/nec.h" -#include "esphomelib/log.h" +#include "esphome/remote/nec.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -109,6 +109,6 @@ bool NECDumper::dump(RemoteReceiveData *data) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/nec.h b/src/esphome/remote/nec.h similarity index 76% rename from src/esphomelib/remote/nec.h rename to src/esphome/remote/nec.h index 0e436971..094c4325 100644 --- a/src/esphomelib/remote/nec.h +++ b/src/esphome/remote/nec.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_REMOTE_NEC_H -#define ESPHOMELIB_REMOTE_NEC_H +#ifndef ESPHOME_REMOTE_NEC_H +#define ESPHOME_REMOTE_NEC_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -49,8 +49,8 @@ class NECDumper : public RemoteReceiveDumper { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE -#endif //ESPHOMELIB_REMOTE_NEC_H +#endif //ESPHOME_REMOTE_NEC_H diff --git a/src/esphomelib/remote/panasonic.cpp b/src/esphome/remote/panasonic.cpp similarity index 94% rename from src/esphomelib/remote/panasonic.cpp rename to src/esphome/remote/panasonic.cpp index 2754c07d..4b9583a0 100644 --- a/src/esphomelib/remote/panasonic.cpp +++ b/src/esphome/remote/panasonic.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/panasonic.h" -#include "esphomelib/log.h" +#include "esphome/remote/panasonic.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -111,6 +111,6 @@ bool PanasonicDumper::dump(RemoteReceiveData *data) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/panasonic.h b/src/esphome/remote/panasonic.h similarity index 75% rename from src/esphomelib/remote/panasonic.h rename to src/esphome/remote/panasonic.h index 8f9b4a48..bbeeef1e 100644 --- a/src/esphomelib/remote/panasonic.h +++ b/src/esphome/remote/panasonic.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_REMOTE_PANASONIC_H -#define ESPHOMELIB_REMOTE_PANASONIC_H +#ifndef ESPHOME_REMOTE_PANASONIC_H +#define ESPHOME_REMOTE_PANASONIC_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -49,8 +49,8 @@ class PanasonicDumper : public RemoteReceiveDumper { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE -#endif //ESPHOMELIB_REMOTE_PANASONIC_H +#endif //ESPHOME_REMOTE_PANASONIC_H diff --git a/src/esphomelib/remote/raw.cpp b/src/esphome/remote/raw.cpp similarity index 94% rename from src/esphomelib/remote/raw.cpp rename to src/esphome/remote/raw.cpp index 51b88e74..69356c0f 100644 --- a/src/esphomelib/remote/raw.cpp +++ b/src/esphome/remote/raw.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/raw.h" -#include "esphomelib/log.h" +#include "esphome/remote/raw.h" +#include "esphome/log.h" #include #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -98,6 +98,6 @@ RawReceiver::RawReceiver(const std::string &name, const int32_t *data, size_t le } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/raw.h b/src/esphome/remote/raw.h similarity index 75% rename from src/esphomelib/remote/raw.h rename to src/esphome/remote/raw.h index cdd6bcbe..416ee8d2 100644 --- a/src/esphomelib/remote/raw.h +++ b/src/esphome/remote/raw.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_REMOTE_RAW_H -#define ESPHOMELIB_REMOTE_RAW_H +#ifndef ESPHOME_REMOTE_RAW_H +#define ESPHOME_REMOTE_RAW_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -49,8 +49,8 @@ class RawDumper : public RemoteReceiveDumper { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE -#endif //ESPHOMELIB_REMOTE_RAW_H +#endif //ESPHOME_REMOTE_RAW_H diff --git a/src/esphomelib/remote/rc_switch.cpp b/src/esphome/remote/rc_switch.cpp similarity index 98% rename from src/esphomelib/remote/rc_switch.cpp rename to src/esphome/remote/rc_switch.cpp index b2a763ac..777ea815 100644 --- a/src/esphomelib/remote/rc_switch.cpp +++ b/src/esphome/remote/rc_switch.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/rc_switch.h" -#include "esphomelib/log.h" +#include "esphome/remote/rc_switch.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -244,6 +244,6 @@ bool RCSwitchDumper::dump(RemoteReceiveData *data) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/rc_switch.h b/src/esphome/remote/rc_switch.h similarity index 92% rename from src/esphomelib/remote/rc_switch.h rename to src/esphome/remote/rc_switch.h index ab6758f8..7aedd776 100644 --- a/src/esphomelib/remote/rc_switch.h +++ b/src/esphome/remote/rc_switch.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_REMOTE_RC_SWITCH_H -#define ESPHOMELIB_REMOTE_RC_SWITCH_H +#ifndef ESPHOME_REMOTE_RC_SWITCH_H +#define ESPHOME_REMOTE_RC_SWITCH_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" -#include "esphomelib/remote/rc_switch_protocol.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" +#include "esphome/remote/rc_switch_protocol.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -118,8 +118,8 @@ class RCSwitchDumper : public RemoteReceiveDumper { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ -#endif //ESPHOMELIB_REMOTE_RC_SWITCH_H +#endif //ESPHOME_REMOTE_RC_SWITCH_H diff --git a/src/esphomelib/remote/rc_switch_protocol.cpp b/src/esphome/remote/rc_switch_protocol.cpp similarity index 97% rename from src/esphomelib/remote/rc_switch_protocol.cpp rename to src/esphome/remote/rc_switch_protocol.cpp index 5681150c..bb37314d 100644 --- a/src/esphomelib/remote/rc_switch_protocol.cpp +++ b/src/esphome/remote/rc_switch_protocol.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/rc_switch_protocol.h" -#include "esphomelib/log.h" +#include "esphome/remote/rc_switch_protocol.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -235,6 +235,6 @@ void RCSwitchProtocol::type_d_code(uint8_t group, uint8_t device, bool state, ui } // namespace something -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/rc_switch_protocol.h b/src/esphome/remote/rc_switch_protocol.h similarity index 83% rename from src/esphomelib/remote/rc_switch_protocol.h rename to src/esphome/remote/rc_switch_protocol.h index 51631237..2518b10b 100644 --- a/src/esphomelib/remote/rc_switch_protocol.h +++ b/src/esphome/remote/rc_switch_protocol.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_RC_SWITCH_PROTOCOL_H -#define ESPHOMELIB_RC_SWITCH_PROTOCOL_H +#ifndef ESPHOME_RC_SWITCH_PROTOCOL_H +#define ESPHOME_RC_SWITCH_PROTOCOL_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/component.h" +#include "esphome/component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -68,11 +68,11 @@ extern RCSwitchProtocol rc_switch_protocols[8]; } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" #endif //USE_REMOTE -#endif //ESPHOMELIB_RC_SWITCH_PROTOCOL_H +#endif //ESPHOME_RC_SWITCH_PROTOCOL_H diff --git a/src/esphomelib/remote/remote_protocol.cpp b/src/esphome/remote/remote_protocol.cpp similarity index 79% rename from src/esphomelib/remote/remote_protocol.cpp rename to src/esphome/remote/remote_protocol.cpp index b685613f..9a045d20 100644 --- a/src/esphomelib/remote/remote_protocol.cpp +++ b/src/esphome/remote/remote_protocol.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_protocol.h" -#include "esphomelib/log.h" -#include "esphomelib/espmath.h" -#include "esphomelib/helpers.h" +#include "esphome/remote/remote_protocol.h" +#include "esphome/log.h" +#include "esphome/espmath.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -36,6 +36,6 @@ void RemoteControlComponentBase::set_clock_divider(uint8_t clock_divider) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/remote_protocol.h b/src/esphome/remote/remote_protocol.h similarity index 70% rename from src/esphomelib/remote/remote_protocol.h rename to src/esphome/remote/remote_protocol.h index 334470b9..44eb5d80 100644 --- a/src/esphomelib/remote/remote_protocol.h +++ b/src/esphome/remote/remote_protocol.h @@ -1,19 +1,19 @@ -#ifndef ESPHOMELIB_REMOTE_REMOTE_PROTOCOL_H -#define ESPHOMELIB_REMOTE_REMOTE_PROTOCOL_H +#ifndef ESPHOME_REMOTE_REMOTE_PROTOCOL_H +#define ESPHOME_REMOTE_REMOTE_PROTOCOL_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE #include -#include "esphomelib/component.h" -#include "esphomelib/esphal.h" +#include "esphome/component.h" +#include "esphome/esphal.h" #ifdef ARDUINO_ARCH_ESP32 #include #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -42,8 +42,8 @@ class RemoteControlComponentBase { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE -#endif //ESPHOMELIB_REMOTE_REMOTE_PROTOCOL_H +#endif //ESPHOME_REMOTE_REMOTE_PROTOCOL_H diff --git a/src/esphomelib/remote/remote_receiver.cpp b/src/esphome/remote/remote_receiver.cpp similarity index 96% rename from src/esphomelib/remote/remote_receiver.cpp rename to src/esphome/remote/remote_receiver.cpp index 1ca851b7..b83c6aee 100644 --- a/src/esphomelib/remote/remote_receiver.cpp +++ b/src/esphome/remote/remote_receiver.cpp @@ -1,17 +1,17 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE_RECEIVER -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/log.h" -#include "esphomelib/remote/jvc.h" -#include "esphomelib/remote/nec.h" -#include "esphomelib/remote/lg.h" -#include "esphomelib/remote/panasonic.h" -#include "esphomelib/remote/remote_transmitter.h" -#include "esphomelib/remote/rc_switch.h" -#include "esphomelib/remote/samsung.h" -#include "esphomelib/remote/sony.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/log.h" +#include "esphome/remote/jvc.h" +#include "esphome/remote/nec.h" +#include "esphome/remote/lg.h" +#include "esphome/remote/panasonic.h" +#include "esphome/remote/remote_transmitter.h" +#include "esphome/remote/rc_switch.h" +#include "esphome/remote/samsung.h" +#include "esphome/remote/sony.h" #ifdef ARDUINO_ARCH_ESP32 #include @@ -20,7 +20,7 @@ #include "FunctionalInterrupt.h" #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -458,6 +458,6 @@ bool RemoteReceiveDumper::process_(RemoteReceiveData *data) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE_RECEIVER diff --git a/src/esphomelib/remote/remote_receiver.h b/src/esphome/remote/remote_receiver.h similarity index 90% rename from src/esphomelib/remote/remote_receiver.h rename to src/esphome/remote/remote_receiver.h index 06fb12b2..6be8e9db 100644 --- a/src/esphomelib/remote/remote_receiver.h +++ b/src/esphome/remote/remote_receiver.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_REMOTE_REMOTE_RECEIVER_H -#define ESPHOMELIB_REMOTE_REMOTE_RECEIVER_H +#ifndef ESPHOME_REMOTE_REMOTE_RECEIVER_H +#define ESPHOME_REMOTE_REMOTE_RECEIVER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE_RECEIVER -#include "esphomelib/component.h" -#include "esphomelib/remote/remote_protocol.h" -#include "esphomelib/switch_/switch.h" -#include "esphomelib/binary_sensor/binary_sensor.h" +#include "esphome/component.h" +#include "esphome/remote/remote_protocol.h" +#include "esphome/switch_/switch.h" +#include "esphome/binary_sensor/binary_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -174,8 +174,8 @@ class RemoteReceiverComponent : public RemoteControlComponentBase, public Compon } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE_RECEIVER -#endif //ESPHOMELIB_REMOTE_REMOTE_RECEIVER_H +#endif //ESPHOME_REMOTE_REMOTE_RECEIVER_H diff --git a/src/esphomelib/remote/remote_transmitter.cpp b/src/esphome/remote/remote_transmitter.cpp similarity index 96% rename from src/esphomelib/remote/remote_transmitter.cpp rename to src/esphome/remote/remote_transmitter.cpp index e0720c6b..247eda83 100644 --- a/src/esphomelib/remote/remote_transmitter.cpp +++ b/src/esphome/remote/remote_transmitter.cpp @@ -1,23 +1,23 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE_TRANSMITTER -#include "esphomelib/remote/remote_transmitter.h" -#include "esphomelib/log.h" -#include "esphomelib/remote/jvc.h" -#include "esphomelib/remote/nec.h" -#include "esphomelib/remote/lg.h" -#include "esphomelib/remote/panasonic.h" -#include "esphomelib/remote/remote_transmitter.h" -#include "esphomelib/remote/rc_switch.h" -#include "esphomelib/remote/samsung.h" -#include "esphomelib/remote/sony.h" +#include "esphome/remote/remote_transmitter.h" +#include "esphome/log.h" +#include "esphome/remote/jvc.h" +#include "esphome/remote/nec.h" +#include "esphome/remote/lg.h" +#include "esphome/remote/panasonic.h" +#include "esphome/remote/remote_transmitter.h" +#include "esphome/remote/rc_switch.h" +#include "esphome/remote/samsung.h" +#include "esphome/remote/sony.h" #ifdef ARDUINO_ARCH_ESP32 #include #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -420,6 +420,6 @@ void RemoteTransmitterComponent::TransmitCall::set_sony(uint32_t data, uint8_t n } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE_TRANSMITTER diff --git a/src/esphomelib/remote/remote_transmitter.h b/src/esphome/remote/remote_transmitter.h similarity index 92% rename from src/esphomelib/remote/remote_transmitter.h rename to src/esphome/remote/remote_transmitter.h index fffc2665..a68dbb53 100644 --- a/src/esphomelib/remote/remote_transmitter.h +++ b/src/esphome/remote/remote_transmitter.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_REMOTE_TRANSMITTER_H -#define ESPHOMELIB_REMOTE_TRANSMITTER_H +#ifndef ESPHOME_REMOTE_TRANSMITTER_H +#define ESPHOME_REMOTE_TRANSMITTER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE_TRANSMITTER -#include "esphomelib/component.h" -#include "esphomelib/remote/remote_protocol.h" -#include "esphomelib/remote/rc_switch_protocol.h" -#include "esphomelib/switch_/switch.h" +#include "esphome/component.h" +#include "esphome/remote/remote_protocol.h" +#include "esphome/remote/rc_switch_protocol.h" +#include "esphome/switch_/switch.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -152,8 +152,8 @@ class RemoteTransmitterComponent : public RemoteControlComponentBase, public Com } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE_TRANSMITTER -#endif //ESPHOMELIB_REMOTE_TRANSMITTER_H +#endif //ESPHOME_REMOTE_TRANSMITTER_H diff --git a/src/esphomelib/remote/samsung.cpp b/src/esphome/remote/samsung.cpp similarity index 93% rename from src/esphomelib/remote/samsung.cpp rename to src/esphome/remote/samsung.cpp index 130d51d9..ee6fee46 100644 --- a/src/esphomelib/remote/samsung.cpp +++ b/src/esphome/remote/samsung.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/samsung.h" -#include "esphomelib/log.h" +#include "esphome/remote/samsung.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -93,6 +93,6 @@ bool SamsungDumper::dump(RemoteReceiveData *data) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/samsung.h b/src/esphome/remote/samsung.h similarity index 73% rename from src/esphomelib/remote/samsung.h rename to src/esphome/remote/samsung.h index e9fb65b6..90e492b6 100644 --- a/src/esphomelib/remote/samsung.h +++ b/src/esphome/remote/samsung.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_REMOTE_SAMSUNG_H -#define ESPHOMELIB_REMOTE_SAMSUNG_H +#ifndef ESPHOME_REMOTE_SAMSUNG_H +#define ESPHOME_REMOTE_SAMSUNG_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -47,8 +47,8 @@ class SamsungDumper : public RemoteReceiveDumper { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE -#endif //ESPHOMELIB_REMOTE_SAMSUNG_H +#endif //ESPHOME_REMOTE_SAMSUNG_H diff --git a/src/esphomelib/remote/sony.cpp b/src/esphome/remote/sony.cpp similarity index 94% rename from src/esphomelib/remote/sony.cpp rename to src/esphome/remote/sony.cpp index 44f36978..e94c7483 100644 --- a/src/esphomelib/remote/sony.cpp +++ b/src/esphome/remote/sony.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/sony.h" -#include "esphomelib/log.h" +#include "esphome/remote/sony.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -99,6 +99,6 @@ bool SonyDumper::dump(RemoteReceiveData *data) { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE diff --git a/src/esphomelib/remote/sony.h b/src/esphome/remote/sony.h similarity index 75% rename from src/esphomelib/remote/sony.h rename to src/esphome/remote/sony.h index 88316bdd..5c322416 100644 --- a/src/esphomelib/remote/sony.h +++ b/src/esphome/remote/sony.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_REMOTE_SONY_H -#define ESPHOMELIB_REMOTE_SONY_H +#ifndef ESPHOME_REMOTE_SONY_H +#define ESPHOME_REMOTE_SONY_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_REMOTE -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" +#include "esphome/remote/remote_receiver.h" +#include "esphome/remote/remote_transmitter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace remote { @@ -50,8 +50,8 @@ class SonyDumper : public RemoteReceiveDumper { } // namespace remote -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_REMOTE -#endif //ESPHOMELIB_REMOTE_SONY_H +#endif //ESPHOME_REMOTE_SONY_H diff --git a/src/esphomelib/sensor/adc.cpp b/src/esphome/sensor/adc.cpp similarity index 94% rename from src/esphomelib/sensor/adc.cpp rename to src/esphome/sensor/adc.cpp index 3f8987b2..29b8456c 100644 --- a/src/esphomelib/sensor/adc.cpp +++ b/src/esphome/sensor/adc.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ADC_SENSOR -#include "esphomelib/sensor/adc.h" +#include "esphome/sensor/adc.h" -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -111,6 +111,6 @@ std::string ADCSensorComponent::unique_id() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ADC_SENSOR diff --git a/src/esphomelib/sensor/adc.h b/src/esphome/sensor/adc.h similarity index 84% rename from src/esphomelib/sensor/adc.h rename to src/esphome/sensor/adc.h index 90431d48..298af7b5 100644 --- a/src/esphomelib/sensor/adc.h +++ b/src/esphome/sensor/adc.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_SENSOR_ADC_SENSOR_COMPONENT_H -#define ESPHOMELIB_SENSOR_ADC_SENSOR_COMPONENT_H +#ifndef ESPHOME_SENSOR_ADC_SENSOR_COMPONENT_H +#define ESPHOME_SENSOR_ADC_SENSOR_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ADC_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/esphal.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -69,8 +69,8 @@ class ADCSensorComponent : public PollingSensorComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ADC_SENSOR -#endif //ESPHOMELIB_SENSOR_ADC_SENSOR_COMPONENT_H +#endif //ESPHOME_SENSOR_ADC_SENSOR_COMPONENT_H diff --git a/src/esphomelib/sensor/ads1115_component.cpp b/src/esphome/sensor/ads1115_component.cpp similarity index 97% rename from src/esphomelib/sensor/ads1115_component.cpp rename to src/esphome/sensor/ads1115_component.cpp index b09ed186..dc018914 100644 --- a/src/esphomelib/sensor/ads1115_component.cpp +++ b/src/esphome/sensor/ads1115_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ADS1115_SENSOR -#include "esphomelib/log.h" -#include "esphomelib/sensor/ads1115_component.h" +#include "esphome/log.h" +#include "esphome/sensor/ads1115_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -173,6 +173,6 @@ uint32_t ADS1115Sensor::update_interval() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ADS1115_SENSOR diff --git a/src/esphomelib/sensor/ads1115_component.h b/src/esphome/sensor/ads1115_component.h similarity index 79% rename from src/esphomelib/sensor/ads1115_component.h rename to src/esphome/sensor/ads1115_component.h index 8c7ca39d..3e4e484d 100644 --- a/src/esphomelib/sensor/ads1115_component.h +++ b/src/esphome/sensor/ads1115_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_INPUT_ADS1115_COMPONENT_H -#define ESPHOMELIB_INPUT_ADS1115_COMPONENT_H +#ifndef ESPHOME_INPUT_ADS1115_COMPONENT_H +#define ESPHOME_INPUT_ADS1115_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ADS1115_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -34,19 +34,6 @@ enum ADS1115Gain { class ADS1115Sensor; -/** This class allows you to use your ADS1115 devices with esphomelib through i2c. - * - * It is built of like the DallasComponent: A central hub (can be multiple ones) and multiple - * Sensor instances that all access this central hub. - * - * Note that for this component to work correctly you need to have i2c setup. Do so with - * - * ```cpp - * App.init_i2c(SDA_PIN, SCL_PIN); - * ``` - * - * before the call to `App.setup()`. - */ class ADS1115Component : public Component, public I2CDevice { public: /** Construct the component hub for this ADS1115. @@ -108,8 +95,8 @@ class ADS1115Sensor : public sensor::EmptySensor<3, ICON_FLASH, UNIT_V> { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ADS1115_SENSOR -#endif //ESPHOMELIB_INPUT_ADS1115_COMPONENT_H +#endif //ESPHOME_INPUT_ADS1115_COMPONENT_H diff --git a/src/esphomelib/sensor/apds9960.cpp b/src/esphome/sensor/apds9960.cpp similarity index 98% rename from src/esphomelib/sensor/apds9960.cpp rename to src/esphome/sensor/apds9960.cpp index c84f2350..86dbbd6d 100644 --- a/src/esphomelib/sensor/apds9960.cpp +++ b/src/esphome/sensor/apds9960.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_APDS9960 -#include "esphomelib/sensor/apds9960.h" -#include "esphomelib/log.h" +#include "esphome/sensor/apds9960.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -422,6 +422,6 @@ APDS9960GestureDirectionBinarySensor::APDS9960GestureDirectionBinarySensor(const } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_APDS9960 diff --git a/src/esphomelib/sensor/apds9960.h b/src/esphome/sensor/apds9960.h similarity index 88% rename from src/esphomelib/sensor/apds9960.h rename to src/esphome/sensor/apds9960.h index df328950..f8ce9553 100644 --- a/src/esphomelib/sensor/apds9960.h +++ b/src/esphome/sensor/apds9960.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_SENSOR_APDS9960_H -#define ESPHOMELIB_SENSOR_APDS9960_H +#ifndef ESPHOME_SENSOR_APDS9960_H +#define ESPHOME_SENSOR_APDS9960_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_APDS9960 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/binary_sensor/binary_sensor.h" -#include "esphomelib/i2c_component.h" -#include "esphomelib/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/binary_sensor/binary_sensor.h" +#include "esphome/i2c_component.h" +#include "esphome/component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -77,8 +77,8 @@ class APDS9960GestureDirectionBinarySensor : public binary_sensor::BinarySensor } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_APDS9960 -#endif //ESPHOMELIB_SENSOR_APDS9960_H +#endif //ESPHOME_SENSOR_APDS9960_H diff --git a/src/esphomelib/sensor/bh1750_sensor.cpp b/src/esphome/sensor/bh1750_sensor.cpp similarity index 94% rename from src/esphomelib/sensor/bh1750_sensor.cpp rename to src/esphome/sensor/bh1750_sensor.cpp index df5faead..aae18353 100644 --- a/src/esphomelib/sensor/bh1750_sensor.cpp +++ b/src/esphome/sensor/bh1750_sensor.cpp @@ -3,14 +3,14 @@ // - https://github.com/claws/BH1750 // - https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/BH1750 -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BH1750 -#include "esphomelib/sensor/bh1750_sensor.h" -#include "esphomelib/log.h" +#include "esphome/sensor/bh1750_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -97,6 +97,6 @@ void BH1750Sensor::set_resolution(BH1750Resolution resolution) { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BH1750 diff --git a/src/esphomelib/sensor/bh1750_sensor.h b/src/esphome/sensor/bh1750_sensor.h similarity index 83% rename from src/esphomelib/sensor/bh1750_sensor.h rename to src/esphome/sensor/bh1750_sensor.h index b8626357..a9f7fb84 100644 --- a/src/esphomelib/sensor/bh1750_sensor.h +++ b/src/esphome/sensor/bh1750_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_BH1750_SENSOR_H -#define ESPHOMELIB_SENSOR_BH1750_SENSOR_H +#ifndef ESPHOME_SENSOR_BH1750_SENSOR_H +#define ESPHOME_SENSOR_BH1750_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BH1750 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -55,8 +55,8 @@ class BH1750Sensor : public PollingSensorComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BH1750 -#endif //ESPHOMELIB_SENSOR_BH1750_SENSOR_H +#endif //ESPHOME_SENSOR_BH1750_SENSOR_H diff --git a/src/esphomelib/sensor/bme280_component.cpp b/src/esphome/sensor/bme280_component.cpp similarity index 98% rename from src/esphomelib/sensor/bme280_component.cpp rename to src/esphome/sensor/bme280_component.cpp index e3096ec8..5a8da7ab 100644 --- a/src/esphomelib/sensor/bme280_component.cpp +++ b/src/esphome/sensor/bme280_component.cpp @@ -3,15 +3,15 @@ // - https://github.com/adafruit/Adafruit_BME280_Library // - https://github.com/sparkfun/SparkFun_BME280_Arduino_Library -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BME280 -#include "esphomelib/sensor/bme280_component.h" -#include "esphomelib/espmath.h" -#include "esphomelib/log.h" +#include "esphome/sensor/bme280_component.h" +#include "esphome/espmath.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -341,6 +341,6 @@ int16_t BME280Component::read_s16_le(uint8_t register_) { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BME280 diff --git a/src/esphomelib/sensor/bme280_component.h b/src/esphome/sensor/bme280_component.h similarity index 93% rename from src/esphomelib/sensor/bme280_component.h rename to src/esphome/sensor/bme280_component.h index 8b16a2f4..6db2903d 100644 --- a/src/esphomelib/sensor/bme280_component.h +++ b/src/esphome/sensor/bme280_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_BME280_COMPONENT_H -#define ESPHOMELIB_SENSOR_BME280_COMPONENT_H +#ifndef ESPHOME_SENSOR_BME280_COMPONENT_H +#define ESPHOME_SENSOR_BME280_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BME280 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -122,8 +122,8 @@ class BME280Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BME280 -#endif //ESPHOMELIB_SENSOR_BME280_COMPONENT_H +#endif //ESPHOME_SENSOR_BME280_COMPONENT_H diff --git a/src/esphomelib/sensor/bme680_component.cpp b/src/esphome/sensor/bme680_component.cpp similarity index 99% rename from src/esphomelib/sensor/bme680_component.cpp rename to src/esphome/sensor/bme680_component.cpp index 7cc63d1e..c494d27b 100644 --- a/src/esphomelib/sensor/bme680_component.cpp +++ b/src/esphome/sensor/bme680_component.cpp @@ -5,14 +5,14 @@ // - https://github.com/pimoroni/bme680 // - https://github.com/closedcube/ClosedCube_BME680_Arduino -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BME680 -#include "esphomelib/sensor/bme680_component.h" -#include "esphomelib/log.h" +#include "esphome/sensor/bme680_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -508,6 +508,6 @@ void BME680Component::set_heater(uint16_t heater_temperature, uint16_t heater_du } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BME680 diff --git a/src/esphomelib/sensor/bme680_component.h b/src/esphome/sensor/bme680_component.h similarity index 94% rename from src/esphomelib/sensor/bme680_component.h rename to src/esphome/sensor/bme680_component.h index d8588d84..e42df511 100644 --- a/src/esphomelib/sensor/bme680_component.h +++ b/src/esphome/sensor/bme680_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_BME680_COMPONENT_H -#define ESPHOMELIB_SENSOR_BME680_COMPONENT_H +#ifndef ESPHOME_SENSOR_BME680_COMPONENT_H +#define ESPHOME_SENSOR_BME680_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BME680 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -153,8 +153,8 @@ class BME680Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BME680 -#endif //ESPHOMELIB_SENSOR_BME680_COMPONENT_H +#endif //ESPHOME_SENSOR_BME680_COMPONENT_H diff --git a/src/esphomelib/sensor/bmp085_component.cpp b/src/esphome/sensor/bmp085_component.cpp similarity index 97% rename from src/esphomelib/sensor/bmp085_component.cpp rename to src/esphome/sensor/bmp085_component.cpp index 7846b636..de03a4ee 100644 --- a/src/esphomelib/sensor/bmp085_component.cpp +++ b/src/esphome/sensor/bmp085_component.cpp @@ -3,15 +3,15 @@ // - https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/BMP085 // - http://wmrx00.sourceforge.net/Arduino/BMP085-Calcs.pdf -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BMP085_SENSOR -#include "esphomelib/sensor/bmp085_component.h" +#include "esphome/sensor/bmp085_component.h" -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -161,6 +161,6 @@ float BMP085Component::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BMP085_SENSOR diff --git a/src/esphomelib/sensor/bmp085_component.h b/src/esphome/sensor/bmp085_component.h similarity index 85% rename from src/esphomelib/sensor/bmp085_component.h rename to src/esphome/sensor/bmp085_component.h index ffd7fd2b..caf6bf3c 100644 --- a/src/esphomelib/sensor/bmp085_component.h +++ b/src/esphome/sensor/bmp085_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_SENSOR_BMP085_COMPONENT_H -#define ESPHOMELIB_SENSOR_BMP085_COMPONENT_H +#ifndef ESPHOME_SENSOR_BMP085_COMPONENT_H +#define ESPHOME_SENSOR_BMP085_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BMP085_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -65,8 +65,8 @@ class BMP085Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BMP085_SENSOR -#endif //ESPHOMELIB_SENSOR_BMP085_COMPONENT_H +#endif //ESPHOME_SENSOR_BMP085_COMPONENT_H diff --git a/src/esphomelib/sensor/bmp280_component.cpp b/src/esphome/sensor/bmp280_component.cpp similarity index 97% rename from src/esphomelib/sensor/bmp280_component.cpp rename to src/esphome/sensor/bmp280_component.cpp index 1c266f00..e0b7b6dd 100644 --- a/src/esphomelib/sensor/bmp280_component.cpp +++ b/src/esphome/sensor/bmp280_component.cpp @@ -3,15 +3,15 @@ // - https://github.com/adafruit/Adafruit_BMP280_Library // - https://github.com/sparkfun/SparkFun_BMP280_Arduino_Library -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BMP280 -#include "esphomelib/sensor/bmp280_component.h" -#include "esphomelib/espmath.h" -#include "esphomelib/log.h" +#include "esphome/sensor/bmp280_component.h" +#include "esphome/espmath.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -256,6 +256,6 @@ int16_t BMP280Component::read_s16_le(uint8_t register_) { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BMP280 diff --git a/src/esphomelib/sensor/bmp280_component.h b/src/esphome/sensor/bmp280_component.h similarity index 92% rename from src/esphomelib/sensor/bmp280_component.h rename to src/esphome/sensor/bmp280_component.h index b8158840..8b8edddf 100644 --- a/src/esphomelib/sensor/bmp280_component.h +++ b/src/esphome/sensor/bmp280_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_BMP280_COMPONENT_H -#define ESPHOMELIB_SENSOR_BMP280_COMPONENT_H +#ifndef ESPHOME_SENSOR_BMP280_COMPONENT_H +#define ESPHOME_SENSOR_BMP280_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_BMP280 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -106,8 +106,8 @@ class BMP280Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_BMP280 -#endif //ESPHOMELIB_SENSOR_BMP280_COMPONENT_H +#endif //ESPHOME_SENSOR_BMP280_COMPONENT_H diff --git a/src/esphomelib/sensor/cse7766.cpp b/src/esphome/sensor/cse7766.cpp similarity index 97% rename from src/esphomelib/sensor/cse7766.cpp rename to src/esphome/sensor/cse7766.cpp index 6ab22c70..e00fdec5 100644 --- a/src/esphomelib/sensor/cse7766.cpp +++ b/src/esphome/sensor/cse7766.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CSE7766 -#include "esphomelib/sensor/cse7766.h" -#include "esphomelib/log.h" +#include "esphome/sensor/cse7766.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -188,6 +188,6 @@ void CSE7766Component::dump_config() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CSE7766 diff --git a/src/esphomelib/sensor/cse7766.h b/src/esphome/sensor/cse7766.h similarity index 78% rename from src/esphomelib/sensor/cse7766.h rename to src/esphome/sensor/cse7766.h index ec7e3d7c..d6063368 100644 --- a/src/esphomelib/sensor/cse7766.h +++ b/src/esphome/sensor/cse7766.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_SENSOR_CSE7766_H -#define ESPHOMELIB_SENSOR_CSE7766_H +#ifndef ESPHOME_SENSOR_CSE7766_H +#define ESPHOME_SENSOR_CSE7766_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CSE7766 -#include "esphomelib/component.h" -#include "esphomelib/uart_component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/sensor/sensor.h" +#include "esphome/component.h" +#include "esphome/uart_component.h" +#include "esphome/helpers.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -54,8 +54,8 @@ class CSE7766Component : public PollingComponent, public UARTDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CSE7766 -#endif //ESPHOMELIB_SENSOR_CSE7766_H +#endif //ESPHOME_SENSOR_CSE7766_H diff --git a/src/esphomelib/sensor/custom_sensor.cpp b/src/esphome/sensor/custom_sensor.cpp similarity index 75% rename from src/esphomelib/sensor/custom_sensor.cpp rename to src/esphome/sensor/custom_sensor.cpp index 9bb55ee2..283f454c 100644 --- a/src/esphomelib/sensor/custom_sensor.cpp +++ b/src/esphome/sensor/custom_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_SENSOR -#include "esphomelib/sensor/custom_sensor.h" -#include "esphomelib/log.h" +#include "esphome/sensor/custom_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -25,6 +25,6 @@ void CustomSensorConstructor::dump_config() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_SENSOR diff --git a/src/esphomelib/sensor/custom_sensor.h b/src/esphome/sensor/custom_sensor.h similarity index 55% rename from src/esphomelib/sensor/custom_sensor.h rename to src/esphome/sensor/custom_sensor.h index eac110ec..894004fd 100644 --- a/src/esphomelib/sensor/custom_sensor.h +++ b/src/esphome/sensor/custom_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_CUSTOM_SENSOR_H -#define ESPHOMELIB_SENSOR_CUSTOM_SENSOR_H +#ifndef ESPHOME_SENSOR_CUSTOM_SENSOR_H +#define ESPHOME_SENSOR_CUSTOM_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -26,8 +26,8 @@ class CustomSensorConstructor : public Component { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_SENSOR -#endif //ESPHOMELIB_SENSOR_CUSTOM_SENSOR_H +#endif //ESPHOME_SENSOR_CUSTOM_SENSOR_H diff --git a/src/esphomelib/sensor/dallas_component.cpp b/src/esphome/sensor/dallas_component.cpp similarity index 97% rename from src/esphomelib/sensor/dallas_component.cpp rename to src/esphome/sensor/dallas_component.cpp index 3f171479..ac4ce338 100644 --- a/src/esphomelib/sensor/dallas_component.cpp +++ b/src/esphome/sensor/dallas_component.cpp @@ -1,16 +1,16 @@ // Based on: // - https://github.com/milesburton/Arduino-Temperature-Control-Library -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DALLAS_SENSOR -#include "esphomelib/sensor/dallas_component.h" +#include "esphome/sensor/dallas_component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" +#include "esphome/helpers.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -271,7 +271,7 @@ bool DallasTemperatureSensor::setup_sensor_() { return true; } bool DallasTemperatureSensor::check_scratch_pad_() { -#ifdef ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE +#ifdef ESPHOME_LOG_LEVEL_VERY_VERBOSE ESP_LOGVV(TAG, "Scratch pad: %02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X (%02X)", this->scratch_pad_[0], this->scratch_pad_[1], this->scratch_pad_[2], this->scratch_pad_[3], this->scratch_pad_[4], this->scratch_pad_[5], @@ -299,6 +299,6 @@ std::string DallasTemperatureSensor::unique_id() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DALLAS_SENSOR diff --git a/src/esphomelib/sensor/dallas_component.h b/src/esphome/sensor/dallas_component.h similarity index 93% rename from src/esphomelib/sensor/dallas_component.h rename to src/esphome/sensor/dallas_component.h index f233c1fd..b2871f01 100644 --- a/src/esphomelib/sensor/dallas_component.h +++ b/src/esphome/sensor/dallas_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_DALLAS_COMPONENT_H -#define ESPHOMELIB_SENSOR_DALLAS_COMPONENT_H +#ifndef ESPHOME_SENSOR_DALLAS_COMPONENT_H +#define ESPHOME_SENSOR_DALLAS_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DALLAS_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/esp_one_wire.h" +#include "esphome/sensor/sensor.h" +#include "esphome/esp_one_wire.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -115,8 +115,8 @@ class DallasTemperatureSensor : public EmptyPollingParentSensor<1, ICON_EMPTY, U } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DALLAS_SENSOR -#endif //ESPHOMELIB_SENSOR_DALLAS_COMPONENT_H +#endif //ESPHOME_SENSOR_DALLAS_COMPONENT_H diff --git a/src/esphomelib/sensor/dht12_component.cpp b/src/esphome/sensor/dht12_component.cpp similarity index 94% rename from src/esphomelib/sensor/dht12_component.cpp rename to src/esphome/sensor/dht12_component.cpp index e3d4258c..0c6b3d88 100644 --- a/src/esphomelib/sensor/dht12_component.cpp +++ b/src/esphome/sensor/dht12_component.cpp @@ -2,14 +2,14 @@ // - ESPEasy: https://github.com/letscontrolit/ESPEasy/blob/mega/src/_P034_DHT12.ino // - DHT12_sensor_library: https://github.com/xreef/DHT12_sensor_library/blob/master/DHT12.cpp -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DHT12_SENSOR -#include "esphomelib/sensor/dht12_component.h" -#include "esphomelib/log.h" +#include "esphome/sensor/dht12_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -90,6 +90,6 @@ DHT12HumiditySensor *DHT12Component::get_humidity_sensor() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DHT12_SENSOR diff --git a/src/esphomelib/sensor/dht12_component.h b/src/esphome/sensor/dht12_component.h similarity index 77% rename from src/esphomelib/sensor/dht12_component.h rename to src/esphome/sensor/dht12_component.h index 01ccbbf6..33b7c8bb 100644 --- a/src/esphomelib/sensor/dht12_component.h +++ b/src/esphome/sensor/dht12_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_DHT12_COMPONENT_H -#define ESPHOMELIB_SENSOR_DHT12_COMPONENT_H +#ifndef ESPHOME_SENSOR_DHT12_COMPONENT_H +#define ESPHOME_SENSOR_DHT12_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DHT12_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -39,8 +39,8 @@ class DHT12Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DHT12_SENSOR -#endif //ESPHOMELIB_SENSOR_DHT12_COMPONENT_H +#endif //ESPHOME_SENSOR_DHT12_COMPONENT_H diff --git a/src/esphomelib/sensor/dht_component.cpp b/src/esphome/sensor/dht_component.cpp similarity index 95% rename from src/esphomelib/sensor/dht_component.cpp rename to src/esphome/sensor/dht_component.cpp index a81fc6d1..b2ee55d8 100644 --- a/src/esphomelib/sensor/dht_component.cpp +++ b/src/esphome/sensor/dht_component.cpp @@ -1,18 +1,18 @@ // Based on: // - https://github.com/markruys/arduino-DHT -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DHT_SENSOR -#include "esphomelib/sensor/dht_component.h" +#include "esphome/sensor/dht_component.h" -#include "esphomelib/log.h" -#include "esphomelib/espmath.h" -#include "esphomelib/helpers.h" -#include "esphomelib/espmath.h" +#include "esphome/log.h" +#include "esphome/espmath.h" +#include "esphome/helpers.h" +#include "esphome/espmath.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -210,6 +210,6 @@ bool HOT DHTComponent::read_sensor_(float *temperature, float *humidity, bool re } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DHT_SENSOR diff --git a/src/esphomelib/sensor/dht_component.h b/src/esphome/sensor/dht_component.h similarity index 88% rename from src/esphomelib/sensor/dht_component.h rename to src/esphome/sensor/dht_component.h index eea374a5..086e24e5 100644 --- a/src/esphomelib/sensor/dht_component.h +++ b/src/esphome/sensor/dht_component.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_SENSOR_DHT_COMPONENT_H -#define ESPHOMELIB_SENSOR_DHT_COMPONENT_H +#ifndef ESPHOME_SENSOR_DHT_COMPONENT_H +#define ESPHOME_SENSOR_DHT_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DHT_SENSOR -#include "esphomelib/sensor/sensor.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -74,8 +74,8 @@ class DHTComponent : public PollingComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DHT_SENSOR -#endif //ESPHOMELIB_SENSOR_DHT_COMPONENT_H +#endif //ESPHOME_SENSOR_DHT_COMPONENT_H diff --git a/src/esphomelib/sensor/duty_cycle_sensor.cpp b/src/esphome/sensor/duty_cycle_sensor.cpp similarity index 93% rename from src/esphomelib/sensor/duty_cycle_sensor.cpp rename to src/esphome/sensor/duty_cycle_sensor.cpp index 9efa31c0..e695c665 100644 --- a/src/esphomelib/sensor/duty_cycle_sensor.cpp +++ b/src/esphome/sensor/duty_cycle_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DUTY_CYCLE_SENSOR -#include "esphomelib/sensor/duty_cycle_sensor.h" -#include "esphomelib/log.h" +#include "esphome/sensor/duty_cycle_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -95,6 +95,6 @@ float DutyCycleSensor::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DUTY_CYCLE_SENSOR diff --git a/src/esphomelib/sensor/duty_cycle_sensor.h b/src/esphome/sensor/duty_cycle_sensor.h similarity index 76% rename from src/esphomelib/sensor/duty_cycle_sensor.h rename to src/esphome/sensor/duty_cycle_sensor.h index 1c411d50..f07e9dda 100644 --- a/src/esphomelib/sensor/duty_cycle_sensor.h +++ b/src/esphome/sensor/duty_cycle_sensor.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_DUTY_CYCLE_SENSOR_H -#define ESPHOMELIB_DUTY_CYCLE_SENSOR_H +#ifndef ESPHOME_DUTY_CYCLE_SENSOR_H +#define ESPHOME_DUTY_CYCLE_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_DUTY_CYCLE_SENSOR -#include "esphomelib/sensor/sensor.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -39,8 +39,8 @@ extern DutyCycleSensor *duty_cycle_sensors; } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_DUTY_CYCLE_SENSOR -#endif //ESPHOMELIB_DUTY_CYCLE_SENSOR_H +#endif //ESPHOME_DUTY_CYCLE_SENSOR_H diff --git a/src/esphomelib/sensor/esp32_hall_sensor.cpp b/src/esphome/sensor/esp32_hall_sensor.cpp similarity index 81% rename from src/esphomelib/sensor/esp32_hall_sensor.cpp rename to src/esphome/sensor/esp32_hall_sensor.cpp index 65f9371e..66d27ade 100644 --- a/src/esphomelib/sensor/esp32_hall_sensor.cpp +++ b/src/esphome/sensor/esp32_hall_sensor.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP32_HALL_SENSOR -#include "esphomelib/sensor/esp32_hall_sensor.h" -#include "esphomelib/esphal.h" -#include "esphomelib/log.h" +#include "esphome/sensor/esp32_hall_sensor.h" +#include "esphome/esphal.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -39,6 +39,6 @@ void ESP32HallSensor::dump_config() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP32_HALL_SENSOR diff --git a/src/esphomelib/sensor/esp32_hall_sensor.h b/src/esphome/sensor/esp32_hall_sensor.h similarity index 64% rename from src/esphomelib/sensor/esp32_hall_sensor.h rename to src/esphome/sensor/esp32_hall_sensor.h index 220a6c68..270c0ea9 100644 --- a/src/esphomelib/sensor/esp32_hall_sensor.h +++ b/src/esphome/sensor/esp32_hall_sensor.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_SENSOR_ESP32_HALL_SENSOR_H -#define ESPHOMELIB_SENSOR_ESP32_HALL_SENSOR_H +#ifndef ESPHOME_SENSOR_ESP32_HALL_SENSOR_H +#define ESPHOME_SENSOR_ESP32_HALL_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ESP32_HALL_SENSOR -#include "esphomelib/sensor/sensor.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -27,8 +27,8 @@ class ESP32HallSensor : public PollingSensorComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ESP32_HALL_SENSOR -#endif //ESPHOMELIB_SENSOR_ESP32_HALL_SENSOR_H +#endif //ESPHOME_SENSOR_ESP32_HALL_SENSOR_H diff --git a/src/esphomelib/sensor/filter.cpp b/src/esphome/sensor/filter.cpp similarity index 97% rename from src/esphomelib/sensor/filter.cpp rename to src/esphome/sensor/filter.cpp index 09e9c3d2..539f95a4 100644 --- a/src/esphomelib/sensor/filter.cpp +++ b/src/esphome/sensor/filter.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SENSOR -#include "esphomelib/sensor/filter.h" -#include "esphomelib/sensor/sensor.h" +#include "esphome/sensor/filter.h" +#include "esphome/sensor/sensor.h" -#include "esphomelib/log.h" -#include "esphomelib/espmath.h" +#include "esphome/log.h" +#include "esphome/espmath.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -292,6 +292,6 @@ float HeartbeatFilter::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SENSOR diff --git a/src/esphomelib/sensor/filter.h b/src/esphome/sensor/filter.h similarity index 96% rename from src/esphomelib/sensor/filter.h rename to src/esphome/sensor/filter.h index dcdd8616..29e8fe85 100644 --- a/src/esphomelib/sensor/filter.h +++ b/src/esphome/sensor/filter.h @@ -1,17 +1,17 @@ -#ifndef ESPHOMELIB_SENSOR_FILTER_H -#define ESPHOMELIB_SENSOR_FILTER_H +#ifndef ESPHOME_SENSOR_FILTER_H +#define ESPHOME_SENSOR_FILTER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SENSOR #include #include #include -#include "esphomelib/component.h" -#include "esphomelib/helpers.h" +#include "esphome/component.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -258,8 +258,8 @@ class UniqueFilter : public Filter { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SENSOR -#endif //ESPHOMELIB_SENSOR_FILTER_H +#endif //ESPHOME_SENSOR_FILTER_H diff --git a/src/esphomelib/sensor/hdc1080_component.cpp b/src/esphome/sensor/hdc1080_component.cpp similarity index 94% rename from src/esphomelib/sensor/hdc1080_component.cpp rename to src/esphome/sensor/hdc1080_component.cpp index e5111ef7..74ba210a 100644 --- a/src/esphomelib/sensor/hdc1080_component.cpp +++ b/src/esphome/sensor/hdc1080_component.cpp @@ -2,15 +2,15 @@ // - https://github.com/closedcube/ClosedCube_HDC1080_Arduino // - http://www.ti.com/lit/ds/symlink/hdc1080.pdf -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HDC1080_SENSOR -#include "esphomelib/sensor/hdc1080_component.h" +#include "esphome/sensor/hdc1080_component.h" -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -83,6 +83,6 @@ float HDC1080Component::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HDC1080_SENSOR diff --git a/src/esphomelib/sensor/hdc1080_component.h b/src/esphome/sensor/hdc1080_component.h similarity index 81% rename from src/esphomelib/sensor/hdc1080_component.h rename to src/esphome/sensor/hdc1080_component.h index e75b56ae..6ec0f0ab 100644 --- a/src/esphomelib/sensor/hdc1080_component.h +++ b/src/esphome/sensor/hdc1080_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_SENSOR_HDC1080_COMPONENT_H -#define ESPHOMELIB_SENSOR_HDC1080_COMPONENT_H +#ifndef ESPHOME_SENSOR_HDC1080_COMPONENT_H +#define ESPHOME_SENSOR_HDC1080_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HDC1080_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -49,8 +49,8 @@ class HDC1080Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HDC1080_SENSOR -#endif //ESPHOMELIB_SENSOR_HDC1080_COMPONENT_H +#endif //ESPHOME_SENSOR_HDC1080_COMPONENT_H diff --git a/src/esphomelib/sensor/hlw8012.cpp b/src/esphome/sensor/hlw8012.cpp similarity index 96% rename from src/esphomelib/sensor/hlw8012.cpp rename to src/esphome/sensor/hlw8012.cpp index ac10f5f9..a3d29110 100644 --- a/src/esphomelib/sensor/hlw8012.cpp +++ b/src/esphome/sensor/hlw8012.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HLW8012 -#include "esphomelib/sensor/hlw8012.h" -#include "esphomelib/log.h" -#include "esphomelib/espmath.h" +#include "esphome/sensor/hlw8012.h" +#include "esphome/log.h" +#include "esphome/espmath.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -123,6 +123,6 @@ HLW8012VoltageSensor::HLW8012VoltageSensor(const std::string &name, HLW8012Compo } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HLW8012 diff --git a/src/esphomelib/sensor/hlw8012.h b/src/esphome/sensor/hlw8012.h similarity index 86% rename from src/esphomelib/sensor/hlw8012.h rename to src/esphome/sensor/hlw8012.h index a1a56481..24c40323 100644 --- a/src/esphomelib/sensor/hlw8012.h +++ b/src/esphome/sensor/hlw8012.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_HLW_8012_H -#define ESPHOMELIB_HLW_8012_H +#ifndef ESPHOME_HLW_8012_H +#define ESPHOME_HLW_8012_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HLW8012 -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/sensor/pulse_counter.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/sensor/pulse_counter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -67,8 +67,8 @@ class HLW8012Component : public PollingComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HLW8012 -#endif //ESPHOMELIB_HLW_8012_H +#endif //ESPHOME_HLW_8012_H diff --git a/src/esphomelib/sensor/hmc5883l.cpp b/src/esphome/sensor/hmc5883l.cpp similarity index 97% rename from src/esphomelib/sensor/hmc5883l.cpp rename to src/esphome/sensor/hmc5883l.cpp index bbd725de..92a2b9a0 100644 --- a/src/esphomelib/sensor/hmc5883l.cpp +++ b/src/esphome/sensor/hmc5883l.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HMC5883L -#include "esphomelib/sensor/hmc5883l.h" -#include "esphomelib/log.h" +#include "esphome/sensor/hmc5883l.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -151,6 +151,6 @@ void HMC5883LComponent::set_range(HMC5883LRange range) { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HMC5883L diff --git a/src/esphomelib/sensor/hmc5883l.h b/src/esphome/sensor/hmc5883l.h similarity index 85% rename from src/esphomelib/sensor/hmc5883l.h rename to src/esphome/sensor/hmc5883l.h index 7af7db51..e2e34e27 100644 --- a/src/esphomelib/sensor/hmc5883l.h +++ b/src/esphome/sensor/hmc5883l.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_HMC_5883_L_H -#define ESPHOMELIB_HMC_5883_L_H +#ifndef ESPHOME_HMC_5883_L_H +#define ESPHOME_HMC_5883_L_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HMC5883L -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -57,8 +57,8 @@ class HMC5883LComponent : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HMC5883L -#endif //ESPHOMELIB_HMC_5883_L_H +#endif //ESPHOME_HMC_5883_L_H diff --git a/src/esphomelib/sensor/homeassistant_sensor.cpp b/src/esphome/sensor/homeassistant_sensor.cpp similarity index 83% rename from src/esphomelib/sensor/homeassistant_sensor.cpp rename to src/esphome/sensor/homeassistant_sensor.cpp index 9149ad91..2f1f74ac 100644 --- a/src/esphomelib/sensor/homeassistant_sensor.cpp +++ b/src/esphome/sensor/homeassistant_sensor.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HOMEASSISTANT_SENSOR -#include "esphomelib/sensor/homeassistant_sensor.h" -#include "esphomelib/api/api_server.h" -#include "esphomelib/log.h" +#include "esphome/sensor/homeassistant_sensor.h" +#include "esphome/api/api_server.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -39,6 +39,6 @@ float HomeassistantSensor::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HOMEASSISTANT_SENSOR diff --git a/src/esphomelib/sensor/homeassistant_sensor.h b/src/esphome/sensor/homeassistant_sensor.h similarity index 59% rename from src/esphomelib/sensor/homeassistant_sensor.h rename to src/esphome/sensor/homeassistant_sensor.h index 6481e82a..f630e5f0 100644 --- a/src/esphomelib/sensor/homeassistant_sensor.h +++ b/src/esphome/sensor/homeassistant_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_HOMEASSISTANT_SENSOR_H -#define ESPHOMELIB_HOMEASSISTANT_SENSOR_H +#ifndef ESPHOME_HOMEASSISTANT_SENSOR_H +#define ESPHOME_HOMEASSISTANT_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HOMEASSISTANT_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -24,8 +24,8 @@ class HomeassistantSensor : public Sensor, public Component { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HOMEASSISTANT_SENSOR -#endif //ESPHOMELIB_HOMEASSISTANT_SENSOR_H +#endif //ESPHOME_HOMEASSISTANT_SENSOR_H diff --git a/src/esphomelib/sensor/htu21d_component.cpp b/src/esphome/sensor/htu21d_component.cpp similarity index 94% rename from src/esphomelib/sensor/htu21d_component.cpp rename to src/esphome/sensor/htu21d_component.cpp index e3dd1220..622b4f2e 100644 --- a/src/esphomelib/sensor/htu21d_component.cpp +++ b/src/esphome/sensor/htu21d_component.cpp @@ -2,15 +2,15 @@ // - http://www.te.com/commerce/DocumentDelivery/DDEController?Action=showdoc&DocId=Data+Sheet%7FHPC199_6%7FA6%7Fpdf%7FEnglish%7FENG_DS_HPC199_6_A6.pdf%7FCAT-HSC0004 // - https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/HTU21D -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HTU21D_SENSOR -#include "esphomelib/sensor/htu21d_component.h" +#include "esphome/sensor/htu21d_component.h" -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -84,6 +84,6 @@ float HTU21DComponent::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HTU21D_SENSOR diff --git a/src/esphomelib/sensor/htu21d_component.h b/src/esphome/sensor/htu21d_component.h similarity index 70% rename from src/esphomelib/sensor/htu21d_component.h rename to src/esphome/sensor/htu21d_component.h index 975b8269..4726c949 100644 --- a/src/esphomelib/sensor/htu21d_component.h +++ b/src/esphome/sensor/htu21d_component.h @@ -1,26 +1,21 @@ -#ifndef ESPHOMELIB_SENSOR_HTU21D_COMPONENT_H -#define ESPHOMELIB_SENSOR_HTU21D_COMPONENT_H +#ifndef ESPHOME_SENSOR_HTU21D_COMPONENT_H +#define ESPHOME_SENSOR_HTU21D_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HTU21D_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { using HTU21DTemperatureSensor = EmptyPollingParentSensor<1, ICON_EMPTY, UNIT_C>; using HTU21DHumiditySensor = EmptyPollingParentSensor<0, ICON_WATER_PERCENT, UNIT_PERCENT>; -/** This component represents the HTU21D i2c temperature+humidity sensor in esphomelib. - * - * It's basically an i2c-based accurate temperature and humidity sensor. - * See https://www.adafruit.com/product/1899 for more information. - */ class HTU21DComponent : public PollingComponent, public I2CDevice { public: /// Construct the HTU21D with the given update interval. @@ -50,8 +45,8 @@ class HTU21DComponent : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HTU21D_SENSOR -#endif //ESPHOMELIB_SENSOR_HTU21D_COMPONENT_H +#endif //ESPHOME_SENSOR_HTU21D_COMPONENT_H diff --git a/src/esphomelib/sensor/hx711.cpp b/src/esphome/sensor/hx711.cpp similarity index 93% rename from src/esphomelib/sensor/hx711.cpp rename to src/esphome/sensor/hx711.cpp index 6ca989dd..0033069b 100644 --- a/src/esphomelib/sensor/hx711.cpp +++ b/src/esphome/sensor/hx711.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HX711 -#include "esphomelib/sensor/hx711.h" -#include "esphomelib/log.h" +#include "esphome/sensor/hx711.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -86,6 +86,6 @@ void HX711Sensor::set_gain(HX711Gain gain) { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HX711 diff --git a/src/esphomelib/sensor/hx711.h b/src/esphome/sensor/hx711.h similarity index 76% rename from src/esphomelib/sensor/hx711.h rename to src/esphome/sensor/hx711.h index 34e75dd6..cbafad37 100644 --- a/src/esphomelib/sensor/hx711.h +++ b/src/esphome/sensor/hx711.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_SENSOR_HX711_H -#define ESPHOMELIB_SENSOR_HX711_H +#ifndef ESPHOME_SENSOR_HX711_H +#define ESPHOME_SENSOR_HX711_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HX711 -#include "esphomelib/sensor/sensor.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -42,8 +42,8 @@ class HX711Sensor : public PollingSensorComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HX711 -#endif //ESPHOMELIB_SENSOR_HX711_H +#endif //ESPHOME_SENSOR_HX711_H diff --git a/src/esphomelib/sensor/ina219.cpp b/src/esphome/sensor/ina219.cpp similarity index 97% rename from src/esphomelib/sensor/ina219.cpp rename to src/esphome/sensor/ina219.cpp index 93b5acc5..0e114afb 100644 --- a/src/esphomelib/sensor/ina219.cpp +++ b/src/esphome/sensor/ina219.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_INA219 -#include "esphomelib/sensor/ina219.h" -#include "esphomelib/espmath.h" -#include "esphomelib/log.h" +#include "esphome/sensor/ina219.h" +#include "esphome/espmath.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -220,6 +220,6 @@ INA219PowerSensor *INA219Component::make_power_sensor(const std::string &name) { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_INA219 diff --git a/src/esphomelib/sensor/ina219.h b/src/esphome/sensor/ina219.h similarity index 82% rename from src/esphomelib/sensor/ina219.h rename to src/esphome/sensor/ina219.h index cbcbae3e..477e9919 100644 --- a/src/esphomelib/sensor/ina219.h +++ b/src/esphome/sensor/ina219.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_INA_219_H -#define ESPHOMELIB_INA_219_H +#ifndef ESPHOME_INA_219_H +#define ESPHOME_INA_219_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_INA219 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/component.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/component.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -45,8 +45,8 @@ class INA219Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_INA219 -#endif //ESPHOMELIB_INA_219_H +#endif //ESPHOME_INA_219_H diff --git a/src/esphomelib/sensor/ina3221.cpp b/src/esphome/sensor/ina3221.cpp similarity index 97% rename from src/esphomelib/sensor/ina3221.cpp rename to src/esphome/sensor/ina3221.cpp index ecb86717..0335cb8e 100644 --- a/src/esphomelib/sensor/ina3221.cpp +++ b/src/esphome/sensor/ina3221.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_INA3221 -#include "esphomelib/sensor/ina3221.h" -#include "esphomelib/log.h" +#include "esphome/sensor/ina3221.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -154,6 +154,6 @@ bool INA3221Component::INA3221Channel::should_measure_bus_voltage() { } } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_INA3221 diff --git a/src/esphomelib/sensor/ina3221.h b/src/esphome/sensor/ina3221.h similarity index 85% rename from src/esphomelib/sensor/ina3221.h rename to src/esphome/sensor/ina3221.h index 4b3ec9aa..6b50bbe2 100644 --- a/src/esphomelib/sensor/ina3221.h +++ b/src/esphome/sensor/ina3221.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_INA3221_H -#define ESPHOMELIB_INA3221_H +#ifndef ESPHOME_INA3221_H +#define ESPHOME_INA3221_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_INA3221 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -46,8 +46,8 @@ class INA3221Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_INA3221 -#endif //ESPHOMELIB_INA3221_H +#endif //ESPHOME_INA3221_H diff --git a/src/esphomelib/sensor/max31855_sensor.cpp b/src/esphome/sensor/max31855_sensor.cpp similarity index 95% rename from src/esphomelib/sensor/max31855_sensor.cpp rename to src/esphome/sensor/max31855_sensor.cpp index 169a30eb..8dfba7b5 100644 --- a/src/esphomelib/sensor/max31855_sensor.cpp +++ b/src/esphome/sensor/max31855_sensor.cpp @@ -1,13 +1,13 @@ // Implementation based on https://github.com/adafruit/MAX31855-library/blob/master/max31855.cpp and https://github.com/adafruit/Adafruit_CircuitPython_MAX31855/blob/master/adafruit_max31855.py -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MAX31855_SENSOR -#include "esphomelib/sensor/max31855_sensor.h" -#include "esphomelib/log.h" +#include "esphome/sensor/max31855_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -109,6 +109,6 @@ bool MAX31855Sensor::msb_first() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MAX31855_SENSOR diff --git a/src/esphomelib/sensor/max31855_sensor.h b/src/esphome/sensor/max31855_sensor.h similarity index 69% rename from src/esphomelib/sensor/max31855_sensor.h rename to src/esphome/sensor/max31855_sensor.h index 4d4c995b..3479bb8e 100644 --- a/src/esphomelib/sensor/max31855_sensor.h +++ b/src/esphome/sensor/max31855_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_MAX31855_H -#define ESPHOMELIB_SENSOR_MAX31855_H +#ifndef ESPHOME_SENSOR_MAX31855_H +#define ESPHOME_SENSOR_MAX31855_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MAX31855_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/spi_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/spi_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -34,8 +34,8 @@ class MAX31855Sensor : public PollingSensorComponent, public SPIDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MAX31855_SENSOR -#endif //ESPHOMELIB_SENSOR_MAX31855_H +#endif //ESPHOME_SENSOR_MAX31855_H diff --git a/src/esphomelib/sensor/max6675_sensor.cpp b/src/esphome/sensor/max6675_sensor.cpp similarity index 92% rename from src/esphomelib/sensor/max6675_sensor.cpp rename to src/esphome/sensor/max6675_sensor.cpp index 082da07f..da126bbb 100644 --- a/src/esphomelib/sensor/max6675_sensor.cpp +++ b/src/esphome/sensor/max6675_sensor.cpp @@ -1,13 +1,13 @@ // Implementation based on https://github.com/adafruit/MAX6675-library/blob/master/max6675.cpp -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MAX6675_SENSOR -#include "esphomelib/sensor/max6675_sensor.h" -#include "esphomelib/log.h" +#include "esphome/sensor/max6675_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -75,6 +75,6 @@ bool MAX6675Sensor::msb_first() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MAX6675_SENSOR diff --git a/src/esphomelib/sensor/max6675_sensor.h b/src/esphome/sensor/max6675_sensor.h similarity index 69% rename from src/esphomelib/sensor/max6675_sensor.h rename to src/esphome/sensor/max6675_sensor.h index e5e957c9..f50773c5 100644 --- a/src/esphomelib/sensor/max6675_sensor.h +++ b/src/esphome/sensor/max6675_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_MAX6675_H -#define ESPHOMELIB_SENSOR_MAX6675_H +#ifndef ESPHOME_SENSOR_MAX6675_H +#define ESPHOME_SENSOR_MAX6675_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MAX6675_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/spi_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/spi_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -34,8 +34,8 @@ class MAX6675Sensor : public PollingSensorComponent, public SPIDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MAX6675_SENSOR -#endif //ESPHOMELIB_SENSOR_MAX6675_H +#endif //ESPHOME_SENSOR_MAX6675_H diff --git a/src/esphomelib/sensor/mhz19_component.cpp b/src/esphome/sensor/mhz19_component.cpp similarity index 94% rename from src/esphomelib/sensor/mhz19_component.cpp rename to src/esphome/sensor/mhz19_component.cpp index 0997e862..97048398 100644 --- a/src/esphomelib/sensor/mhz19_component.cpp +++ b/src/esphome/sensor/mhz19_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MHZ19 -#include "esphomelib/sensor/mhz19_component.h" -#include "esphomelib/log.h" +#include "esphome/sensor/mhz19_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -89,6 +89,6 @@ void MHZ19Component::dump_config() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MHZ19 diff --git a/src/esphomelib/sensor/mhz19_component.h b/src/esphome/sensor/mhz19_component.h similarity index 73% rename from src/esphomelib/sensor/mhz19_component.h rename to src/esphome/sensor/mhz19_component.h index 12b13145..b4aa7a57 100644 --- a/src/esphomelib/sensor/mhz19_component.h +++ b/src/esphome/sensor/mhz19_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_MHZ_19_COMPONENT_H -#define ESPHOMELIB_MHZ_19_COMPONENT_H +#ifndef ESPHOME_MHZ_19_COMPONENT_H +#define ESPHOME_MHZ_19_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MHZ19 -#include "esphomelib/component.h" -#include "esphomelib/uart_component.h" -#include "esphomelib/sensor/sensor.h" +#include "esphome/component.h" +#include "esphome/uart_component.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -38,8 +38,8 @@ class MHZ19Component : public PollingComponent, public UARTDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MHZ19 -#endif //ESPHOMELIB_MHZ_19_COMPONENT_H +#endif //ESPHOME_MHZ_19_COMPONENT_H diff --git a/src/esphomelib/sensor/mpu6050_component.cpp b/src/esphome/sensor/mpu6050_component.cpp similarity index 97% rename from src/esphomelib/sensor/mpu6050_component.cpp rename to src/esphome/sensor/mpu6050_component.cpp index f8ec0bc1..ee531d52 100644 --- a/src/esphomelib/sensor/mpu6050_component.cpp +++ b/src/esphome/sensor/mpu6050_component.cpp @@ -3,14 +3,14 @@ // - https://github.com/jarzebski/Arduino-MPU6050 // - https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050 -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MPU6050 -#include "esphomelib/sensor/mpu6050_component.h" -#include "esphomelib/log.h" +#include "esphome/sensor/mpu6050_component.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -180,6 +180,6 @@ float MPU6050Component::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MPUT6050 diff --git a/src/esphomelib/sensor/mpu6050_component.h b/src/esphome/sensor/mpu6050_component.h similarity index 82% rename from src/esphomelib/sensor/mpu6050_component.h rename to src/esphome/sensor/mpu6050_component.h index a1f7c4ca..9c5c12d6 100644 --- a/src/esphomelib/sensor/mpu6050_component.h +++ b/src/esphome/sensor/mpu6050_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_MPU_6050_COMPONENT_H -#define ESPHOMELIB_MPU_6050_COMPONENT_H +#ifndef ESPHOME_MPU_6050_COMPONENT_H +#define ESPHOME_MPU_6050_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MPU6050 -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -48,8 +48,8 @@ class MPU6050Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MPU6050 -#endif //ESPHOMELIB_MPU_6050_COMPONENT_H +#endif //ESPHOME_MPU_6050_COMPONENT_H diff --git a/src/esphomelib/sensor/mqtt_sensor_component.cpp b/src/esphome/sensor/mqtt_sensor_component.cpp similarity index 89% rename from src/esphomelib/sensor/mqtt_sensor_component.cpp rename to src/esphome/sensor/mqtt_sensor_component.cpp index 7e49b963..0f7ac558 100644 --- a/src/esphomelib/sensor/mqtt_sensor_component.cpp +++ b/src/esphome/sensor/mqtt_sensor_component.cpp @@ -1,15 +1,15 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_SENSOR -#include "esphomelib/sensor/mqtt_sensor_component.h" +#include "esphome/sensor/mqtt_sensor_component.h" -#include "esphomelib/deep_sleep_component.h" -#include "esphomelib/espmath.h" -#include "esphomelib/log.h" -#include "esphomelib/component.h" +#include "esphome/deep_sleep_component.h" +#include "esphome/espmath.h" +#include "esphome/log.h" +#include "esphome/component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -91,6 +91,6 @@ std::string MQTTSensorComponent::unique_id() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_SENSOR diff --git a/src/esphomelib/sensor/mqtt_sensor_component.h b/src/esphome/sensor/mqtt_sensor_component.h similarity index 80% rename from src/esphomelib/sensor/mqtt_sensor_component.h rename to src/esphome/sensor/mqtt_sensor_component.h index 54f77cf3..eef836bb 100644 --- a/src/esphomelib/sensor/mqtt_sensor_component.h +++ b/src/esphome/sensor/mqtt_sensor_component.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_SENSOR_MQTT_SENSOR_COMPONENT_H -#define ESPHOMELIB_SENSOR_MQTT_SENSOR_COMPONENT_H +#ifndef ESPHOME_SENSOR_MQTT_SENSOR_COMPONENT_H +#define ESPHOME_SENSOR_MQTT_SENSOR_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/mqtt/mqtt_component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/sensor/filter.h" +#include "esphome/sensor/sensor.h" +#include "esphome/mqtt/mqtt_component.h" +#include "esphome/helpers.h" +#include "esphome/sensor/filter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -61,8 +61,8 @@ class MQTTSensorComponent : public mqtt::MQTTComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_SENSOR -#endif //ESPHOMELIB_SENSOR_MQTT_SENSOR_COMPONENT_H +#endif //ESPHOME_SENSOR_MQTT_SENSOR_COMPONENT_H diff --git a/src/esphomelib/sensor/mqtt_subscribe_sensor.cpp b/src/esphome/sensor/mqtt_subscribe_sensor.cpp similarity index 82% rename from src/esphomelib/sensor/mqtt_subscribe_sensor.cpp rename to src/esphome/sensor/mqtt_subscribe_sensor.cpp index 11581b1c..778d300f 100644 --- a/src/esphomelib/sensor/mqtt_subscribe_sensor.cpp +++ b/src/esphome/sensor/mqtt_subscribe_sensor.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_SUBSCRIBE_SENSOR -#include "esphomelib/sensor/mqtt_subscribe_sensor.h" -#include "esphomelib/mqtt/mqtt_client_component.h" -#include "esphomelib/log.h" +#include "esphome/sensor/mqtt_subscribe_sensor.h" +#include "esphome/mqtt/mqtt_client_component.h" +#include "esphome/log.h" #include #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -44,6 +44,6 @@ void MQTTSubscribeSensor::dump_config() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_SUBSCRIBE_SENSOR diff --git a/src/esphomelib/sensor/mqtt_subscribe_sensor.h b/src/esphome/sensor/mqtt_subscribe_sensor.h similarity index 59% rename from src/esphomelib/sensor/mqtt_subscribe_sensor.h rename to src/esphome/sensor/mqtt_subscribe_sensor.h index d85ce4a0..f28b2892 100644 --- a/src/esphomelib/sensor/mqtt_subscribe_sensor.h +++ b/src/esphome/sensor/mqtt_subscribe_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_MQTT_SUBSCRIBE_SENSOR_H -#define ESPHOMELIB_SENSOR_MQTT_SUBSCRIBE_SENSOR_H +#ifndef ESPHOME_SENSOR_MQTT_SUBSCRIBE_SENSOR_H +#define ESPHOME_SENSOR_MQTT_SUBSCRIBE_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_SUBSCRIBE_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -29,8 +29,8 @@ class MQTTSubscribeSensor : public Sensor, public Component { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_SUBSCRIBE_SENSOR -#endif //ESPHOMELIB_SENSOR_MQTT_SUBSCRIBE_SENSOR_H +#endif //ESPHOME_SENSOR_MQTT_SUBSCRIBE_SENSOR_H diff --git a/src/esphomelib/sensor/ms5611.cpp b/src/esphome/sensor/ms5611.cpp similarity index 96% rename from src/esphomelib/sensor/ms5611.cpp rename to src/esphome/sensor/ms5611.cpp index 0a439c43..916d9b1f 100644 --- a/src/esphomelib/sensor/ms5611.cpp +++ b/src/esphome/sensor/ms5611.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MS5611 -#include "esphomelib/sensor/ms5611.h" -#include "esphomelib/log.h" +#include "esphome/sensor/ms5611.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -126,6 +126,6 @@ MS5611Component::MS5611Component(I2CComponent *parent, const std::string &temper } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MS5611 diff --git a/src/esphomelib/sensor/ms5611.h b/src/esphome/sensor/ms5611.h similarity index 79% rename from src/esphomelib/sensor/ms5611.h rename to src/esphome/sensor/ms5611.h index 2c9b42cd..03c20627 100644 --- a/src/esphomelib/sensor/ms5611.h +++ b/src/esphome/sensor/ms5611.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_MS5611_H -#define ESPHOMELIB_SENSOR_MS5611_H +#ifndef ESPHOME_SENSOR_MS5611_H +#define ESPHOME_SENSOR_MS5611_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MS5611 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -40,8 +40,8 @@ class MS5611Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MS5611 -#endif //ESPHOMELIB_SENSOR_MS5611_H +#endif //ESPHOME_SENSOR_MS5611_H diff --git a/src/esphomelib/sensor/pmsx003.cpp b/src/esphome/sensor/pmsx003.cpp similarity index 98% rename from src/esphomelib/sensor/pmsx003.cpp rename to src/esphome/sensor/pmsx003.cpp index 211d0ccf..14fbed2f 100644 --- a/src/esphomelib/sensor/pmsx003.cpp +++ b/src/esphome/sensor/pmsx003.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PMSX003 -#include "esphomelib/sensor/pmsx003.h" -#include "esphomelib/log.h" +#include "esphome/sensor/pmsx003.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -232,6 +232,6 @@ PMSX003Sensor::PMSX003Sensor(const std::string &name, PMSX003SensorType type) } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PMSX003 diff --git a/src/esphomelib/sensor/pmsx003.h b/src/esphome/sensor/pmsx003.h similarity index 86% rename from src/esphomelib/sensor/pmsx003.h rename to src/esphome/sensor/pmsx003.h index ec6de0a2..db097b72 100644 --- a/src/esphomelib/sensor/pmsx003.h +++ b/src/esphome/sensor/pmsx003.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_SENSOR_PMSX003_H -#define ESPHOMELIB_SENSOR_PMSX003_H +#ifndef ESPHOME_SENSOR_PMSX003_H +#define ESPHOME_SENSOR_PMSX003_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PMSX003 -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/uart_component.h" -#include "esphomelib/helpers.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/uart_component.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -81,8 +81,8 @@ class PMSX003Component : public UARTDevice, public Component { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PMSX003 -#endif //ESPHOMELIB_SENSOR_PMSX003_H +#endif //ESPHOME_SENSOR_PMSX003_H diff --git a/src/esphomelib/sensor/pulse_counter.cpp b/src/esphome/sensor/pulse_counter.cpp similarity index 96% rename from src/esphomelib/sensor/pulse_counter.cpp rename to src/esphome/sensor/pulse_counter.cpp index 07da2369..ee039400 100644 --- a/src/esphomelib/sensor/pulse_counter.cpp +++ b/src/esphome/sensor/pulse_counter.cpp @@ -1,18 +1,18 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PULSE_COUNTER_SENSOR -#include "esphomelib/sensor/pulse_counter.h" +#include "esphome/sensor/pulse_counter.h" -#include "esphomelib/log.h" -#include "esphomelib/esphal.h" -#include "esphomelib/espmath.h" +#include "esphome/log.h" +#include "esphome/esphal.h" +#include "esphome/espmath.h" #ifdef ARDUINO_ARCH_ESP8266 #include "FunctionalInterrupt.h" #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -197,6 +197,6 @@ pcnt_unit_t next_pcnt_unit = PCNT_UNIT_0; } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PULSE_COUNTER_SENSOR diff --git a/src/esphomelib/sensor/pulse_counter.h b/src/esphome/sensor/pulse_counter.h similarity index 91% rename from src/esphomelib/sensor/pulse_counter.h rename to src/esphome/sensor/pulse_counter.h index 375121a8..3e5b1ac2 100644 --- a/src/esphomelib/sensor/pulse_counter.h +++ b/src/esphome/sensor/pulse_counter.h @@ -1,18 +1,18 @@ -#ifndef ESPHOMELIB_SENSOR_PULSE_COUNTER_H -#define ESPHOMELIB_SENSOR_PULSE_COUNTER_H +#ifndef ESPHOME_SENSOR_PULSE_COUNTER_H +#define ESPHOME_SENSOR_PULSE_COUNTER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_PULSE_COUNTER_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/esphal.h" +#include "esphome/sensor/sensor.h" +#include "esphome/esphal.h" #ifdef ARDUINO_ARCH_ESP32 #include #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -100,8 +100,8 @@ extern pcnt_unit_t next_pcnt_unit; } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_PULSE_COUNTER_SENSOR -#endif //ESPHOMELIB_SENSOR_PULSE_COUNTER_H +#endif //ESPHOME_SENSOR_PULSE_COUNTER_H diff --git a/src/esphomelib/sensor/rotary_encoder.cpp b/src/esphome/sensor/rotary_encoder.cpp similarity index 97% rename from src/esphomelib/sensor/rotary_encoder.cpp rename to src/esphome/sensor/rotary_encoder.cpp index d188a5b9..05a80b6e 100644 --- a/src/esphomelib/sensor/rotary_encoder.cpp +++ b/src/esphome/sensor/rotary_encoder.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ROTARY_ENCODER_SENSOR -#include "esphomelib/sensor/rotary_encoder.h" -#include "esphomelib/log.h" +#include "esphome/sensor/rotary_encoder.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -167,6 +167,6 @@ float RotaryEncoderSensor::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ROTARY_ENCODER_SENSOR diff --git a/src/esphomelib/sensor/rotary_encoder.h b/src/esphome/sensor/rotary_encoder.h similarity index 89% rename from src/esphomelib/sensor/rotary_encoder.h rename to src/esphome/sensor/rotary_encoder.h index 8e5722f4..cb466321 100644 --- a/src/esphomelib/sensor/rotary_encoder.h +++ b/src/esphome/sensor/rotary_encoder.h @@ -1,16 +1,16 @@ // Based on the awesome work of Jochen Krapf: https://github.com/jkDesignDE/MechInputs -#ifndef ESPHOMELIB_ROTARY_ENCODER_H -#define ESPHOMELIB_ROTARY_ENCODER_H +#ifndef ESPHOME_ROTARY_ENCODER_H +#define ESPHOME_ROTARY_ENCODER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ROTARY_ENCODER_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/esphal.h" +#include "esphome/sensor/sensor.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -69,8 +69,8 @@ extern std::vector global_rotary_encoders_; } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ROTARY_ENCODER_SENSOR -#endif //ESPHOMELIB_ROTARY_ENCODER_H +#endif //ESPHOME_ROTARY_ENCODER_H diff --git a/src/esphomelib/sensor/sensor.cpp b/src/esphome/sensor/sensor.cpp similarity index 98% rename from src/esphomelib/sensor/sensor.cpp rename to src/esphome/sensor/sensor.cpp index 1aa6c654..021ead70 100644 --- a/src/esphomelib/sensor/sensor.cpp +++ b/src/esphome/sensor/sensor.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SENSOR #include -#include "esphomelib/sensor/sensor.h" +#include "esphome/sensor/sensor.h" -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -265,6 +265,6 @@ float ValueRangeTrigger::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SENSOR diff --git a/src/esphomelib/sensor/sensor.h b/src/esphome/sensor/sensor.h similarity index 96% rename from src/esphomelib/sensor/sensor.h rename to src/esphome/sensor/sensor.h index 4508d603..e41fc032 100644 --- a/src/esphomelib/sensor/sensor.h +++ b/src/esphome/sensor/sensor.h @@ -1,19 +1,19 @@ -#ifndef ESPHOMELIB_SENSOR_SENSOR_H -#define ESPHOMELIB_SENSOR_SENSOR_H +#ifndef ESPHOME_SENSOR_SENSOR_H +#define ESPHOME_SENSOR_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SENSOR #include #include -#include "esphomelib/component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/automation.h" -#include "esphomelib/sensor/filter.h" +#include "esphome/component.h" +#include "esphome/helpers.h" +#include "esphome/automation.h" +#include "esphome/sensor/filter.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -149,7 +149,7 @@ class Sensor : public Nameable { * On startup, when no state is available yet, this is NAN (not-a-number) and the validity * can be checked using has_state(). * - * This is exposed through a member variable for ease of use in esphomeyaml lambdas. + * This is exposed through a member variable for ease of use in esphome lambdas. */ float state; @@ -406,10 +406,10 @@ SensorPublishAction *Sensor::make_sensor_publish_action() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/sensor/mqtt_sensor_component.h" +#include "esphome/sensor/mqtt_sensor_component.h" #endif //USE_SENSOR -#endif //ESPHOMELIB_SENSOR_SENSOR_H +#endif //ESPHOME_SENSOR_SENSOR_H diff --git a/src/esphomelib/sensor/sht3xd_component.cpp b/src/esphome/sensor/sht3xd_component.cpp similarity index 96% rename from src/esphomelib/sensor/sht3xd_component.cpp rename to src/esphome/sensor/sht3xd_component.cpp index 953d0e61..9d03b6be 100644 --- a/src/esphomelib/sensor/sht3xd_component.cpp +++ b/src/esphome/sensor/sht3xd_component.cpp @@ -2,15 +2,15 @@ // - https://cdn-shop.adafruit.com/product-files/2857/Sensirion_Humidity_SHT3x_Datasheet_digital-767294.pdf // - https://github.com/Sensirion/arduino-sht -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SHT3XD -#include "esphomelib/sensor/sht3xd_component.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" +#include "esphome/sensor/sht3xd_component.h" +#include "esphome/log.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -159,6 +159,6 @@ std::string SHT3XDHumiditySensor::unique_id() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SHT3XD diff --git a/src/esphomelib/sensor/sht3xd_component.h b/src/esphome/sensor/sht3xd_component.h similarity index 85% rename from src/esphomelib/sensor/sht3xd_component.h rename to src/esphome/sensor/sht3xd_component.h index 72e58933..d3be05a9 100644 --- a/src/esphomelib/sensor/sht3xd_component.h +++ b/src/esphome/sensor/sht3xd_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_SHT3XD_COMPONENT_H -#define ESPHOMELIB_SENSOR_SHT3XD_COMPONENT_H +#ifndef ESPHOME_SENSOR_SHT3XD_COMPONENT_H +#define ESPHOME_SENSOR_SHT3XD_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SHT3XD -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -68,8 +68,8 @@ class SHT3XDHumiditySensor : public EmptyPollingParentSensor<1, ICON_WATER_PERCE } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SHT3XD -#endif //ESPHOMELIB_SENSOR_SHT3XD_COMPONENT_H +#endif //ESPHOME_SENSOR_SHT3XD_COMPONENT_H diff --git a/src/esphomelib/sensor/tcs34725.cpp b/src/esphome/sensor/tcs34725.cpp similarity index 97% rename from src/esphomelib/sensor/tcs34725.cpp rename to src/esphome/sensor/tcs34725.cpp index be9a527e..da1b2b10 100644 --- a/src/esphomelib/sensor/tcs34725.cpp +++ b/src/esphome/sensor/tcs34725.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TCS34725 -#include "esphomelib/sensor/tcs34725.h" -#include "esphomelib/espmath.h" -#include "esphomelib/log.h" +#include "esphome/sensor/tcs34725.h" +#include "esphome/espmath.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -150,6 +150,6 @@ TCS34725Component::TCS34725Component(I2CComponent *parent, uint32_t update_inter } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TCS34725 diff --git a/src/esphomelib/sensor/tcs34725.h b/src/esphome/sensor/tcs34725.h similarity index 88% rename from src/esphomelib/sensor/tcs34725.h rename to src/esphome/sensor/tcs34725.h index 3e613e87..2c7efeb9 100644 --- a/src/esphomelib/sensor/tcs34725.h +++ b/src/esphome/sensor/tcs34725.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_TCS34725_H -#define ESPHOMELIB_SENSOR_TCS34725_H +#ifndef ESPHOME_SENSOR_TCS34725_H +#define ESPHOME_SENSOR_TCS34725_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TCS34725 -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/i2c_component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/i2c_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -64,8 +64,8 @@ class TCS34725Component : public PollingComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TCS34725 -#endif //ESPHOMELIB_SENSOR_TCS34725_H +#endif //ESPHOME_SENSOR_TCS34725_H diff --git a/src/esphomelib/sensor/template_sensor.cpp b/src/esphome/sensor/template_sensor.cpp similarity index 82% rename from src/esphomelib/sensor/template_sensor.cpp rename to src/esphome/sensor/template_sensor.cpp index ae7e0304..e11de7f0 100644 --- a/src/esphomelib/sensor/template_sensor.cpp +++ b/src/esphome/sensor/template_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_SENSOR -#include "esphomelib/sensor/template_sensor.h" -#include "esphomelib/log.h" +#include "esphome/sensor/template_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -37,6 +37,6 @@ void TemplateSensor::dump_config() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_SENSOR diff --git a/src/esphomelib/sensor/template_sensor.h b/src/esphome/sensor/template_sensor.h similarity index 62% rename from src/esphomelib/sensor/template_sensor.h rename to src/esphome/sensor/template_sensor.h index 24feaf2c..faff753f 100644 --- a/src/esphomelib/sensor/template_sensor.h +++ b/src/esphome/sensor/template_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_TEMPLATE_SENSOR_H -#define ESPHOMELIB_SENSOR_TEMPLATE_SENSOR_H +#ifndef ESPHOME_SENSOR_TEMPLATE_SENSOR_H +#define ESPHOME_SENSOR_TEMPLATE_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/helpers.h" +#include "esphome/sensor/sensor.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -30,8 +30,8 @@ class TemplateSensor : public PollingSensorComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_SENSOR -#endif //ESPHOMELIB_SENSOR_TEMPLATE_SENSOR_H +#endif //ESPHOME_SENSOR_TEMPLATE_SENSOR_H diff --git a/src/esphomelib/sensor/total_daily_energy.cpp b/src/esphome/sensor/total_daily_energy.cpp similarity index 93% rename from src/esphomelib/sensor/total_daily_energy.cpp rename to src/esphome/sensor/total_daily_energy.cpp index f81a2d72..581cb0a1 100644 --- a/src/esphomelib/sensor/total_daily_energy.cpp +++ b/src/esphome/sensor/total_daily_energy.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TOTAL_DAILY_ENERGY_SENSOR -#include "esphomelib/sensor/total_daily_energy.h" -#include "esphomelib/log.h" +#include "esphome/sensor/total_daily_energy.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -79,6 +79,6 @@ TotalDailyEnergy::TotalDailyEnergy(const std::string &name, time::RealTimeClockC } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TOTAL_DAILY_ENERGY_SENSOR diff --git a/src/esphomelib/sensor/total_daily_energy.h b/src/esphome/sensor/total_daily_energy.h similarity index 69% rename from src/esphomelib/sensor/total_daily_energy.h rename to src/esphome/sensor/total_daily_energy.h index 91853468..3e2af1b5 100644 --- a/src/esphomelib/sensor/total_daily_energy.h +++ b/src/esphome/sensor/total_daily_energy.h @@ -1,16 +1,16 @@ -#ifndef ESPHOMELIB_SENSOR_TOTAL_DAILY_ENERGY_H -#define ESPHOMELIB_SENSOR_TOTAL_DAILY_ENERGY_H +#ifndef ESPHOME_SENSOR_TOTAL_DAILY_ENERGY_H +#define ESPHOME_SENSOR_TOTAL_DAILY_ENERGY_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TOTAL_DAILY_ENERGY_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/time/rtc_component.h" -#include "esphomelib/esppreferences.h" +#include "esphome/component.h" +#include "esphome/sensor/sensor.h" +#include "esphome/time/rtc_component.h" +#include "esphome/esppreferences.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -41,8 +41,8 @@ class TotalDailyEnergy : public Sensor, public Component { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TOTAL_DAILY_ENERGY_SENSOR -#endif //ESPHOMELIB_SENSOR_TOTAL_DAILY_ENERGY_H +#endif //ESPHOME_SENSOR_TOTAL_DAILY_ENERGY_H diff --git a/src/esphomelib/sensor/tsl2561_sensor.cpp b/src/esphome/sensor/tsl2561_sensor.cpp similarity index 97% rename from src/esphomelib/sensor/tsl2561_sensor.cpp rename to src/esphome/sensor/tsl2561_sensor.cpp index f18a2fa8..0a17d2d3 100644 --- a/src/esphomelib/sensor/tsl2561_sensor.cpp +++ b/src/esphome/sensor/tsl2561_sensor.cpp @@ -2,14 +2,14 @@ // - https://cdn-shop.adafruit.com/datasheets/TSL2561.pdf // - https://github.com/adafruit/TSL2561-Arduino-Library -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TSL2561 -#include "esphomelib/sensor/tsl2561_sensor.h" -#include "esphomelib/log.h" +#include "esphome/sensor/tsl2561_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -189,6 +189,6 @@ bool TSL2561Sensor::tsl2561_read_byte(uint8_t register_, uint8_t *value) { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TSL2561 diff --git a/src/esphomelib/sensor/tsl2561_sensor.h b/src/esphome/sensor/tsl2561_sensor.h similarity index 90% rename from src/esphomelib/sensor/tsl2561_sensor.h rename to src/esphome/sensor/tsl2561_sensor.h index 8cc32829..8f18e038 100644 --- a/src/esphomelib/sensor/tsl2561_sensor.h +++ b/src/esphome/sensor/tsl2561_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_TSL2561_SENSOR_H -#define ESPHOMELIB_SENSOR_TSL2561_SENSOR_H +#ifndef ESPHOME_SENSOR_TSL2561_SENSOR_H +#define ESPHOME_SENSOR_TSL2561_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TSL2561 -#include "esphomelib/i2c_component.h" -#include "esphomelib/sensor/sensor.h" +#include "esphome/i2c_component.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -96,8 +96,8 @@ class TSL2561Sensor : public PollingSensorComponent, public I2CDevice { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TSL2561 -#endif //ESPHOMELIB_SENSOR_TSL2561_SENSOR_H +#endif //ESPHOME_SENSOR_TSL2561_SENSOR_H diff --git a/src/esphomelib/sensor/ultrasonic_sensor.cpp b/src/esphome/sensor/ultrasonic_sensor.cpp similarity index 93% rename from src/esphomelib/sensor/ultrasonic_sensor.cpp rename to src/esphome/sensor/ultrasonic_sensor.cpp index ebe37b02..d42ce9eb 100644 --- a/src/esphomelib/sensor/ultrasonic_sensor.cpp +++ b/src/esphome/sensor/ultrasonic_sensor.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ULTRASONIC_SENSOR -#include "esphomelib/sensor/ultrasonic_sensor.h" +#include "esphome/sensor/ultrasonic_sensor.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" +#include "esphome/log.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -95,6 +95,6 @@ int8_t UltrasonicSensorComponent::accuracy_decimals() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ULTRASONIC_SENSOR diff --git a/src/esphomelib/sensor/ultrasonic_sensor.h b/src/esphome/sensor/ultrasonic_sensor.h similarity index 92% rename from src/esphomelib/sensor/ultrasonic_sensor.h rename to src/esphome/sensor/ultrasonic_sensor.h index c2c89947..16d98ffd 100644 --- a/src/esphomelib/sensor/ultrasonic_sensor.h +++ b/src/esphome/sensor/ultrasonic_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SENSOR_ULTRASONIC_SENSOR_H -#define ESPHOMELIB_SENSOR_ULTRASONIC_SENSOR_H +#ifndef ESPHOME_SENSOR_ULTRASONIC_SENSOR_H +#define ESPHOME_SENSOR_ULTRASONIC_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ULTRASONIC_SENSOR -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/esphal.h" +#include "esphome/sensor/sensor.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -88,8 +88,8 @@ class UltrasonicSensorComponent : public PollingSensorComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ULTRASONIC_SENSOR -#endif //ESPHOMELIB_SENSOR_ULTRASONIC_SENSOR_H +#endif //ESPHOME_SENSOR_ULTRASONIC_SENSOR_H diff --git a/src/esphomelib/sensor/uptime_sensor.cpp b/src/esphome/sensor/uptime_sensor.cpp similarity index 89% rename from src/esphomelib/sensor/uptime_sensor.cpp rename to src/esphome/sensor/uptime_sensor.cpp index 32767170..28b28ece 100644 --- a/src/esphomelib/sensor/uptime_sensor.cpp +++ b/src/esphome/sensor/uptime_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_UPTIME_SENSOR -#include "esphomelib/sensor/uptime_sensor.h" -#include "esphomelib/log.h" +#include "esphome/sensor/uptime_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -51,6 +51,6 @@ float UptimeSensor::get_setup_priority() const { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_UPTIME_SENSOR diff --git a/src/esphomelib/sensor/uptime_sensor.h b/src/esphome/sensor/uptime_sensor.h similarity index 69% rename from src/esphomelib/sensor/uptime_sensor.h rename to src/esphome/sensor/uptime_sensor.h index 68633e5c..43fae683 100644 --- a/src/esphomelib/sensor/uptime_sensor.h +++ b/src/esphome/sensor/uptime_sensor.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_UPTIME_SENSOR_H -#define ESPHOMELIB_UPTIME_SENSOR_H +#ifndef ESPHOME_UPTIME_SENSOR_H +#define ESPHOME_UPTIME_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_UPTIME_SENSOR -#include "esphomelib/sensor/sensor.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -30,8 +30,8 @@ class UptimeSensor : public PollingSensorComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_UPTIME_SENSOR -#endif //ESPHOMELIB_UPTIME_SENSOR_H +#endif //ESPHOME_UPTIME_SENSOR_H diff --git a/src/esphomelib/sensor/wifi_signal_sensor.cpp b/src/esphome/sensor/wifi_signal_sensor.cpp similarity index 84% rename from src/esphomelib/sensor/wifi_signal_sensor.cpp rename to src/esphome/sensor/wifi_signal_sensor.cpp index 3056d23c..fa5179fc 100644 --- a/src/esphomelib/sensor/wifi_signal_sensor.cpp +++ b/src/esphome/sensor/wifi_signal_sensor.cpp @@ -1,16 +1,16 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_WIFI_SIGNAL_SENSOR -#include "esphomelib/sensor/wifi_signal_sensor.h" +#include "esphome/sensor/wifi_signal_sensor.h" #ifdef ARDUINO_ARCH_ESP32 #include #else #include #endif -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -44,6 +44,6 @@ void WiFiSignalSensor::dump_config() { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_WIFI_SIGNAL_SENSOR diff --git a/src/esphomelib/sensor/wifi_signal_sensor.h b/src/esphome/sensor/wifi_signal_sensor.h similarity index 66% rename from src/esphomelib/sensor/wifi_signal_sensor.h rename to src/esphome/sensor/wifi_signal_sensor.h index dcf9972b..dfe1f250 100644 --- a/src/esphomelib/sensor/wifi_signal_sensor.h +++ b/src/esphome/sensor/wifi_signal_sensor.h @@ -1,13 +1,13 @@ -#ifndef ESPHOMELIB_SENSOR_WIFI_SIGNAL_SENSOR_H -#define ESPHOMELIB_SENSOR_WIFI_SIGNAL_SENSOR_H +#ifndef ESPHOME_SENSOR_WIFI_SIGNAL_SENSOR_H +#define ESPHOME_SENSOR_WIFI_SIGNAL_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_WIFI_SIGNAL_SENSOR -#include "esphomelib/sensor/sensor.h" +#include "esphome/sensor/sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace sensor { @@ -27,8 +27,8 @@ class WiFiSignalSensor : public PollingSensorComponent { } // namespace sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_WIFI_SIGNAL_SENSOR -#endif //ESPHOMELIB_SENSOR_WIFI_SIGNAL_SENSOR_H +#endif //ESPHOME_SENSOR_WIFI_SIGNAL_SENSOR_H diff --git a/src/esphomelib/spi_component.cpp b/src/esphome/spi_component.cpp similarity index 95% rename from src/esphomelib/spi_component.cpp rename to src/esphome/spi_component.cpp index 64a427d0..44c188fd 100644 --- a/src/esphomelib/spi_component.cpp +++ b/src/esphome/spi_component.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SPI -#include "esphomelib/spi_component.h" -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" +#include "esphome/spi_component.h" +#include "esphome/log.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "spi"; @@ -145,6 +145,6 @@ bool HOT SPIDevice::high_speed() { return false; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SPI diff --git a/src/esphomelib/spi_component.h b/src/esphome/spi_component.h similarity index 81% rename from src/esphomelib/spi_component.h rename to src/esphome/spi_component.h index 66e44eb6..a810d779 100644 --- a/src/esphomelib/spi_component.h +++ b/src/esphome/spi_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SPI_COMPONENT_H -#define ESPHOMELIB_SPI_COMPONENT_H +#ifndef ESPHOME_SPI_COMPONENT_H +#define ESPHOME_SPI_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SPI -#include "esphomelib/component.h" -#include "esphomelib/esphal.h" +#include "esphome/component.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN class SPIComponent : public Component { public: @@ -74,8 +74,8 @@ class SPIDevice { -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SPI -#endif //ESPHOMELIB_SPI_COMPONENT_H +#endif //ESPHOME_SPI_COMPONENT_H diff --git a/src/esphomelib/status_led.cpp b/src/esphome/status_led.cpp similarity index 86% rename from src/esphomelib/status_led.cpp rename to src/esphome/status_led.cpp index 6fe909fa..550b460a 100644 --- a/src/esphomelib/status_led.cpp +++ b/src/esphome/status_led.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_STATUS_LED -#include "esphomelib/status_led.h" -#include "esphomelib/log.h" +#include "esphome/status_led.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "status_led"; @@ -39,6 +39,6 @@ float StatusLEDComponent::get_loop_priority() const { return 50.0f; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_STATUS_LED diff --git a/src/esphomelib/status_led.h b/src/esphome/status_led.h similarity index 62% rename from src/esphomelib/status_led.h rename to src/esphome/status_led.h index b94a6b85..23f66996 100644 --- a/src/esphomelib/status_led.h +++ b/src/esphome/status_led.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_STATUS_LED_H -#define ESPHOMELIB_STATUS_LED_H +#ifndef ESPHOME_STATUS_LED_H +#define ESPHOME_STATUS_LED_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_STATUS_LED -#include "esphomelib/component.h" -#include "esphomelib/esphal.h" +#include "esphome/component.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN class StatusLEDComponent : public Component { public: @@ -26,8 +26,8 @@ class StatusLEDComponent : public Component { extern StatusLEDComponent *global_status_led; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_STATUS_LED -#endif //ESPHOMELIB_STATUS_LED_H +#endif //ESPHOME_STATUS_LED_H diff --git a/src/esphomelib/stepper/a4988.cpp b/src/esphome/stepper/a4988.cpp similarity index 90% rename from src/esphomelib/stepper/a4988.cpp rename to src/esphome/stepper/a4988.cpp index b7c63f99..8a090fa2 100644 --- a/src/esphomelib/stepper/a4988.cpp +++ b/src/esphome/stepper/a4988.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_A4988 -#include "esphomelib/stepper/a4988.h" -#include "esphomelib/log.h" +#include "esphome/stepper/a4988.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace stepper { @@ -62,6 +62,6 @@ void A4988::set_sleep_pin(const GPIOOutputPin &sleep_pin) { } // namespace stepper -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_A4988 diff --git a/src/esphomelib/stepper/a4988.h b/src/esphome/stepper/a4988.h similarity index 63% rename from src/esphomelib/stepper/a4988.h rename to src/esphome/stepper/a4988.h index 0a6c2773..b89f502a 100644 --- a/src/esphomelib/stepper/a4988.h +++ b/src/esphome/stepper/a4988.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_STEPPER_A4988_H -#define ESPHOMELIB_STEPPER_A4988_H +#ifndef ESPHOME_STEPPER_A4988_H +#define ESPHOME_STEPPER_A4988_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_A4988 -#include "esphomelib/component.h" -#include "esphomelib/stepper/stepper.h" -#include "esphomelib/esphal.h" +#include "esphome/component.h" +#include "esphome/stepper/stepper.h" +#include "esphome/esphal.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace stepper { @@ -31,8 +31,8 @@ class A4988 : public Stepper, public Component { } // namespace stepper -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_A4988 -#endif //ESPHOMELIB_STEPPER_A4988_H +#endif //ESPHOME_STEPPER_A4988_H diff --git a/src/esphomelib/stepper/stepper.cpp b/src/esphome/stepper/stepper.cpp similarity index 89% rename from src/esphomelib/stepper/stepper.cpp rename to src/esphome/stepper/stepper.cpp index a3c29f84..ac5bfd1a 100644 --- a/src/esphomelib/stepper/stepper.cpp +++ b/src/esphome/stepper/stepper.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_STEPPER -#include "esphomelib/stepper/stepper.h" -#include "esphomelib/log.h" -#include "esphomelib/espmath.h" -#include "esphomelib/helpers.h" +#include "esphome/stepper/stepper.h" +#include "esphome/log.h" +#include "esphome/espmath.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace stepper { @@ -73,6 +73,6 @@ bool Stepper::has_reached_target() { } // namespace stepper -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_STEPPER diff --git a/src/esphomelib/stepper/stepper.h b/src/esphome/stepper/stepper.h similarity index 90% rename from src/esphomelib/stepper/stepper.h rename to src/esphome/stepper/stepper.h index 9fbb2ed2..58bb7fc3 100644 --- a/src/esphomelib/stepper/stepper.h +++ b/src/esphome/stepper/stepper.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_STEPPER_STEPPER_H -#define ESPHOMELIB_STEPPER_STEPPER_H +#ifndef ESPHOME_STEPPER_STEPPER_H +#define ESPHOME_STEPPER_STEPPER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_STEPPER -#include "esphomelib/component.h" -#include "esphomelib/automation.h" +#include "esphome/component.h" +#include "esphome/automation.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace stepper { @@ -113,8 +113,8 @@ void SetTargetAction::play(T x) { } // namespace stepper -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_STEPPER -#endif //ESPHOMELIB_STEPPER_STEPPER_H +#endif //ESPHOME_STEPPER_STEPPER_H diff --git a/src/esphomelib/stepper/uln2003.cpp b/src/esphome/stepper/uln2003.cpp similarity index 94% rename from src/esphomelib/stepper/uln2003.cpp rename to src/esphome/stepper/uln2003.cpp index a00aabb8..0bd99e7a 100644 --- a/src/esphomelib/stepper/uln2003.cpp +++ b/src/esphome/stepper/uln2003.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ULN2003 -#include "esphomelib/stepper/uln2003.h" -#include "esphomelib/log.h" +#include "esphome/stepper/uln2003.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace stepper { @@ -113,6 +113,6 @@ void ULN2003::set_step_mode(ULN2003StepMode step_mode) { } // namespace stepper -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ULN2003 diff --git a/src/esphomelib/stepper/uln2003.h b/src/esphome/stepper/uln2003.h similarity index 75% rename from src/esphomelib/stepper/uln2003.h rename to src/esphome/stepper/uln2003.h index f361bd8f..7b6848a2 100644 --- a/src/esphomelib/stepper/uln2003.h +++ b/src/esphome/stepper/uln2003.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_STEPPER_ULN2003_H -#define ESPHOMELIB_STEPPER_ULN2003_H +#ifndef ESPHOME_STEPPER_ULN2003_H +#define ESPHOME_STEPPER_ULN2003_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_ULN2003 -#include "esphomelib/component.h" -#include "esphomelib/stepper/stepper.h" +#include "esphome/component.h" +#include "esphome/stepper/stepper.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace stepper { @@ -44,8 +44,8 @@ class ULN2003 : public Stepper, public Component { } // namespace stepper -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_ULN2003 -#endif //ESPHOMELIB_STEPPER_ULN2003_H +#endif //ESPHOME_STEPPER_ULN2003_H diff --git a/src/esphomelib/switch_/custom_switch.cpp b/src/esphome/switch_/custom_switch.cpp similarity index 75% rename from src/esphomelib/switch_/custom_switch.cpp rename to src/esphome/switch_/custom_switch.cpp index 38562fc3..b917ebd3 100644 --- a/src/esphomelib/switch_/custom_switch.cpp +++ b/src/esphome/switch_/custom_switch.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_SWITCH -#include "esphomelib/switch_/custom_switch.h" -#include "esphomelib/log.h" +#include "esphome/switch_/custom_switch.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -25,6 +25,6 @@ void CustomSwitchConstructor::dump_config() { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_SWITCH diff --git a/src/esphomelib/switch_/custom_switch.h b/src/esphome/switch_/custom_switch.h similarity index 57% rename from src/esphomelib/switch_/custom_switch.h rename to src/esphome/switch_/custom_switch.h index b236a061..590ed4b9 100644 --- a/src/esphomelib/switch_/custom_switch.h +++ b/src/esphome/switch_/custom_switch.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_CUSTOM_SWITCH_H -#define ESPHOMELIB_CUSTOM_SWITCH_H +#ifndef ESPHOME_CUSTOM_SWITCH_H +#define ESPHOME_CUSTOM_SWITCH_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_SWITCH -#include "esphomelib/switch_/switch.h" -#include "esphomelib/component.h" +#include "esphome/switch_/switch.h" +#include "esphome/component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -25,8 +25,8 @@ class CustomSwitchConstructor : public Component { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_SWITCH -#endif //ESPHOMELIB_CUSTOM_SWITCH_H +#endif //ESPHOME_CUSTOM_SWITCH_H diff --git a/src/esphomelib/switch_/gpio_switch.cpp b/src/esphome/switch_/gpio_switch.cpp similarity index 93% rename from src/esphomelib/switch_/gpio_switch.cpp rename to src/esphome/switch_/gpio_switch.cpp index 940809dd..caea0d31 100644 --- a/src/esphomelib/switch_/gpio_switch.cpp +++ b/src/esphome/switch_/gpio_switch.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_GPIO_SWITCH -#include "esphomelib/switch_/gpio_switch.h" -#include "esphomelib/log.h" +#include "esphome/switch_/gpio_switch.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -91,6 +91,6 @@ void GPIOSwitch::set_interlock(const std::vector &interlock) { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_GPIO_SWITCH diff --git a/src/esphomelib/switch_/gpio_switch.h b/src/esphome/switch_/gpio_switch.h similarity index 73% rename from src/esphomelib/switch_/gpio_switch.h rename to src/esphome/switch_/gpio_switch.h index ffadb9f7..65da6860 100644 --- a/src/esphomelib/switch_/gpio_switch.h +++ b/src/esphome/switch_/gpio_switch.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_SWITCH_GPIO_SWITCH_H -#define ESPHOMELIB_SWITCH_GPIO_SWITCH_H +#ifndef ESPHOME_SWITCH_GPIO_SWITCH_H +#define ESPHOME_SWITCH_GPIO_SWITCH_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_GPIO_SWITCH -#include "esphomelib/component.h" -#include "esphomelib/esphal.h" -#include "esphomelib/switch_/switch.h" +#include "esphome/component.h" +#include "esphome/esphal.h" +#include "esphome/switch_/switch.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -44,8 +44,8 @@ class GPIOSwitch : public Switch, public Component { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_GPIO_SWITCH -#endif //ESPHOMELIB_SWITCH_GPIO_SWITCH_H +#endif //ESPHOME_SWITCH_GPIO_SWITCH_H diff --git a/src/esphomelib/switch_/mqtt_switch_component.cpp b/src/esphome/switch_/mqtt_switch_component.cpp similarity index 92% rename from src/esphomelib/switch_/mqtt_switch_component.cpp rename to src/esphome/switch_/mqtt_switch_component.cpp index 4d9e09db..30e30268 100644 --- a/src/esphomelib/switch_/mqtt_switch_component.cpp +++ b/src/esphome/switch_/mqtt_switch_component.cpp @@ -1,14 +1,14 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_SWITCH -#include "esphomelib/switch_/mqtt_switch_component.h" +#include "esphome/switch_/mqtt_switch_component.h" #include -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -74,6 +74,6 @@ bool MQTTSwitchComponent::publish_state(bool state) { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_SWITCH diff --git a/src/esphomelib/switch_/mqtt_switch_component.h b/src/esphome/switch_/mqtt_switch_component.h similarity index 69% rename from src/esphomelib/switch_/mqtt_switch_component.h rename to src/esphome/switch_/mqtt_switch_component.h index a39c5fb2..8e38dc3d 100644 --- a/src/esphomelib/switch_/mqtt_switch_component.h +++ b/src/esphome/switch_/mqtt_switch_component.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_SWITCH_MQTT_SWITCH_COMPONENT_H -#define ESPHOMELIB_SWITCH_MQTT_SWITCH_COMPONENT_H +#ifndef ESPHOME_SWITCH_MQTT_SWITCH_COMPONENT_H +#define ESPHOME_SWITCH_MQTT_SWITCH_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_SWITCH -#include "esphomelib/binary_sensor/mqtt_binary_sensor_component.h" -#include "esphomelib/mqtt/mqtt_component.h" -#include "esphomelib/switch_/switch.h" +#include "esphome/binary_sensor/mqtt_binary_sensor_component.h" +#include "esphome/mqtt/mqtt_component.h" +#include "esphome/switch_/switch.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -44,8 +44,8 @@ class MQTTSwitchComponent : public mqtt::MQTTComponent { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_SWITCH -#endif //ESPHOMELIB_SWITCH_MQTT_SWITCH_COMPONENT_H +#endif //ESPHOME_SWITCH_MQTT_SWITCH_COMPONENT_H diff --git a/src/esphomelib/switch_/output_switch.cpp b/src/esphome/switch_/output_switch.cpp similarity index 83% rename from src/esphomelib/switch_/output_switch.cpp rename to src/esphome/switch_/output_switch.cpp index 681179ec..b40b2f37 100644 --- a/src/esphomelib/switch_/output_switch.cpp +++ b/src/esphome/switch_/output_switch.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OUTPUT_SWITCH -#include "esphomelib/switch_/output_switch.h" -#include "esphomelib/log.h" +#include "esphome/switch_/output_switch.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -43,6 +43,6 @@ void OutputSwitch::dump_config() { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OUTPUT_SWITCH diff --git a/src/esphomelib/switch_/output_switch.h b/src/esphome/switch_/output_switch.h similarity index 69% rename from src/esphomelib/switch_/output_switch.h rename to src/esphome/switch_/output_switch.h index 85f06d1f..3ee08339 100644 --- a/src/esphomelib/switch_/output_switch.h +++ b/src/esphome/switch_/output_switch.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SWITCH_OUTPUT_SWITCH -#define ESPHOMELIB_SWITCH_OUTPUT_SWITCH +#ifndef ESPHOME_SWITCH_OUTPUT_SWITCH +#define ESPHOME_SWITCH_OUTPUT_SWITCH -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_OUTPUT_SWITCH -#include "esphomelib/output/binary_output.h" -#include "esphomelib/switch_/switch.h" +#include "esphome/output/binary_output.h" +#include "esphome/switch_/switch.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -32,8 +32,8 @@ class OutputSwitch : public Switch, public Component { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_OUTPUT_SWITCH -#endif //ESPHOMELIB_SWITCH_OUTPUT_SWITCH +#endif //ESPHOME_SWITCH_OUTPUT_SWITCH diff --git a/src/esphomelib/switch_/restart_switch.cpp b/src/esphome/switch_/restart_switch.cpp similarity index 79% rename from src/esphomelib/switch_/restart_switch.cpp rename to src/esphome/switch_/restart_switch.cpp index 5e94e1bd..e011a06d 100644 --- a/src/esphomelib/switch_/restart_switch.cpp +++ b/src/esphome/switch_/restart_switch.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_RESTART_SWITCH -#include "esphomelib/switch_/restart_switch.h" +#include "esphome/switch_/restart_switch.h" -#include "esphomelib/log.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -36,6 +36,6 @@ void RestartSwitch::dump_config() { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_RESTART_SWITCH diff --git a/src/esphomelib/switch_/restart_switch.h b/src/esphome/switch_/restart_switch.h similarity index 63% rename from src/esphomelib/switch_/restart_switch.h rename to src/esphome/switch_/restart_switch.h index 3b33a813..350ebe3b 100644 --- a/src/esphomelib/switch_/restart_switch.h +++ b/src/esphome/switch_/restart_switch.h @@ -1,12 +1,12 @@ -#ifndef ESPHOMELIB_RESTART_SWITCH_H -#define ESPHOMELIB_RESTART_SWITCH_H +#ifndef ESPHOME_RESTART_SWITCH_H +#define ESPHOME_RESTART_SWITCH_H -#include "esphomelib/switch_/switch.h" -#include "esphomelib/defines.h" +#include "esphome/switch_/switch.h" +#include "esphome/defines.h" #ifdef USE_RESTART_SWITCH -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -25,8 +25,8 @@ class RestartSwitch : public Switch, public Component { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_RESTART_SWITCH -#endif //ESPHOMELIB_RESTART_SWITCH_H +#endif //ESPHOME_RESTART_SWITCH_H diff --git a/src/esphomelib/switch_/shutdown_switch.cpp b/src/esphome/switch_/shutdown_switch.cpp similarity index 82% rename from src/esphomelib/switch_/shutdown_switch.cpp rename to src/esphome/switch_/shutdown_switch.cpp index fd2efe8d..c334a8a3 100644 --- a/src/esphomelib/switch_/shutdown_switch.cpp +++ b/src/esphome/switch_/shutdown_switch.cpp @@ -1,13 +1,13 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SHUTDOWN_SWITCH -#include "esphomelib/switch_/shutdown_switch.h" -#include "esphomelib/log.h" +#include "esphome/switch_/shutdown_switch.h" +#include "esphome/log.h" #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -41,6 +41,6 @@ void ShutdownSwitch::dump_config() { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SHUTDOWN_SWITCH diff --git a/src/esphomelib/switch_/shutdown_switch.h b/src/esphome/switch_/shutdown_switch.h similarity index 62% rename from src/esphomelib/switch_/shutdown_switch.h rename to src/esphome/switch_/shutdown_switch.h index c666f5da..6d6d7195 100644 --- a/src/esphomelib/switch_/shutdown_switch.h +++ b/src/esphome/switch_/shutdown_switch.h @@ -1,12 +1,12 @@ -#ifndef ESPHOMELIB_SWITCH_SHUTDOWN_SWITCH_H -#define ESPHOMELIB_SWITCH_SHUTDOWN_SWITCH_H +#ifndef ESPHOME_SWITCH_SHUTDOWN_SWITCH_H +#define ESPHOME_SWITCH_SHUTDOWN_SWITCH_H -#include "esphomelib/switch_/switch.h" -#include "esphomelib/defines.h" +#include "esphome/switch_/switch.h" +#include "esphome/defines.h" #ifdef USE_SHUTDOWN_SWITCH -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -24,9 +24,9 @@ class ShutdownSwitch : public Switch, public Component { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_RESTART_SWITCH -#endif //ESPHOMELIB_SWITCH_SHUTDOWN_SWITCH_H +#endif //ESPHOME_SWITCH_SHUTDOWN_SWITCH_H diff --git a/src/esphomelib/switch_/switch.cpp b/src/esphome/switch_/switch.cpp similarity index 92% rename from src/esphomelib/switch_/switch.cpp rename to src/esphome/switch_/switch.cpp index 867f1340..7afefdf2 100644 --- a/src/esphomelib/switch_/switch.cpp +++ b/src/esphome/switch_/switch.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SWITCH -#include "esphomelib/switch_/switch.h" -#include "esphomelib/log.h" -#include "esphomelib/esppreferences.h" +#include "esphome/switch_/switch.h" +#include "esphome/log.h" +#include "esphome/esppreferences.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -104,6 +104,6 @@ SwitchTurnOffTrigger::SwitchTurnOffTrigger(Switch *switch_) { } } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SWITCH diff --git a/src/esphomelib/switch_/switch.h b/src/esphome/switch_/switch.h similarity index 95% rename from src/esphomelib/switch_/switch.h rename to src/esphome/switch_/switch.h index edbc8933..4f9bbd60 100644 --- a/src/esphomelib/switch_/switch.h +++ b/src/esphome/switch_/switch.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_SWITCH_SWITCH_H -#define ESPHOMELIB_SWITCH_SWITCH_H +#ifndef ESPHOME_SWITCH_SWITCH_H +#define ESPHOME_SWITCH_SWITCH_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SWITCH -#include "esphomelib/component.h" -#include "esphomelib/automation.h" -#include "esphomelib/esppreferences.h" +#include "esphome/component.h" +#include "esphome/automation.h" +#include "esphome/esppreferences.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -311,10 +311,10 @@ SwitchPublishAction *Switch::make_switch_publish_action() { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/switch_/mqtt_switch_component.h" +#include "esphome/switch_/mqtt_switch_component.h" #endif //USE_SWITCH -#endif //ESPHOMELIB_SWITCH_SWITCH_H +#endif //ESPHOME_SWITCH_SWITCH_H diff --git a/src/esphomelib/switch_/template_switch.cpp b/src/esphome/switch_/template_switch.cpp similarity index 93% rename from src/esphomelib/switch_/template_switch.cpp rename to src/esphome/switch_/template_switch.cpp index 855449d1..1e61d0cd 100644 --- a/src/esphomelib/switch_/template_switch.cpp +++ b/src/esphome/switch_/template_switch.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_SWITCH -#include "esphomelib/switch_/template_switch.h" -#include "esphomelib/log.h" +#include "esphome/switch_/template_switch.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -87,6 +87,6 @@ void TemplateSwitch::set_assumed_state(bool assumed_state) { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_SWITCH diff --git a/src/esphomelib/switch_/template_switch.h b/src/esphome/switch_/template_switch.h similarity index 77% rename from src/esphomelib/switch_/template_switch.h rename to src/esphome/switch_/template_switch.h index 3dd04128..eae155d9 100644 --- a/src/esphomelib/switch_/template_switch.h +++ b/src/esphome/switch_/template_switch.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SWITCH_TEMPLATE_SWITCH_H -#define ESPHOMELIB_SWITCH_TEMPLATE_SWITCH_H +#ifndef ESPHOME_SWITCH_TEMPLATE_SWITCH_H +#define ESPHOME_SWITCH_TEMPLATE_SWITCH_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_SWITCH -#include "esphomelib/switch_/switch.h" -#include "esphomelib/helpers.h" +#include "esphome/switch_/switch.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -45,8 +45,8 @@ class TemplateSwitch : public Switch, public Component { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_SWITCH -#endif //ESPHOMELIB_SWITCH_TEMPLATE_SWITCH_H +#endif //ESPHOME_SWITCH_TEMPLATE_SWITCH_H diff --git a/src/esphomelib/switch_/uart_switch.cpp b/src/esphome/switch_/uart_switch.cpp similarity index 81% rename from src/esphomelib/switch_/uart_switch.cpp rename to src/esphome/switch_/uart_switch.cpp index 58eb5ab0..6df59c9e 100644 --- a/src/esphomelib/switch_/uart_switch.cpp +++ b/src/esphome/switch_/uart_switch.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_UART_SWITCH -#include "esphomelib/switch_/uart_switch.h" -#include "esphomelib/log.h" +#include "esphome/switch_/uart_switch.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -33,6 +33,6 @@ void UARTSwitch::dump_config() { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_UART_SWITCH diff --git a/src/esphomelib/switch_/uart_switch.h b/src/esphome/switch_/uart_switch.h similarity index 60% rename from src/esphomelib/switch_/uart_switch.h rename to src/esphome/switch_/uart_switch.h index e24e7603..3bfad54a 100644 --- a/src/esphomelib/switch_/uart_switch.h +++ b/src/esphome/switch_/uart_switch.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_UART_SWITCH_H -#define ESPHOMELIB_UART_SWITCH_H +#ifndef ESPHOME_UART_SWITCH_H +#define ESPHOME_UART_SWITCH_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_UART_SWITCH -#include "esphomelib/switch_/switch.h" -#include "esphomelib/uart_component.h" +#include "esphome/switch_/switch.h" +#include "esphome/uart_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace switch_ { @@ -25,8 +25,8 @@ class UARTSwitch : public Switch, public UARTDevice, public Component { } // namespace switch_ -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_UART_SWITCH -#endif //ESPHOMELIB_UART_SWITCH_H +#endif //ESPHOME_UART_SWITCH_H diff --git a/src/esphomelib/text_sensor/custom_text_sensor.cpp b/src/esphome/text_sensor/custom_text_sensor.cpp similarity index 77% rename from src/esphomelib/text_sensor/custom_text_sensor.cpp rename to src/esphome/text_sensor/custom_text_sensor.cpp index c7020597..f473e163 100644 --- a/src/esphomelib/text_sensor/custom_text_sensor.cpp +++ b/src/esphome/text_sensor/custom_text_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_TEXT_SENSOR -#include "esphomelib/text_sensor/custom_text_sensor.h" -#include "esphomelib/log.h" +#include "esphome/text_sensor/custom_text_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -25,6 +25,6 @@ void CustomTextSensorConstructor::dump_config() { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_TEXT_SENSOR diff --git a/src/esphomelib/text_sensor/custom_text_sensor.h b/src/esphome/text_sensor/custom_text_sensor.h similarity index 55% rename from src/esphomelib/text_sensor/custom_text_sensor.h rename to src/esphome/text_sensor/custom_text_sensor.h index fe51d723..1a460407 100644 --- a/src/esphomelib/text_sensor/custom_text_sensor.h +++ b/src/esphome/text_sensor/custom_text_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_TEXT_SENSOR_CUSTOM_TEXT_SENSOR_H -#define ESPHOMELIB_TEXT_SENSOR_CUSTOM_TEXT_SENSOR_H +#ifndef ESPHOME_TEXT_SENSOR_CUSTOM_TEXT_SENSOR_H +#define ESPHOME_TEXT_SENSOR_CUSTOM_TEXT_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_CUSTOM_TEXT_SENSOR -#include "esphomelib/text_sensor/text_sensor.h" -#include "esphomelib/log.h" +#include "esphome/text_sensor/text_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -26,8 +26,8 @@ class CustomTextSensorConstructor : public Component { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_CUSTOM_TEXT_SENSOR -#endif //ESPHOMELIB_TEXT_SENSOR_CUSTOM_TEXT_SENSOR_H +#endif //ESPHOME_TEXT_SENSOR_CUSTOM_TEXT_SENSOR_H diff --git a/src/esphomelib/text_sensor/homeassistant_text_sensor.cpp b/src/esphome/text_sensor/homeassistant_text_sensor.cpp similarity index 78% rename from src/esphomelib/text_sensor/homeassistant_text_sensor.cpp rename to src/esphome/text_sensor/homeassistant_text_sensor.cpp index 7aa4e870..f49b11a8 100644 --- a/src/esphomelib/text_sensor/homeassistant_text_sensor.cpp +++ b/src/esphome/text_sensor/homeassistant_text_sensor.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HOMEASSISTANT_TEXT_SENSOR -#include "esphomelib/text_sensor/homeassistant_text_sensor.h" -#include "esphomelib/api/api_server.h" -#include "esphomelib/log.h" +#include "esphome/text_sensor/homeassistant_text_sensor.h" +#include "esphome/api/api_server.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -29,6 +29,6 @@ void HomeassistantTextSensor::setup() { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HOMEASSISTANT_TEXT_SENSOR diff --git a/src/esphomelib/text_sensor/homeassistant_text_sensor.h b/src/esphome/text_sensor/homeassistant_text_sensor.h similarity index 56% rename from src/esphomelib/text_sensor/homeassistant_text_sensor.h rename to src/esphome/text_sensor/homeassistant_text_sensor.h index 473e8170..6a330ea3 100644 --- a/src/esphomelib/text_sensor/homeassistant_text_sensor.h +++ b/src/esphome/text_sensor/homeassistant_text_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_HOMEASSISTANT_TEXT_SENSOR_H -#define ESPHOMELIB_HOMEASSISTANT_TEXT_SENSOR_H +#ifndef ESPHOME_HOMEASSISTANT_TEXT_SENSOR_H +#define ESPHOME_HOMEASSISTANT_TEXT_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HOMEASSISTANT_TEXT_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/text_sensor/text_sensor.h" +#include "esphome/component.h" +#include "esphome/text_sensor/text_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -23,8 +23,8 @@ class HomeassistantTextSensor : public TextSensor, public Component { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HOMEASSISTANT_TEXT_SENSOR -#endif //ESPHOMELIB_HOMEASSISTANT_TEXT_SENSOR_H +#endif //ESPHOME_HOMEASSISTANT_TEXT_SENSOR_H diff --git a/src/esphomelib/text_sensor/mqtt_subscribe_text_sensor.cpp b/src/esphome/text_sensor/mqtt_subscribe_text_sensor.cpp similarity index 83% rename from src/esphomelib/text_sensor/mqtt_subscribe_text_sensor.cpp rename to src/esphome/text_sensor/mqtt_subscribe_text_sensor.cpp index 42a3fe55..8d485dfa 100644 --- a/src/esphomelib/text_sensor/mqtt_subscribe_text_sensor.cpp +++ b/src/esphome/text_sensor/mqtt_subscribe_text_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_SUBSCRIBE_TEXT_SENSOR -#include "esphomelib/text_sensor/mqtt_subscribe_text_sensor.h" -#include "esphomelib/log.h" +#include "esphome/text_sensor/mqtt_subscribe_text_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -33,6 +33,6 @@ void MQTTSubscribeTextSensor::dump_config() { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_SUBSCRIBE_TEXT_SENSOR diff --git a/src/esphomelib/text_sensor/mqtt_subscribe_text_sensor.h b/src/esphome/text_sensor/mqtt_subscribe_text_sensor.h similarity index 56% rename from src/esphomelib/text_sensor/mqtt_subscribe_text_sensor.h rename to src/esphome/text_sensor/mqtt_subscribe_text_sensor.h index b9775599..99ffd800 100644 --- a/src/esphomelib/text_sensor/mqtt_subscribe_text_sensor.h +++ b/src/esphome/text_sensor/mqtt_subscribe_text_sensor.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_MQTT_SUBSCRIBE_TEXT_SENSOR_H -#define ESPHOMELIB_MQTT_SUBSCRIBE_TEXT_SENSOR_H +#ifndef ESPHOME_MQTT_SUBSCRIBE_TEXT_SENSOR_H +#define ESPHOME_MQTT_SUBSCRIBE_TEXT_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_SUBSCRIBE_TEXT_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/text_sensor/text_sensor.h" -#include "esphomelib/mqtt/mqtt_client_component.h" +#include "esphome/component.h" +#include "esphome/text_sensor/text_sensor.h" +#include "esphome/mqtt/mqtt_client_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -29,8 +29,8 @@ class MQTTSubscribeTextSensor : public TextSensor, public Component { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_SUBSCRIBE_TEXT_SENSOR -#endif //ESPHOMELIB_MQTT_SUBSCRIBE_TEXT_SENSOR_H +#endif //ESPHOME_MQTT_SUBSCRIBE_TEXT_SENSOR_H diff --git a/src/esphomelib/text_sensor/mqtt_text_sensor.cpp b/src/esphome/text_sensor/mqtt_text_sensor.cpp similarity index 89% rename from src/esphomelib/text_sensor/mqtt_text_sensor.cpp rename to src/esphome/text_sensor/mqtt_text_sensor.cpp index dfdb2f29..f07f1a24 100644 --- a/src/esphomelib/text_sensor/mqtt_text_sensor.cpp +++ b/src/esphome/text_sensor/mqtt_text_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_TEXT_SENSOR -#include "esphomelib/text_sensor/mqtt_text_sensor.h" -#include "esphomelib/log.h" +#include "esphome/text_sensor/mqtt_text_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -57,6 +57,6 @@ std::string MQTTTextSensor::friendly_name() const { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_TEXT_SENSOR diff --git a/src/esphomelib/text_sensor/mqtt_text_sensor.h b/src/esphome/text_sensor/mqtt_text_sensor.h similarity index 65% rename from src/esphomelib/text_sensor/mqtt_text_sensor.h rename to src/esphome/text_sensor/mqtt_text_sensor.h index 5d602851..40cbd910 100644 --- a/src/esphomelib/text_sensor/mqtt_text_sensor.h +++ b/src/esphome/text_sensor/mqtt_text_sensor.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_MQTT_TEXT_SENSOR_H -#define ESPHOMELIB_MQTT_TEXT_SENSOR_H +#ifndef ESPHOME_MQTT_TEXT_SENSOR_H +#define ESPHOME_MQTT_TEXT_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_MQTT_TEXT_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/mqtt/mqtt_component.h" -#include "esphomelib/text_sensor/text_sensor.h" +#include "esphome/component.h" +#include "esphome/mqtt/mqtt_component.h" +#include "esphome/text_sensor/text_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -39,8 +39,8 @@ class MQTTTextSensor : public mqtt::MQTTComponent { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_MQTT_TEXT_SENSOR -#endif //ESPHOMELIB_MQTT_TEXT_SENSOR_H +#endif //ESPHOME_MQTT_TEXT_SENSOR_H diff --git a/src/esphomelib/text_sensor/template_text_sensor.cpp b/src/esphome/text_sensor/template_text_sensor.cpp similarity index 82% rename from src/esphomelib/text_sensor/template_text_sensor.cpp rename to src/esphome/text_sensor/template_text_sensor.cpp index 0e8d8b72..2e24e1f6 100644 --- a/src/esphomelib/text_sensor/template_text_sensor.cpp +++ b/src/esphome/text_sensor/template_text_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_TEXT_SENSOR -#include "esphomelib/text_sensor/template_text_sensor.h" -#include "esphomelib/log.h" +#include "esphome/text_sensor/template_text_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -36,6 +36,6 @@ void TemplateTextSensor::dump_config() { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_TEXT_SENSOR diff --git a/src/esphomelib/text_sensor/template_text_sensor.h b/src/esphome/text_sensor/template_text_sensor.h similarity index 61% rename from src/esphomelib/text_sensor/template_text_sensor.h rename to src/esphome/text_sensor/template_text_sensor.h index 8560f38f..8e505840 100644 --- a/src/esphomelib/text_sensor/template_text_sensor.h +++ b/src/esphome/text_sensor/template_text_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_TEXT_SENSOR_TEMPLATE_TEXT_SENSOR_H -#define ESPHOMELIB_TEXT_SENSOR_TEMPLATE_TEXT_SENSOR_H +#ifndef ESPHOME_TEXT_SENSOR_TEMPLATE_TEXT_SENSOR_H +#define ESPHOME_TEXT_SENSOR_TEMPLATE_TEXT_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEMPLATE_TEXT_SENSOR -#include "esphomelib/text_sensor/text_sensor.h" -#include "esphomelib/helpers.h" +#include "esphome/text_sensor/text_sensor.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -30,8 +30,8 @@ class TemplateTextSensor : public TextSensor, public PollingComponent { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEMPLATE_TEXT_SENSOR -#endif //ESPHOMELIB_TEXT_SENSOR_TEMPLATE_TEXT_SENSOR_H +#endif //ESPHOME_TEXT_SENSOR_TEMPLATE_TEXT_SENSOR_H diff --git a/src/esphomelib/text_sensor/text_sensor.cpp b/src/esphome/text_sensor/text_sensor.cpp similarity index 89% rename from src/esphomelib/text_sensor/text_sensor.cpp rename to src/esphome/text_sensor/text_sensor.cpp index 3d1c80fd..87ee5634 100644 --- a/src/esphomelib/text_sensor/text_sensor.cpp +++ b/src/esphome/text_sensor/text_sensor.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEXT_SENSOR -#include "esphomelib/text_sensor/text_sensor.h" -#include "esphomelib/log.h" +#include "esphome/text_sensor/text_sensor.h" +#include "esphome/log.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -60,6 +60,6 @@ TextSensorStateTrigger::TextSensorStateTrigger(TextSensor *parent) { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TEXT_SENSOR diff --git a/src/esphomelib/text_sensor/text_sensor.h b/src/esphome/text_sensor/text_sensor.h similarity index 86% rename from src/esphomelib/text_sensor/text_sensor.h rename to src/esphome/text_sensor/text_sensor.h index a9aa89ec..29b23045 100644 --- a/src/esphomelib/text_sensor/text_sensor.h +++ b/src/esphome/text_sensor/text_sensor.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_TEXT_SENSOR_TEXT_SENSOR_H -#define ESPHOMELIB_TEXT_SENSOR_TEXT_SENSOR_H +#ifndef ESPHOME_TEXT_SENSOR_TEXT_SENSOR_H +#define ESPHOME_TEXT_SENSOR_TEXT_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TEXT_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/automation.h" -#include "esphomelib/helpers.h" +#include "esphome/component.h" +#include "esphome/automation.h" +#include "esphome/helpers.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -105,10 +105,10 @@ TextSensorPublishAction *TextSensor::make_text_sensor_publish_action() { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#include "esphomelib/text_sensor/mqtt_text_sensor.h" +#include "esphome/text_sensor/mqtt_text_sensor.h" #endif //USE_TEXT_SENSOR -#endif //ESPHOMELIB_TEXT_SENSOR_TEXT_SENSOR_H +#endif //ESPHOME_TEXT_SENSOR_TEXT_SENSOR_H diff --git a/src/esphomelib/text_sensor/version_text_sensor.cpp b/src/esphome/text_sensor/version_text_sensor.cpp similarity index 68% rename from src/esphomelib/text_sensor/version_text_sensor.cpp rename to src/esphome/text_sensor/version_text_sensor.cpp index 7943580a..4f6937f2 100644 --- a/src/esphomelib/text_sensor/version_text_sensor.cpp +++ b/src/esphome/text_sensor/version_text_sensor.cpp @@ -1,12 +1,12 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_VERSION_TEXT_SENSOR -#include "esphomelib/text_sensor/version_text_sensor.h" -#include "esphomelib/log.h" -#include "esphomelib/util.h" +#include "esphome/text_sensor/version_text_sensor.h" +#include "esphome/log.h" +#include "esphome/util.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -14,9 +14,9 @@ static const char *TAG = "text_sensor.version"; void VersionTextSensor::setup() { if (get_app_compilation_time().empty()) { - this->publish_state(ESPHOMELIB_VERSION); + this->publish_state(ESPHOME_VERSION); } else { - this->publish_state(ESPHOMELIB_VERSION " " + get_app_compilation_time()); + this->publish_state(ESPHOME_VERSION " " + get_app_compilation_time()); } } float VersionTextSensor::get_setup_priority() const { @@ -36,6 +36,6 @@ void VersionTextSensor::dump_config() { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_VERSION_TEXT_SENSOR diff --git a/src/esphomelib/text_sensor/version_text_sensor.h b/src/esphome/text_sensor/version_text_sensor.h similarity index 59% rename from src/esphomelib/text_sensor/version_text_sensor.h rename to src/esphome/text_sensor/version_text_sensor.h index 6a40679d..edecce89 100644 --- a/src/esphomelib/text_sensor/version_text_sensor.h +++ b/src/esphome/text_sensor/version_text_sensor.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_VERSION_TEXT_SENSOR_H -#define ESPHOMELIB_VERSION_TEXT_SENSOR_H +#ifndef ESPHOME_VERSION_TEXT_SENSOR_H +#define ESPHOME_VERSION_TEXT_SENSOR_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_VERSION_TEXT_SENSOR -#include "esphomelib/component.h" -#include "esphomelib/text_sensor/text_sensor.h" +#include "esphome/component.h" +#include "esphome/text_sensor/text_sensor.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace text_sensor { @@ -24,8 +24,8 @@ class VersionTextSensor : public TextSensor, public Component { } // namespace text_sensor -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_VERSION_TEXT_SENSOR -#endif //ESPHOMELIB_VERSION_TEXT_SENSOR_H +#endif //ESPHOME_VERSION_TEXT_SENSOR_H diff --git a/src/esphomelib/time/homeassistant_time.cpp b/src/esphome/time/homeassistant_time.cpp similarity index 88% rename from src/esphomelib/time/homeassistant_time.cpp rename to src/esphome/time/homeassistant_time.cpp index 8a3f7f91..f29b254f 100644 --- a/src/esphomelib/time/homeassistant_time.cpp +++ b/src/esphome/time/homeassistant_time.cpp @@ -1,16 +1,16 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HOMEASSISTANT_TIME -#include "esphomelib/time/homeassistant_time.h" -#include "esphomelib/api/api_server.h" -#include "esphomelib/log.h" +#include "esphome/time/homeassistant_time.h" +#include "esphome/api/api_server.h" +#include "esphome/log.h" #include "lwip/opt.h" #ifdef ARDUINO_ARCH_ESP8266 #include "sys/time.h" #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace time { @@ -65,6 +65,6 @@ api::APIMessageType GetTimeResponse::message_type() const { } // namespace time -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HOMEASSISTANT_TIME diff --git a/src/esphomelib/time/homeassistant_time.h b/src/esphome/time/homeassistant_time.h similarity index 63% rename from src/esphomelib/time/homeassistant_time.h rename to src/esphome/time/homeassistant_time.h index 0b343e2d..7ae76dad 100644 --- a/src/esphomelib/time/homeassistant_time.h +++ b/src/esphome/time/homeassistant_time.h @@ -1,15 +1,15 @@ -#ifndef ESPHOMELIB_HOMEASSISTANT_TIME_H -#define ESPHOMELIB_HOMEASSISTANT_TIME_H +#ifndef ESPHOME_HOMEASSISTANT_TIME_H +#define ESPHOME_HOMEASSISTANT_TIME_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_HOMEASSISTANT_TIME -#include "esphomelib/component.h" -#include "esphomelib/time/rtc_component.h" -#include "esphomelib/api/api_message.h" +#include "esphome/component.h" +#include "esphome/time/rtc_component.h" +#include "esphome/api/api_message.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace time { @@ -32,8 +32,8 @@ class GetTimeResponse : public api::APIMessage { } // namespace time -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_HOMEASSISTANT_TIME -#endif //ESPHOMELIB_HOMEASSISTANT_TIME_H +#endif //ESPHOME_HOMEASSISTANT_TIME_H diff --git a/src/esphomelib/time/rtc_component.cpp b/src/esphome/time/rtc_component.cpp similarity index 84% rename from src/esphomelib/time/rtc_component.cpp rename to src/esphome/time/rtc_component.cpp index 3ba15d9f..7c06354a 100644 --- a/src/esphomelib/time/rtc_component.cpp +++ b/src/esphome/time/rtc_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TIME -#include "esphomelib/log.h" -#include "esphomelib/time/rtc_component.h" +#include "esphome/log.h" +#include "esphome/time/rtc_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace time { @@ -20,15 +20,15 @@ void RealTimeClockComponent::set_timezone(const std::string &tz) { std::string RealTimeClockComponent::get_timezone() { return this->timezone_; } -EsphomelibTime RealTimeClockComponent::now() { +ESPTime RealTimeClockComponent::now() { time_t t = ::time(nullptr); struct tm *c_tm = ::localtime(&t); - return EsphomelibTime::from_tm(c_tm, t); + return ESPTime::from_tm(c_tm, t); } -EsphomelibTime RealTimeClockComponent::utcnow() { +ESPTime RealTimeClockComponent::utcnow() { time_t t = ::time(nullptr); struct tm *c_tm = ::gmtime(&t); - return EsphomelibTime::from_tm(c_tm, t); + return ESPTime::from_tm(c_tm, t); } CronTrigger *RealTimeClockComponent::make_cron_trigger() { return new CronTrigger(this); @@ -40,12 +40,12 @@ void RealTimeClockComponent::setup_() { this->setup(); } -size_t EsphomelibTime::strftime(char *buffer, size_t buffer_len, const char *format) { +size_t ESPTime::strftime(char *buffer, size_t buffer_len, const char *format) { struct tm c_tm = this->to_c_tm(); return ::strftime(buffer, buffer_len, format, &c_tm); } -EsphomelibTime EsphomelibTime::from_tm(struct tm *c_tm, time_t c_time) { - return EsphomelibTime{ +ESPTime ESPTime::from_tm(struct tm *c_tm, time_t c_time) { + return ESPTime{ .second = uint8_t(c_tm->tm_sec), .minute = uint8_t(c_tm->tm_min), .hour = uint8_t(c_tm->tm_hour), @@ -58,7 +58,7 @@ EsphomelibTime EsphomelibTime::from_tm(struct tm *c_tm, time_t c_time) { .time = c_time }; } -struct tm EsphomelibTime::to_c_tm() { +struct tm ESPTime::to_c_tm() { struct tm c_tm = tm{ .tm_sec = this->second, .tm_min = this->minute, @@ -72,7 +72,7 @@ struct tm EsphomelibTime::to_c_tm() { }; return c_tm; } -std::string EsphomelibTime::strftime(const std::string &format) { +std::string ESPTime::strftime(const std::string &format) { std::string timestr; timestr.resize(format.size() * 4); struct tm c_tm = this->to_c_tm(); @@ -84,7 +84,7 @@ std::string EsphomelibTime::strftime(const std::string &format) { timestr.resize(len); return timestr; } -bool EsphomelibTime::is_valid() const { +bool ESPTime::is_valid() const { return this->year >= 2018; } @@ -98,7 +98,7 @@ bool increment_time_value(T ¤t, uint16_t begin, uint16_t end) { return false; } -void EsphomelibTime::increment_second() { +void ESPTime::increment_second() { this->time++; if (!increment_time_value(this->second, 0, 60)) return; @@ -130,22 +130,22 @@ void EsphomelibTime::increment_second() { this->year++; } } -bool EsphomelibTime::operator<(EsphomelibTime other) { +bool ESPTime::operator<(ESPTime other) { return this->time < other.time; } -bool EsphomelibTime::operator<=(EsphomelibTime other) { +bool ESPTime::operator<=(ESPTime other) { return this->time <= other.time; } -bool EsphomelibTime::operator==(EsphomelibTime other) { +bool ESPTime::operator==(ESPTime other) { return this->time == other.time; } -bool EsphomelibTime::operator>=(EsphomelibTime other) { +bool ESPTime::operator>=(ESPTime other) { return this->time >= other.time; } -bool EsphomelibTime::operator>(EsphomelibTime other) { +bool ESPTime::operator>(ESPTime other) { return this->time > other.time; } -bool EsphomelibTime::in_range() const { +bool ESPTime::in_range() const { return this->second < 61 && this->minute < 60 && this->hour < 24 && this->day_of_week > 0 && this->day_of_week < 8 && this->day_of_month > 0 && this->day_of_month < 32 && @@ -171,13 +171,13 @@ void CronTrigger::add_month(uint8_t month) { void CronTrigger::add_day_of_week(uint8_t day_of_week) { this->days_of_week_[day_of_week] = true; } -bool CronTrigger::matches(const EsphomelibTime &time) { +bool CronTrigger::matches(const ESPTime &time) { return time.is_valid() && this->seconds_[time.second] && this->minutes_[time.minute] && this->hours_[time.hour] && this->days_of_month_[time.day_of_month] && this->months_[time.month] && this->days_of_week_[time.day_of_week]; } void CronTrigger::loop() { - EsphomelibTime time = this->rtc_->now(); + ESPTime time = this->rtc_->now(); if (!time.is_valid()) return; @@ -242,6 +242,6 @@ float CronTrigger::get_setup_priority() const { } // namespace time -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TIME diff --git a/src/esphomelib/time/rtc_component.h b/src/esphome/time/rtc_component.h similarity index 78% rename from src/esphomelib/time/rtc_component.h rename to src/esphome/time/rtc_component.h index 173f9311..2621f293 100644 --- a/src/esphomelib/time/rtc_component.h +++ b/src/esphome/time/rtc_component.h @@ -1,22 +1,22 @@ -#ifndef ESPHOMELIB_TIME_RTC_COMPONENT_H -#define ESPHOMELIB_TIME_RTC_COMPONENT_H +#ifndef ESPHOME_TIME_RTC_COMPONENT_H +#define ESPHOME_TIME_RTC_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_TIME -#include "esphomelib/component.h" -#include "esphomelib/automation.h" +#include "esphome/component.h" +#include "esphome/automation.h" #include #include #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace time { /// A more user-friendly version of struct tm from time.h -struct EsphomelibTime { +struct ESPTime { /** seconds after the minute [0-60] * @note second is generally 0-59; the extra range is to accommodate leap seconds. */ @@ -40,14 +40,14 @@ struct EsphomelibTime { /// unix epoch time (seconds since UTC Midnight January 1, 1970) time_t time; - /** Convert this EsphomelibTime struct to a null-terminated c string buffer as specified by the format argument. + /** Convert this ESPTime struct to a null-terminated c string buffer as specified by the format argument. * Up to buffer_len bytes are written. * * @see https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html#index-strftime */ size_t strftime(char *buffer, size_t buffer_len, const char *format); - /** Convert this EsphomelibTime struct to a string as specified by the format argument. + /** Convert this ESPTime struct to a string as specified by the format argument. * @see https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html#index-strftime * * @warning This method uses dynamically allocated strings which can cause heap fragmentation with some @@ -59,18 +59,20 @@ struct EsphomelibTime { bool in_range() const; - static EsphomelibTime from_tm(struct tm *c_tm, time_t c_time); + static ESPTime from_tm(struct tm *c_tm, time_t c_time); struct tm to_c_tm(); void increment_second(); - bool operator<(EsphomelibTime other); - bool operator<=(EsphomelibTime other); - bool operator==(EsphomelibTime other); - bool operator>=(EsphomelibTime other); - bool operator>(EsphomelibTime other); + bool operator<(ESPTime other); + bool operator<=(ESPTime other); + bool operator==(ESPTime other); + bool operator>=(ESPTime other); + bool operator>(ESPTime other); }; +using EsphomelibTime = ESPTime; + class RealTimeClockComponent; class CronTrigger : public Trigger, public Component { @@ -88,7 +90,7 @@ class CronTrigger : public Trigger, public Component { void add_months(const std::vector &months); void add_day_of_week(uint8_t day_of_week); void add_days_of_week(const std::vector &days_of_week); - bool matches(const EsphomelibTime &time); + bool matches(const ESPTime &time); void loop() override; float get_setup_priority() const override; @@ -100,7 +102,7 @@ class CronTrigger : public Trigger, public Component { std::bitset<13> months_; std::bitset<8> days_of_week_; RealTimeClockComponent *rtc_; - optional last_check_; + optional last_check_; }; /// The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock. @@ -120,10 +122,10 @@ class RealTimeClockComponent : public Component { std::string get_timezone(); /// Get the time in the currently defined timezone. - EsphomelibTime now(); + ESPTime now(); /// Get the time without any time zone or DST corrections. - EsphomelibTime utcnow(); + ESPTime utcnow(); CronTrigger *make_cron_trigger(); @@ -134,8 +136,8 @@ class RealTimeClockComponent : public Component { } // namespace time -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_TIME -#endif //ESPHOMELIB_TIME_RTC_COMPONENT_H +#endif //ESPHOME_TIME_RTC_COMPONENT_H diff --git a/src/esphomelib/time/sntp_component.cpp b/src/esphome/time/sntp_component.cpp similarity index 90% rename from src/esphomelib/time/sntp_component.cpp rename to src/esphome/time/sntp_component.cpp index 1b5d31df..d06534b3 100644 --- a/src/esphomelib/time/sntp_component.cpp +++ b/src/esphome/time/sntp_component.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SNTP_COMPONENT -#include "esphomelib/log.h" -#include "esphomelib/helpers.h" -#include "esphomelib/component.h" -#include "esphomelib/time/sntp_component.h" +#include "esphome/log.h" +#include "esphome/helpers.h" +#include "esphome/component.h" +#include "esphome/time/sntp_component.h" #ifdef ARDUINO_ARCH_ESP32 #include "apps/sntp/sntp.h" @@ -14,7 +14,7 @@ #include "sntp.h" #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace time { @@ -85,6 +85,6 @@ void SNTPComponent::loop() { } // namespace time -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SNTP_COMPONENT diff --git a/src/esphomelib/time/sntp_component.h b/src/esphome/time/sntp_component.h similarity index 78% rename from src/esphomelib/time/sntp_component.h rename to src/esphome/time/sntp_component.h index 70df7a0a..205f6d30 100644 --- a/src/esphomelib/time/sntp_component.h +++ b/src/esphome/time/sntp_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_SNTP_COMPONENT_H -#define ESPHOMELIB_SNTP_COMPONENT_H +#ifndef ESPHOME_SNTP_COMPONENT_H +#define ESPHOME_SNTP_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_SNTP_COMPONENT -#include "esphomelib/component.h" -#include "esphomelib/time/rtc_component.h" +#include "esphome/component.h" +#include "esphome/time/rtc_component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN namespace time { @@ -41,8 +41,8 @@ class SNTPComponent : public RealTimeClockComponent { } // namespace time -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_SNTP_COMPONENT -#endif //ESPHOMELIB_SNTP_COMPONENT_H +#endif //ESPHOME_SNTP_COMPONENT_H diff --git a/src/esphomelib/uart_component.cpp b/src/esphome/uart_component.cpp similarity index 98% rename from src/esphomelib/uart_component.cpp rename to src/esphome/uart_component.cpp index ac9b965c..378227e3 100644 --- a/src/esphomelib/uart_component.cpp +++ b/src/esphome/uart_component.cpp @@ -1,16 +1,16 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_UART -#include "esphomelib/uart_component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" +#include "esphome/uart_component.h" +#include "esphome/helpers.h" +#include "esphome/log.h" #ifdef ARDUINO_ARCH_ESP8266 #include "FunctionalInterrupt.h" #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "uart"; @@ -417,6 +417,6 @@ int UARTDevice::peek() { return this->parent_->peek(); } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_UART diff --git a/src/esphomelib/uart_component.h b/src/esphome/uart_component.h similarity index 91% rename from src/esphomelib/uart_component.h rename to src/esphome/uart_component.h index d4ec6389..28dbad94 100644 --- a/src/esphomelib/uart_component.h +++ b/src/esphome/uart_component.h @@ -1,14 +1,14 @@ -#ifndef ESPHOMELIB_UART_COMPONENT_H -#define ESPHOMELIB_UART_COMPONENT_H +#ifndef ESPHOME_UART_COMPONENT_H +#define ESPHOME_UART_COMPONENT_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_UART #include -#include "esphomelib/component.h" +#include "esphome/component.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN #ifdef ARDUINO_ARCH_ESP8266 class ESP8266SoftwareSerial { @@ -119,8 +119,8 @@ class UARTDevice : public Stream { UARTComponent *parent_; }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_UART -#endif //ESPHOMELIB_UART_COMPONENT_H +#endif //ESPHOME_UART_COMPONENT_H diff --git a/src/esphomelib/util.cpp b/src/esphome/util.cpp similarity index 84% rename from src/esphomelib/util.cpp rename to src/esphome/util.cpp index 3b1eb949..be00fdf5 100644 --- a/src/esphomelib/util.cpp +++ b/src/esphome/util.cpp @@ -1,9 +1,9 @@ -#include "esphomelib/util.h" -#include "esphomelib/defines.h" -#include "esphomelib/wifi_component.h" -#include "esphomelib/ethernet_component.h" -#include "esphomelib/api/api_server.h" -#include "esphomelib/application.h" +#include "esphome/util.h" +#include "esphome/defines.h" +#include "esphome/wifi_component.h" +#include "esphome/ethernet_component.h" +#include "esphome/api/api_server.h" +#include "esphome/application.h" #ifdef ARDUINO_ARCH_ESP32 #include @@ -12,7 +12,7 @@ #include #endif -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN bool network_is_connected() { #ifdef USE_ETHERNET @@ -70,14 +70,14 @@ void network_setup_mdns() { if (api::global_api_server != nullptr) { MDNS.addService("esphomelib", "tcp", api::global_api_server->get_port()); // DNS-SD (!=mDNS !) requires at least one TXT record for service discovery - let's add version - MDNS.addServiceTxt("esphomelib", "tcp", "version", ESPHOMELIB_VERSION); + MDNS.addServiceTxt("esphomelib", "tcp", "version", ESPHOME_VERSION); MDNS.addServiceTxt("esphomelib", "tcp", "address", network_get_address().c_str()); } else { #endif // Publish "http" service if not using native API. // This is just to have *some* mDNS service so that .local resolution works MDNS.addService("http", "tcp", 80); - MDNS.addServiceTxt("http", "tcp", "version", ESPHOMELIB_VERSION); + MDNS.addServiceTxt("http", "tcp", "version", ESPHOME_VERSION); #ifdef USE_API } #endif @@ -106,4 +106,4 @@ std::string get_app_compilation_time() { return App.get_compilation_time(); } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/util.h b/src/esphome/util.h similarity index 75% rename from src/esphomelib/util.h rename to src/esphome/util.h index 6319c32e..824b8c45 100644 --- a/src/esphomelib/util.h +++ b/src/esphome/util.h @@ -1,11 +1,11 @@ -#ifndef ESPHOMELIB_UTIL_H -#define ESPHOMELIB_UTIL_H +#ifndef ESPHOME_UTIL_H +#define ESPHOME_UTIL_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #include #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN /// Return whether the node is connected to the network (through wifi, eth, ...) bool network_is_connected(); @@ -21,6 +21,6 @@ void network_tick_mdns(); std::string get_app_name(); std::string get_app_compilation_time(); -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_UTIL_H +#endif //ESPHOME_UTIL_H diff --git a/src/esphomelib/web_server.cpp b/src/esphome/web_server.cpp similarity index 97% rename from src/esphomelib/web_server.cpp rename to src/esphome/web_server.cpp index 8d6b3c57..e215e9f6 100644 --- a/src/esphomelib/web_server.cpp +++ b/src/esphome/web_server.cpp @@ -1,11 +1,11 @@ -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_WEB_SERVER -#include "esphomelib/web_server.h" -#include "esphomelib/log.h" -#include "esphomelib/application.h" -#include "esphomelib/util.h" +#include "esphome/web_server.h" +#include "esphome/log.h" +#include "esphome/application.h" +#include "esphome/util.h" #include "StreamString.h" #ifdef ARDUINO_ARCH_ESP32 @@ -17,7 +17,7 @@ #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "web_server"; @@ -230,7 +230,7 @@ void WebServer::handle_index_request(AsyncWebServerRequest *request) { if (this->css_url_ != nullptr) { stream->print(this->css_url_); } else { - stream->print(F("https://esphomelib.com/_static/webserver-v1.min.css")); + stream->print(F("https://esphome.io/_static/webserver-v1.min.css")); } stream->print(F("\">

")); stream->print(title.c_str()); @@ -273,7 +273,7 @@ void WebServer::handle_index_request(AsyncWebServerRequest *request) { #endif stream->print( - F("

See esphomelib Web API for REST API documentation.

" + F("

See ESPHome Web API for REST API documentation.

" "

OTA Update

" "

Debug Log

"
         "
")); @@ -674,6 +674,6 @@ bool WebServer::isRequestHandlerTrivial() { return false; } -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_WEB_SERVER diff --git a/src/esphomelib/web_server.h b/src/esphome/web_server.h similarity index 90% rename from src/esphomelib/web_server.h rename to src/esphome/web_server.h index 2fbd6cb7..aab821ec 100644 --- a/src/esphomelib/web_server.h +++ b/src/esphome/web_server.h @@ -1,17 +1,17 @@ -#ifndef ESPHOMELIB_WEB_SERVER_H -#define ESPHOMELIB_WEB_SERVER_H +#ifndef ESPHOME_WEB_SERVER_H +#define ESPHOME_WEB_SERVER_H -#include "esphomelib/defines.h" +#include "esphome/defines.h" #ifdef USE_WEB_SERVER -#include "esphomelib/component.h" -#include "esphomelib/controller.h" +#include "esphome/component.h" +#include "esphome/controller.h" #include #include -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN /// Internal helper struct that is used to parse incoming URLs struct UrlMatch { @@ -25,10 +25,10 @@ struct UrlMatch { * * Behind the scenes it's using AsyncWebServer to set up the server. It exposes 3 things: * an index page under '/' that's used to show a simple web interface (the css/js is hosted - * by esphomelib.com by default), an event source under '/events' that automatically sends + * by esphome.io by default), an event source under '/events' that automatically sends * all state updates in real time + the debug log. Lastly, there's an REST API available * under the '/light/...', '/sensor/...', ... URLs. A full documentation for this API - * can be found under https://esphomelib.com/web-api/index.html. + * can be found under https://esphome.io/web-api/index.html. */ class WebServer : public StoringUpdateListenerController, public Component, public AsyncWebHandler { public: @@ -36,14 +36,14 @@ class WebServer : public StoringUpdateListenerController, public Component, publ explicit WebServer(uint16_t port); /** Set the URL to the CSS that's sent to each client. Defaults to - * https://esphomelib.com/_static/webserver-v1.min.css + * https://esphome.io/_static/webserver-v1.min.css * * @param css_url The url to the web server stylesheet. */ void set_css_url(const char *css_url); /** Set the URL to the script that's embedded in the index page. Defaults to - * https://esphomelib.com/_static/webserver-v1.min.js + * https://esphome.io/_static/webserver-v1.min.js * * @param js_url The url to the web server script. */ @@ -146,8 +146,8 @@ class WebServer : public StoringUpdateListenerController, public Component, publ uint32_t ota_read_length_{0}; }; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END #endif //USE_WEB_SERVER -#endif //ESPHOMELIB_WEB_SERVER_H +#endif //ESPHOME_WEB_SERVER_H diff --git a/src/esphomelib/wifi_component.cpp b/src/esphome/wifi_component.cpp similarity index 99% rename from src/esphomelib/wifi_component.cpp rename to src/esphome/wifi_component.cpp index 19af377b..ed8af662 100644 --- a/src/esphomelib/wifi_component.cpp +++ b/src/esphome/wifi_component.cpp @@ -1,4 +1,4 @@ -#include "esphomelib/wifi_component.h" +#include "esphome/wifi_component.h" #ifdef ARDUINO_ARCH_ESP32 #include @@ -12,12 +12,12 @@ #include "lwip/err.h" #include "lwip/dns.h" -#include "esphomelib/helpers.h" -#include "esphomelib/log.h" -#include "esphomelib/esphal.h" -#include "esphomelib/util.h" +#include "esphome/helpers.h" +#include "esphome/log.h" +#include "esphome/esphal.h" +#include "esphome/util.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN static const char *TAG = "wifi"; @@ -1537,4 +1537,4 @@ bool WiFiScanResult::get_is_hidden() const { WiFiComponent *global_wifi_component; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END diff --git a/src/esphomelib/wifi_component.h b/src/esphome/wifi_component.h similarity index 96% rename from src/esphomelib/wifi_component.h rename to src/esphome/wifi_component.h index 00c59158..c2aacdc9 100644 --- a/src/esphomelib/wifi_component.h +++ b/src/esphome/wifi_component.h @@ -1,5 +1,5 @@ -#ifndef ESPHOMELIB_WIFI_COMPONENT_H -#define ESPHOMELIB_WIFI_COMPONENT_H +#ifndef ESPHOME_WIFI_COMPONENT_H +#define ESPHOME_WIFI_COMPONENT_H #include #include @@ -14,11 +14,11 @@ #include #endif -#include "esphomelib/component.h" -#include "esphomelib/helpers.h" -#include "esphomelib/defines.h" +#include "esphome/component.h" +#include "esphome/helpers.h" +#include "esphome/defines.h" -ESPHOMELIB_NAMESPACE_BEGIN +ESPHOME_NAMESPACE_BEGIN enum WiFiComponentState { /** Nothing has been initialized yet. Internal AP, if configured, is disabled at this point. */ @@ -226,6 +226,6 @@ class WiFiComponent : public Component { extern WiFiComponent *global_wifi_component; -ESPHOMELIB_NAMESPACE_END +ESPHOME_NAMESPACE_END -#endif //ESPHOMELIB_WIFI_COMPONENT_H +#endif //ESPHOME_WIFI_COMPONENT_H diff --git a/src/esphomelib.h b/src/esphomelib.h index 890e2123..7e4d00d7 100644 --- a/src/esphomelib.h +++ b/src/esphomelib.h @@ -1 +1,3 @@ -#include "esphomelib/application.h" +#pragma once +#warning "This header file is deprecated, please include esphome.h instead." +#include "esphome/application.h" diff --git a/src/esphomelib/application.h b/src/esphomelib/application.h index 286557b4..7e4d00d7 100644 --- a/src/esphomelib/application.h +++ b/src/esphomelib/application.h @@ -1,1314 +1,3 @@ -#ifndef ESPHOMELIB_APPLICATION_H -#define ESPHOMELIB_APPLICATION_H - -#include -#include "esphomelib/defines.h" -#include "esphomelib/api/api_server.h" -#include "esphomelib/automation.h" -#include "esphomelib/component.h" -#include "esphomelib/controller.h" -#include "esphomelib/custom_component.h" -#include "esphomelib/debug_component.h" -#include "esphomelib/deep_sleep_component.h" -#include "esphomelib/esp32_ble_beacon.h" -#include "esphomelib/esp32_ble_tracker.h" -#include "esphomelib/esp_one_wire.h" -#include "esphomelib/esphal.h" -#include "esphomelib/esppreferences.h" -#include "esphomelib/ethernet_component.h" -#include "esphomelib/i2c_component.h" -#include "esphomelib/log.h" -#include "esphomelib/log_component.h" -#include "esphomelib/ota_component.h" -#include "esphomelib/power_supply_component.h" -#include "esphomelib/spi_component.h" -#include "esphomelib/status_led.h" -#include "esphomelib/uart_component.h" -#include "esphomelib/web_server.h" -#include "esphomelib/wifi_component.h" -#include "esphomelib/binary_sensor/binary_sensor.h" -#include "esphomelib/binary_sensor/custom_binary_sensor.h" -#include "esphomelib/binary_sensor/esp32_touch_binary_sensor.h" -#include "esphomelib/binary_sensor/filter.h" -#include "esphomelib/binary_sensor/gpio_binary_sensor_component.h" -#include "esphomelib/binary_sensor/homeassistant_binary_sensor.h" -#include "esphomelib/binary_sensor/mqtt_binary_sensor_component.h" -#include "esphomelib/binary_sensor/pn532_component.h" -#include "esphomelib/binary_sensor/rdm6300.h" -#include "esphomelib/binary_sensor/status_binary_sensor.h" -#include "esphomelib/binary_sensor/template_binary_sensor.h" -#include "esphomelib/cover/cover.h" -#include "esphomelib/cover/mqtt_cover_component.h" -#include "esphomelib/cover/template_cover.h" -#include "esphomelib/display/display.h" -#include "esphomelib/display/lcd_display.h" -#include "esphomelib/display/max7219.h" -#include "esphomelib/display/nextion.h" -#include "esphomelib/display/ssd1306.h" -#include "esphomelib/display/waveshare_epaper.h" -#include "esphomelib/fan/basic_fan_component.h" -#include "esphomelib/fan/fan_state.h" -#include "esphomelib/fan/mqtt_fan_component.h" -#include "esphomelib/io/pcf8574_component.h" -#include "esphomelib/light/addressable_light_effect.h" -#include "esphomelib/light/fast_led_light_output.h" -#include "esphomelib/light/light_color_values.h" -#include "esphomelib/light/light_effect.h" -#include "esphomelib/light/light_output_component.h" -#include "esphomelib/light/light_state.h" -#include "esphomelib/light/mqtt_json_light_component.h" -#include "esphomelib/light/neo_pixel_bus_light_output.h" -#include "esphomelib/mqtt/custom_mqtt_device.h" -#include "esphomelib/mqtt/mqtt_client_component.h" -#include "esphomelib/mqtt/mqtt_component.h" -#include "esphomelib/output/binary_output.h" -#include "esphomelib/output/custom_output.h" -#include "esphomelib/output/esp8266_pwm_output.h" -#include "esphomelib/output/float_output.h" -#include "esphomelib/output/gpio_binary_output_component.h" -#include "esphomelib/output/ledc_output_component.h" -#include "esphomelib/output/pca9685_output_component.h" -#include "esphomelib/output/my9231_output_component.h" -#include "esphomelib/remote/jvc.h" -#include "esphomelib/remote/lg.h" -#include "esphomelib/remote/nec.h" -#include "esphomelib/remote/panasonic.h" -#include "esphomelib/remote/raw.h" -#include "esphomelib/remote/rc_switch.h" -#include "esphomelib/remote/remote_receiver.h" -#include "esphomelib/remote/remote_transmitter.h" -#include "esphomelib/remote/samsung.h" -#include "esphomelib/remote/sony.h" -#include "esphomelib/sensor/adc.h" -#include "esphomelib/sensor/ads1115_component.h" -#include "esphomelib/sensor/apds9960.h" -#include "esphomelib/sensor/bh1750_sensor.h" -#include "esphomelib/sensor/bme280_component.h" -#include "esphomelib/sensor/bme680_component.h" -#include "esphomelib/sensor/bmp085_component.h" -#include "esphomelib/sensor/bmp280_component.h" -#include "esphomelib/sensor/cse7766.h" -#include "esphomelib/sensor/custom_sensor.h" -#include "esphomelib/sensor/dallas_component.h" -#include "esphomelib/sensor/dht12_component.h" -#include "esphomelib/sensor/dht_component.h" -#include "esphomelib/sensor/duty_cycle_sensor.h" -#include "esphomelib/sensor/esp32_hall_sensor.h" -#include "esphomelib/sensor/filter.h" -#include "esphomelib/sensor/hdc1080_component.h" -#include "esphomelib/sensor/hlw8012.h" -#include "esphomelib/sensor/hmc5883l.h" -#include "esphomelib/sensor/homeassistant_sensor.h" -#include "esphomelib/sensor/htu21d_component.h" -#include "esphomelib/sensor/hx711.h" -#include "esphomelib/sensor/ina219.h" -#include "esphomelib/sensor/ina3221.h" -#include "esphomelib/sensor/max31855_sensor.h" -#include "esphomelib/sensor/max6675_sensor.h" -#include "esphomelib/sensor/mhz19_component.h" -#include "esphomelib/sensor/mpu6050_component.h" -#include "esphomelib/sensor/mqtt_sensor_component.h" -#include "esphomelib/sensor/mqtt_subscribe_sensor.h" -#include "esphomelib/sensor/ms5611.h" -#include "esphomelib/sensor/pmsx003.h" -#include "esphomelib/sensor/pulse_counter.h" -#include "esphomelib/sensor/rotary_encoder.h" -#include "esphomelib/sensor/sensor.h" -#include "esphomelib/sensor/sht3xd_component.h" -#include "esphomelib/sensor/tcs34725.h" -#include "esphomelib/sensor/template_sensor.h" -#include "esphomelib/sensor/total_daily_energy.h" -#include "esphomelib/sensor/tsl2561_sensor.h" -#include "esphomelib/sensor/ultrasonic_sensor.h" -#include "esphomelib/sensor/uptime_sensor.h" -#include "esphomelib/sensor/wifi_signal_sensor.h" -#include "esphomelib/stepper/a4988.h" -#include "esphomelib/stepper/stepper.h" -#include "esphomelib/stepper/uln2003.h" -#include "esphomelib/switch_/custom_switch.h" -#include "esphomelib/switch_/gpio_switch.h" -#include "esphomelib/switch_/mqtt_switch_component.h" -#include "esphomelib/switch_/output_switch.h" -#include "esphomelib/switch_/restart_switch.h" -#include "esphomelib/switch_/shutdown_switch.h" -#include "esphomelib/switch_/switch.h" -#include "esphomelib/switch_/template_switch.h" -#include "esphomelib/switch_/uart_switch.h" -#include "esphomelib/text_sensor/custom_text_sensor.h" -#include "esphomelib/text_sensor/homeassistant_text_sensor.h" -#include "esphomelib/text_sensor/mqtt_subscribe_text_sensor.h" -#include "esphomelib/text_sensor/mqtt_text_sensor.h" -#include "esphomelib/text_sensor/template_text_sensor.h" -#include "esphomelib/text_sensor/text_sensor.h" -#include "esphomelib/text_sensor/version_text_sensor.h" -#include "esphomelib/time/rtc_component.h" -#include "esphomelib/time/sntp_component.h" -#include "esphomelib/time/homeassistant_time.h" - -ESPHOMELIB_NAMESPACE_BEGIN - -/// This is the class that combines all components. -class Application { - public: - /** Set the name of the item that is running this app. - * - * Note: This will automatically be converted to lowercase_underscore. - * - * @param name The name of your app. - */ - void set_name(const std::string &name); - - /** Initialize the logging engine. - * - * @param baud_rate The serial baud rate. Set to 0 to disable UART debugging. - * @param tx_buffer_size The size of the printf buffer. - * @param hw_serial The hardware serial UART used for logging. - * @return The created and initialized LogComponent. - */ - LogComponent *init_log(uint32_t baud_rate = 115200, - size_t tx_buffer_size = 512, - UARTSelection uart = UART_SELECTION_UART0); - - /** Initialize the WiFi engine in client mode. - * - * Note: for advanced options, such as manual ip, use the return value. - * - * @param ssid The ssid of the network you want to connect to. - * @param password The password of your network. Leave empty for no password - * @return The WiFiComponent. - */ - WiFiComponent *init_wifi(const std::string &ssid, const std::string &password = ""); - - /// Initialize the WiFi engine with no initial mode. Use this if you just want an Access Point. - WiFiComponent *init_wifi(); - -#ifdef USE_ETHERNET - EthernetComponent *init_ethernet(); -#endif - -#ifdef USE_OTA - /** Initialize Over-the-Air updates. - * - * @return The OTAComponent. Use this to set advanced settings. - */ - OTAComponent *init_ota(); -#endif - -#ifdef USE_MQTT - /** Initialize the MQTT client. - * - * @param address The address of your server. - * @param port The port of your server. - * @param username The username. - * @param password The password. Empty for no password. - * @return The MQTTClient. Use this to set advanced settings. - */ - mqtt::MQTTClientComponent *init_mqtt(const std::string &address, uint16_t port, - const std::string &username, const std::string &password); - - /** Initialize the MQTT client. - * - * @param address The address of your server. - * @param username The username. - * @param password The password. Empty for no password. - * @return The MQTTClient. Use this to set advanced settings. - */ - mqtt::MQTTClientComponent *init_mqtt(const std::string &address, - const std::string &username, const std::string &password); -#endif - -#ifdef USE_I2C - /** Initialize the i2c bus on the provided SDA and SCL pins for use with other components. - * - * SDA/SCL pins default to the values defined by the Arduino framework and are usually - * GPIO4 and GPIO5 on the ESP8266 (D2 and D1 on NodeMCU). And for the ESP32 it defaults to - * GPIO21 and GPIO22 for SDA and SCL, respectively. - * - * @param sda_pin The SDA pin the i2c bus is connected to. - * @param scl_pin The SCL pin the i2c bus is connected to. - * @param scan If a scan of connected i2c devices should be done at startup. - */ - I2CComponent *init_i2c(uint8_t sda_pin = SDA, uint8_t scl_pin = SCL, bool scan = false); -#endif - -#ifdef USE_UART - UARTComponent *init_uart(uint32_t baud_rate = 9600); -#endif - -#ifdef USE_SPI - SPIComponent *init_spi(const GPIOOutputPin &clk, const GPIOInputPin &miso, const GPIOOutputPin &mosi); - - SPIComponent *init_spi(const GPIOOutputPin &clk); -#endif - -#ifdef USE_WEB_SERVER - /** Initialize the web server. Note that this will take up quite a bit of flash space and - * RAM of the node. Especially on ESP8266 boards this can quickly cause memory problems. - * - * @param port The port of the web server, defaults to 80. - * @return The WebServer object, use this for advanced settings. - */ - WebServer *init_web_server(uint16_t port = 80); -#endif - -#ifdef USE_API - api::APIServer *init_api_server(); -#endif - -#ifdef USE_ESP32_BLE_TRACKER - /** Setup an ESP32 BLE Tracker Hub. - * - * Only one of these should be created. Individual sensors can be created using make_device() on - * the return value. - * - * Note that this component is currently not completely stable (probably due to some issues in the - * esp-idf core that are being worked on). Enabling this integration will increase the created binary - * size by up to 500kB, can cause seemingly random reboots/resets and only can discover a small - * number of devices at the moment. - * - * @return An ESP32BLETracker instance, use this to create individual trackers as binary sensors. - */ - ESP32BLETracker *make_esp32_ble_tracker(); -#endif - -#ifdef USE_ESP32_BLE_BEACON - ESP32BLEBeacon *make_esp32_ble_beacon(const std::array &uuid); -#endif - -#ifdef USE_STATUS_LED - StatusLEDComponent *make_status_led(const GPIOOutputPin &pin); -#endif - -#ifdef USE_DISPLAY - display::Font *make_font(std::vector &&glyphs, int baseline, int bottom); - - display::Image *make_image(const uint8_t *data_start, int width, int height); -#endif - -#ifdef USE_MAX7219 - display::MAX7219Component *make_max7219(SPIComponent *parent, - const GPIOOutputPin &cs, - uint32_t update_interval = 1000); -#endif - -#ifdef USE_LCD_DISPLAY_PCF8574 - display::PCF8574LCDDisplay *make_pcf8574_lcd_display(uint8_t columns, - uint8_t rows, - uint8_t address = 0x3F, - uint32_t update_interval = 1000); -#endif - -#ifdef USE_LCD_DISPLAY - display::GPIOLCDDisplay *make_gpio_lcd_display(uint8_t columns, uint8_t rows, uint32_t update_interval = 1000); -#endif - -#ifdef USE_SSD1306 -#ifdef USE_SPI - display::SPISSD1306 *make_spi_ssd1306(SPIComponent *parent, - const GPIOOutputPin &cs, - const GPIOOutputPin &dc, - uint32_t update_interval = 5000); -#endif -#ifdef USE_I2C - display::I2CSSD1306 *make_i2c_ssd1306(uint32_t update_interval = 5000); -#endif -#endif - -#ifdef USE_WAVESHARE_EPAPER - display::WaveshareEPaperTypeA *make_waveshare_epaper_type_a(SPIComponent *parent, - const GPIOOutputPin &cs, - const GPIOOutputPin &dc_pin, - display::WaveshareEPaperTypeAModel model, - uint32_t update_interval = 10000); - - display::WaveshareEPaper *make_waveshare_epaper_type_b(SPIComponent *parent, - const GPIOOutputPin &cs, - const GPIOOutputPin &dc_pin, - display::WaveshareEPaperTypeBModel model, - uint32_t update_interval = 10000); -#endif - -#ifdef USE_NEXTION - display::Nextion *make_nextion(UARTComponent *parent, uint32_t update_interval = 5000); -#endif - - template - GlobalVariableComponent *make_global_variable(); - - template - GlobalVariableComponent *make_global_variable(T initial_value); - - - - - - - - - /* _ _ _______ ____ __ __ _______ _____ ____ _ _ - * /\ | | | |__ __/ __ \| \/ | /\|__ __|_ _/ __ \| \ | | - * / \ | | | | | | | | | | \ / | / \ | | | || | | | \| | - * / /\ \| | | | | | | | | | |\/| | / /\ \ | | | || | | | . ` | - * / ____ \ |__| | | | | |__| | | | |/ ____ \| | _| || |__| | |\ | - * /_/ \_\____/ |_| \____/|_| |_/_/ \_\_| |_____\____/|_| \_| - */ - - template - Automation *make_automation(Trigger *trigger); - - StartupTrigger *make_startup_trigger(); - - ShutdownTrigger *make_shutdown_trigger(); - - - - - - - - /* ____ ___ _ _ _ ______ __ ____ _____ _ _ ____ ___ ____ - * | __ |_ _| \ | | / \ | _ \ \ / / / ___|| ____| \ | / ___| / _ \| _ \ - * | _ \| || \| | / _ \ | |_) \ V / \___ \| _| | \| \___ \| | | | |_) | - * | |_) | || |\ |/ ___ \| _ < | | ___) | |___| |\ |___) | |_| | _ < - * |____|___|_| \_/_/ \_|_| \_\|_| |____/|_____|_| \_|____/ \___/|_| \_\ - */ -#ifdef USE_BINARY_SENSOR - /// Register a binary sensor and set it up for the front-end. - void register_binary_sensor(binary_sensor::BinarySensor *binary_sensor); -#endif - -#ifdef USE_GPIO_BINARY_SENSOR - /** Create a simple GPIO binary sensor. - * - * Note: advanced options such as inverted input are available in the return value. - * - * @param friendly_name The friendly name that should be advertised. Leave empty for no automatic discovery. - * @param pin The GPIO pin. - * @param device_class The Home Assistant device_class. - */ - binary_sensor::GPIOBinarySensorComponent *make_gpio_binary_sensor(const std::string &friendly_name, - const GPIOInputPin &pin, - const std::string &device_class = ""); -#endif - -#ifdef USE_STATUS_BINARY_SENSOR - /** Create a simple binary sensor that reports the online/offline state of the node. - * - * Uses the MQTT last will and birth message feature. If the values for these features are custom, you need - * to override them using the return value of this function. - * - * @param friendly_name The friendly name advertised via MQTT discovery. - */ - binary_sensor::StatusBinarySensor *make_status_binary_sensor(const std::string &friendly_name); -#endif - -#ifdef USE_ESP32_TOUCH_BINARY_SENSOR - /** Setup an ESP32TouchComponent to detect touches on certain pins of the ESP32 using the built-in touch peripheral. - * - * First set up the global hub using this method. Then create individual binary sensors using the make_touch_pad - * function on the return type. - * - * @return The new ESP32TouchComponent. Use this to create the binary sensors. - */ - binary_sensor::ESP32TouchComponent *make_esp32_touch_component(); -#endif - -#ifdef USE_TEMPLATE_BINARY_SENSOR - binary_sensor::TemplateBinarySensor *make_template_binary_sensor(const std::string &name); -#endif - -#ifdef USE_REMOTE_RECEIVER - remote::RemoteReceiverComponent *make_remote_receiver_component(const GPIOInputPin &output); -#endif - -#ifdef USE_PN532 - binary_sensor::PN532Component *make_pn532_component(SPIComponent *parent, const GPIOOutputPin &cs, - uint32_t update_interval = 1000); -#endif - -#ifdef USE_RDM6300 - binary_sensor::RDM6300Component *make_rdm6300_component(UARTComponent *parent); -#endif - -#ifdef USE_CUSTOM_BINARY_SENSOR - binary_sensor::CustomBinarySensorConstructor *make_custom_binary_sensor(const std::function()> &init); -#endif - - - - - - - - - - /* ____ _____ _ _ ____ ___ ____ - * / ___|| ____| \ | / ___| / _ \| _ \ - * \___ \| _| | \| \___ \| | | | |_) | - * ___) | |___| |\ |___) | |_| | _ < - * |____/|_____|_| \_|____/ \___/|_| \_\ - */ -#ifdef USE_SENSOR - /// Register a sensor and create a MQTT Sensor if the MQTT client is set up - void register_sensor(sensor::Sensor *sensor); -#endif - -#ifdef USE_TEXT_SENSOR - /// Register a text sensor and create a MQTT Sensor if the MQTT client is set up - void register_text_sensor(text_sensor::TextSensor *sensor); -#endif - -#ifdef USE_DHT_SENSOR - /** Create a DHT sensor component. - * - * Note: This method automatically applies a SlidingWindowMovingAverageFilter. - * - * @param temperature_friendly_name The name the temperature sensor should be advertised as. Leave empty for no - * automatic discovery. - * @param humidity_friendly_name The name the humidity sensor should be advertised as. Leave empty for no - * automatic discovery. - * @param pin The pin the DHT sensor is connected to. - * @param update_interval The interval (in ms) the sensor should be checked. - * @return The components. Use this for advanced settings. - */ - sensor::DHTComponent *make_dht_sensor(const std::string &temperature_friendly_name, - const std::string &humidity_friendly_name, - const GPIOOutputPin &pin, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_DALLAS_SENSOR - sensor::DallasComponent *make_dallas_component(ESPOneWire *one_wire, uint32_t update_interval = 60000); - - sensor::DallasComponent *make_dallas_component(const GPIOOutputPin &pin, uint32_t update_interval = 60000); -#endif - -#ifdef USE_PULSE_COUNTER_SENSOR - /** Create an ESP32 Pulse Counter component. - * - * The pulse counter peripheral will automatically all pulses on pin in the background. Every - * check_interval ms the amount of pulses will be retrieved and the difference to the last value - * will be reported via MQTT as a sensor. - * - * @param pin The pin the pulse counter should count pulses on. - * @param friendly_name The name the sensor should be advertised as. - * @param update_interval The interval in ms the sensor should be checked. - * @return The components. Use this for advanced settings. - */ - sensor::PulseCounterSensorComponent *make_pulse_counter_sensor(const std::string &friendly_name, - const GPIOInputPin &pin, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_ADC_SENSOR - /** Create an ADC Sensor component. - * - * Every check_interval ms, the value from the specified pin (only A0 on ESP8266, 32-39 for ESP32), - * and converts it into the volt unit. On the ESP32 you can additionally specify a channel attenuation - * using the return value of this function. pinMode can also be set using the return value. - * - * @param pin The pin the ADC should sense on. - * @param friendly_name The name the sensor should be advertised as. - * @param update_interval The interval in ms the sensor should be checked. - * @return The components. Use this for advanced settings. - */ - sensor::ADCSensorComponent *make_adc_sensor(const std::string &friendly_name, - uint8_t pin, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_ADS1115_SENSOR - /** Create an ADS1115 component hub. From this hub you can then create individual sensors using `get_sensor()`. - * - * Note that you should have i2c setup for this component to work. To setup i2c call `App.init_i2c(SDA_PIN, SCL_PIN);` - * before `App.setup()`. - * - * @param address The i2c address of the ADS1115. See ADS1115Component::set_address for possible values. - * @return The ADS1115Component hub. Use this to set advanced setting and create the actual sensors. - */ - sensor::ADS1115Component *make_ads1115_component(uint8_t address); -#endif - -#ifdef USE_BMP085_SENSOR - /** Create an BMP085/BMP180/BMP280 i2c temperature+pressure sensor. - * - * Be sure to initialize i2c before calling `App.setup()` in order for this to work. Do so - * with `App.init_i2c(SDA_PIN, SCL_PIN);`. - * - * @param temperature_friendly_name The friendly name the temperature should be advertised as. - * @param pressure_friendly_name The friendly name the pressure should be advertised as. - * @param update_interval The interval in ms to update the sensor values. - */ - sensor::BMP085Component *make_bmp085_sensor(const std::string &temperature_friendly_name, - const std::string &pressure_friendly_name, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_HTU21D_SENSOR - - /** Create a HTU21D i2c-based temperature+humidity highly accurate sensor. - * - * Be sure to initialize i2c before calling `App.setup` in order for this to work. Do so - * with `App.init_i2c(SDA_PIN, SCL_PIN);`. - * - * @param temperature_friendly_name The friendly name the temperature sensor should be advertised as. - * @param humidity_friendly_name The friendly name the humidity sensor should be advertised as. - * @param update_interval The interval in ms to update the sensor values. - */ - sensor::HTU21DComponent *make_htu21d_sensor(const std::string &temperature_friendly_name, - const std::string &humidity_friendly_name, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_HDC1080_SENSOR - /** Create a HDC1080 i2c-based temperature+humidity sensor. - * - * Be sure to initialize i2c before calling `App.setup` in order for this to work. Do so - * with `App.init_i2c(SDA_PIN, SCL_PIN);`. - * - * @param temperature_friendly_name The friendly name the temperature sensor should be advertised as. - * @param humidity_friendly_name The friendly name the humidity sensor should be advertised as. - * @param update_interval The interval in ms to update the sensor values. - */ - sensor::HDC1080Component *make_hdc1080_sensor(const std::string &temperature_friendly_name, - const std::string &humidity_friendly_name, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_ULTRASONIC_SENSOR - /** Create an Ultrasonic range sensor. - * - * This can for example be an HC-SR04 ultrasonic sensor. It sends out a short ultrasonic wave and listens - * for an echo. The time between the sending and receiving is then (with some maths) converted to a measurement - * in meters. You need to specify the trigger pin (where to short pulse will be sent to) and the echo pin - * (where we're waiting for the echo). Note that in order to not block indefinitely if we don't receive an - * echo, this class has a default timeout of around 2m. You can change that using the return value of this - * function. - * - * @param friendly_name The friendly name for this sensor advertised to Home Assistant. - * @param trigger_pin The pin the short pulse will be sent to, can be integer or GPIOOutputPin. - * @param echo_pin The pin we wait that we wait on for the echo, can be integer or GPIOInputPin. - * @param update_interval The time in ms between updates, defaults to 5 seconds. - */ - sensor::UltrasonicSensorComponent *make_ultrasonic_sensor(const std::string &friendly_name, - const GPIOOutputPin &trigger_pin, - const GPIOInputPin &echo_pin, - uint32_t update_interval = 5000); -#endif - -#ifdef USE_WIFI_SIGNAL_SENSOR - sensor::WiFiSignalSensor *make_wifi_signal_sensor(const std::string &name, uint32_t update_interval = 60000); -#endif - -#ifdef USE_MPU6050 - /** Create a MPU6050 Accelerometer+Gyroscope+Temperature sensor hub. - * - * This integration can be used to get accurate accelerometer readings and uncalibrated gyroscope - * values (in degrees per second). If you need the latter with calibration applied, your best bet - * it to just copy the source and do it yourself, as calibration must be performed while the sensor - * is at rest and this property can not be asserted for all use cases. - * - * @param address The address of the device, defaults to 0x68. - * @param update_interval The interval in ms to update the sensor values. - * @return An MPU6050Component, use this to create the individual sensors and register them with `register_sensor`. - */ - sensor::MPU6050Component *make_mpu6050_sensor(uint8_t address = 0x68, uint32_t update_interval = 60000); -#endif - -#ifdef USE_TSL2561 - /** Create a TSL2561 accurate ambient light sensor. - * - * This i2c-based device can provide very precise illuminance readings with great accuracy regarding the human - * eye response to the brightness level. By default, this sensor uses the i2c address 0x39, but you can change it - * with `set_address` later using the return value of this function (address 0x29 if '0' shorted on board, address - * 0x49 if '1' shorted on board). - * - * The sensor values that are pushed out will be the transformed illuminance values in lx taking using the - * internal IR and Full Spectrum photodiodes. - * - * Additionally, you can specify the time the sensor takes for accumulating the values (higher is better for - * lower light conditions, defaults to 402ms - the max) and a gain that should be used for the ADCs (defaults to - * 1x). Finally, this integration is energy efficient and only turns on the sensor when the values are read out. - * - * @param name The friendly name how the sensor should be advertised. - * @param address The address of this i2c device. - * @param update_interval The interval in ms to update the sensor values. - */ - sensor::TSL2561Sensor *make_tsl2561_sensor(const std::string &name, uint8_t address = 0x23, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_BH1750 - /** Create a BH1750 ambient light sensor. - * - * This i2c-based provides ambient light readings in lx with resolutions of 4LX, 1LX and 0.5LX (the default). - * To change the resolution, call set_resolution on the return value of this function. - * - * By default, this sensor uses the i2c address 0x23 (the default if ADDR is pulled low). If the ADDR pin - * is pulled high (above 0.7VCC), then you can manually set the address to 0x5C using set_address. - * - * @param name The friendly name that this sensor should be advertised as. - * @param address The address of this i2c device. - * @param update_interval The interval in ms to update the sensor values. - * @return The BH1750Sensor + MQTT sensor pair, use this for advanced settings. - */ - sensor::BH1750Sensor *make_bh1750_sensor(const std::string &name, uint8_t address = 0x23, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_BME280 - /** Create a BME280 Temperature+Pressure+Humidity i2c sensor. - * - * @param temperature_name The friendly name the temperature sensor should be advertised as. - * @param pressure_name The friendly name the pressure sensor should be advertised as. - * @param humidity_name The friendly name the humidity sensor should be advertised as. - * @param address The i2c address of the sensor. Defaults to 0x77 (SDO to V_DDIO), can also be 0x76. - * @param update_interval The interval in ms to update the sensor values. - */ - sensor::BME280Component *make_bme280_sensor(const std::string &temperature_name, const std::string &pressure_name, - const std::string &humidity_name, - uint8_t address = 0x77, uint32_t update_interval = 60000); -#endif - -#ifdef USE_BMP280 - /** Create a BMP280 Temperature+Pressure i2c sensor. - * - * @param temperature_name The friendly name the temperature sensor should be advertised as. - * @param pressure_name The friendly name the pressure sensor should be advertised as. - * @param address The i2c address of the sensor. Defaults to 0x77 (SDO to V_DDIO), can also be 0x76. - * @param update_interval The interval in ms to update the sensor values. - */ - sensor::BMP280Component *make_bmp280_sensor(const std::string &temperature_name, const std::string &pressure_name, - uint8_t address = 0x77, uint32_t update_interval = 60000); -#endif - -#ifdef USE_BME680 - sensor::BME680Component *make_bme680_sensor(const std::string &temperature_name, const std::string &pressure_name, - const std::string &humidity_name, const std::string &gas_resistance_name, - uint8_t address = 0x76, uint32_t update_interval = 60000); -#endif - -#ifdef USE_SHT3XD - sensor::SHT3XDComponent *make_sht3xd_sensor(const std::string &temperature_name, const std::string &humidity_name, - uint8_t address = 0x44, uint32_t update_interval = 60000); -#endif - -#ifdef USE_DHT12_SENSOR - sensor::DHT12Component *make_dht12_sensor(const std::string &temperature_name, const std::string &humidity_name, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_ROTARY_ENCODER_SENSOR - /** Create a continuous rotary encoder sensor with a digital signal. - * - * It will keep track of how far the encoder has been turned using the signals from the two required pins A & B. - * There's also support for a third "index" pin. Each time this pin is pulled high, the counter will reset to 0. - * - * Additionally, you can specify a resolution for the rotary encoder. By default, the encoder will only increment - * the counter once a full cycle of A&B signals has been detected to prevent triggers from noise. You can change - * this behavior using the set_resolution method. - * - * The output value of this rotary encoder is a raw integer step value. Use filters - * to convert this raw value to something sensible like degrees. Next, this sensor pushes its state on every detected - * counter change. - * - * Read https://playground.arduino.cc/Main/RotaryEncoders to see how they work. - * - * @param name The name of the rotary encoder. - * @param pin_a The first pin of the sensor. - * @param pin_b The second pin of the sensor. - */ - sensor::RotaryEncoderSensor *make_rotary_encoder_sensor(const std::string &name, - const GPIOInputPin &pin_a, - const GPIOInputPin &pin_b); -#endif - -#ifdef USE_TEMPLATE_SENSOR - sensor::TemplateSensor *make_template_sensor(const std::string &name, uint32_t update_interval = 60000); -#endif - -#ifdef USE_MAX31855_SENSOR - sensor::MAX31855Sensor *make_max31855_sensor(const std::string &name, SPIComponent *spi_bus, const GPIOOutputPin &cs, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_MAX6675_SENSOR - sensor::MAX6675Sensor *make_max6675_sensor(const std::string &name, SPIComponent *spi_bus, const GPIOOutputPin &cs, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_ESP32_HALL_SENSOR - sensor::ESP32HallSensor *make_esp32_hall_sensor(const std::string &name, uint32_t update_interval = 60000); -#endif - -#ifdef USE_DUTY_CYCLE_SENSOR - sensor::DutyCycleSensor *make_duty_cycle_sensor(const std::string &name, const GPIOInputPin &pin, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_MHZ19 - sensor::MHZ19Component *make_mhz19_sensor(UARTComponent *parent, const std::string &co2_name, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_UPTIME_SENSOR - sensor::UptimeSensor *make_uptime_sensor(const std::string &name, uint32_t update_interval = 60000); -#endif - -#ifdef USE_INA219 - sensor::INA219Component *make_ina219(float shunt_resistance_ohm, float max_current_a, float max_voltage_v, - uint8_t address = 0x40, uint32_t update_interval = 60000); -#endif - -#ifdef USE_INA3221 - sensor::INA3221Component *make_ina3221(uint8_t address = 0x40, uint32_t update_interval = 60000); -#endif - -#ifdef USE_HMC5883L - sensor::HMC5883LComponent *make_hmc5883l(uint32_t update_interval = 60000); -#endif - -#ifdef USE_HX711 - sensor::HX711Sensor *make_hx711_sensor(const std::string &name, const GPIOInputPin &dout, const GPIOOutputPin &sck, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_MS5611 - sensor::MS5611Component *make_ms5611_sensor(const std::string &temperature_name, const std::string &pressure_name, - uint32_t update_interval = 60000); -#endif - -#ifdef USE_TCS34725 - sensor::TCS34725Component *make_tcs34725(uint32_t update_interval = 60000); -#endif - -#ifdef USE_SNTP_COMPONENT - time::SNTPComponent *make_sntp_component(); -#endif - -#ifdef USE_HOMEASSISTANT_TIME - time::HomeAssistantTime *make_homeassistant_time_component(); -#endif - -#ifdef USE_HLW8012 - sensor::HLW8012Component *make_hlw8012(const GPIOOutputPin &sel_pin, uint8_t cf_pin, uint8_t cf1_pin, uint32_t update_interval = 60000); -#endif - -#ifdef USE_MQTT_SUBSCRIBE_SENSOR - sensor::MQTTSubscribeSensor *make_mqtt_subscribe_sensor(const std::string &name, std::string topic); -#endif - -#ifdef USE_HOMEASSISTANT_SENSOR - sensor::HomeassistantSensor *make_homeassistant_sensor(const std::string &name, std::string entity_id); -#endif - -#ifdef USE_HOMEASSISTANT_BINARY_SENSOR - binary_sensor::HomeassistantBinarySensor *make_homeassistant_binary_sensor(const std::string &name, std::string entity_id); -#endif - -#ifdef USE_CSE7766 - sensor::CSE7766Component *make_cse7766(UARTComponent *parent, uint32_t update_interval = 60000); -#endif - - -#ifdef USE_MQTT_SUBSCRIBE_TEXT_SENSOR - text_sensor::MQTTSubscribeTextSensor *make_mqtt_subscribe_text_sensor(const std::string &name, std::string topic); -#endif - -#ifdef USE_HOMEASSISTANT_TEXT_SENSOR - text_sensor::HomeassistantTextSensor *make_homeassistant_text_sensor(const std::string &name, std::string entity_id); -#endif - -#ifdef USE_VERSION_TEXT_SENSOR - text_sensor::VersionTextSensor *make_version_text_sensor(const std::string &name); -#endif - -#ifdef USE_TEMPLATE_TEXT_SENSOR - text_sensor::TemplateTextSensor *make_template_text_sensor(const std::string &name, uint32_t update_interval = 60000); -#endif - -#ifdef USE_PMSX003 - sensor::PMSX003Component *make_pmsx003(UARTComponent *parent, sensor::PMSX003Type type); -#endif - -#ifdef USE_TOTAL_DAILY_ENERGY_SENSOR - sensor::TotalDailyEnergy *make_total_daily_energy_sensor(const std::string &name, time::RealTimeClockComponent *time, - sensor::Sensor *parent); -#endif - -#ifdef USE_APDS9960 - sensor::APDS9960 *make_apds9960(uint32_t update_interval = 60000); -#endif - - -#ifdef USE_CUSTOM_SENSOR - sensor::CustomSensorConstructor *make_custom_sensor(const std::function()> &init); -#endif - - - - - - /* ___ _ _ _____ ____ _ _ _____ - * / _ \| | | |_ _| _ \| | | |_ _| - * | | | | | | | | | | |_) | | | | | | - * | |_| | |_| | | | | __/| |_| | | | - * \___/ \___/ |_| |_| \___/ |_| - */ -#ifdef USE_OUTPUT - /** Create a power supply component that will automatically switch on and off. - * - * @param pin The pin the power supply is connected to. - * @param enable_time The time (in ms) the power supply needs until it can provide high power when powering on. - * @param keep_on_time The time (in ms) the power supply should stay on when it is not used. - * @return The PowerSupplyComponent. - */ - PowerSupplyComponent *make_power_supply(const GPIOOutputPin &pin, uint32_t enable_time = 20, - uint32_t keep_on_time = 10000); -#endif - -#ifdef USE_LEDC_OUTPUT - /** Create a ESP32 LEDC channel. - * - * @param pin The pin. - * @param frequency The PWM frequency. - * @param bit_depth The LEDC bit depth. - * @return The LEDC component. Use this for advanced settings. - */ - output::LEDCOutputComponent *make_ledc_output(uint8_t pin, float frequency = 1000.0f, uint8_t bit_depth = 12); -#endif - -#ifdef USE_PCA9685_OUTPUT - /** Create a PCA9685 component. - * - * @param frequency The PWM frequency. - * @return The PCA9685 component. Use this for advanced settings. - */ - output::PCA9685OutputComponent *make_pca9685_component(float frequency); -#endif - -#ifdef USE_GPIO_OUTPUT - /** Create a simple binary GPIO output component. - * - * Note: This is *only* a binary output component, not a switch that will be exposed - * in Home Assistant. See make_simple_gpio_switch for a switch. - * - * @param pin The GPIO pin. - * @return The GPIOBinaryOutputComponent. Use this for advanced settings. - */ - output::GPIOBinaryOutputComponent *make_gpio_output(const GPIOOutputPin &pin); -#endif - -#ifdef USE_ESP8266_PWM_OUTPUT - /** Create an ESP8266 software PWM channel. - * - * Warning: This is a *software* PWM and therefore can have noticeable flickering. Additionally, - * this software PWM can't output values higher than 80%. - * - * @param pin The pin for this PWM output, supported pins are 0-16. - * @return The PWM output channel, use this for advanced settings and using it with lights. - */ - output::ESP8266PWMOutput *make_esp8266_pwm_output(GPIOOutputPin pin_); -#endif - -#ifdef USE_MY9231_OUTPUT - /** Create a MY9231 component. - * - * @param pin_di The pin which DI is connected to. - * @param pin_dcki The pin which DCKI is connected to. - * @return The MY9231 component. Use this for advanced settings. - */ - output::MY9231OutputComponent *make_my9231_component(const GPIOOutputPin &pin_di, - const GPIOOutputPin &pin_dcki); -#endif - - - - - - - /* _ ___ ____ _ _ _____ - * | | |_ _/ ___| | | |_ _| - * | | | | | _| |_| | | | - * | |___ | | |_| | _ | | | - * |_____|___\____|_| |_| |_| - */ -#ifdef USE_LIGHT - /// Register a light within esphomelib. - void register_light(light::LightState *state); - - struct MakeLight { - light::LightOutput *output; - light::LightState *state; - }; - - MakeLight make_light_for_light_output(const std::string &name, light::LightOutput *output); - - /** Create a binary light. - * - * @param friendly_name The name the light should be advertised as. Leave empty for no automatic discovery. - * @param binary The binary output channel. - * @return The components for this light. Use this for advanced settings. - */ - MakeLight make_binary_light(const std::string &friendly_name, output::BinaryOutput *binary); - - /** Create a monochromatic light. - * - * @param friendly_name The name the light should be advertised as. Leave empty for no automatic discovery. - * @param mono The output channel. - * @return The components for this light. Use this for advanced settings. - */ - MakeLight make_monochromatic_light(const std::string &friendly_name, output::FloatOutput *mono); - - /** Create a RGB light. - * - * @param friendly_name The name the light should be advertised as. Leave empty for no automatic discovery. - * @param red The red output channel. - * @param green The green output channel. - * @param blue The blue output channel. - * @return The components for this light. Use this for advanced settings. - */ - MakeLight make_rgb_light(const std::string &friendly_name, - output::FloatOutput *red, output::FloatOutput *green, output::FloatOutput *blue); - - /** Create a RGBW light. - * - * @param friendly_name The name the light should be advertised as. Leave empty for no automatic discovery. - * @param red The red output channel. - * @param green The green output channel. - * @param blue The blue output channel. - * @param white The white output channel. - * @return The components for this light. Use this for advanced settings. - */ - MakeLight make_rgbw_light(const std::string &friendly_name, - output::FloatOutput *red, output::FloatOutput *green, output::FloatOutput *blue, - output::FloatOutput *white); - - MakeLight make_rgbww_light(const std::string &friendly_name, - float cold_white_mireds, - float warm_white_mireds, - output::FloatOutput *red, - output::FloatOutput *green, - output::FloatOutput *blue, - output::FloatOutput *cold_white, - output::FloatOutput *warm_white); - - MakeLight make_cwww_light(const std::string &friendly_name, - float cold_white_mireds, - float warm_white_mireds, - output::FloatOutput *cold_white, - output::FloatOutput *warm_white); -#endif - -#ifdef USE_FAST_LED_LIGHT - struct MakeFastLEDLight { - light::FastLEDLightOutputComponent *fast_led; - light::LightState *state; - }; - - /// Create an FastLED light. - MakeFastLEDLight make_fast_led_light(const std::string &name); -#endif - -#ifdef USE_NEO_PIXEL_BUS_LIGHT - template - struct MakeNeoPixelBusLight { - light::NeoPixelBusLightOutputBase *output; - light::LightState *state; - }; - - /// Create an RGB NeoPixelBus light. - template - MakeNeoPixelBusLight make_neo_pixel_bus_rgb_light(const std::string &name); - - /// Create an RGBW NeoPixelBus light. - template - MakeNeoPixelBusLight make_neo_pixel_bus_rgbw_light(const std::string &name); -#endif - - - - - - /* ______ _____ _____ ____ _ _ - * / ___\ \ / |_ _|_ _/ ___| | | | - * \___ \\ \ /\ / / | | | || | | |_| | - * ___) |\ V V / | | | || |___| _ | - * |____/ \_/\_/ |___| |_| \____|_| |_| - */ -#ifdef USE_SWITCH - /// Register a Switch internally, creating a MQTT Switch if the MQTT client is set up - void register_switch(switch_::Switch *switch_); -#endif - -#ifdef USE_GPIO_SWITCH - /** Create a simple GPIO switch that can be toggled on/off and appears in the frontend. - * - * @param pin The pin used for this switch. Can be integer or GPIOOutputPin. - * @param friendly_name The friendly name advertised to Home Assistant for this switch- - */ - switch_::GPIOSwitch *make_gpio_switch(const std::string &friendly_name, const GPIOOutputPin &pin); -#endif - -#ifdef USE_RESTART_SWITCH - /// Make a simple switch that restarts the device with the provided friendly name. - switch_::RestartSwitch *make_restart_switch(const std::string &friendly_name); -#endif - -#ifdef USE_SHUTDOWN_SWITCH - /// Make a simple switch that shuts the node down indefinitely. - switch_::ShutdownSwitch *make_shutdown_switch(const std::string &friendly_name); -#endif - -#ifdef USE_OUTPUT_SWITCH - /// Make an output switch that exposes a binary output as a switch - switch_::OutputSwitch *make_output_switch(const std::string &friendly_name, output::BinaryOutput *output); -#endif - -#ifdef USE_TEMPLATE_SWITCH - switch_::TemplateSwitch *make_template_switch(const std::string &name); -#endif - -#ifdef USE_REMOTE_TRANSMITTER - remote::RemoteTransmitterComponent *make_remote_transmitter_component(const GPIOOutputPin &output); -#endif - -#ifdef USE_UART_SWITCH - switch_::UARTSwitch *make_uart_switch(UARTComponent *parent, const std::string &name, const std::vector &data); -#endif - -#ifdef USE_CUSTOM_SWITCH - switch_::CustomSwitchConstructor *make_custom_switch(const std::function()> &init); -#endif - - - - - - - /* _____ _ _ _ - * | ___/ \ | \ | | - * | |_ / _ \ | \| | - * | _/ ___ \| |\ | - * |_|/_/ \_|_| \_| - */ -#ifdef USE_FAN - /// Register a fan internally. - void register_fan(fan::FanState *state); - - struct MakeFan { - fan::BasicFanComponent *output; - fan::FanState *state; - }; - - /** Create and connect a Fan with the specified friendly name. - * - * @param friendly_name The friendly name of the Fan to advertise. - * @return A FanStruct, use the output field to set your output channels. - */ - MakeFan make_fan(const std::string &friendly_name); -#endif - - - - - - - /* _____ ______ ________ _____ - * / ____/ __ \ \ / / ____| __ \ - * | | | | | \ \ / /| |__ | |__) | - * | | | | | |\ \/ / | __| | _ / - * | |___| |__| | \ / | |____| | \ \ - * \_____\____/ \/ |______|_| \_\ - */ -#ifdef USE_COVER - void register_cover(cover::Cover *cover); -#endif - -#ifdef USE_TEMPLATE_COVER - cover::TemplateCover *make_template_cover(const std::string &name); -#endif - - -#ifdef USE_A4988 - stepper::A4988 *make_a4988(const GPIOOutputPin &step_pin, const GPIOOutputPin &dir_pin); -#endif - -#ifdef USE_ULN2003 - stepper::ULN2003 *make_uln2003(const GPIOOutputPin &pin_a, const GPIOOutputPin &pin_b, - const GPIOOutputPin &pin_c, const GPIOOutputPin &pin_d); -#endif - - - - - - - - /* _ _ _____ _ ____ _____ ____ ____ - * | | | | ____| | | _ \| ____| _ \/ ___| - * | |_| | _| | | | |_) | _| | |_) \___ \ - * | _ | |___| |___| __/| |___| _ < ___) | - * |_| |_|_____|_____|_| |_____|_| \_|____/ - */ -#ifdef USE_DEBUG_COMPONENT - DebugComponent *make_debug_component(); -#endif - -#ifdef USE_DEEP_SLEEP - DeepSleepComponent *make_deep_sleep_component(); -#endif - -#ifdef USE_PCF8574 - /** Create a PCF8574/PCF8575 port expander component. - * - * This component will allow you to emulate GPIOInputPin and GPIOOutputPin instances that - * are used within esphomelib. You can therefore simply pass the result of calling - * `make_pin` on the component to any method accepting GPIOInputPin or GPIOOutputPin. - * - * Optionally, this component also has support for the 16-channel PCF8575 port expander. - * To use the PCF8575, set the pcf8575 in this helper function. - * - * @param address The i2c address to use for this port expander. Defaults to 0x21. - * @param pcf8575 If this is an PCF8575. Defaults to PCF8574. - * @return The PCF8574Component instance to get individual pins. - */ - io::PCF8574Component *make_pcf8574_component(uint8_t address = 0x21, bool pcf8575 = false); -#endif - - /// Register the component in this Application instance. - template - C *register_component(C *c); - - template - C *register_controller(C *c); - - /// Set up all the registered components. Call this at the end of your setup() function. - void setup(); - - /// Make a loop iteration. Call this in your loop() function. - void loop(); - - WiFiComponent *get_wifi() const; -#ifdef USE_MQTT - mqtt::MQTTClientComponent *get_mqtt_client() const; -#endif - - /// Get the name of this Application set by set_name(). - const std::string &get_name() const; - - bool is_fully_setup() const; - - /** Tell esphomelib when your project was last compiled. This is used to show - * a message like "You're running esphomelib v1.9.0 compiled on Oct 10 2018, 16:42:00" - * - * To use this method in code, put the following before App.setup(): - * - * ```cpp - * App.set_compilation_datetime(__DATE__ ", " __TIME__); - * ``` - * - * @param str The string of the time of compilation. - */ - void set_compilation_datetime(const char *str); - - const std::string &get_compilation_time() const; - - /** Set the target interval with which to run the loop() calls. - * If the loop() method takes longer than the target interval, esphomelib won't - * sleep in loop(), but if the time spent in loop() is small than the target, esphomelib - * will delay at the end of the App.loop() method. - * - * This is done to conserve power: In most use-cases, high-speed loop() calls are not required - * and degrade power consumption. - * - * Each component can request a high frequency loop execution by using the HighFrequencyLoopRequester - * helper in helpers.h - * - * @param loop_interval The interval in milliseconds to run the core loop at. Defaults to 16 milliseconds. - */ - void set_loop_interval(uint32_t loop_interval); - - void dump_config(); - void schedule_dump_config(); - - protected: - void register_component_(Component *comp); - - std::vector components_{}; - std::vector controllers_{}; -#ifdef USE_MQTT - mqtt::MQTTClientComponent *mqtt_client_{nullptr}; -#endif - WiFiComponent *wifi_{nullptr}; - - std::string name_; - std::string compilation_time_; - uint32_t application_state_{COMPONENT_STATE_CONSTRUCTION}; - uint32_t last_loop_{0}; - uint32_t loop_interval_{16}; -#ifdef USE_I2C - I2CComponent *i2c_{nullptr}; -#endif - bool dump_config_scheduled_{false}; -}; - -/// Global storage of Application pointer - only one Application can exist. -extern Application App; - -template -C *Application::register_component(C *c) { - static_assert(std::is_base_of::value, "Only Component subclasses can be registered"); - this->register_component_((Component *) c); - return c; -} - -template -C *Application::register_controller(C *c) { - static_assert(std::is_base_of::value, "Only Controller subclasses can be registered"); - Controller *controller = c; - this->controllers_.push_back(controller); - return c; -} - -template -Automation *Application::make_automation(Trigger *trigger) { - return new Automation(trigger); -} - -template -GlobalVariableComponent *Application::make_global_variable() { - return this->register_component(new GlobalVariableComponent()); -} - -template -GlobalVariableComponent *Application::make_global_variable(T initial_value) { - return this->register_component(new GlobalVariableComponent(initial_value)); -} - -#ifdef USE_NEO_PIXEL_BUS_LIGHT -template -Application::MakeNeoPixelBusLight Application::make_neo_pixel_bus_rgb_light(const std::string &name) { - auto *neo_pixel = this->register_component(new light::NeoPixelRGBLightOutput()); - auto make = this->make_light_for_light_output(name, neo_pixel); - - return MakeNeoPixelBusLight { - .output = neo_pixel, - .state = make.state, - }; -} -template -Application::MakeNeoPixelBusLight Application::make_neo_pixel_bus_rgbw_light(const std::string &name) { - auto *neo_pixel = this->register_component(new light::NeoPixelRGBWLightOutput()); - auto make = this->make_light_for_light_output(name, neo_pixel); - - return MakeNeoPixelBusLight { - .output = neo_pixel, - .state = make.state, - }; -} -#endif - -ESPHOMELIB_NAMESPACE_END - -#endif //ESPHOMELIB_APPLICATION_H +#pragma once +#warning "This header file is deprecated, please include esphome.h instead." +#include "esphome/application.h" diff --git a/src/esphomelib/log.h b/src/esphomelib/log.h deleted file mode 100644 index cc382f18..00000000 --- a/src/esphomelib/log.h +++ /dev/null @@ -1,173 +0,0 @@ -#ifndef ESPHOMELIB_LOG_H -#define ESPHOMELIB_LOG_H - -#include -#include -#include -#include "esphomelib/defines.h" -#ifdef USE_STORE_LOG_STR_IN_FLASH - #include "WString.h" -#endif - -// avoid esp-idf redefining our macros -#include "esphomelib/esphal.h" - -#ifdef ARDUINO_ARCH_ESP32 - #include "esp_err.h" -#endif - -#define ESPHOMELIB_LOG_LEVEL_NONE 0 -#define ESPHOMELIB_LOG_LEVEL_ERROR 1 -#define ESPHOMELIB_LOG_LEVEL_WARN 2 -#define ESPHOMELIB_LOG_LEVEL_INFO 3 -#define ESPHOMELIB_LOG_LEVEL_DEBUG 4 -#define ESPHOMELIB_LOG_LEVEL_VERBOSE 5 -#define ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE 6 - -#ifndef ESPHOMELIB_LOG_LEVEL - #define ESPHOMELIB_LOG_LEVEL ESPHOMELIB_LOG_LEVEL_DEBUG -#endif - -#define ESPHOMELIB_LOG_COLOR_BLACK "30" -#define ESPHOMELIB_LOG_COLOR_RED "31" //ERROR -#define ESPHOMELIB_LOG_COLOR_GREEN "32" //INFO -#define ESPHOMELIB_LOG_COLOR_YELLOW "33" //WARNING -#define ESPHOMELIB_LOG_COLOR_BLUE "34" -#define ESPHOMELIB_LOG_COLOR_MAGENTA "35" //CONFIG -#define ESPHOMELIB_LOG_COLOR_CYAN "36" //DEBUG -#define ESPHOMELIB_LOG_COLOR_GRAY "37" //VERBOSE -#define ESPHOMELIB_LOG_COLOR_WHITE "38" -#define ESPHOMELIB_LOG_SECRET_BEGIN "\033[5m" -#define ESPHOMELIB_LOG_SECRET_END "\033[6m" -#define LOG_SECRET(x) ESPHOMELIB_LOG_SECRET_BEGIN x ESPHOMELIB_LOG_SECRET_END - -#define ESPHOMELIB_LOG_COLOR(COLOR) "\033[0;" COLOR "m" -#define ESPHOMELIB_LOG_BOLD(COLOR) "\033[1;" COLOR "m" - -#ifndef ESPHOMELIB_LOG_NO_COLORS - #define ESPHOMELIB_LOG_COLOR_E ESPHOMELIB_LOG_BOLD(ESPHOMELIB_LOG_COLOR_RED) - #define ESPHOMELIB_LOG_COLOR_W ESPHOMELIB_LOG_COLOR(ESPHOMELIB_LOG_COLOR_YELLOW) - #define ESPHOMELIB_LOG_COLOR_I ESPHOMELIB_LOG_COLOR(ESPHOMELIB_LOG_COLOR_GREEN) - #define ESPHOMELIB_LOG_COLOR_C ESPHOMELIB_LOG_COLOR(ESPHOMELIB_LOG_COLOR_MAGENTA) - #define ESPHOMELIB_LOG_COLOR_D ESPHOMELIB_LOG_COLOR(ESPHOMELIB_LOG_COLOR_CYAN) - #define ESPHOMELIB_LOG_COLOR_V ESPHOMELIB_LOG_COLOR(ESPHOMELIB_LOG_COLOR_GRAY) - #define ESPHOMELIB_LOG_COLOR_VV ESPHOMELIB_LOG_COLOR(ESPHOMELIB_LOG_COLOR_WHITE) - #define ESPHOMELIB_LOG_RESET_COLOR "\033[0m" -#else - #define ESPHOMELIB_LOG_COLOR_E - #define ESPHOMELIB_LOG_COLOR_W - #define ESPHOMELIB_LOG_COLOR_I - #define ESPHOMELIB_LOG_COLOR_C - #define ESPHOMELIB_LOG_COLOR_D - #define ESPHOMELIB_LOG_COLOR_V - #define ESPHOMELIB_LOG_COLOR_VV - #define ESPHOMELIB_LOG_RESET_COLOR -#endif - -int esp_log_printf_(int level, const char *tag, const char *format, ...) __attribute__ ((format (printf, 3, 4))); -#ifdef USE_STORE_LOG_STR_IN_FLASH - int esp_log_printf_(int level, const char *tag, const __FlashStringHelper *format, ...); -#endif -int esp_log_vprintf_(int level, const char *tag, const char *format, va_list args); -#ifdef USE_STORE_LOG_STR_IN_FLASH - int esp_log_vprintf_(int level, const char *tag, const __FlashStringHelper *format, va_list args); -#endif -int esp_idf_log_vprintf_(const char *format, va_list args); - -#ifdef USE_STORE_LOG_STR_IN_FLASH - #define ESPHOMELIB_LOG_FORMAT(tag, letter, format) F(ESPHOMELIB_LOG_COLOR_ ## letter "[" #letter "][%s:%03u]: " format ESPHOMELIB_LOG_RESET_COLOR), tag, __LINE__ -#else - #define ESPHOMELIB_LOG_FORMAT(tag, letter, format) ESPHOMELIB_LOG_COLOR_ ## letter "[" #letter "][%s:%03u]: " format ESPHOMELIB_LOG_RESET_COLOR, tag, __LINE__ -#endif - -#if ESPHOMELIB_LOG_LEVEL >= ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE - #define esph_log_vv(tag, format, ...) esp_log_printf_(ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE, tag, ESPHOMELIB_LOG_FORMAT(tag, VV, format), ##__VA_ARGS__) - - #define ESPHOMELIB_LOG_HAS_VERY_VERBOSE -#else - #define esph_log_vv(tag, format, ...) -#endif - -#if ESPHOMELIB_LOG_LEVEL >= ESPHOMELIB_LOG_LEVEL_VERBOSE - #define esph_log_v(tag, format, ...) esp_log_printf_(ESPHOMELIB_LOG_LEVEL_VERBOSE, tag, ESPHOMELIB_LOG_FORMAT(tag, V, format), ##__VA_ARGS__) - - #define ESPHOMELIB_LOG_HAS_VERBOSE -#else - #define esph_log_v(tag, format, ...) -#endif - -#if ESPHOMELIB_LOG_LEVEL >= ESPHOMELIB_LOG_LEVEL_DEBUG - #define esph_log_d(tag, format, ...) esp_log_printf_(ESPHOMELIB_LOG_LEVEL_DEBUG, tag, ESPHOMELIB_LOG_FORMAT(tag, D, format), ##__VA_ARGS__) - - #define esph_log_config(tag, format, ...) esp_log_printf_(ESPHOMELIB_LOG_LEVEL_DEBUG, tag, ESPHOMELIB_LOG_FORMAT(tag, C, format), ##__VA_ARGS__) - - #define ESPHOMELIB_LOG_HAS_DEBUG - #define ESPHOMELIB_LOG_HAS_CONFIG -#else - #define esph_log_d(tag, format, ...) - - #define esph_log_config(tag, format, ...) -#endif - -#if ESPHOMELIB_LOG_LEVEL >= ESPHOMELIB_LOG_LEVEL_INFO - #define esph_log_i(tag, format, ...) esp_log_printf_(ESPHOMELIB_LOG_LEVEL_INFO, tag, ESPHOMELIB_LOG_FORMAT(tag, I, format), ##__VA_ARGS__) - - #define ESPHOMELIB_LOG_HAS_INFO -#else - #define esph_log_i(tag, format, ...) -#endif - -#if ESPHOMELIB_LOG_LEVEL >= ESPHOMELIB_LOG_LEVEL_WARN - #define esph_log_w(tag, format, ...) esp_log_printf_(ESPHOMELIB_LOG_LEVEL_WARN, tag, ESPHOMELIB_LOG_FORMAT(tag, W, format), ##__VA_ARGS__) - - #define ESPHOMELIB_LOG_HAS_WARN -#else - #define esph_log_w(tag, format, ...) -#endif - -#if ESPHOMELIB_LOG_LEVEL >= ESPHOMELIB_LOG_LEVEL_ERROR - #define esph_log_e(tag, format, ...) esp_log_printf_(ESPHOMELIB_LOG_LEVEL_ERROR, tag, ESPHOMELIB_LOG_FORMAT(tag, E, format), ##__VA_ARGS__) - - #define ESPHOMELIB_LOG_HAS_ERROR -#else - #define esph_log_e(tag, format, ...) -#endif - -#ifdef ESP_LOGE - #undef ESP_LOGE -#endif -#ifdef ESP_LOGW - #undef ESP_LOGW -#endif -#ifdef ESP_LOGI - #undef ESP_LOGI -#endif -#ifdef ESP_LOGD - #undef ESP_LOGD -#endif -#ifdef ESP_LOGV - #undef ESP_LOGV -#endif - -#define ESP_LOGE(tag, ...) esph_log_e(tag, __VA_ARGS__) -#define ESP_LOGW(tag, ...) esph_log_w(tag, __VA_ARGS__) -#define ESP_LOGI(tag, ...) esph_log_i(tag, __VA_ARGS__) -#define ESP_LOGD(tag, ...) esph_log_d(tag, __VA_ARGS__) -#define ESP_LOGV(tag, ...) esph_log_v(tag, __VA_ARGS__) -#define ESP_LOGVV(tag, ...) esph_log_vv(tag, __VA_ARGS__) -#define ESP_LOGCONFIG(tag, ...) esph_log_config(tag, __VA_ARGS__) - -#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" -#define BYTE_TO_BINARY(byte) \ - ((byte) & 0x80 ? '1' : '0'), \ - ((byte) & 0x40 ? '1' : '0'), \ - ((byte) & 0x20 ? '1' : '0'), \ - ((byte) & 0x10 ? '1' : '0'), \ - ((byte) & 0x08 ? '1' : '0'), \ - ((byte) & 0x04 ? '1' : '0'), \ - ((byte) & 0x02 ? '1' : '0'), \ - ((byte) & 0x01 ? '1' : '0') -#define YESNO(b) ((b) ? "YES" : "NO") -#define ONOFF(b) ((b) ? "ON" : "OFF") - -#endif //ESPHOMELIB_LOG_H