mirror of
https://github.com/esphome/esphome.git
synced 2025-11-08 11:01:50 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
929600d7f7 | ||
|
|
163d0c55ab | ||
|
|
327ccb241e | ||
|
|
6b3c7b0854 | ||
|
|
681dcb51da | ||
|
|
576d5021fd | ||
|
|
6cd76f00ac | ||
|
|
6f63a62a8d | ||
|
|
8867a0fcfb |
@@ -31,6 +31,10 @@ uint8_t I2CAS3935Component::read_register(uint8_t reg) {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
void I2CAS3935Component::dump_config() {
|
||||
AS3935Component::dump_config();
|
||||
LOG_I2C_DEVICE(this);
|
||||
}
|
||||
|
||||
} // namespace as3935_i2c
|
||||
} // namespace esphome
|
||||
|
||||
@@ -10,6 +10,9 @@ namespace esphome {
|
||||
namespace as3935_i2c {
|
||||
|
||||
class I2CAS3935Component : public as3935::AS3935Component, public i2c::I2CDevice {
|
||||
public:
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
void write_register(uint8_t reg, uint8_t mask, uint8_t bits, uint8_t start_position) override;
|
||||
uint8_t read_register(uint8_t reg) override;
|
||||
|
||||
@@ -145,6 +145,14 @@ Trigger<> *BangBangClimate::get_cool_trigger() const { return this->cool_trigger
|
||||
void BangBangClimate::set_supports_cool(bool supports_cool) { this->supports_cool_ = supports_cool; }
|
||||
Trigger<> *BangBangClimate::get_heat_trigger() const { return this->heat_trigger_; }
|
||||
void BangBangClimate::set_supports_heat(bool supports_heat) { this->supports_heat_ = supports_heat; }
|
||||
void BangBangClimate::dump_config() {
|
||||
LOG_CLIMATE("", "Bang Bang Climate", this);
|
||||
ESP_LOGCONFIG(TAG, " Supports HEAT: %s", YESNO(this->supports_heat_));
|
||||
ESP_LOGCONFIG(TAG, " Supports COOL: %s", YESNO(this->supports_cool_));
|
||||
ESP_LOGCONFIG(TAG, " Supports AWAY mode: %s", YESNO(this->supports_away_));
|
||||
ESP_LOGCONFIG(TAG, " Default Target Temperature Low: %.1f°C", this->normal_config_.default_temperature_low);
|
||||
ESP_LOGCONFIG(TAG, " Default Target Temperature High: %.1f°C", this->normal_config_.default_temperature_high);
|
||||
}
|
||||
|
||||
BangBangClimateTargetTempConfig::BangBangClimateTargetTempConfig() = default;
|
||||
BangBangClimateTargetTempConfig::BangBangClimateTargetTempConfig(float default_temperature_low,
|
||||
|
||||
@@ -21,6 +21,7 @@ class BangBangClimate : public climate::Climate, public Component {
|
||||
public:
|
||||
BangBangClimate();
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
void set_sensor(sensor::Sensor *sensor);
|
||||
Trigger<> *get_idle_trigger() const;
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace binary_sensor {
|
||||
|
||||
#define LOG_BINARY_SENSOR(prefix, type, obj) \
|
||||
if (obj != nullptr) { \
|
||||
ESP_LOGCONFIG(TAG, prefix type " '%s'", obj->get_name().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, type, obj->get_name().c_str()); \
|
||||
if (!obj->get_device_class().empty()) { \
|
||||
ESP_LOGCONFIG(TAG, prefix " Device Class: '%s'", obj->get_device_class().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, obj->get_device_class().c_str()); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import esphome.config_validation as cv
|
||||
|
||||
from esphome.components import sensor, binary_sensor
|
||||
from esphome.const import CONF_ID, CONF_CHANNELS, CONF_VALUE, CONF_TYPE, UNIT_EMPTY, \
|
||||
ICON_CHECK_CIRCLE_OUTLINE, CONF_BINARY_SENSOR
|
||||
ICON_CHECK_CIRCLE_OUTLINE, CONF_BINARY_SENSOR, CONF_GROUP
|
||||
|
||||
DEPENDENCIES = ['binary_sensor']
|
||||
|
||||
@@ -11,7 +11,6 @@ binary_sensor_map_ns = cg.esphome_ns.namespace('binary_sensor_map')
|
||||
BinarySensorMap = binary_sensor_map_ns.class_('BinarySensorMap', cg.Component, sensor.Sensor)
|
||||
SensorMapType = binary_sensor_map_ns.enum('SensorMapType')
|
||||
|
||||
CONF_GROUP = 'group'
|
||||
SENSOR_MAP_TYPES = {
|
||||
CONF_GROUP: SensorMapType.BINARY_SENSOR_MAP_TYPE_GROUP,
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ float CaptivePortal::get_setup_priority() const {
|
||||
// Before WiFi
|
||||
return setup_priority::WIFI + 1.0f;
|
||||
}
|
||||
void CaptivePortal::dump_config() { ESP_LOGCONFIG(TAG, "Captive Portal:"); }
|
||||
|
||||
CaptivePortal *global_captive_portal = nullptr;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <DNSServer.h>
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/preferences.h"
|
||||
#include "esphome/components/web_server_base/web_server_base.h"
|
||||
|
||||
@@ -18,6 +19,7 @@ class CaptivePortal : public AsyncWebHandler, public Component {
|
||||
public:
|
||||
CaptivePortal(web_server_base::WebServerBase *base);
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
void loop() override {
|
||||
if (this->dns_server_ != nullptr)
|
||||
this->dns_server_->processNextRequest();
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
namespace esphome {
|
||||
namespace climate {
|
||||
|
||||
#define LOG_CLIMATE(prefix, type, obj) \
|
||||
if (obj != nullptr) { \
|
||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, type, obj->get_name().c_str()); \
|
||||
}
|
||||
|
||||
class Climate;
|
||||
|
||||
/** This class is used to encode all control actions on a climate device.
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include "climate_ir.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace climate {
|
||||
|
||||
static const char *TAG = "climate_ir";
|
||||
|
||||
climate::ClimateTraits ClimateIR::traits() {
|
||||
auto traits = climate::ClimateTraits();
|
||||
traits.set_supports_current_temperature(this->sensor_ != nullptr);
|
||||
@@ -52,6 +55,13 @@ void ClimateIR::control(const climate::ClimateCall &call) {
|
||||
this->transmit_state();
|
||||
this->publish_state();
|
||||
}
|
||||
void ClimateIR::dump_config() {
|
||||
LOG_CLIMATE("", "IR Climate", this);
|
||||
ESP_LOGCONFIG(TAG, " Min. Temperature: %.1f°C", this->minimum_temperature_);
|
||||
ESP_LOGCONFIG(TAG, " Max. Temperature: %.1f°C", this->maximum_temperature_);
|
||||
ESP_LOGCONFIG(TAG, " Supports HEAT: %s", YESNO(this->supports_heat_));
|
||||
ESP_LOGCONFIG(TAG, " Supports COOL: %s", YESNO(this->supports_cool_));
|
||||
}
|
||||
|
||||
} // namespace climate
|
||||
} // namespace esphome
|
||||
|
||||
@@ -25,6 +25,7 @@ class ClimateIR : public climate::Climate, public Component, public remote_base:
|
||||
}
|
||||
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
void set_transmitter(remote_transmitter::RemoteTransmitterComponent *transmitter) {
|
||||
this->transmitter_ = transmitter;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import climate, remote_transmitter, remote_receiver, sensor
|
||||
from esphome.const import CONF_ID, CONF_SENSOR
|
||||
from esphome.components.remote_base import CONF_TRANSMITTER_ID, CONF_RECEIVER_ID
|
||||
from esphome.const import CONF_ID, CONF_SENSOR, CONF_SUPPORTS_COOL, CONF_SUPPORTS_HEAT
|
||||
|
||||
AUTO_LOAD = ['sensor', 'climate_ir']
|
||||
|
||||
coolix_ns = cg.esphome_ns.namespace('coolix')
|
||||
CoolixClimate = coolix_ns.class_('CoolixClimate', climate.Climate, cg.Component)
|
||||
|
||||
CONF_TRANSMITTER_ID = 'transmitter_id'
|
||||
CONF_RECEIVER_ID = 'receiver_id'
|
||||
CONF_SUPPORTS_HEAT = 'supports_heat'
|
||||
CONF_SUPPORTS_COOL = 'supports_cool'
|
||||
|
||||
CONFIG_SCHEMA = cv.All(climate.CLIMATE_SCHEMA.extend({
|
||||
cv.GenerateID(): cv.declare_id(CoolixClimate),
|
||||
cv.GenerateID(CONF_TRANSMITTER_ID): cv.use_id(remote_transmitter.RemoteTransmitterComponent),
|
||||
|
||||
@@ -13,13 +13,13 @@ const extern float COVER_CLOSED;
|
||||
|
||||
#define LOG_COVER(prefix, type, obj) \
|
||||
if (obj != nullptr) { \
|
||||
ESP_LOGCONFIG(TAG, prefix type " '%s'", obj->get_name().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, type, obj->get_name().c_str()); \
|
||||
auto traits_ = obj->get_traits(); \
|
||||
if (traits_.get_is_assumed_state()) { \
|
||||
ESP_LOGCONFIG(TAG, prefix " Assumed State: YES"); \
|
||||
ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \
|
||||
} \
|
||||
if (!obj->get_device_class().empty()) { \
|
||||
ESP_LOGCONFIG(TAG, prefix " Device Class: '%s'", obj->get_device_class().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, obj->get_device_class().c_str()); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import output
|
||||
from esphome.const import CONF_ID, CONF_LAMBDA, CONF_OUTPUTS, CONF_TYPE
|
||||
from esphome.const import CONF_ID, CONF_LAMBDA, CONF_OUTPUTS, CONF_TYPE, CONF_BINARY
|
||||
from .. import custom_ns
|
||||
|
||||
CustomBinaryOutputConstructor = custom_ns.class_('CustomBinaryOutputConstructor')
|
||||
CustomFloatOutputConstructor = custom_ns.class_('CustomFloatOutputConstructor')
|
||||
|
||||
CONF_BINARY = 'binary'
|
||||
CONF_FLOAT = 'float'
|
||||
|
||||
CONFIG_SCHEMA = cv.typed_schema({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.const import CONF_ID, CONF_TRIGGER_ID
|
||||
from esphome.const import CONF_ID, CONF_TRIGGER_ID, CONF_FILE, CONF_DEVICE
|
||||
from esphome.components import uart
|
||||
|
||||
DEPENDENCIES = ['uart']
|
||||
@@ -14,10 +14,8 @@ DFPlayerIsPlayingCondition = dfplayer_ns.class_('DFPlayerIsPlayingCondition', au
|
||||
|
||||
MULTI_CONF = True
|
||||
CONF_FOLDER = 'folder'
|
||||
CONF_FILE = 'file'
|
||||
CONF_LOOP = 'loop'
|
||||
CONF_VOLUME = 'volume'
|
||||
CONF_DEVICE = 'device'
|
||||
CONF_EQ_PRESET = 'eq_preset'
|
||||
CONF_ON_FINISHED_PLAYBACK = 'on_finished_playback'
|
||||
|
||||
|
||||
@@ -115,6 +115,10 @@ void DFPlayer::loop() {
|
||||
this->read_pos_++;
|
||||
}
|
||||
}
|
||||
void DFPlayer::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "DFPlayer:");
|
||||
this->check_uart_settings(9600);
|
||||
}
|
||||
|
||||
} // namespace dfplayer
|
||||
} // namespace esphome
|
||||
|
||||
@@ -52,6 +52,7 @@ class DFPlayer : public uart::UARTDevice, public Component {
|
||||
void random() { this->send_cmd_(0x18); }
|
||||
|
||||
bool is_playing() { return is_playing_; }
|
||||
void dump_config() override;
|
||||
|
||||
void add_on_finished_playback_callback(std::function<void()> callback) {
|
||||
this->on_finished_playback_callback_.add(std::move(callback));
|
||||
|
||||
@@ -84,8 +84,8 @@ using display_writer_t = std::function<void(DisplayBuffer &)>;
|
||||
#define LOG_DISPLAY(prefix, type, obj) \
|
||||
if (obj != nullptr) { \
|
||||
ESP_LOGCONFIG(TAG, prefix type); \
|
||||
ESP_LOGCONFIG(TAG, prefix " Rotations: %d °", obj->rotation_); \
|
||||
ESP_LOGCONFIG(TAG, prefix " Dimensions: %dpx x %dpx", obj->get_width(), obj->get_height()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Rotations: %d °", prefix, obj->rotation_); \
|
||||
ESP_LOGCONFIG(TAG, "%s Dimensions: %dpx x %dpx", prefix, obj->get_width(), obj->get_height()); \
|
||||
}
|
||||
|
||||
class DisplayBuffer {
|
||||
|
||||
@@ -31,6 +31,11 @@ static esp_ble_adv_params_t ble_adv_params = {
|
||||
static esp_ble_ibeacon_head_t ibeacon_common_head = {
|
||||
.flags = {0x02, 0x01, 0x06}, .length = 0x1A, .type = 0xFF, .company_id = 0x004C, .beacon_type = 0x1502};
|
||||
|
||||
void ESP32BLEBeacon::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ESP32 BLE Beacon:");
|
||||
ESP_LOGCONFIG(TAG, " Major: %u, Minor: %u", this->major_, this->minor_);
|
||||
}
|
||||
|
||||
void ESP32BLEBeacon::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up ESP32 BLE beacon...");
|
||||
global_esp32_ble_beacon = this;
|
||||
@@ -50,7 +55,7 @@ void ESP32BLEBeacon::ble_core_task(void *params) {
|
||||
ble_setup();
|
||||
|
||||
while (true) {
|
||||
delay(1000);
|
||||
delay(1000); // NOLINT
|
||||
}
|
||||
}
|
||||
void ESP32BLEBeacon::ble_setup() {
|
||||
|
||||
@@ -34,6 +34,7 @@ class ESP32BLEBeacon : public Component {
|
||||
explicit ESP32BLEBeacon(const std::array<uint8_t, 16> &uuid) : uuid_(uuid) {}
|
||||
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
float get_setup_priority() const override;
|
||||
|
||||
void set_major(uint16_t major) { this->major_ = major; }
|
||||
|
||||
@@ -134,7 +134,7 @@ bool ESP32BLETracker::ble_setup() {
|
||||
}
|
||||
|
||||
// BLE takes some time to be fully set up, 200ms should be more than enough
|
||||
delay(200);
|
||||
delay(200); // NOLINT
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import pins
|
||||
from esphome.const import CONF_FREQUENCY, CONF_ID, CONF_NAME, CONF_PIN, CONF_SCL, CONF_SDA, \
|
||||
ESP_PLATFORM_ESP32
|
||||
ESP_PLATFORM_ESP32, CONF_DATA_PINS, CONF_RESET_PIN, CONF_RESOLUTION, CONF_BRIGHTNESS
|
||||
|
||||
ESP_PLATFORMS = [ESP_PLATFORM_ESP32]
|
||||
DEPENDENCIES = ['api']
|
||||
@@ -35,23 +35,19 @@ FRAME_SIZES = {
|
||||
'UXGA': ESP32CameraFrameSize.ESP32_CAMERA_SIZE_1600X1200,
|
||||
}
|
||||
|
||||
CONF_DATA_PINS = 'data_pins'
|
||||
CONF_VSYNC_PIN = 'vsync_pin'
|
||||
CONF_HREF_PIN = 'href_pin'
|
||||
CONF_PIXEL_CLOCK_PIN = 'pixel_clock_pin'
|
||||
CONF_EXTERNAL_CLOCK = 'external_clock'
|
||||
CONF_I2C_PINS = 'i2c_pins'
|
||||
CONF_RESET_PIN = 'reset_pin'
|
||||
CONF_POWER_DOWN_PIN = 'power_down_pin'
|
||||
|
||||
CONF_MAX_FRAMERATE = 'max_framerate'
|
||||
CONF_IDLE_FRAMERATE = 'idle_framerate'
|
||||
CONF_RESOLUTION = 'resolution'
|
||||
CONF_JPEG_QUALITY = 'jpeg_quality'
|
||||
CONF_VERTICAL_FLIP = 'vertical_flip'
|
||||
CONF_HORIZONTAL_MIRROR = 'horizontal_mirror'
|
||||
CONF_CONTRAST = 'contrast'
|
||||
CONF_BRIGHTNESS = 'brightness'
|
||||
CONF_SATURATION = 'saturation'
|
||||
CONF_TEST_PATTERN = 'test_pattern'
|
||||
|
||||
|
||||
@@ -108,6 +108,8 @@ void ESP32TouchComponent::dump_config() {
|
||||
}
|
||||
|
||||
void ESP32TouchComponent::loop() {
|
||||
const uint32_t now = millis();
|
||||
bool should_print = this->setup_mode_ && now - this->setup_mode_last_log_print_ > 250;
|
||||
for (auto *child : this->children_) {
|
||||
uint16_t value;
|
||||
if (this->iir_filter_enabled_()) {
|
||||
@@ -119,14 +121,14 @@ void ESP32TouchComponent::loop() {
|
||||
child->value_ = value;
|
||||
child->publish_state(value < child->get_threshold());
|
||||
|
||||
if (this->setup_mode_) {
|
||||
if (should_print) {
|
||||
ESP_LOGD(TAG, "Touch Pad '%s' (T%u): %u", child->get_name().c_str(), child->get_touch_pad(), value);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->setup_mode_) {
|
||||
if (should_print) {
|
||||
// Avoid spamming logs
|
||||
delay(250);
|
||||
this->setup_mode_last_log_print_ = now;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ class ESP32TouchComponent : public Component {
|
||||
touch_volt_atten_t voltage_attenuation_{};
|
||||
std::vector<ESP32TouchBinarySensor *> children_;
|
||||
bool setup_mode_{false};
|
||||
uint32_t setup_mode_last_log_print_{};
|
||||
uint32_t iir_filter_{0};
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ void MPR121Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up MPR121...");
|
||||
// soft reset device
|
||||
this->write_byte(MPR121_SOFTRESET, 0x63);
|
||||
delay(100);
|
||||
delay(100); // NOLINT
|
||||
if (!this->write_byte(MPR121_ECR, 0x0)) {
|
||||
this->error_code_ = COMMUNICATION_FAILED;
|
||||
this->mark_failed();
|
||||
|
||||
@@ -201,7 +201,7 @@ void MQTTClientComponent::check_connected() {
|
||||
this->status_clear_warning();
|
||||
ESP_LOGI(TAG, "MQTT Connected!");
|
||||
// MQTT Client needs some time to be fully set up.
|
||||
delay(100);
|
||||
delay(100); // NOLINT
|
||||
|
||||
this->resubscribe_subscriptions_();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ void MS5611Component::setup() {
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
delay(100);
|
||||
delay(100); // NOLINT
|
||||
for (uint8_t offset = 0; offset < 6; offset++) {
|
||||
if (!this->read_byte_16(MS5611_CMD_READ_PROM + (offset * 2), &this->prom_[offset])) {
|
||||
this->mark_failed();
|
||||
|
||||
@@ -19,9 +19,9 @@ void NTC::process_(float value) {
|
||||
return;
|
||||
}
|
||||
|
||||
float lr = logf(value);
|
||||
float v = this->a_ + this->b_ * lr + this->c_ * lr * lr * lr;
|
||||
float temp = 1 / v - 273.15f;
|
||||
double lr = log(double(value));
|
||||
double v = this->a_ + this->b_ * lr + this->c_ * lr * lr * lr;
|
||||
auto temp = float(1.0 / v - 273.15);
|
||||
|
||||
ESP_LOGD(TAG, "'%s' - Temperature: %.1f°C", this->name_.c_str(), temp);
|
||||
this->publish_state(temp);
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace ntc {
|
||||
class NTC : public Component, public sensor::Sensor {
|
||||
public:
|
||||
void set_sensor(Sensor *sensor) { sensor_ = sensor; }
|
||||
void set_a(float a) { a_ = a; }
|
||||
void set_b(float b) { b_ = b; }
|
||||
void set_c(float c) { c_ = c; }
|
||||
void set_a(double a) { a_ = a; }
|
||||
void set_b(double b) { b_ = b; }
|
||||
void set_c(double c) { c_ = c; }
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
float get_setup_priority() const override;
|
||||
@@ -20,9 +20,9 @@ class NTC : public Component, public sensor::Sensor {
|
||||
void process_(float value);
|
||||
|
||||
sensor::Sensor *sensor_;
|
||||
float a_;
|
||||
float b_;
|
||||
float c_;
|
||||
double a_;
|
||||
double b_;
|
||||
double c_;
|
||||
};
|
||||
|
||||
} // namespace ntc
|
||||
|
||||
@@ -266,7 +266,7 @@ void OTAComponent::handle_() {
|
||||
delay(10);
|
||||
ESP_LOGI(TAG, "OTA update finished!");
|
||||
this->status_clear_warning();
|
||||
delay(100);
|
||||
delay(100); // NOLINT
|
||||
App.safe_reboot();
|
||||
|
||||
error:
|
||||
|
||||
@@ -12,24 +12,24 @@ pmsx003_ns = cg.esphome_ns.namespace('pmsx003')
|
||||
PMSX003Component = pmsx003_ns.class_('PMSX003Component', uart.UARTDevice, cg.Component)
|
||||
PMSX003Sensor = pmsx003_ns.class_('PMSX003Sensor', sensor.Sensor)
|
||||
|
||||
CONF_PMSX003 = 'PMSX003'
|
||||
CONF_PMS5003T = 'PMS5003T'
|
||||
CONF_PMS5003ST = 'PMS5003ST'
|
||||
TYPE_PMSX003 = 'PMSX003'
|
||||
TYPE_PMS5003T = 'PMS5003T'
|
||||
TYPE_PMS5003ST = 'PMS5003ST'
|
||||
|
||||
PMSX003Type = pmsx003_ns.enum('PMSX003Type')
|
||||
PMSX003_TYPES = {
|
||||
CONF_PMSX003: PMSX003Type.PMSX003_TYPE_X003,
|
||||
CONF_PMS5003T: PMSX003Type.PMSX003_TYPE_5003T,
|
||||
CONF_PMS5003ST: PMSX003Type.PMSX003_TYPE_5003ST,
|
||||
TYPE_PMSX003: PMSX003Type.PMSX003_TYPE_X003,
|
||||
TYPE_PMS5003T: PMSX003Type.PMSX003_TYPE_5003T,
|
||||
TYPE_PMS5003ST: PMSX003Type.PMSX003_TYPE_5003ST,
|
||||
}
|
||||
|
||||
SENSORS_TO_TYPE = {
|
||||
CONF_PM_1_0: [CONF_PMSX003, CONF_PMS5003ST],
|
||||
CONF_PM_2_5: [CONF_PMSX003, CONF_PMS5003T, CONF_PMS5003ST],
|
||||
CONF_PM_10_0: [CONF_PMSX003, CONF_PMS5003ST],
|
||||
CONF_TEMPERATURE: [CONF_PMS5003T, CONF_PMS5003ST],
|
||||
CONF_HUMIDITY: [CONF_PMS5003T, CONF_PMS5003ST],
|
||||
CONF_FORMALDEHYDE: [CONF_PMS5003ST],
|
||||
CONF_PM_1_0: [TYPE_PMSX003, TYPE_PMS5003ST],
|
||||
CONF_PM_2_5: [TYPE_PMSX003, TYPE_PMS5003T, TYPE_PMS5003ST],
|
||||
CONF_PM_10_0: [TYPE_PMSX003, TYPE_PMS5003ST],
|
||||
CONF_TEMPERATURE: [TYPE_PMS5003T, TYPE_PMS5003ST],
|
||||
CONF_HUMIDITY: [TYPE_PMS5003T, TYPE_PMS5003ST],
|
||||
CONF_FORMALDEHYDE: [TYPE_PMS5003ST],
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -98,6 +98,12 @@ void PZEM004T::write_state_(PZEM004T::PZEM004TReadState state) {
|
||||
this->write_array(data);
|
||||
this->read_state_ = state;
|
||||
}
|
||||
void PZEM004T::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "PZEM004T:");
|
||||
LOG_SENSOR("", "Voltage", this->voltage_sensor_);
|
||||
LOG_SENSOR("", "Current", this->current_sensor_);
|
||||
LOG_SENSOR("", "Power", this->power_sensor_);
|
||||
}
|
||||
|
||||
} // namespace pzem004t
|
||||
} // namespace esphome
|
||||
|
||||
@@ -17,6 +17,8 @@ class PZEM004T : public PollingComponent, public uart::UARTDevice {
|
||||
|
||||
void update() override;
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_;
|
||||
|
||||
@@ -57,6 +57,15 @@ void PZEMAC::on_modbus_data(const std::vector<uint8_t> &data) {
|
||||
}
|
||||
|
||||
void PZEMAC::update() { this->send(PZEM_CMD_READ_IN_REGISTERS, 0, PZEM_REGISTER_COUNT); }
|
||||
void PZEMAC::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "PZEMAC:");
|
||||
ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->address_);
|
||||
LOG_SENSOR("", "Voltage", this->voltage_sensor_);
|
||||
LOG_SENSOR("", "Current", this->current_sensor_);
|
||||
LOG_SENSOR("", "Power", this->power_sensor_);
|
||||
LOG_SENSOR("", "Frequency", this->frequency_sensor_);
|
||||
LOG_SENSOR("", "Power Factor", this->power_factor_sensor_);
|
||||
}
|
||||
|
||||
} // namespace pzemac
|
||||
} // namespace esphome
|
||||
|
||||
@@ -19,6 +19,8 @@ class PZEMAC : public PollingComponent, public modbus::ModbusDevice {
|
||||
|
||||
void on_modbus_data(const std::vector<uint8_t> &data) override;
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_;
|
||||
|
||||
@@ -47,6 +47,13 @@ void PZEMDC::on_modbus_data(const std::vector<uint8_t> &data) {
|
||||
}
|
||||
|
||||
void PZEMDC::update() { this->send(PZEM_CMD_READ_IN_REGISTERS, 0, 8); }
|
||||
void PZEMDC::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "PZEMDC:");
|
||||
ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->address_);
|
||||
LOG_SENSOR("", "Voltage", this->voltage_sensor_);
|
||||
LOG_SENSOR("", "Current", this->current_sensor_);
|
||||
LOG_SENSOR("", "Power", this->power_sensor_);
|
||||
}
|
||||
|
||||
} // namespace pzemdc
|
||||
} // namespace esphome
|
||||
|
||||
@@ -19,6 +19,8 @@ class PZEMDC : public PollingComponent, public modbus::ModbusDevice {
|
||||
|
||||
void on_modbus_data(const std::vector<uint8_t> &data) override;
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
sensor::Sensor *voltage_sensor_;
|
||||
sensor::Sensor *current_sensor_;
|
||||
|
||||
@@ -13,8 +13,8 @@ void RestartSwitch::write_state(bool state) {
|
||||
|
||||
if (state) {
|
||||
ESP_LOGI(TAG, "Restarting device...");
|
||||
// then execute
|
||||
delay(100); // Let MQTT settle a bit
|
||||
// Let MQTT settle a bit
|
||||
delay(100); // NOLINT
|
||||
App.safe_reboot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import esphome.config_validation as cv
|
||||
from esphome import pins, automation
|
||||
from esphome.components import sensor
|
||||
from esphome.const import CONF_ID, CONF_RESOLUTION, CONF_MIN_VALUE, CONF_MAX_VALUE, UNIT_STEPS, \
|
||||
ICON_ROTATE_RIGHT, CONF_VALUE
|
||||
ICON_ROTATE_RIGHT, CONF_VALUE, CONF_PIN_A, CONF_PIN_B
|
||||
|
||||
rotary_encoder_ns = cg.esphome_ns.namespace('rotary_encoder')
|
||||
RotaryEncoderResolution = rotary_encoder_ns.enum('RotaryEncoderResolution')
|
||||
@@ -13,8 +13,6 @@ RESOLUTIONS = {
|
||||
4: RotaryEncoderResolution.ROTARY_ENCODER_4_PULSES_PER_CYCLE,
|
||||
}
|
||||
|
||||
CONF_PIN_A = 'pin_a'
|
||||
CONF_PIN_B = 'pin_b'
|
||||
CONF_PIN_RESET = 'pin_reset'
|
||||
|
||||
RotaryEncoderSensor = rotary_encoder_ns.class_('RotaryEncoderSensor', sensor.Sensor, cg.Component)
|
||||
|
||||
@@ -3,15 +3,13 @@ import esphome.config_validation as cv
|
||||
from esphome.components import i2c, sensor
|
||||
from esphome.const import CONF_ID, UNIT_PARTS_PER_MILLION, \
|
||||
CONF_HUMIDITY, CONF_TEMPERATURE, ICON_PERIODIC_TABLE_CO2, \
|
||||
UNIT_CELSIUS, ICON_THERMOMETER, ICON_WATER_PERCENT, UNIT_PERCENT
|
||||
UNIT_CELSIUS, ICON_THERMOMETER, ICON_WATER_PERCENT, UNIT_PERCENT, CONF_CO2
|
||||
|
||||
DEPENDENCIES = ['i2c']
|
||||
|
||||
scd30_ns = cg.esphome_ns.namespace('scd30')
|
||||
SCD30Component = scd30_ns.class_('SCD30Component', cg.PollingComponent, i2c.I2CDevice)
|
||||
|
||||
CONF_CO2 = 'co2'
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema({
|
||||
cv.GenerateID(): cv.declare_id(SCD30Component),
|
||||
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION,
|
||||
|
||||
@@ -259,7 +259,7 @@ def setup_sensor_core_(var, config):
|
||||
if CONF_ACCURACY_DECIMALS in config:
|
||||
cg.add(var.set_accuracy_decimals(config[CONF_ACCURACY_DECIMALS]))
|
||||
cg.add(var.set_force_update(config[CONF_FORCE_UPDATE]))
|
||||
if CONF_FILTERS in config:
|
||||
if config.get(CONF_FILTERS): # must exist and not be empty
|
||||
filters = yield build_filters(config[CONF_FILTERS])
|
||||
cg.add(var.set_filters(filters))
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@ namespace sensor {
|
||||
|
||||
#define LOG_SENSOR(prefix, type, obj) \
|
||||
if (obj != nullptr) { \
|
||||
ESP_LOGCONFIG(TAG, prefix type " '%s'", obj->get_name().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, prefix " Unit of Measurement: '%s'", obj->get_unit_of_measurement().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, prefix " Accuracy Decimals: %d", obj->get_accuracy_decimals()); \
|
||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, type, obj->get_name().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Unit of Measurement: '%s'", prefix, obj->get_unit_of_measurement().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Accuracy Decimals: %d", prefix, obj->get_accuracy_decimals()); \
|
||||
if (!obj->get_icon().empty()) { \
|
||||
ESP_LOGCONFIG(TAG, prefix " Icon: '%s'", obj->get_icon().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, obj->get_icon().c_str()); \
|
||||
} \
|
||||
if (!obj->unique_id().empty()) { \
|
||||
ESP_LOGV(TAG, prefix " Unique ID: '%s'", obj->unique_id().c_str()); \
|
||||
ESP_LOGV(TAG, "%s Unique ID: '%s'", prefix, obj->unique_id().c_str()); \
|
||||
} \
|
||||
if (obj->get_force_update()) { \
|
||||
ESP_LOGV(TAG, prefix " Force Update: YES"); \
|
||||
ESP_LOGV(TAG, "%s Force Update: YES", prefix); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ CONF_TVOC = 'tvoc'
|
||||
CONF_BASELINE = 'baseline'
|
||||
CONF_UPTIME = 'uptime'
|
||||
CONF_COMPENSATION = 'compensation'
|
||||
CONF_COMPENSATION_HUMIDITY = 'humidity_source'
|
||||
CONF_COMPENSATION_TEMPERATURE = 'temperature_source'
|
||||
CONF_HUMIDITY_SOURCE = 'humidity_source'
|
||||
CONF_TEMPERATURE_SOURCE = 'temperature_source'
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema({
|
||||
cv.GenerateID(): cv.declare_id(SGP30Component),
|
||||
@@ -24,8 +24,8 @@ CONFIG_SCHEMA = cv.Schema({
|
||||
cv.Required(CONF_TVOC): sensor.sensor_schema(UNIT_PARTS_PER_BILLION, ICON_RADIATOR, 0),
|
||||
cv.Optional(CONF_BASELINE): cv.hex_uint16_t,
|
||||
cv.Optional(CONF_COMPENSATION): cv.Schema({
|
||||
cv.Required(CONF_COMPENSATION_HUMIDITY): cv.use_id(sensor.Sensor),
|
||||
cv.Required(CONF_COMPENSATION_TEMPERATURE): cv.use_id(sensor.Sensor)
|
||||
cv.Required(CONF_HUMIDITY_SOURCE): cv.use_id(sensor.Sensor),
|
||||
cv.Required(CONF_TEMPERATURE_SOURCE): cv.use_id(sensor.Sensor)
|
||||
}),
|
||||
}).extend(cv.polling_component_schema('60s')).extend(i2c.i2c_device_schema(0x58))
|
||||
|
||||
@@ -48,7 +48,7 @@ def to_code(config):
|
||||
|
||||
if CONF_COMPENSATION in config:
|
||||
compensation_config = config[CONF_COMPENSATION]
|
||||
sens = yield cg.get_variable(compensation_config[CONF_COMPENSATION_HUMIDITY])
|
||||
sens = yield cg.get_variable(compensation_config[CONF_HUMIDITY_SOURCE])
|
||||
cg.add(var.set_humidity_sensor(sens))
|
||||
sens = yield cg.get_variable(compensation_config[CONF_COMPENSATION_TEMPERATURE])
|
||||
sens = yield cg.get_variable(compensation_config[CONF_TEMPERATURE_SOURCE])
|
||||
cg.add(var.set_temperature_sensor(sens))
|
||||
|
||||
@@ -14,7 +14,7 @@ void ShutdownSwitch::write_state(bool state) {
|
||||
|
||||
if (state) {
|
||||
ESP_LOGI(TAG, "Shutting down...");
|
||||
delay(100); // Let MQTT settle a bit
|
||||
delay(100); // NOLINT
|
||||
|
||||
App.run_safe_shutdown_hooks();
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
|
||||
@@ -255,6 +255,10 @@ void Sim800LComponent::send_sms(std::string recipient, std::string message) {
|
||||
this->send_pending_ = true;
|
||||
this->update();
|
||||
}
|
||||
void Sim800LComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "SIM800L:");
|
||||
ESP_LOGCONFIG(TAG, " RSSI: %d dB", this->rssi_);
|
||||
}
|
||||
|
||||
} // namespace sim800l
|
||||
} // namespace esphome
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
#include "esphome/components/uart/uart.h"
|
||||
#include "esphome/core/automation.h"
|
||||
|
||||
#define SIM800L_READ_BUFFER_LENGTH 255
|
||||
|
||||
namespace esphome {
|
||||
namespace sim800l {
|
||||
|
||||
const uint8_t SIM800L_READ_BUFFER_LENGTH = 255;
|
||||
|
||||
enum State {
|
||||
STATE_IDLE = 0,
|
||||
STATE_INIT,
|
||||
@@ -37,6 +37,7 @@ class Sim800LComponent : public uart::UARTDevice, public PollingComponent {
|
||||
/// Retrieve the latest sensor values. This operation takes approximately 16ms.
|
||||
void update() override;
|
||||
void loop() override;
|
||||
void dump_config() override;
|
||||
void add_on_sms_received_callback(std::function<void(std::string, std::string)> callback) {
|
||||
this->callback_.add(std::move(callback));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/esphal.h"
|
||||
#include "esphome/components/output/float_output.h"
|
||||
|
||||
namespace esphome {
|
||||
|
||||
@@ -14,7 +14,7 @@ void SPISSD1325::setup() {
|
||||
this->cs_->setup(); // OUTPUT
|
||||
|
||||
this->init_reset_();
|
||||
delay(500);
|
||||
delay(500); // NOLINT
|
||||
SSD1325::setup();
|
||||
}
|
||||
void SPISSD1325::dump_config() {
|
||||
|
||||
@@ -9,15 +9,15 @@ namespace switch_ {
|
||||
|
||||
#define LOG_SWITCH(prefix, type, obj) \
|
||||
if (obj != nullptr) { \
|
||||
ESP_LOGCONFIG(TAG, prefix type " '%s'", obj->get_name().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, type, obj->get_name().c_str()); \
|
||||
if (!obj->get_icon().empty()) { \
|
||||
ESP_LOGCONFIG(TAG, prefix " Icon: '%s'", obj->get_icon().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, obj->get_icon().c_str()); \
|
||||
} \
|
||||
if (obj->assumed_state()) { \
|
||||
ESP_LOGCONFIG(TAG, prefix " Assumed State: YES"); \
|
||||
ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \
|
||||
} \
|
||||
if (obj->is_inverted()) { \
|
||||
ESP_LOGCONFIG(TAG, prefix " Inverted: YES"); \
|
||||
ESP_LOGCONFIG(TAG, "%s Inverted: YES", prefix); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from esphome.const import CONF_ID
|
||||
from .. import SX1509Component, sx1509_ns, CONF_SX1509_ID
|
||||
|
||||
CONF_ROW = 'row'
|
||||
CONF_COLUMN = 'col'
|
||||
CONF_COL = 'col'
|
||||
|
||||
DEPENDENCIES = ['sx1509']
|
||||
|
||||
@@ -15,7 +15,7 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend({
|
||||
cv.GenerateID(): cv.declare_id(SX1509BinarySensor),
|
||||
cv.GenerateID(CONF_SX1509_ID): cv.use_id(SX1509Component),
|
||||
cv.Required(CONF_ROW): cv.int_range(min=0, max=4),
|
||||
cv.Required(CONF_COLUMN): cv.int_range(min=0, max=4),
|
||||
cv.Required(CONF_COL): cv.int_range(min=0, max=4),
|
||||
})
|
||||
|
||||
|
||||
@@ -23,6 +23,6 @@ def to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
yield binary_sensor.register_binary_sensor(var, config)
|
||||
hub = yield cg.get_variable(config[CONF_SX1509_ID])
|
||||
cg.add(var.set_row_col(config[CONF_ROW], config[CONF_COLUMN]))
|
||||
cg.add(var.set_row_col(config[CONF_ROW], config[CONF_COL]))
|
||||
|
||||
cg.add(hub.register_keypad_binary_sensor(var))
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import climate, remote_transmitter, remote_receiver, sensor
|
||||
from esphome.const import CONF_ID, CONF_SENSOR
|
||||
from esphome.components.remote_base import CONF_TRANSMITTER_ID, CONF_RECEIVER_ID
|
||||
from esphome.const import CONF_ID, CONF_SENSOR, CONF_SUPPORTS_COOL, CONF_SUPPORTS_HEAT
|
||||
|
||||
AUTO_LOAD = ['sensor', 'climate_ir']
|
||||
|
||||
tcl112_ns = cg.esphome_ns.namespace('tcl112')
|
||||
Tcl112Climate = tcl112_ns.class_('Tcl112Climate', climate.Climate, cg.Component)
|
||||
|
||||
CONF_TRANSMITTER_ID = 'transmitter_id'
|
||||
CONF_RECEIVER_ID = 'receiver_id'
|
||||
CONF_SUPPORTS_HEAT = 'supports_heat'
|
||||
CONF_SUPPORTS_COOL = 'supports_cool'
|
||||
|
||||
CONFIG_SCHEMA = cv.All(climate.CLIMATE_SCHEMA.extend({
|
||||
cv.GenerateID(): cv.declare_id(Tcl112Climate),
|
||||
cv.GenerateID(CONF_TRANSMITTER_ID): cv.use_id(remote_transmitter.RemoteTransmitterComponent),
|
||||
|
||||
@@ -2,13 +2,12 @@ import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.components import output
|
||||
from esphome.const import CONF_ID, CONF_TYPE
|
||||
from esphome.const import CONF_ID, CONF_TYPE, CONF_BINARY
|
||||
from .. import template_ns
|
||||
|
||||
TemplateBinaryOutput = template_ns.class_('TemplateBinaryOutput', output.BinaryOutput)
|
||||
TemplateFloatOutput = template_ns.class_('TemplateFloatOutput', output.FloatOutput)
|
||||
|
||||
CONF_BINARY = 'binary'
|
||||
CONF_FLOAT = 'float'
|
||||
CONF_WRITE_ACTION = 'write_action'
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ namespace text_sensor {
|
||||
|
||||
#define LOG_TEXT_SENSOR(prefix, type, obj) \
|
||||
if (obj != nullptr) { \
|
||||
ESP_LOGCONFIG(TAG, prefix type " '%s'", obj->get_name().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, type, obj->get_name().c_str()); \
|
||||
if (!obj->get_icon().empty()) { \
|
||||
ESP_LOGCONFIG(TAG, prefix " Icon: '%s'", obj->get_icon().c_str()); \
|
||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, obj->get_icon().c_str()); \
|
||||
} \
|
||||
if (!obj->unique_id().empty()) { \
|
||||
ESP_LOGV(TAG, prefix " Unique ID: '%s'", obj->unique_id().c_str()); \
|
||||
ESP_LOGV(TAG, "%s Unique ID: '%s'", prefix, obj->unique_id().c_str()); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ void UptimeSensor::update() {
|
||||
}
|
||||
std::string UptimeSensor::unique_id() { return get_mac_address() + "-uptime"; }
|
||||
float UptimeSensor::get_setup_priority() const { return setup_priority::HARDWARE; }
|
||||
void UptimeSensor::dump_config() { LOG_SENSOR("", "Uptime Sensor", this); }
|
||||
|
||||
} // namespace uptime
|
||||
} // namespace esphome
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace uptime {
|
||||
class UptimeSensor : public sensor::Sensor, public PollingComponent {
|
||||
public:
|
||||
void update() override;
|
||||
void dump_config() override;
|
||||
|
||||
float get_setup_priority() const override;
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ class WaveshareEPaper : public PollingComponent,
|
||||
void reset_() {
|
||||
if (this->reset_pin_ != nullptr) {
|
||||
this->reset_pin_->digital_write(false);
|
||||
delay(200);
|
||||
delay(200); // NOLINT
|
||||
this->reset_pin_->digital_write(true);
|
||||
delay(200);
|
||||
delay(200); // NOLINT
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class WaveshareEPaper4P2In : public WaveshareEPaper {
|
||||
// COMMAND PANEL SETTING
|
||||
this->command(0x00);
|
||||
|
||||
delay(100);
|
||||
delay(100); // NOLINT
|
||||
|
||||
// COMMAND POWER SETTING
|
||||
this->command(0x01);
|
||||
@@ -153,7 +153,7 @@ class WaveshareEPaper4P2In : public WaveshareEPaper {
|
||||
this->data(0x00);
|
||||
this->data(0x00);
|
||||
this->data(0x00);
|
||||
delay(100);
|
||||
delay(100); // NOLINT
|
||||
|
||||
// COMMAND POWER OFF
|
||||
this->command(0x02);
|
||||
|
||||
@@ -481,7 +481,7 @@ void WiFiComponent::retry_connect() {
|
||||
// If retry failed for more than 5 times, let's restart STA
|
||||
ESP_LOGW(TAG, "Restarting WiFi adapter...");
|
||||
this->wifi_mode_(false, {});
|
||||
delay(100);
|
||||
delay(100); // NOLINT
|
||||
this->num_retried_ = 0;
|
||||
} else {
|
||||
this->num_retried_++;
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import climate, remote_transmitter, sensor
|
||||
from esphome.const import CONF_ID, CONF_SENSOR
|
||||
from esphome.components.remote_base import CONF_TRANSMITTER_ID
|
||||
from esphome.const import CONF_ID, CONF_SENSOR, CONF_SUPPORTS_COOL, CONF_SUPPORTS_HEAT
|
||||
|
||||
AUTO_LOAD = ['sensor']
|
||||
|
||||
yashima_ns = cg.esphome_ns.namespace('yashima')
|
||||
YashimaClimate = yashima_ns.class_('YashimaClimate', climate.Climate, cg.Component)
|
||||
|
||||
CONF_TRANSMITTER_ID = 'transmitter_id'
|
||||
CONF_SUPPORTS_HEAT = 'supports_heat'
|
||||
CONF_SUPPORTS_COOL = 'supports_cool'
|
||||
|
||||
CONFIG_SCHEMA = cv.All(climate.CLIMATE_SCHEMA.extend({
|
||||
cv.GenerateID(): cv.declare_id(YashimaClimate),
|
||||
cv.GenerateID(CONF_TRANSMITTER_ID): cv.use_id(remote_transmitter.RemoteTransmitterComponent),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import codecs
|
||||
import json
|
||||
import os
|
||||
|
||||
from esphome.core import CORE, EsphomeError
|
||||
from esphome.core import CORE
|
||||
from esphome.helpers import read_file
|
||||
from esphome.py_compat import safe_input
|
||||
|
||||
|
||||
@@ -20,10 +20,4 @@ def read_config_file(path):
|
||||
assert data['type'] == 'file_response'
|
||||
return data['content']
|
||||
|
||||
try:
|
||||
with codecs.open(path, encoding='utf-8') as handle:
|
||||
return handle.read()
|
||||
except IOError as exc:
|
||||
raise EsphomeError(u"Error accessing file {}: {}".format(path, exc))
|
||||
except UnicodeDecodeError as exc:
|
||||
raise EsphomeError(u"Unable to read file {}: {}".format(path, exc))
|
||||
return read_file(path)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
MAJOR_VERSION = 1
|
||||
MINOR_VERSION = 14
|
||||
PATCH_VERSION = '0b3'
|
||||
PATCH_VERSION = '0b4'
|
||||
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
||||
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
||||
|
||||
@@ -63,8 +63,8 @@ CONF_BROKER = 'broker'
|
||||
CONF_BSSID = 'bssid'
|
||||
CONF_BUFFER_SIZE = 'buffer_size'
|
||||
CONF_BUILD_PATH = 'build_path'
|
||||
CONF_BUSY_PIN = 'busy_pin'
|
||||
CONF_BUS_VOLTAGE = 'bus_voltage'
|
||||
CONF_BUSY_PIN = 'busy_pin'
|
||||
CONF_CALIBRATE_LINEAR = 'calibrate_linear'
|
||||
CONF_CALIBRATION = 'calibration'
|
||||
CONF_CAPACITANCE = 'capacitance'
|
||||
@@ -84,23 +84,23 @@ CONF_CO2 = 'co2'
|
||||
CONF_CODE = 'code'
|
||||
CONF_COLD_WHITE = 'cold_white'
|
||||
CONF_COLD_WHITE_COLOR_TEMPERATURE = 'cold_white_color_temperature'
|
||||
CONF_COLORS = 'colors'
|
||||
CONF_COLOR_CORRECT = 'color_correct'
|
||||
CONF_COLOR_TEMPERATURE = 'color_temperature'
|
||||
CONF_COLORS = 'colors'
|
||||
CONF_COMMAND = 'command'
|
||||
CONF_COMMAND_TOPIC = 'command_topic'
|
||||
CONF_COMMENT = 'comment'
|
||||
CONF_COMMIT = 'commit'
|
||||
CONF_COMPONENTS = 'components'
|
||||
CONF_COMPONENT_ID = 'component_id'
|
||||
CONF_COMPONENTS = 'components'
|
||||
CONF_CONDITION = 'condition'
|
||||
CONF_CONDITION_ID = 'condition_id'
|
||||
CONF_CONDUCTIVITY = 'conductivity'
|
||||
CONF_COOL_ACTION = 'cool_action'
|
||||
CONF_COUNT_MODE = 'count_mode'
|
||||
CONF_CRON = 'cron'
|
||||
CONF_CSS_URL = 'css_url'
|
||||
CONF_CS_PIN = 'cs_pin'
|
||||
CONF_CSS_URL = 'css_url'
|
||||
CONF_CURRENT = 'current'
|
||||
CONF_CURRENT_OPERATION = 'current_operation'
|
||||
CONF_CURRENT_RESISTOR = 'current_resistor'
|
||||
@@ -122,12 +122,12 @@ CONF_DELTA = 'delta'
|
||||
CONF_DEVICE = 'device'
|
||||
CONF_DEVICE_CLASS = 'device_class'
|
||||
CONF_DIMENSIONS = 'dimensions'
|
||||
CONF_DIRECTION = 'direction'
|
||||
CONF_DIR_PIN = 'dir_pin'
|
||||
CONF_DIRECTION = 'direction'
|
||||
CONF_DISCOVERY = 'discovery'
|
||||
CONF_DISTANCE = 'distance'
|
||||
CONF_DISCOVERY_PREFIX = 'discovery_prefix'
|
||||
CONF_DISCOVERY_RETAIN = 'discovery_retain'
|
||||
CONF_DISTANCE = 'distance'
|
||||
CONF_DIV_RATIO = 'div_ratio'
|
||||
CONF_DNS1 = 'dns1'
|
||||
CONF_DNS2 = 'dns2'
|
||||
@@ -152,8 +152,8 @@ CONF_FAMILY = 'family'
|
||||
CONF_FAST_CONNECT = 'fast_connect'
|
||||
CONF_FILE = 'file'
|
||||
CONF_FILTER = 'filter'
|
||||
CONF_FILTERS = 'filters'
|
||||
CONF_FILTER_OUT = 'filter_out'
|
||||
CONF_FILTERS = 'filters'
|
||||
CONF_FLASH_LENGTH = 'flash_length'
|
||||
CONF_FOR = 'for'
|
||||
CONF_FORCE_UPDATE = 'force_update'
|
||||
@@ -172,8 +172,8 @@ CONF_GREEN = 'green'
|
||||
CONF_GROUP = 'group'
|
||||
CONF_HARDWARE_UART = 'hardware_uart'
|
||||
CONF_HEARTBEAT = 'heartbeat'
|
||||
CONF_HEATER = 'heater'
|
||||
CONF_HEAT_ACTION = 'heat_action'
|
||||
CONF_HEATER = 'heater'
|
||||
CONF_HIDDEN = 'hidden'
|
||||
CONF_HIGH = 'high'
|
||||
CONF_HIGH_VOLTAGE_REFERENCE = 'high_voltage_reference'
|
||||
@@ -207,8 +207,8 @@ CONF_INVERTED = 'inverted'
|
||||
CONF_IP_ADDRESS = 'ip_address'
|
||||
CONF_JS_URL = 'js_url'
|
||||
CONF_JVC = 'jvc'
|
||||
CONF_KEEPALIVE = 'keepalive'
|
||||
CONF_KEEP_ON_TIME = 'keep_on_time'
|
||||
CONF_KEEPALIVE = 'keepalive'
|
||||
CONF_LAMBDA = 'lambda'
|
||||
CONF_LEVEL = 'level'
|
||||
CONF_LG = 'lg'
|
||||
@@ -218,9 +218,9 @@ CONF_LIGHTNING_ENERGY = 'lightning_energy'
|
||||
CONF_LIGHTNING_THRESHOLD = 'lightning_threshold'
|
||||
CONF_LOADED_INTEGRATIONS = 'loaded_integrations'
|
||||
CONF_LOCAL = 'local'
|
||||
CONF_LOG_TOPIC = 'log_topic'
|
||||
CONF_LOGGER = 'logger'
|
||||
CONF_LOGS = 'logs'
|
||||
CONF_LOG_TOPIC = 'log_topic'
|
||||
CONF_LOW = 'low'
|
||||
CONF_LOW_VOLTAGE_REFERENCE = 'low_voltage_reference'
|
||||
CONF_MAC_ADDRESS = 'mac_address'
|
||||
@@ -240,13 +240,13 @@ CONF_MAX_VOLTAGE = 'max_voltage'
|
||||
CONF_MEASUREMENT_DURATION = 'measurement_duration'
|
||||
CONF_MEDIUM = 'medium'
|
||||
CONF_METHOD = 'method'
|
||||
CONF_MINUTE = 'minute'
|
||||
CONF_MINUTES = 'minutes'
|
||||
CONF_MIN_LENGTH = 'min_length'
|
||||
CONF_MIN_LEVEL = 'min_level'
|
||||
CONF_MIN_POWER = 'min_power'
|
||||
CONF_MIN_TEMPERATURE = 'min_temperature'
|
||||
CONF_MIN_VALUE = 'min_value'
|
||||
CONF_MINUTE = 'minute'
|
||||
CONF_MINUTES = 'minutes'
|
||||
CONF_MISO_PIN = 'miso_pin'
|
||||
CONF_MODE = 'mode'
|
||||
CONF_MODEL = 'model'
|
||||
@@ -262,14 +262,13 @@ CONF_NBITS = 'nbits'
|
||||
CONF_NEC = 'nec'
|
||||
CONF_NETWORKS = 'networks'
|
||||
CONF_NOISE_LEVEL = 'noise_level'
|
||||
CONF_NUMBER = 'number'
|
||||
CONF_NUM_ATTEMPTS = 'num_attempts'
|
||||
CONF_NUM_CHANNELS = 'num_channels'
|
||||
CONF_NUM_CHIPS = 'num_chips'
|
||||
CONF_NUM_LEDS = 'num_leds'
|
||||
CONF_NUMBER = 'number'
|
||||
CONF_OFFSET = 'offset'
|
||||
CONF_ON = 'on'
|
||||
CONF_ONE = 'one'
|
||||
CONF_ON_BOOT = 'on_boot'
|
||||
CONF_ON_CLICK = 'on_click'
|
||||
CONF_ON_DOUBLE_CLICK = 'on_double_click'
|
||||
@@ -288,6 +287,7 @@ CONF_ON_TURN_OFF = 'on_turn_off'
|
||||
CONF_ON_TURN_ON = 'on_turn_on'
|
||||
CONF_ON_VALUE = 'on_value'
|
||||
CONF_ON_VALUE_RANGE = 'on_value_range'
|
||||
CONF_ONE = 'one'
|
||||
CONF_OPEN_ACTION = 'open_action'
|
||||
CONF_OPEN_DURATION = 'open_duration'
|
||||
CONF_OPEN_ENDSTOP = 'open_endstop'
|
||||
@@ -299,11 +299,11 @@ CONF_OSCILLATION_OUTPUT = 'oscillation_output'
|
||||
CONF_OSCILLATION_STATE_TOPIC = 'oscillation_state_topic'
|
||||
CONF_OTA = 'ota'
|
||||
CONF_OUTPUT = 'output'
|
||||
CONF_OUTPUTS = 'outputs'
|
||||
CONF_OUTPUT_ID = 'output_id'
|
||||
CONF_OUTPUTS = 'outputs'
|
||||
CONF_OVERSAMPLING = 'oversampling'
|
||||
CONF_PAGES = 'pages'
|
||||
CONF_PAGE_ID = 'page_id'
|
||||
CONF_PAGES = 'pages'
|
||||
CONF_PANASONIC = 'panasonic'
|
||||
CONF_PASSWORD = 'password'
|
||||
CONF_PAYLOAD = 'payload'
|
||||
@@ -311,15 +311,15 @@ CONF_PAYLOAD_AVAILABLE = 'payload_available'
|
||||
CONF_PAYLOAD_NOT_AVAILABLE = 'payload_not_available'
|
||||
CONF_PHASE_BALANCER = 'phase_balancer'
|
||||
CONF_PIN = 'pin'
|
||||
CONF_PINS = 'pins'
|
||||
CONF_PIN_A = 'pin_a'
|
||||
CONF_PIN_B = 'pin_b'
|
||||
CONF_PIN_C = 'pin_c'
|
||||
CONF_PIN_D = 'pin_d'
|
||||
CONF_PINS = 'pins'
|
||||
CONF_PLATFORM = 'platform'
|
||||
CONF_PLATFORMIO_OPTIONS = 'platformio_options'
|
||||
CONF_PM_10_0 = 'pm_10_0'
|
||||
CONF_PM_1_0 = 'pm_1_0'
|
||||
CONF_PM_10_0 = 'pm_10_0'
|
||||
CONF_PM_2_5 = 'pm_2_5'
|
||||
CONF_PORT = 'port'
|
||||
CONF_POSITION = 'position'
|
||||
@@ -353,8 +353,8 @@ CONF_RESTORE_MODE = 'restore_mode'
|
||||
CONF_RESTORE_STATE = 'restore_state'
|
||||
CONF_RESTORE_VALUE = 'restore_value'
|
||||
CONF_RETAIN = 'retain'
|
||||
CONF_RGBW = 'rgbw'
|
||||
CONF_RGB_ORDER = 'rgb_order'
|
||||
CONF_RGBW = 'rgbw'
|
||||
CONF_RISING_EDGE = 'rising_edge'
|
||||
CONF_ROTATION = 'rotation'
|
||||
CONF_RS_PIN = 'rs_pin'
|
||||
@@ -377,14 +377,14 @@ CONF_SEL_PIN = 'sel_pin'
|
||||
CONF_SEND_EVERY = 'send_every'
|
||||
CONF_SEND_FIRST_AT = 'send_first_at'
|
||||
CONF_SENSOR = 'sensor'
|
||||
CONF_SENSORS = 'sensors'
|
||||
CONF_SENSOR_ID = 'sensor_id'
|
||||
CONF_SENSORS = 'sensors'
|
||||
CONF_SEQUENCE = 'sequence'
|
||||
CONF_SERVERS = 'servers'
|
||||
CONF_SERVICE = 'service'
|
||||
CONF_SERVICES = 'services'
|
||||
CONF_SETUP_MODE = 'setup_mode'
|
||||
CONF_SETUP_PRIORITY = 'setup_priority'
|
||||
CONF_SEQUENCE = 'sequence'
|
||||
CONF_SHUNT_RESISTANCE = 'shunt_resistance'
|
||||
CONF_SHUNT_VOLTAGE = 'shunt_voltage'
|
||||
CONF_SHUTDOWN_MESSAGE = 'shutdown_message'
|
||||
@@ -408,6 +408,8 @@ CONF_STEP_PIN = 'step_pin'
|
||||
CONF_STOP = 'stop'
|
||||
CONF_STOP_ACTION = 'stop_action'
|
||||
CONF_SUBNET = 'subnet'
|
||||
CONF_SUPPORTS_COOL = 'supports_cool'
|
||||
CONF_SUPPORTS_HEAT = 'supports_heat'
|
||||
CONF_SWITCHES = 'switches'
|
||||
CONF_SYNC = 'sync'
|
||||
CONF_TAG = 'tag'
|
||||
@@ -425,10 +427,10 @@ CONF_TILT = 'tilt'
|
||||
CONF_TILT_ACTION = 'tilt_action'
|
||||
CONF_TILT_LAMBDA = 'tilt_lambda'
|
||||
CONF_TIME = 'time'
|
||||
CONF_TIME_ID = 'time_id'
|
||||
CONF_TIMEOUT = 'timeout'
|
||||
CONF_TIMES = 'times'
|
||||
CONF_TIMEZONE = 'timezone'
|
||||
CONF_TIME_ID = 'time_id'
|
||||
CONF_TIMING = 'timing'
|
||||
CONF_TO = 'to'
|
||||
CONF_TOLERANCE = 'tolerance'
|
||||
@@ -449,8 +451,8 @@ CONF_UNIQUE = 'unique'
|
||||
CONF_UNIT_OF_MEASUREMENT = 'unit_of_measurement'
|
||||
CONF_UPDATE_INTERVAL = 'update_interval'
|
||||
CONF_UPDATE_ON_BOOT = 'update_on_boot'
|
||||
CONF_USERNAME = 'username'
|
||||
CONF_USE_ADDRESS = 'use_address'
|
||||
CONF_USERNAME = 'username'
|
||||
CONF_UUID = 'uuid'
|
||||
CONF_VALUE = 'value'
|
||||
CONF_VARIABLES = 'variables'
|
||||
@@ -470,8 +472,8 @@ CONF_WHITE = 'white'
|
||||
CONF_WIDTH = 'width'
|
||||
CONF_WIFI = 'wifi'
|
||||
CONF_WILL_MESSAGE = 'will_message'
|
||||
CONF_WIND_SPEED = 'wind_speed'
|
||||
CONF_WIND_DIRECTION_DEGREES = 'wind_direction_degrees'
|
||||
CONF_WIND_SPEED = 'wind_speed'
|
||||
CONF_WINDOW_SIZE = 'window_size'
|
||||
CONF_ZERO = 'zero'
|
||||
|
||||
@@ -479,8 +481,8 @@ ICON_ARROW_EXPAND_VERTICAL = 'mdi:arrow-expand-vertical'
|
||||
ICON_BATTERY = 'mdi:battery'
|
||||
ICON_BRIEFCASE_DOWNLOAD = 'mdi:briefcase-download'
|
||||
ICON_BRIGHTNESS_5 = 'mdi:brightness-5'
|
||||
ICON_CHEMICAL_WEAPON = 'mdi:chemical-weapon'
|
||||
ICON_CHECK_CIRCLE_OUTLINE = 'mdi:check-circle-outline'
|
||||
ICON_CHEMICAL_WEAPON = 'mdi:chemical-weapon'
|
||||
ICON_CURRENT_AC = 'mdi:current-ac'
|
||||
ICON_EMPTY = ''
|
||||
ICON_FLASH = 'mdi:flash'
|
||||
@@ -499,26 +501,26 @@ ICON_RESTART = 'mdi:restart'
|
||||
ICON_ROTATE_RIGHT = 'mdi:rotate-right'
|
||||
ICON_SCALE = 'mdi:scale'
|
||||
ICON_SCREEN_ROTATION = 'mdi:screen-rotation'
|
||||
ICON_SIGN_DIRECTION = 'mdi:sign-direction'
|
||||
ICON_SIGNAL = 'mdi: signal-distance-variant'
|
||||
ICON_SIGNAL_DISTANCE_VARIANT = 'mdi:signal'
|
||||
ICON_SIGN_DIRECTION = 'mdi:sign-direction'
|
||||
ICON_WEATHER_SUNSET = 'mdi:weather-sunset'
|
||||
ICON_WEATHER_SUNSET_DOWN = 'mdi:weather-sunset-down'
|
||||
ICON_WEATHER_SUNSET_UP = 'mdi:weather-sunset-up'
|
||||
ICON_THERMOMETER = 'mdi:thermometer'
|
||||
ICON_TIMER = 'mdi:timer'
|
||||
ICON_WATER_PERCENT = 'mdi:water-percent'
|
||||
ICON_WEATHER_SUNSET = 'mdi:weather-sunset'
|
||||
ICON_WEATHER_SUNSET_DOWN = 'mdi:weather-sunset-down'
|
||||
ICON_WEATHER_SUNSET_UP = 'mdi:weather-sunset-up'
|
||||
ICON_WEATHER_WINDY = 'mdi:weather-windy'
|
||||
ICON_WIFI = 'mdi:wifi'
|
||||
|
||||
UNIT_AMPERE = 'A'
|
||||
UNIT_CELSIUS = u'°C'
|
||||
UNIT_DECIBEL = 'dB'
|
||||
UNIT_DEGREES = u'°'
|
||||
UNIT_DEGREE_PER_SECOND = u'°/s'
|
||||
UNIT_DEGREES = u'°'
|
||||
UNIT_EMPTY = ''
|
||||
UNIT_HZ = 'hz'
|
||||
UNIT_HECTOPASCAL = 'hPa'
|
||||
UNIT_HZ = 'hz'
|
||||
UNIT_KELVIN = 'K'
|
||||
UNIT_KILOMETER = 'km'
|
||||
UNIT_KILOMETER_PER_HOUR = 'km/h'
|
||||
@@ -529,8 +531,8 @@ UNIT_MICROGRAMS_PER_CUBIC_METER = u'µg/m³'
|
||||
UNIT_MICROSIEMENS_PER_CENTIMETER = u'µS/cm'
|
||||
UNIT_MICROTESLA = u'µT'
|
||||
UNIT_OHM = u'Ω'
|
||||
UNIT_PARTS_PER_MILLION = 'ppm'
|
||||
UNIT_PARTS_PER_BILLION = 'ppb'
|
||||
UNIT_PARTS_PER_MILLION = 'ppm'
|
||||
UNIT_PERCENT = '%'
|
||||
UNIT_PULSES_PER_MINUTE = 'pulses/min'
|
||||
UNIT_SECOND = 's'
|
||||
|
||||
@@ -54,15 +54,15 @@ bool ESPPreferenceObject::save_() {
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
|
||||
#define ESP_RTC_USER_MEM_START 0x60001200
|
||||
static const uint32_t ESP_RTC_USER_MEM_START = 0x60001200;
|
||||
#define ESP_RTC_USER_MEM ((uint32_t *) ESP_RTC_USER_MEM_START)
|
||||
#define ESP_RTC_USER_MEM_SIZE_WORDS 128
|
||||
#define ESP_RTC_USER_MEM_SIZE_BYTES ESP_RTC_USER_MEM_SIZE_WORDS * 4
|
||||
static const uint32_t ESP_RTC_USER_MEM_SIZE_WORDS = 128;
|
||||
static const uint32_t ESP_RTC_USER_MEM_SIZE_BYTES = ESP_RTC_USER_MEM_SIZE_WORDS * 4;
|
||||
|
||||
#ifdef USE_ESP8266_PREFERENCES_FLASH
|
||||
#define ESP8266_FLASH_STORAGE_SIZE 128
|
||||
static const uint32_t ESP8266_FLASH_STORAGE_SIZE = 128;
|
||||
#else
|
||||
#define ESP8266_FLASH_STORAGE_SIZE 64
|
||||
static const uint32_t ESP8266_FLASH_STORAGE_SIZE = 64;
|
||||
#endif
|
||||
|
||||
static inline bool esp_rtc_user_mem_read(uint32_t index, uint32_t *dest) {
|
||||
|
||||
@@ -57,7 +57,7 @@ void HOT Scheduler::set_interval(Component *component, const std::string &name,
|
||||
item->name = name;
|
||||
item->type = SchedulerItem::INTERVAL;
|
||||
item->interval = interval;
|
||||
item->last_execution = now - offset;
|
||||
item->last_execution = now - offset - interval;
|
||||
item->last_execution_major = this->millis_major_;
|
||||
if (item->last_execution > now)
|
||||
item->last_execution_major--;
|
||||
@@ -106,7 +106,7 @@ void ICACHE_RAM_ATTR HOT Scheduler::call() {
|
||||
// Not reached timeout yet, done for this call
|
||||
break;
|
||||
uint8_t major = item->last_execution_major;
|
||||
if (item->last_execution + item->interval < item->last_execution)
|
||||
if (item->last_execution > now)
|
||||
major++;
|
||||
if (major != this->millis_major_)
|
||||
break;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import codecs
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from esphome.py_compat import char_to_byte, text_type
|
||||
from esphome.py_compat import char_to_byte, text_type, IS_PY2, encode_text
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -79,15 +80,15 @@ def run_system_command(*args):
|
||||
|
||||
|
||||
def mkdir_p(path):
|
||||
import errno
|
||||
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError as exc:
|
||||
if exc.errno == errno.EEXIST and os.path.isdir(path):
|
||||
except OSError as err:
|
||||
import errno
|
||||
if err.errno == errno.EEXIST and os.path.isdir(path):
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
from esphome.core import EsphomeError
|
||||
raise EsphomeError(u"Error creating directories {}: {}".format(path, err))
|
||||
|
||||
|
||||
def is_ip_address(host):
|
||||
@@ -151,17 +152,6 @@ def is_hassio():
|
||||
return get_bool_env('ESPHOME_IS_HASSIO')
|
||||
|
||||
|
||||
def copy_file_if_changed(src, dst):
|
||||
src_text = read_file(src)
|
||||
if os.path.isfile(dst):
|
||||
dst_text = read_file(dst)
|
||||
else:
|
||||
dst_text = None
|
||||
if src_text == dst_text:
|
||||
return
|
||||
write_file(dst, src_text)
|
||||
|
||||
|
||||
def walk_files(path):
|
||||
for root, _, files in os.walk(path):
|
||||
for name in files:
|
||||
@@ -172,28 +162,99 @@ def read_file(path):
|
||||
try:
|
||||
with codecs.open(path, 'r', encoding='utf-8') as f_handle:
|
||||
return f_handle.read()
|
||||
except OSError:
|
||||
except OSError as err:
|
||||
from esphome.core import EsphomeError
|
||||
raise EsphomeError(u"Could not read file at {}".format(path))
|
||||
raise EsphomeError(u"Error reading file {}: {}".format(path, err))
|
||||
except UnicodeDecodeError as err:
|
||||
from esphome.core import EsphomeError
|
||||
raise EsphomeError(u"Error reading file {}: {}".format(path, err))
|
||||
|
||||
|
||||
def _write_file(path, text):
|
||||
import tempfile
|
||||
directory = os.path.dirname(path)
|
||||
mkdir_p(directory)
|
||||
|
||||
tmp_path = None
|
||||
data = encode_text(text)
|
||||
try:
|
||||
with tempfile.NamedTemporaryFile(mode="wb", dir=directory, delete=False) as f_handle:
|
||||
tmp_path = f_handle.name
|
||||
f_handle.write(data)
|
||||
# Newer tempfile implementations create the file with mode 0o600
|
||||
os.chmod(tmp_path, 0o644)
|
||||
if IS_PY2:
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
os.rename(tmp_path, path)
|
||||
else:
|
||||
# If destination exists, will be overwritten
|
||||
os.replace(tmp_path, path)
|
||||
finally:
|
||||
if tmp_path is not None and os.path.exists(tmp_path):
|
||||
try:
|
||||
os.remove(tmp_path)
|
||||
except OSError as err:
|
||||
_LOGGER.error("Write file cleanup failed: %s", err)
|
||||
|
||||
|
||||
def write_file(path, text):
|
||||
try:
|
||||
mkdir_p(os.path.dirname(path))
|
||||
with codecs.open(path, 'w+', encoding='utf-8') as f_handle:
|
||||
f_handle.write(text)
|
||||
_write_file(path, text)
|
||||
except OSError:
|
||||
from esphome.core import EsphomeError
|
||||
raise EsphomeError(u"Could not write file at {}".format(path))
|
||||
|
||||
|
||||
def write_file_if_changed(text, dst):
|
||||
def write_file_if_changed(path, text):
|
||||
src_content = None
|
||||
if os.path.isfile(dst):
|
||||
src_content = read_file(dst)
|
||||
if os.path.isfile(path):
|
||||
src_content = read_file(path)
|
||||
if src_content != text:
|
||||
write_file(dst, text)
|
||||
write_file(path, text)
|
||||
|
||||
|
||||
def copy_file_if_changed(src, dst):
|
||||
import shutil
|
||||
if file_compare(src, dst):
|
||||
return
|
||||
mkdir_p(os.path.dirname(dst))
|
||||
try:
|
||||
shutil.copy(src, dst)
|
||||
except OSError as err:
|
||||
from esphome.core import EsphomeError
|
||||
raise EsphomeError(u"Error copying file {} to {}: {}".format(src, dst, err))
|
||||
|
||||
|
||||
def list_starts_with(list_, sub):
|
||||
return len(sub) <= len(list_) and all(list_[i] == x for i, x in enumerate(sub))
|
||||
|
||||
|
||||
def file_compare(path1, path2):
|
||||
"""Return True if the files path1 and path2 have the same contents."""
|
||||
import stat
|
||||
|
||||
try:
|
||||
stat1, stat2 = os.stat(path1), os.stat(path2)
|
||||
except OSError:
|
||||
# File doesn't exist or another error -> not equal
|
||||
return False
|
||||
|
||||
if stat.S_IFMT(stat1.st_mode) != stat.S_IFREG or stat.S_IFMT(stat2.st_mode) != stat.S_IFREG:
|
||||
# At least one of them is not a regular file (or does not exist)
|
||||
return False
|
||||
if stat1.st_size != stat2.st_size:
|
||||
# Different sizes
|
||||
return False
|
||||
|
||||
bufsize = 8*1024
|
||||
# Read files in blocks until a mismatch is found
|
||||
with open(path1, 'rb') as fh1, open(path2, 'rb') as fh2:
|
||||
while True:
|
||||
blob1, blob2 = fh1.read(bufsize), fh2.read(bufsize)
|
||||
if blob1 != blob2:
|
||||
# Different content
|
||||
return False
|
||||
if not blob1:
|
||||
# Reached end
|
||||
return True
|
||||
|
||||
@@ -15,6 +15,7 @@ from esphome.const import CONF_BROKER, CONF_DISCOVERY_PREFIX, CONF_ESPHOME, \
|
||||
CONF_TOPIC, CONF_TOPIC_PREFIX, CONF_USERNAME
|
||||
from esphome.core import CORE, EsphomeError
|
||||
from esphome.helpers import color
|
||||
from esphome.py_compat import decode_text
|
||||
from esphome.util import safe_print
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -22,6 +23,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
def initialize(config, subscriptions, on_message, username, password, client_id):
|
||||
def on_connect(client, userdata, flags, return_code):
|
||||
_LOGGER.info("Connected to MQTT broker!")
|
||||
for topic in subscriptions:
|
||||
client.subscribe(topic)
|
||||
|
||||
@@ -94,7 +96,8 @@ def show_logs(config, topic=None, username=None, password=None, client_id=None):
|
||||
|
||||
def on_message(client, userdata, msg):
|
||||
time_ = datetime.now().time().strftime(u'[%H:%M:%S]')
|
||||
message = time_ + msg.payload
|
||||
payload = decode_text(msg.payload)
|
||||
message = time_ + payload
|
||||
safe_print(message)
|
||||
|
||||
return initialize(config, [topic], on_message, username, password, client_id)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import functools
|
||||
import sys
|
||||
import codecs
|
||||
|
||||
PYTHON_MAJOR = sys.version_info[0]
|
||||
IS_PY2 = PYTHON_MAJOR == 2
|
||||
@@ -75,15 +76,14 @@ def indexbytes(buf, i):
|
||||
return ord(buf[i])
|
||||
|
||||
|
||||
if IS_PY2:
|
||||
def decode_text(data, encoding='utf-8', errors='strict'):
|
||||
# type: (str, str, str) -> unicode
|
||||
if isinstance(data, unicode):
|
||||
return data
|
||||
return unicode(data, encoding=encoding, errors=errors)
|
||||
else:
|
||||
def decode_text(data, encoding='utf-8', errors='strict'):
|
||||
# type: (bytes, str, str) -> str
|
||||
if isinstance(data, str):
|
||||
return data
|
||||
return data.decode(encoding=encoding, errors=errors)
|
||||
def decode_text(data, encoding='utf-8', errors='strict'):
|
||||
if isinstance(data, text_type):
|
||||
return data
|
||||
return codecs.decode(data, encoding, errors)
|
||||
|
||||
|
||||
def encode_text(data, encoding='utf-8', errors='strict'):
|
||||
if isinstance(data, binary_type):
|
||||
return data
|
||||
|
||||
return codecs.encode(data, encoding, errors)
|
||||
|
||||
@@ -7,7 +7,7 @@ import os
|
||||
|
||||
from esphome import const
|
||||
from esphome.core import CORE
|
||||
from esphome.helpers import mkdir_p
|
||||
from esphome.helpers import mkdir_p, write_file_if_changed
|
||||
|
||||
# pylint: disable=unused-import, wrong-import-order
|
||||
from esphome.core import CoreType # noqa
|
||||
@@ -89,8 +89,7 @@ class StorageJSON(object):
|
||||
|
||||
def save(self, path):
|
||||
mkdir_p(os.path.dirname(path))
|
||||
with codecs.open(path, 'w', encoding='utf-8') as f_handle:
|
||||
f_handle.write(self.to_json())
|
||||
write_file_if_changed(path, self.to_json())
|
||||
|
||||
@staticmethod
|
||||
def from_esphome_core(esph, old): # type: (CoreType, Optional[StorageJSON]) -> StorageJSON
|
||||
@@ -130,8 +129,7 @@ class StorageJSON(object):
|
||||
@staticmethod
|
||||
def _load_impl(path): # type: (str) -> Optional[StorageJSON]
|
||||
with codecs.open(path, 'r', encoding='utf-8') as f_handle:
|
||||
text = f_handle.read()
|
||||
storage = json.loads(text, encoding='utf-8')
|
||||
storage = json.load(f_handle)
|
||||
storage_version = storage['storage_version']
|
||||
name = storage.get('name')
|
||||
comment = storage.get('comment')
|
||||
@@ -195,15 +193,12 @@ class EsphomeStorageJSON(object):
|
||||
return json.dumps(self.as_dict(), indent=2) + u'\n'
|
||||
|
||||
def save(self, path): # type: (str) -> None
|
||||
mkdir_p(os.path.dirname(path))
|
||||
with codecs.open(path, 'w', encoding='utf-8') as f_handle:
|
||||
f_handle.write(self.to_json())
|
||||
write_file_if_changed(path, self.to_json())
|
||||
|
||||
@staticmethod
|
||||
def _load_impl(path): # type: (str) -> Optional[EsphomeStorageJSON]
|
||||
with codecs.open(path, 'r', encoding='utf-8') as f_handle:
|
||||
text = f_handle.read()
|
||||
storage = json.loads(text, encoding='utf-8')
|
||||
storage = json.load(f_handle)
|
||||
storage_version = storage['storage_version']
|
||||
cookie_secret = storage.get('cookie_secret')
|
||||
last_update_check = storage.get('last_update_check')
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import codecs
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
@@ -9,7 +8,7 @@ import unicodedata
|
||||
import voluptuous as vol
|
||||
|
||||
import esphome.config_validation as cv
|
||||
from esphome.helpers import color, get_bool_env
|
||||
from esphome.helpers import color, get_bool_env, write_file
|
||||
# pylint: disable=anomalous-backslash-in-string
|
||||
from esphome.pins import ESP32_BOARD_PINS, ESP8266_BOARD_PINS
|
||||
from esphome.py_compat import safe_input, text_type
|
||||
@@ -104,8 +103,7 @@ def wizard_write(path, **kwargs):
|
||||
kwargs['platform'] = 'ESP8266' if board in ESP8266_BOARD_PINS else 'ESP32'
|
||||
platform = kwargs['platform']
|
||||
|
||||
with codecs.open(path, 'w', 'utf-8') as f_handle:
|
||||
f_handle.write(wizard_file(**kwargs))
|
||||
write_file(path, wizard_file(**kwargs))
|
||||
storage = StorageJSON.from_wizard(name, name + '.local', platform, board)
|
||||
storage_path = ext_storage_path(os.path.dirname(path), os.path.basename(path))
|
||||
storage.save(storage_path)
|
||||
|
||||
@@ -8,7 +8,8 @@ from esphome.config import iter_components
|
||||
from esphome.const import CONF_BOARD_FLASH_MODE, CONF_ESPHOME, CONF_PLATFORMIO_OPTIONS, \
|
||||
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS, __version__
|
||||
from esphome.core import CORE, EsphomeError
|
||||
from esphome.helpers import mkdir_p, read_file, write_file_if_changed, walk_files
|
||||
from esphome.helpers import mkdir_p, read_file, write_file_if_changed, walk_files, \
|
||||
copy_file_if_changed
|
||||
from esphome.storage_json import StorageJSON, storage_path
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -112,7 +113,7 @@ def migrate_src_version_0_to_1():
|
||||
"auto-generated again.", main_cpp, main_cpp)
|
||||
_LOGGER.info("Migration: Added include section to %s", main_cpp)
|
||||
|
||||
write_file_if_changed(content, main_cpp)
|
||||
write_file_if_changed(main_cpp, content)
|
||||
|
||||
|
||||
def migrate_src_version(old, new):
|
||||
@@ -251,7 +252,7 @@ def write_platformio_ini(content):
|
||||
content_format = INI_BASE_FORMAT
|
||||
full_file = content_format[0] + INI_AUTO_GENERATE_BEGIN + '\n' + content
|
||||
full_file += INI_AUTO_GENERATE_END + content_format[1]
|
||||
write_file_if_changed(full_file, path)
|
||||
write_file_if_changed(path, full_file)
|
||||
|
||||
|
||||
def write_platformio_project():
|
||||
@@ -285,7 +286,6 @@ or use the custom_components folder.
|
||||
|
||||
|
||||
def copy_src_tree():
|
||||
import filecmp
|
||||
import shutil
|
||||
|
||||
source_files = {}
|
||||
@@ -321,9 +321,7 @@ def copy_src_tree():
|
||||
os.remove(path)
|
||||
else:
|
||||
src_path = source_files_copy.pop(target)
|
||||
if not filecmp.cmp(path, src_path):
|
||||
# Files are not same, copy
|
||||
shutil.copy(src_path, path)
|
||||
copy_file_if_changed(src_path, path)
|
||||
|
||||
# Now copy new files
|
||||
for target, src_path in source_files_copy.items():
|
||||
@@ -332,14 +330,14 @@ def copy_src_tree():
|
||||
shutil.copy(src_path, dst_path)
|
||||
|
||||
# Finally copy defines
|
||||
write_file_if_changed(generate_defines_h(),
|
||||
CORE.relative_src_path('esphome', 'core', 'defines.h'))
|
||||
write_file_if_changed(ESPHOME_README_TXT,
|
||||
CORE.relative_src_path('esphome', 'README.txt'))
|
||||
write_file_if_changed(ESPHOME_H_FORMAT.format(include_s),
|
||||
CORE.relative_src_path('esphome.h'))
|
||||
write_file_if_changed(VERSION_H_FORMAT.format(__version__),
|
||||
CORE.relative_src_path('esphome', 'core', 'version.h'))
|
||||
write_file_if_changed(CORE.relative_src_path('esphome', 'core', 'defines.h'),
|
||||
generate_defines_h())
|
||||
write_file_if_changed(CORE.relative_src_path('esphome', 'README.txt'),
|
||||
ESPHOME_README_TXT)
|
||||
write_file_if_changed(CORE.relative_src_path('esphome.h'),
|
||||
ESPHOME_H_FORMAT.format(include_s))
|
||||
write_file_if_changed(CORE.relative_src_path('esphome', 'core', 'version.h'),
|
||||
VERSION_H_FORMAT.format(__version__))
|
||||
|
||||
|
||||
def generate_defines_h():
|
||||
@@ -365,7 +363,7 @@ def write_cpp(code_s):
|
||||
full_file = code_format[0] + CPP_INCLUDE_BEGIN + u'\n' + global_s + CPP_INCLUDE_END
|
||||
full_file += code_format[1] + CPP_AUTO_GENERATE_BEGIN + u'\n' + code_s + CPP_AUTO_GENERATE_END
|
||||
full_file += code_format[2]
|
||||
write_file_if_changed(full_file, path)
|
||||
write_file_if_changed(path, full_file)
|
||||
|
||||
|
||||
def clean_build():
|
||||
|
||||
@@ -7,6 +7,7 @@ import fnmatch
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import re
|
||||
|
||||
|
||||
def find_all(a_str, sub):
|
||||
@@ -39,6 +40,7 @@ ignore_types = ('.ico', '.woff', '.woff2', '')
|
||||
|
||||
LINT_FILE_CHECKS = []
|
||||
LINT_CONTENT_CHECKS = []
|
||||
LINT_POST_CHECKS = []
|
||||
|
||||
|
||||
def run_check(lint_obj, fname, *args):
|
||||
@@ -84,6 +86,31 @@ def lint_content_check(**kwargs):
|
||||
return decorator
|
||||
|
||||
|
||||
def lint_post_check(func):
|
||||
_add_check(LINT_POST_CHECKS, func)
|
||||
return func
|
||||
|
||||
|
||||
def lint_re_check(regex, **kwargs):
|
||||
prog = re.compile(regex, re.MULTILINE)
|
||||
decor = lint_content_check(**kwargs)
|
||||
|
||||
def decorator(func):
|
||||
def new_func(fname, content):
|
||||
errors = []
|
||||
for match in prog.finditer(content):
|
||||
if 'NOLINT' in match.group(0):
|
||||
continue
|
||||
lineno = content.count("\n", 0, match.start()) + 1
|
||||
err = func(fname, match)
|
||||
if err is None:
|
||||
continue
|
||||
errors.append("{} See line {}.".format(err, lineno))
|
||||
return errors
|
||||
return decor(new_func)
|
||||
return decorator
|
||||
|
||||
|
||||
def lint_content_find_check(find, **kwargs):
|
||||
decor = lint_content_check(**kwargs)
|
||||
|
||||
@@ -92,9 +119,12 @@ def lint_content_find_check(find, **kwargs):
|
||||
find_ = find
|
||||
if callable(find):
|
||||
find_ = find(fname, content)
|
||||
errors = []
|
||||
for line, col in find_all(content, find_):
|
||||
err = func(fname)
|
||||
return "{err} See line {line}:{col}.".format(err=err, line=line+1, col=col+1)
|
||||
errors.append("{err} See line {line}:{col}."
|
||||
"".format(err=err, line=line+1, col=col+1))
|
||||
return errors
|
||||
return decor(new_func)
|
||||
return decorator
|
||||
|
||||
@@ -143,6 +173,98 @@ def lint_end_newline(fname, content):
|
||||
return None
|
||||
|
||||
|
||||
CPP_RE_EOL = r'\s*?(?://.*?)?$'
|
||||
|
||||
|
||||
def highlight(s):
|
||||
return '\033[36m{}\033[0m'.format(s)
|
||||
|
||||
|
||||
@lint_re_check(r'^#define\s+([a-zA-Z0-9_]+)\s+([0-9bx]+)' + CPP_RE_EOL,
|
||||
include=cpp_include, exclude=['esphome/core/log.h'])
|
||||
def lint_no_defines(fname, match):
|
||||
s = highlight('static const uint8_t {} = {};'.format(match.group(1), match.group(2)))
|
||||
return ("#define macros for integer constants are not allowed, please use "
|
||||
"{} style instead (replace uint8_t with the appropriate "
|
||||
"datatype). See also Google style guide.".format(s))
|
||||
|
||||
|
||||
@lint_re_check(r'^\s*delay\((\d+)\);' + CPP_RE_EOL, include=cpp_include)
|
||||
def lint_no_long_delays(fname, match):
|
||||
duration_ms = int(match.group(1))
|
||||
if duration_ms < 50:
|
||||
return None
|
||||
return (
|
||||
"{} - long calls to delay() are not allowed in ESPHome because everything executes "
|
||||
"in one thread. Calling delay() will block the main thread and slow down ESPHome.\n"
|
||||
"If there's no way to work around the delay() and it doesn't execute often, please add "
|
||||
"a '// NOLINT' comment to the line."
|
||||
"".format(highlight(match.group(0).strip()))
|
||||
)
|
||||
|
||||
|
||||
@lint_content_check(include=['esphome/const.py'])
|
||||
def lint_const_ordered(fname, content):
|
||||
lines = content.splitlines()
|
||||
errors = []
|
||||
for start in ['CONF_', 'ICON_', 'UNIT_']:
|
||||
matching = [(i+1, line) for i, line in enumerate(lines) if line.startswith(start)]
|
||||
ordered = list(sorted(matching, key=lambda x: x[1].replace('_', ' ')))
|
||||
ordered = [(mi, ol) for (mi, _), (_, ol) in zip(matching, ordered)]
|
||||
for (mi, ml), (oi, ol) in zip(matching, ordered):
|
||||
if ml == ol:
|
||||
continue
|
||||
target = next(i for i, l in ordered if l == ml)
|
||||
target_text = next(l for i, l in matching if target == i)
|
||||
errors.append("Constant {} is not ordered, please make sure all constants are ordered. "
|
||||
"See line {} (should go to line {}, {})"
|
||||
"".format(highlight(ml), mi, target, target_text))
|
||||
return errors
|
||||
|
||||
|
||||
@lint_re_check(r'^\s*CONF_([A-Z_0-9a-z]+)\s+=\s+[\'"](.*?)[\'"]\s*?$', include=['*.py'])
|
||||
def lint_conf_matches(fname, match):
|
||||
const = match.group(1)
|
||||
value = match.group(2)
|
||||
const_norm = const.lower()
|
||||
value_norm = value.replace('.', '_')
|
||||
if const_norm == value_norm:
|
||||
return None
|
||||
return ("Constant {} does not match value {}! Please make sure the constant's name matches its "
|
||||
"value!"
|
||||
"".format(highlight('CONF_' + const), highlight(value)))
|
||||
|
||||
|
||||
CONF_RE = r'^(CONF_[a-zA-Z0-9_]+)\s*=\s*[\'"].*?[\'"]\s*?$'
|
||||
with codecs.open('esphome/const.py', 'r', encoding='utf-8') as f_handle:
|
||||
constants_content = f_handle.read()
|
||||
CONSTANTS = [m.group(1) for m in re.finditer(CONF_RE, constants_content, re.MULTILINE)]
|
||||
|
||||
CONSTANTS_USES = collections.defaultdict(list)
|
||||
|
||||
|
||||
@lint_re_check(CONF_RE, include=['*.py'], exclude=['esphome/const.py'])
|
||||
def lint_conf_from_const_py(fname, match):
|
||||
name = match.group(1)
|
||||
if name not in CONSTANTS:
|
||||
CONSTANTS_USES[name].append(fname)
|
||||
return None
|
||||
return ("Constant {} has already been defined in const.py - please import the constant from "
|
||||
"const.py directly.".format(highlight(name)))
|
||||
|
||||
|
||||
@lint_post_check
|
||||
def lint_constants_usage():
|
||||
errors = []
|
||||
for constant, uses in CONSTANTS_USES.items():
|
||||
if len(uses) < 4:
|
||||
continue
|
||||
errors.append("Constant {} is defined in {} files. Please move all definitions of the "
|
||||
"constant to const.py (Uses: {})"
|
||||
"".format(highlight(constant), len(uses), ', '.join(uses)))
|
||||
return errors
|
||||
|
||||
|
||||
def relative_cpp_search_text(fname, content):
|
||||
parts = fname.split('/')
|
||||
integration = parts[2]
|
||||
@@ -203,6 +325,7 @@ def lint_pragma_once(fname, content):
|
||||
'esphome/components/stepper/stepper.h',
|
||||
'esphome/components/switch/switch.h',
|
||||
'esphome/components/text_sensor/text_sensor.h',
|
||||
'esphome/components/climate/climate.h',
|
||||
'esphome/core/component.h',
|
||||
'esphome/core/esphal.h',
|
||||
'esphome/core/log.h',
|
||||
@@ -241,6 +364,8 @@ for fname in files:
|
||||
continue
|
||||
run_checks(LINT_CONTENT_CHECKS, fname, fname, content)
|
||||
|
||||
run_checks(LINT_POST_CHECKS, 'POST')
|
||||
|
||||
for f, errs in sorted(errors.items()):
|
||||
print("\033[0;32m************* File \033[1;32m{}\033[0m".format(f))
|
||||
for err in errs:
|
||||
|
||||
Reference in New Issue
Block a user