mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-03 00:21:56 +00:00 
			
		
		
		
	Compare commits
	
		
			32 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					5f535e9756 | ||
| 
						 | 
					70faeb2fa8 | ||
| 
						 | 
					469c0db981 | ||
| 
						 | 
					440e428aa4 | ||
| 
						 | 
					dde70c95a4 | ||
| 
						 | 
					09d1846261 | ||
| 
						 | 
					34d26a517d | ||
| 
						 | 
					d24b88271c | ||
| 
						 | 
					f22115792a | ||
| 
						 | 
					82a30558e1 | ||
| 
						 | 
					847fe5adca | ||
| 
						 | 
					775b51c6a1 | ||
| 
						 | 
					e0ad5a9009 | ||
| 
						 | 
					1bf01a9081 | ||
| 
						 | 
					6ae59bb43d | ||
| 
						 | 
					929600d7f7 | ||
| 
						 | 
					163d0c55ab | ||
| 
						 | 
					327ccb241e | ||
| 
						 | 
					6b3c7b0854 | ||
| 
						 | 
					681dcb51da | ||
| 
						 | 
					576d5021fd | ||
| 
						 | 
					6cd76f00ac | ||
| 
						 | 
					6f63a62a8d | ||
| 
						 | 
					8867a0fcfb | ||
| 
						 | 
					42b4a166ec | ||
| 
						 | 
					c27fd0f01a | ||
| 
						 | 
					dcb4a0a81e | ||
| 
						 | 
					17da9fddc3 | ||
| 
						 | 
					31aa3c55ca | ||
| 
						 | 
					eca3685ea0 | ||
| 
						 | 
					bd216c5c63 | ||
| 
						 | 
					31ff76427c | 
@@ -3,7 +3,7 @@
 | 
			
		||||
variables:
 | 
			
		||||
  DOCKER_DRIVER: overlay2
 | 
			
		||||
  DOCKER_HOST: tcp://docker:2375/
 | 
			
		||||
  BASE_VERSION: '2.0.0'
 | 
			
		||||
  BASE_VERSION: '2.0.1'
 | 
			
		||||
  TZ: UTC
 | 
			
		||||
 | 
			
		||||
stages:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
ARG BUILD_FROM=esphome/esphome-base-amd64:2.0.0
 | 
			
		||||
ARG BUILD_FROM=esphome/esphome-base-amd64:2.0.1
 | 
			
		||||
FROM ${BUILD_FROM}
 | 
			
		||||
 | 
			
		||||
COPY . .
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
FROM esphome/esphome-base-amd64:2.0.0
 | 
			
		||||
FROM esphome/esphome-base-amd64:2.0.1
 | 
			
		||||
 | 
			
		||||
RUN \
 | 
			
		||||
    apt-get update \
 | 
			
		||||
 
 | 
			
		||||
@@ -364,7 +364,7 @@ def command_update_all(args):
 | 
			
		||||
    def print_bar(middle_text):
 | 
			
		||||
        middle_text = " {} ".format(middle_text)
 | 
			
		||||
        width = len(click.unstyle(middle_text))
 | 
			
		||||
        half_line = "=" * ((twidth - width) / 2)
 | 
			
		||||
        half_line = "=" * ((twidth - width) // 2)
 | 
			
		||||
        click.echo("%s%s%s" % (half_line, middle_text, half_line))
 | 
			
		||||
 | 
			
		||||
    for f in files:
 | 
			
		||||
@@ -509,6 +509,11 @@ def run_esphome(argv):
 | 
			
		||||
        _LOGGER.error("Missing configuration parameter, see esphome --help.")
 | 
			
		||||
        return 1
 | 
			
		||||
 | 
			
		||||
    if IS_PY2:
 | 
			
		||||
        _LOGGER.warning("You're using ESPHome with python 2. Support for python 2 is deprecated "
 | 
			
		||||
                        "and will be removed in 1.15.0. Please reinstall ESPHome with python 3.6 "
 | 
			
		||||
                        "or higher.")
 | 
			
		||||
 | 
			
		||||
    if args.command in PRE_CONFIG_ACTIONS:
 | 
			
		||||
        try:
 | 
			
		||||
            return PRE_CONFIG_ACTIONS[args.command](args)
 | 
			
		||||
 
 | 
			
		||||
@@ -406,6 +406,7 @@ message ListEntitiesSensorResponse {
 | 
			
		||||
  string icon = 5;
 | 
			
		||||
  string unit_of_measurement = 6;
 | 
			
		||||
  int32 accuracy_decimals = 7;
 | 
			
		||||
  bool force_update = 8;
 | 
			
		||||
}
 | 
			
		||||
message SensorStateResponse {
 | 
			
		||||
  option (id) = 25;
 | 
			
		||||
 
 | 
			
		||||
@@ -1359,6 +1359,10 @@ bool ListEntitiesSensorResponse::decode_varint(uint32_t field_id, ProtoVarInt va
 | 
			
		||||
      this->accuracy_decimals = value.as_int32();
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    case 8: {
 | 
			
		||||
      this->force_update = value.as_bool();
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    default:
 | 
			
		||||
      return false;
 | 
			
		||||
  }
 | 
			
		||||
@@ -1407,6 +1411,7 @@ void ListEntitiesSensorResponse::encode(ProtoWriteBuffer buffer) const {
 | 
			
		||||
  buffer.encode_string(5, this->icon);
 | 
			
		||||
  buffer.encode_string(6, this->unit_of_measurement);
 | 
			
		||||
  buffer.encode_int32(7, this->accuracy_decimals);
 | 
			
		||||
  buffer.encode_bool(8, this->force_update);
 | 
			
		||||
}
 | 
			
		||||
void ListEntitiesSensorResponse::dump_to(std::string &out) const {
 | 
			
		||||
  char buffer[64];
 | 
			
		||||
@@ -1440,6 +1445,10 @@ void ListEntitiesSensorResponse::dump_to(std::string &out) const {
 | 
			
		||||
  sprintf(buffer, "%d", this->accuracy_decimals);
 | 
			
		||||
  out.append(buffer);
 | 
			
		||||
  out.append("\n");
 | 
			
		||||
 | 
			
		||||
  out.append("  force_update: ");
 | 
			
		||||
  out.append(YESNO(this->force_update));
 | 
			
		||||
  out.append("\n");
 | 
			
		||||
  out.append("}");
 | 
			
		||||
}
 | 
			
		||||
bool SensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
 | 
			
		||||
 
 | 
			
		||||
@@ -364,6 +364,7 @@ class ListEntitiesSensorResponse : public ProtoMessage {
 | 
			
		||||
  std::string icon{};                 // NOLINT
 | 
			
		||||
  std::string unit_of_measurement{};  // NOLINT
 | 
			
		||||
  int32_t accuracy_decimals{0};       // NOLINT
 | 
			
		||||
  bool force_update{false};           // NOLINT
 | 
			
		||||
  void encode(ProtoWriteBuffer buffer) const override;
 | 
			
		||||
  void dump_to(std::string &out) const override;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,11 @@
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
import esphome.config_validation as cv
 | 
			
		||||
from esphome import pins
 | 
			
		||||
from esphome.const import CONF_PIN, CONF_INDOOR, CONF_WATCHDOG_THRESHOLD, \
 | 
			
		||||
from esphome.const import CONF_INDOOR, CONF_WATCHDOG_THRESHOLD, \
 | 
			
		||||
    CONF_NOISE_LEVEL, CONF_SPIKE_REJECTION, CONF_LIGHTNING_THRESHOLD, \
 | 
			
		||||
    CONF_MASK_DISTURBER, CONF_DIV_RATIO, CONF_CAPACITANCE
 | 
			
		||||
from esphome.core import coroutine
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTO_LOAD = ['sensor', 'binary_sensor']
 | 
			
		||||
MULTI_CONF = True
 | 
			
		||||
 | 
			
		||||
@@ -15,10 +14,10 @@ CONF_AS3935_ID = 'as3935_id'
 | 
			
		||||
as3935_ns = cg.esphome_ns.namespace('as3935')
 | 
			
		||||
AS3935 = as3935_ns.class_('AS3935Component', cg.Component)
 | 
			
		||||
 | 
			
		||||
CONF_IRQ_PIN = 'irq_pin'
 | 
			
		||||
AS3935_SCHEMA = cv.Schema({
 | 
			
		||||
    cv.GenerateID(): cv.declare_id(AS3935),
 | 
			
		||||
    cv.Required(CONF_PIN): cv.All(pins.internal_gpio_input_pin_schema,
 | 
			
		||||
                                  pins.validate_has_interrupt),
 | 
			
		||||
    cv.Required(CONF_IRQ_PIN): pins.gpio_input_pin_schema,
 | 
			
		||||
 | 
			
		||||
    cv.Optional(CONF_INDOOR, default=True): cv.boolean,
 | 
			
		||||
    cv.Optional(CONF_NOISE_LEVEL, default=2): cv.int_range(min=1, max=7),
 | 
			
		||||
@@ -35,8 +34,8 @@ AS3935_SCHEMA = cv.Schema({
 | 
			
		||||
def setup_as3935(var, config):
 | 
			
		||||
    yield cg.register_component(var, config)
 | 
			
		||||
 | 
			
		||||
    pin = yield cg.gpio_pin_expression(config[CONF_PIN])
 | 
			
		||||
    cg.add(var.set_pin(pin))
 | 
			
		||||
    irq_pin = yield cg.gpio_pin_expression(config[CONF_IRQ_PIN])
 | 
			
		||||
    cg.add(var.set_irq_pin(irq_pin))
 | 
			
		||||
    cg.add(var.set_indoor(config[CONF_INDOOR]))
 | 
			
		||||
    cg.add(var.set_noise_level(config[CONF_NOISE_LEVEL]))
 | 
			
		||||
    cg.add(var.set_watchdog_threshold(config[CONF_WATCHDOG_THRESHOLD]))
 | 
			
		||||
 
 | 
			
		||||
@@ -9,10 +9,8 @@ static const char *TAG = "as3935";
 | 
			
		||||
void AS3935Component::setup() {
 | 
			
		||||
  ESP_LOGCONFIG(TAG, "Setting up AS3935...");
 | 
			
		||||
 | 
			
		||||
  this->pin_->setup();
 | 
			
		||||
  this->store_.pin = this->pin_->to_isr();
 | 
			
		||||
  LOG_PIN("  Interrupt Pin: ", this->pin_);
 | 
			
		||||
  this->pin_->attach_interrupt(AS3935ComponentStore::gpio_intr, &this->store_, RISING);
 | 
			
		||||
  this->irq_pin_->setup();
 | 
			
		||||
  LOG_PIN("  IRQ Pin: ", this->irq_pin_);
 | 
			
		||||
 | 
			
		||||
  // Write properties to sensor
 | 
			
		||||
  this->write_indoor(this->indoor_);
 | 
			
		||||
@@ -27,13 +25,13 @@ void AS3935Component::setup() {
 | 
			
		||||
 | 
			
		||||
void AS3935Component::dump_config() {
 | 
			
		||||
  ESP_LOGCONFIG(TAG, "AS3935:");
 | 
			
		||||
  LOG_PIN("  Interrupt Pin: ", this->pin_);
 | 
			
		||||
  LOG_PIN("  Interrupt Pin: ", this->irq_pin_);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
float AS3935Component::get_setup_priority() const { return setup_priority::DATA; }
 | 
			
		||||
 | 
			
		||||
void AS3935Component::loop() {
 | 
			
		||||
  if (!this->store_.interrupt)
 | 
			
		||||
  if (!this->irq_pin_->digital_read())
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  uint8_t int_value = this->read_interrupt_register_();
 | 
			
		||||
@@ -53,7 +51,6 @@ void AS3935Component::loop() {
 | 
			
		||||
      this->energy_sensor_->publish_state(energy);
 | 
			
		||||
  }
 | 
			
		||||
  this->thunder_alert_binary_sensor_->publish_state(false);
 | 
			
		||||
  this->store_.interrupt = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AS3935Component::write_indoor(bool indoor) {
 | 
			
		||||
@@ -222,7 +219,5 @@ uint8_t AS3935Component::read_register_(uint8_t reg, uint8_t mask) {
 | 
			
		||||
  return value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ICACHE_RAM_ATTR AS3935ComponentStore::gpio_intr(AS3935ComponentStore *arg) { arg->interrupt = true; }
 | 
			
		||||
 | 
			
		||||
}  // namespace as3935
 | 
			
		||||
}  // namespace esphome
 | 
			
		||||
 
 | 
			
		||||
@@ -50,14 +50,6 @@ enum AS3935Values {
 | 
			
		||||
  NOISE_INT = 0x01
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/// Store data in a class that doesn't use multiple-inheritance (vtables in flash)
 | 
			
		||||
struct AS3935ComponentStore {
 | 
			
		||||
  volatile bool interrupt;
 | 
			
		||||
 | 
			
		||||
  ISRInternalGPIOPin *pin;
 | 
			
		||||
  static void gpio_intr(AS3935ComponentStore *arg);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class AS3935Component : public Component {
 | 
			
		||||
 public:
 | 
			
		||||
  void setup() override;
 | 
			
		||||
@@ -65,7 +57,7 @@ class AS3935Component : public Component {
 | 
			
		||||
  float get_setup_priority() const override;
 | 
			
		||||
  void loop() override;
 | 
			
		||||
 | 
			
		||||
  void set_pin(GPIOPin *pin) { pin_ = pin; }
 | 
			
		||||
  void set_irq_pin(GPIOPin *irq_pin) { irq_pin_ = irq_pin; }
 | 
			
		||||
  void set_distance_sensor(sensor::Sensor *distance_sensor) { distance_sensor_ = distance_sensor; }
 | 
			
		||||
  void set_energy_sensor(sensor::Sensor *energy_sensor) { energy_sensor_ = energy_sensor; }
 | 
			
		||||
  void set_thunder_alert_binary_sensor(binary_sensor::BinarySensor *thunder_alert_binary_sensor) {
 | 
			
		||||
@@ -102,8 +94,7 @@ class AS3935Component : public Component {
 | 
			
		||||
  sensor::Sensor *distance_sensor_;
 | 
			
		||||
  sensor::Sensor *energy_sensor_;
 | 
			
		||||
  binary_sensor::BinarySensor *thunder_alert_binary_sensor_;
 | 
			
		||||
  GPIOPin *pin_;
 | 
			
		||||
  AS3935ComponentStore store_;
 | 
			
		||||
  GPIOPin *irq_pin_;
 | 
			
		||||
 | 
			
		||||
  bool indoor_;
 | 
			
		||||
  uint8_t noise_level_;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -24,4 +24,4 @@ def to_code(config):
 | 
			
		||||
 | 
			
		||||
    if CONF_OSCILLATION_OUTPUT in config:
 | 
			
		||||
        oscillation_output = yield cg.get_variable(config[CONF_OSCILLATION_OUTPUT])
 | 
			
		||||
        cg.add(var.set_oscillation(oscillation_output))
 | 
			
		||||
        cg.add(var.set_oscillating(oscillation_output))
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,7 @@ IS_PLATFORM_COMPONENT = True
 | 
			
		||||
 | 
			
		||||
binary_sensor_ns = cg.esphome_ns.namespace('binary_sensor')
 | 
			
		||||
BinarySensor = binary_sensor_ns.class_('BinarySensor', cg.Nameable)
 | 
			
		||||
BinarySensorInitiallyOff = binary_sensor_ns.class_('BinarySensorInitiallyOff', BinarySensor)
 | 
			
		||||
BinarySensorPtr = BinarySensor.operator('ptr')
 | 
			
		||||
 | 
			
		||||
# Triggers
 | 
			
		||||
 
 | 
			
		||||
@@ -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()); \
 | 
			
		||||
    } \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -67,7 +67,7 @@ class BinarySensor : public Nameable {
 | 
			
		||||
  void send_state_internal(bool state, bool is_initial);
 | 
			
		||||
 | 
			
		||||
  /// Return whether this binary sensor has outputted a state.
 | 
			
		||||
  bool has_state() const;
 | 
			
		||||
  virtual bool has_state() const;
 | 
			
		||||
 | 
			
		||||
  virtual bool is_status_binary_sensor() const;
 | 
			
		||||
 | 
			
		||||
@@ -86,5 +86,10 @@ class BinarySensor : public Nameable {
 | 
			
		||||
  Deduplicator<bool> publish_dedup_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class BinarySensorInitiallyOff : public BinarySensor {
 | 
			
		||||
 public:
 | 
			
		||||
  bool has_state() const override { return true; }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}  // namespace binary_sensor
 | 
			
		||||
}  // namespace esphome
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
namespace esphome {
 | 
			
		||||
namespace ble_presence {
 | 
			
		||||
 | 
			
		||||
class BLEPresenceDevice : public binary_sensor::BinarySensor,
 | 
			
		||||
class BLEPresenceDevice : public binary_sensor::BinarySensorInitiallyOff,
 | 
			
		||||
                          public esp32_ble_tracker::ESPBTDeviceListener,
 | 
			
		||||
                          public Component {
 | 
			
		||||
 public:
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,41 @@
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
import esphome.config_validation as cv
 | 
			
		||||
from esphome.components import climate, remote_transmitter, remote_receiver, sensor, remote_base
 | 
			
		||||
from esphome.components.remote_base import CONF_RECEIVER_ID, CONF_TRANSMITTER_ID
 | 
			
		||||
from esphome.const import CONF_SUPPORTS_COOL, CONF_SUPPORTS_HEAT, CONF_SENSOR
 | 
			
		||||
from esphome.core import coroutine
 | 
			
		||||
 | 
			
		||||
AUTO_LOAD = ['sensor', 'remote_base']
 | 
			
		||||
 | 
			
		||||
climate_ir_ns = cg.esphome_ns.namespace('climate_ir')
 | 
			
		||||
ClimateIR = climate_ir_ns.class_('ClimateIR', climate.Climate, cg.Component,
 | 
			
		||||
                                 remote_base.RemoteReceiverListener)
 | 
			
		||||
 | 
			
		||||
CLIMATE_IR_SCHEMA = climate.CLIMATE_SCHEMA.extend({
 | 
			
		||||
    cv.GenerateID(CONF_TRANSMITTER_ID): cv.use_id(remote_transmitter.RemoteTransmitterComponent),
 | 
			
		||||
    cv.Optional(CONF_SUPPORTS_COOL, default=True): cv.boolean,
 | 
			
		||||
    cv.Optional(CONF_SUPPORTS_HEAT, default=True): cv.boolean,
 | 
			
		||||
    cv.Optional(CONF_SENSOR): cv.use_id(sensor.Sensor),
 | 
			
		||||
}).extend(cv.COMPONENT_SCHEMA)
 | 
			
		||||
 | 
			
		||||
CLIMATE_IR_WITH_RECEIVER_SCHEMA = CLIMATE_IR_SCHEMA.extend({
 | 
			
		||||
    cv.Optional(CONF_RECEIVER_ID): cv.use_id(remote_receiver.RemoteReceiverComponent),
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@coroutine
 | 
			
		||||
def register_climate_ir(var, config):
 | 
			
		||||
    yield cg.register_component(var, config)
 | 
			
		||||
    yield climate.register_climate(var, config)
 | 
			
		||||
 | 
			
		||||
    cg.add(var.set_supports_cool(config[CONF_SUPPORTS_COOL]))
 | 
			
		||||
    cg.add(var.set_supports_heat(config[CONF_SUPPORTS_HEAT]))
 | 
			
		||||
    if CONF_SENSOR in config:
 | 
			
		||||
        sens = yield cg.get_variable(config[CONF_SENSOR])
 | 
			
		||||
        cg.add(var.set_sensor(sens))
 | 
			
		||||
    if CONF_RECEIVER_ID in config:
 | 
			
		||||
        receiver = yield cg.get_variable(config[CONF_RECEIVER_ID])
 | 
			
		||||
        cg.add(receiver.register_listener(var))
 | 
			
		||||
 | 
			
		||||
    transmitter = yield cg.get_variable(config[CONF_TRANSMITTER_ID])
 | 
			
		||||
    cg.add(var.set_transmitter(transmitter))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,10 @@
 | 
			
		||||
#include "climate_ir.h"
 | 
			
		||||
#include "esphome/core/log.h"
 | 
			
		||||
 | 
			
		||||
namespace esphome {
 | 
			
		||||
namespace climate {
 | 
			
		||||
namespace climate_ir {
 | 
			
		||||
 | 
			
		||||
static const char *TAG = "climate_ir";
 | 
			
		||||
 | 
			
		||||
climate::ClimateTraits ClimateIR::traits() {
 | 
			
		||||
  auto traits = climate::ClimateTraits();
 | 
			
		||||
@@ -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 climate_ir
 | 
			
		||||
}  // namespace esphome
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
#include "esphome/components/sensor/sensor.h"
 | 
			
		||||
 | 
			
		||||
namespace esphome {
 | 
			
		||||
namespace climate {
 | 
			
		||||
namespace climate_ir {
 | 
			
		||||
 | 
			
		||||
/* A base for climate which works by sending (and receiving) IR codes
 | 
			
		||||
 | 
			
		||||
@@ -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;
 | 
			
		||||
  }
 | 
			
		||||
@@ -41,7 +42,7 @@ class ClimateIR : public climate::Climate, public Component, public remote_base:
 | 
			
		||||
  climate::ClimateTraits traits() override;
 | 
			
		||||
 | 
			
		||||
  /// Transmit via IR the state of this climate controller.
 | 
			
		||||
  virtual void transmit_state() {}
 | 
			
		||||
  virtual void transmit_state() = 0;
 | 
			
		||||
 | 
			
		||||
  bool supports_cool_{true};
 | 
			
		||||
  bool supports_heat_{true};
 | 
			
		||||
@@ -49,5 +50,6 @@ class ClimateIR : public climate::Climate, public Component, public remote_base:
 | 
			
		||||
  remote_transmitter::RemoteTransmitterComponent *transmitter_;
 | 
			
		||||
  sensor::Sensor *sensor_{nullptr};
 | 
			
		||||
};
 | 
			
		||||
}  // namespace climate
 | 
			
		||||
 | 
			
		||||
}  // namespace climate_ir
 | 
			
		||||
}  // namespace esphome
 | 
			
		||||
 
 | 
			
		||||
@@ -1,41 +1,18 @@
 | 
			
		||||
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 import climate_ir
 | 
			
		||||
from esphome.const import CONF_ID
 | 
			
		||||
 | 
			
		||||
AUTO_LOAD = ['sensor', 'climate_ir']
 | 
			
		||||
AUTO_LOAD = ['climate_ir']
 | 
			
		||||
 | 
			
		||||
coolix_ns = cg.esphome_ns.namespace('coolix')
 | 
			
		||||
CoolixClimate = coolix_ns.class_('CoolixClimate', climate.Climate, cg.Component)
 | 
			
		||||
CoolixClimate = coolix_ns.class_('CoolixClimate', climate_ir.ClimateIR)
 | 
			
		||||
 | 
			
		||||
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({
 | 
			
		||||
CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend({
 | 
			
		||||
    cv.GenerateID(): cv.declare_id(CoolixClimate),
 | 
			
		||||
    cv.GenerateID(CONF_TRANSMITTER_ID): cv.use_id(remote_transmitter.RemoteTransmitterComponent),
 | 
			
		||||
    cv.Optional(CONF_RECEIVER_ID): cv.use_id(remote_receiver.RemoteReceiverComponent),
 | 
			
		||||
    cv.Optional(CONF_SUPPORTS_COOL, default=True): cv.boolean,
 | 
			
		||||
    cv.Optional(CONF_SUPPORTS_HEAT, default=True): cv.boolean,
 | 
			
		||||
    cv.Optional(CONF_SENSOR): cv.use_id(sensor.Sensor),
 | 
			
		||||
}).extend(cv.COMPONENT_SCHEMA))
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def to_code(config):
 | 
			
		||||
    var = cg.new_Pvariable(config[CONF_ID])
 | 
			
		||||
    yield cg.register_component(var, config)
 | 
			
		||||
    yield climate.register_climate(var, config)
 | 
			
		||||
 | 
			
		||||
    cg.add(var.set_supports_cool(config[CONF_SUPPORTS_COOL]))
 | 
			
		||||
    cg.add(var.set_supports_heat(config[CONF_SUPPORTS_HEAT]))
 | 
			
		||||
    if CONF_SENSOR in config:
 | 
			
		||||
        sens = yield cg.get_variable(config[CONF_SENSOR])
 | 
			
		||||
        cg.add(var.set_sensor(sens))
 | 
			
		||||
    if CONF_RECEIVER_ID in config:
 | 
			
		||||
        receiver = yield cg.get_variable(config[CONF_RECEIVER_ID])
 | 
			
		||||
        cg.add(receiver.register_listener(var))
 | 
			
		||||
 | 
			
		||||
    transmitter = yield cg.get_variable(config[CONF_TRANSMITTER_ID])
 | 
			
		||||
    cg.add(var.set_transmitter(transmitter))
 | 
			
		||||
    yield climate_ir.register_climate_ir(var, config)
 | 
			
		||||
 
 | 
			
		||||
@@ -9,9 +9,9 @@ namespace coolix {
 | 
			
		||||
const uint8_t COOLIX_TEMP_MIN = 17;  // Celsius
 | 
			
		||||
const uint8_t COOLIX_TEMP_MAX = 30;  // Celsius
 | 
			
		||||
 | 
			
		||||
class CoolixClimate : public climate::ClimateIR {
 | 
			
		||||
class CoolixClimate : public climate_ir::ClimateIR {
 | 
			
		||||
 public:
 | 
			
		||||
  CoolixClimate() : climate::ClimateIR(COOLIX_TEMP_MIN, COOLIX_TEMP_MAX) {}
 | 
			
		||||
  CoolixClimate() : climate_ir::ClimateIR(COOLIX_TEMP_MIN, COOLIX_TEMP_MAX) {}
 | 
			
		||||
 | 
			
		||||
 protected:
 | 
			
		||||
  /// Transmit via IR the state of this climate controller.
 | 
			
		||||
 
 | 
			
		||||
@@ -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};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										0
									
								
								esphome/components/fujitsu_general/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								esphome/components/fujitsu_general/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										18
									
								
								esphome/components/fujitsu_general/climate.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								esphome/components/fujitsu_general/climate.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
import esphome.config_validation as cv
 | 
			
		||||
from esphome.components import climate_ir
 | 
			
		||||
from esphome.const import CONF_ID
 | 
			
		||||
 | 
			
		||||
AUTO_LOAD = ['climate_ir']
 | 
			
		||||
 | 
			
		||||
fujitsu_general_ns = cg.esphome_ns.namespace('fujitsu_general')
 | 
			
		||||
FujitsuGeneralClimate = fujitsu_general_ns.class_('FujitsuGeneralClimate', climate_ir.ClimateIR)
 | 
			
		||||
 | 
			
		||||
CONFIG_SCHEMA = climate_ir.CLIMATE_IR_SCHEMA.extend({
 | 
			
		||||
    cv.GenerateID(): cv.declare_id(FujitsuGeneralClimate),
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def to_code(config):
 | 
			
		||||
    var = cg.new_Pvariable(config[CONF_ID])
 | 
			
		||||
    yield climate_ir.register_climate_ir(var, config)
 | 
			
		||||
							
								
								
									
										212
									
								
								esphome/components/fujitsu_general/fujitsu_general.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										212
									
								
								esphome/components/fujitsu_general/fujitsu_general.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,212 @@
 | 
			
		||||
#include "fujitsu_general.h"
 | 
			
		||||
 | 
			
		||||
namespace esphome {
 | 
			
		||||
namespace fujitsu_general {
 | 
			
		||||
 | 
			
		||||
static const char *TAG = "fujitsu_general.climate";
 | 
			
		||||
 | 
			
		||||
// Control packet
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_STATE_LENGTH = 16;
 | 
			
		||||
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE0 = 0x14;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE1 = 0x63;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE2 = 0x00;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE3 = 0x10;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE4 = 0x10;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE5 = 0xFE;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE6 = 0x09;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE7 = 0x30;
 | 
			
		||||
 | 
			
		||||
// Temperature and POWER ON
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_POWER_ON_MASK_BYTE8 = 0b00000001;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE8 = 0x40;
 | 
			
		||||
 | 
			
		||||
// Mode
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_MODE_AUTO_BYTE9 = 0x00;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_MODE_HEAT_BYTE9 = 0x04;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_MODE_COOL_BYTE9 = 0x01;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_MODE_DRY_BYTE9 = 0x02;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_MODE_FAN_BYTE9 = 0x03;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_MODE_10C_BYTE9 = 0x0B;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE9 = 0x01;
 | 
			
		||||
 | 
			
		||||
// Fan speed and swing
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_FAN_AUTO_BYTE10 = 0x00;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_FAN_HIGH_BYTE10 = 0x01;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_FAN_MEDIUM_BYTE10 = 0x02;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_FAN_LOW_BYTE10 = 0x03;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_FAN_SILENT_BYTE10 = 0x04;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_SWING_MASK_BYTE10 = 0b00010000;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE10 = 0x00;
 | 
			
		||||
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE11 = 0x00;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE12 = 0x00;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE13 = 0x00;
 | 
			
		||||
 | 
			
		||||
// Outdoor Unit Low Noise
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_OUTDOOR_UNIT_LOW_NOISE_BYTE14 = 0xA0;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE14 = 0x20;
 | 
			
		||||
 | 
			
		||||
// CRC
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_BASE_BYTE15 = 0x6F;
 | 
			
		||||
 | 
			
		||||
// Power off packet is specific
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_OFF_LENGTH = 7;
 | 
			
		||||
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_OFF_BYTE0 = FUJITSU_GENERAL_BASE_BYTE0;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_OFF_BYTE1 = FUJITSU_GENERAL_BASE_BYTE1;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_OFF_BYTE2 = FUJITSU_GENERAL_BASE_BYTE2;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_OFF_BYTE3 = FUJITSU_GENERAL_BASE_BYTE3;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_OFF_BYTE4 = FUJITSU_GENERAL_BASE_BYTE4;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_OFF_BYTE5 = 0x02;
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_OFF_BYTE6 = 0xFD;
 | 
			
		||||
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_TEMP_MAX = 30;  // Celsius
 | 
			
		||||
const uint8_t FUJITSU_GENERAL_TEMP_MIN = 16;  // Celsius
 | 
			
		||||
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_HEADER_MARK = 3300;
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_HEADER_SPACE = 1600;
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_BIT_MARK = 420;
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_ONE_SPACE = 1200;
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_ZERO_SPACE = 420;
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_TRL_MARK = 420;
 | 
			
		||||
const uint16_t FUJITSU_GENERAL_TRL_SPACE = 8000;
 | 
			
		||||
 | 
			
		||||
const uint32_t FUJITSU_GENERAL_CARRIER_FREQUENCY = 38000;
 | 
			
		||||
 | 
			
		||||
FujitsuGeneralClimate::FujitsuGeneralClimate() : ClimateIR(FUJITSU_GENERAL_TEMP_MIN, FUJITSU_GENERAL_TEMP_MAX, 1) {}
 | 
			
		||||
 | 
			
		||||
void FujitsuGeneralClimate::transmit_state() {
 | 
			
		||||
  if (this->mode == climate::CLIMATE_MODE_OFF) {
 | 
			
		||||
    this->transmit_off_();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  uint8_t remote_state[FUJITSU_GENERAL_STATE_LENGTH] = {0};
 | 
			
		||||
 | 
			
		||||
  remote_state[0] = FUJITSU_GENERAL_BASE_BYTE0;
 | 
			
		||||
  remote_state[1] = FUJITSU_GENERAL_BASE_BYTE1;
 | 
			
		||||
  remote_state[2] = FUJITSU_GENERAL_BASE_BYTE2;
 | 
			
		||||
  remote_state[3] = FUJITSU_GENERAL_BASE_BYTE3;
 | 
			
		||||
  remote_state[4] = FUJITSU_GENERAL_BASE_BYTE4;
 | 
			
		||||
  remote_state[5] = FUJITSU_GENERAL_BASE_BYTE5;
 | 
			
		||||
  remote_state[6] = FUJITSU_GENERAL_BASE_BYTE6;
 | 
			
		||||
  remote_state[7] = FUJITSU_GENERAL_BASE_BYTE7;
 | 
			
		||||
  remote_state[8] = FUJITSU_GENERAL_BASE_BYTE8;
 | 
			
		||||
  remote_state[9] = FUJITSU_GENERAL_BASE_BYTE9;
 | 
			
		||||
  remote_state[10] = FUJITSU_GENERAL_BASE_BYTE10;
 | 
			
		||||
  remote_state[11] = FUJITSU_GENERAL_BASE_BYTE11;
 | 
			
		||||
  remote_state[12] = FUJITSU_GENERAL_BASE_BYTE12;
 | 
			
		||||
  remote_state[13] = FUJITSU_GENERAL_BASE_BYTE13;
 | 
			
		||||
  remote_state[14] = FUJITSU_GENERAL_BASE_BYTE14;
 | 
			
		||||
  remote_state[15] = FUJITSU_GENERAL_BASE_BYTE15;
 | 
			
		||||
 | 
			
		||||
  // Set temperature
 | 
			
		||||
  uint8_t safecelsius = std::max((uint8_t) this->target_temperature, FUJITSU_GENERAL_TEMP_MIN);
 | 
			
		||||
  safecelsius = std::min(safecelsius, FUJITSU_GENERAL_TEMP_MAX);
 | 
			
		||||
  remote_state[8] = (byte) safecelsius - 16;
 | 
			
		||||
  remote_state[8] = remote_state[8] << 4;
 | 
			
		||||
 | 
			
		||||
  // If not powered - set power on flag
 | 
			
		||||
  if (!this->power_) {
 | 
			
		||||
    remote_state[8] = (byte) remote_state[8] | FUJITSU_GENERAL_POWER_ON_MASK_BYTE8;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Set mode
 | 
			
		||||
  switch (this->mode) {
 | 
			
		||||
    case climate::CLIMATE_MODE_COOL:
 | 
			
		||||
      remote_state[9] = FUJITSU_GENERAL_MODE_COOL_BYTE9;
 | 
			
		||||
      break;
 | 
			
		||||
    case climate::CLIMATE_MODE_HEAT:
 | 
			
		||||
      remote_state[9] = FUJITSU_GENERAL_MODE_HEAT_BYTE9;
 | 
			
		||||
      break;
 | 
			
		||||
    case climate::CLIMATE_MODE_AUTO:
 | 
			
		||||
    default:
 | 
			
		||||
      remote_state[9] = FUJITSU_GENERAL_MODE_AUTO_BYTE9;
 | 
			
		||||
      break;
 | 
			
		||||
      // TODO: CLIMATE_MODE_FAN_ONLY, CLIMATE_MODE_DRY, CLIMATE_MODE_10C are missing in esphome
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // TODO: missing support for fan speed
 | 
			
		||||
  remote_state[10] = FUJITSU_GENERAL_FAN_AUTO_BYTE10;
 | 
			
		||||
 | 
			
		||||
  // TODO: missing support for swing
 | 
			
		||||
  // remote_state[10] = (byte) remote_state[10] | FUJITSU_GENERAL_SWING_MASK_BYTE10;
 | 
			
		||||
 | 
			
		||||
  // TODO: missing support for outdoor unit low noise
 | 
			
		||||
  // remote_state[14] = (byte) remote_state[14] | FUJITSU_GENERAL_OUTDOOR_UNIT_LOW_NOISE_BYTE14;
 | 
			
		||||
 | 
			
		||||
  // CRC
 | 
			
		||||
  remote_state[15] = 0;
 | 
			
		||||
  for (int i = 7; i < 15; i++) {
 | 
			
		||||
    remote_state[15] += (byte) remote_state[i];  // Addiction
 | 
			
		||||
  }
 | 
			
		||||
  remote_state[15] = 0x100 - remote_state[15];  // mod 256
 | 
			
		||||
 | 
			
		||||
  auto transmit = this->transmitter_->transmit();
 | 
			
		||||
  auto data = transmit.get_data();
 | 
			
		||||
 | 
			
		||||
  data->set_carrier_frequency(FUJITSU_GENERAL_CARRIER_FREQUENCY);
 | 
			
		||||
 | 
			
		||||
  // Header
 | 
			
		||||
  data->mark(FUJITSU_GENERAL_HEADER_MARK);
 | 
			
		||||
  data->space(FUJITSU_GENERAL_HEADER_SPACE);
 | 
			
		||||
  // Data
 | 
			
		||||
  for (uint8_t i : remote_state) {
 | 
			
		||||
    // Send all Bits from Byte Data in Reverse Order
 | 
			
		||||
    for (uint8_t mask = 00000001; mask > 0; mask <<= 1) {  // iterate through bit mask
 | 
			
		||||
      data->mark(FUJITSU_GENERAL_BIT_MARK);
 | 
			
		||||
      bool bit = i & mask;
 | 
			
		||||
      data->space(bit ? FUJITSU_GENERAL_ONE_SPACE : FUJITSU_GENERAL_ZERO_SPACE);
 | 
			
		||||
      // Next bits
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  // Footer
 | 
			
		||||
  data->mark(FUJITSU_GENERAL_TRL_MARK);
 | 
			
		||||
  data->space(FUJITSU_GENERAL_TRL_SPACE);
 | 
			
		||||
 | 
			
		||||
  transmit.perform();
 | 
			
		||||
 | 
			
		||||
  this->power_ = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void FujitsuGeneralClimate::transmit_off_() {
 | 
			
		||||
  uint8_t remote_state[FUJITSU_GENERAL_OFF_LENGTH] = {0};
 | 
			
		||||
 | 
			
		||||
  remote_state[0] = FUJITSU_GENERAL_OFF_BYTE0;
 | 
			
		||||
  remote_state[1] = FUJITSU_GENERAL_OFF_BYTE1;
 | 
			
		||||
  remote_state[2] = FUJITSU_GENERAL_OFF_BYTE2;
 | 
			
		||||
  remote_state[3] = FUJITSU_GENERAL_OFF_BYTE3;
 | 
			
		||||
  remote_state[4] = FUJITSU_GENERAL_OFF_BYTE4;
 | 
			
		||||
  remote_state[5] = FUJITSU_GENERAL_OFF_BYTE5;
 | 
			
		||||
  remote_state[6] = FUJITSU_GENERAL_OFF_BYTE6;
 | 
			
		||||
 | 
			
		||||
  auto transmit = this->transmitter_->transmit();
 | 
			
		||||
  auto data = transmit.get_data();
 | 
			
		||||
 | 
			
		||||
  data->set_carrier_frequency(FUJITSU_GENERAL_CARRIER_FREQUENCY);
 | 
			
		||||
 | 
			
		||||
  // Header
 | 
			
		||||
  data->mark(FUJITSU_GENERAL_HEADER_MARK);
 | 
			
		||||
  data->space(FUJITSU_GENERAL_HEADER_SPACE);
 | 
			
		||||
 | 
			
		||||
  // Data
 | 
			
		||||
  for (uint8_t i : remote_state) {
 | 
			
		||||
    // Send all Bits from Byte Data in Reverse Order
 | 
			
		||||
    for (uint8_t mask = 00000001; mask > 0; mask <<= 1) {  // iterate through bit mask
 | 
			
		||||
      data->mark(FUJITSU_GENERAL_BIT_MARK);
 | 
			
		||||
      bool bit = i & mask;
 | 
			
		||||
      data->space(bit ? FUJITSU_GENERAL_ONE_SPACE : FUJITSU_GENERAL_ZERO_SPACE);
 | 
			
		||||
      // Next bits
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  // Footer
 | 
			
		||||
  data->mark(FUJITSU_GENERAL_TRL_MARK);
 | 
			
		||||
  data->space(FUJITSU_GENERAL_TRL_SPACE);
 | 
			
		||||
 | 
			
		||||
  transmit.perform();
 | 
			
		||||
 | 
			
		||||
  this->power_ = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}  // namespace fujitsu_general
 | 
			
		||||
}  // namespace esphome
 | 
			
		||||
							
								
								
									
										24
									
								
								esphome/components/fujitsu_general/fujitsu_general.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								esphome/components/fujitsu_general/fujitsu_general.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "esphome/core/component.h"
 | 
			
		||||
#include "esphome/core/automation.h"
 | 
			
		||||
#include "esphome/components/climate_ir/climate_ir.h"
 | 
			
		||||
 | 
			
		||||
namespace esphome {
 | 
			
		||||
namespace fujitsu_general {
 | 
			
		||||
 | 
			
		||||
class FujitsuGeneralClimate : public climate_ir::ClimateIR {
 | 
			
		||||
 public:
 | 
			
		||||
  FujitsuGeneralClimate();
 | 
			
		||||
 | 
			
		||||
 protected:
 | 
			
		||||
  /// Transmit via IR the state of this climate controller.
 | 
			
		||||
  void transmit_state() override;
 | 
			
		||||
  /// Transmit via IR power off command.
 | 
			
		||||
  void transmit_off_();
 | 
			
		||||
 | 
			
		||||
  bool power_{false};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}  // namespace fujitsu_general
 | 
			
		||||
}  // namespace esphome
 | 
			
		||||
@@ -148,6 +148,11 @@ void LCDDisplay::printf(const char *format, ...) {
 | 
			
		||||
  if (ret > 0)
 | 
			
		||||
    this->print(0, 0, buffer);
 | 
			
		||||
}
 | 
			
		||||
void LCDDisplay::clear() {
 | 
			
		||||
  // clear display, also sets DDRAM address to 0 (home)
 | 
			
		||||
  this->command_(LCD_DISPLAY_COMMAND_CLEAR_DISPLAY);
 | 
			
		||||
  delay(2);
 | 
			
		||||
}
 | 
			
		||||
#ifdef USE_TIME
 | 
			
		||||
void LCDDisplay::strftime(uint8_t column, uint8_t row, const char *format, time::ESPTime time) {
 | 
			
		||||
  char buffer[64];
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,8 @@ class LCDDisplay : public PollingComponent {
 | 
			
		||||
  float get_setup_priority() const override;
 | 
			
		||||
  void update() override;
 | 
			
		||||
  void display();
 | 
			
		||||
  //// Clear LCD display
 | 
			
		||||
  void clear();
 | 
			
		||||
 | 
			
		||||
  /// Print the given text at the specified column and row.
 | 
			
		||||
  void print(uint8_t column, uint8_t row, const char *str);
 | 
			
		||||
 
 | 
			
		||||
@@ -42,8 +42,8 @@ float ledc_min_frequency_for_bit_depth(uint8_t bit_depth) {
 | 
			
		||||
}
 | 
			
		||||
optional<uint8_t> ledc_bit_depth_for_frequency(float frequency) {
 | 
			
		||||
  for (int i = 20; i >= 1; i--) {
 | 
			
		||||
    const float min_frequency = ledc_min_frequency_for_bit_depth(frequency);
 | 
			
		||||
    const float max_frequency = ledc_max_frequency_for_bit_depth(frequency);
 | 
			
		||||
    const float min_frequency = ledc_min_frequency_for_bit_depth(i);
 | 
			
		||||
    const float max_frequency = ledc_max_frequency_for_bit_depth(i);
 | 
			
		||||
    if (min_frequency <= frequency && frequency <= max_frequency)
 | 
			
		||||
      return i;
 | 
			
		||||
  }
 | 
			
		||||
@@ -56,7 +56,7 @@ void LEDCOutput::apply_frequency(float frequency) {
 | 
			
		||||
    ESP_LOGW(TAG, "Frequency %f can't be achieved with any bit depth", frequency);
 | 
			
		||||
    this->status_set_warning();
 | 
			
		||||
  }
 | 
			
		||||
  this->bit_depth_ = *bit_depth_opt;
 | 
			
		||||
  this->bit_depth_ = bit_depth_opt.value_or(8);
 | 
			
		||||
  this->frequency_ = frequency;
 | 
			
		||||
  ledcSetup(this->channel_, frequency, this->bit_depth_);
 | 
			
		||||
  // re-apply duty
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@ class Logger : public Component {
 | 
			
		||||
 | 
			
		||||
  /// Manually set the baud rate for serial, set to 0 to disable.
 | 
			
		||||
  void set_baud_rate(uint32_t baud_rate);
 | 
			
		||||
  uint32_t get_baud_rate() const { return baud_rate_; }
 | 
			
		||||
 | 
			
		||||
  /// Get the UART used by the logger.
 | 
			
		||||
  UARTSelection get_uart() const;
 | 
			
		||||
 
 | 
			
		||||
@@ -41,3 +41,4 @@ def register_modbus_device(var, config):
 | 
			
		||||
    parent = yield cg.get_variable(config[CONF_MODBUS_ID])
 | 
			
		||||
    cg.add(var.set_parent(parent))
 | 
			
		||||
    cg.add(var.set_address(config[CONF_ADDRESS]))
 | 
			
		||||
    cg.add(parent.register_device(var))
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ void Modbus::loop() {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t crc16(uint8_t *data, uint8_t len) {
 | 
			
		||||
uint16_t crc16(const uint8_t *data, uint8_t len) {
 | 
			
		||||
  uint16_t crc = 0xFFFF;
 | 
			
		||||
  while (len--) {
 | 
			
		||||
    crc ^= *data++;
 | 
			
		||||
@@ -43,7 +43,7 @@ uint16_t crc16(uint8_t *data, uint8_t len) {
 | 
			
		||||
bool Modbus::parse_modbus_byte_(uint8_t byte) {
 | 
			
		||||
  size_t at = this->rx_buffer_.size();
 | 
			
		||||
  this->rx_buffer_.push_back(byte);
 | 
			
		||||
  uint8_t *raw = &this->rx_buffer_[0];
 | 
			
		||||
  const uint8_t *raw = &this->rx_buffer_[0];
 | 
			
		||||
 | 
			
		||||
  // Byte 0: modbus address (match all)
 | 
			
		||||
  if (at == 0)
 | 
			
		||||
@@ -69,7 +69,7 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
 | 
			
		||||
    return true;
 | 
			
		||||
  // Byte 3+len+1: CRC_HI (over all bytes)
 | 
			
		||||
  uint16_t computed_crc = crc16(raw, 3 + data_len);
 | 
			
		||||
  uint16_t remote_crc = uint16_t(raw[3 + data_len]) | (uint16_t(raw[3 + data_len]) << 8);
 | 
			
		||||
  uint16_t remote_crc = uint16_t(raw[3 + data_len]) | (uint16_t(raw[3 + data_len + 1]) << 8);
 | 
			
		||||
  if (computed_crc != remote_crc) {
 | 
			
		||||
    ESP_LOGW(TAG, "Modbus CRC Check failed! %02X!=%02X", computed_crc, remote_crc);
 | 
			
		||||
    return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -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_();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -55,6 +55,9 @@ void MQTTSensorComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryCo
 | 
			
		||||
  if (!this->sensor_->get_icon().empty())
 | 
			
		||||
    root["icon"] = this->sensor_->get_icon();
 | 
			
		||||
 | 
			
		||||
  if (this->sensor_->get_force_update())
 | 
			
		||||
    root["force_update"] = true;
 | 
			
		||||
 | 
			
		||||
  config.command_topic = false;
 | 
			
		||||
}
 | 
			
		||||
bool MQTTSensorComponent::send_initial_state() {
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -394,7 +394,7 @@ class Nextion : public PollingComponent, public uart::UARTDevice {
 | 
			
		||||
  bool wait_for_ack_{true};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class NextionTouchComponent : public binary_sensor::BinarySensor {
 | 
			
		||||
class NextionTouchComponent : public binary_sensor::BinarySensorInitiallyOff {
 | 
			
		||||
 public:
 | 
			
		||||
  void set_page_id(uint8_t page_id) { page_id_ = page_id; }
 | 
			
		||||
  void set_component_id(uint8_t component_id) { component_id_ = component_id; }
 | 
			
		||||
 
 | 
			
		||||
@@ -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],
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -149,6 +149,7 @@ void PulseCounterSensor::dump_config() {
 | 
			
		||||
  ESP_LOGCONFIG(TAG, "  Rising Edge: %s", EDGE_MODE_TO_STRING[this->storage_.rising_edge_mode]);
 | 
			
		||||
  ESP_LOGCONFIG(TAG, "  Falling Edge: %s", EDGE_MODE_TO_STRING[this->storage_.falling_edge_mode]);
 | 
			
		||||
  ESP_LOGCONFIG(TAG, "  Filtering pulses shorter than %u µs", this->storage_.filter_us);
 | 
			
		||||
  LOG_UPDATE_INTERVAL(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PulseCounterSensor::update() {
 | 
			
		||||
 
 | 
			
		||||
@@ -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_;
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ class RDM6300Component : public Component, public uart::UARTDevice {
 | 
			
		||||
  uint32_t last_id_{0};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class RDM6300BinarySensor : public binary_sensor::BinarySensor {
 | 
			
		||||
class RDM6300BinarySensor : public binary_sensor::BinarySensorInitiallyOff {
 | 
			
		||||
 public:
 | 
			
		||||
  void set_id(uint32_t id) { id_ = id; }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -267,11 +267,11 @@ class RemoteReceiverBase : public RemoteComponentBase {
 | 
			
		||||
  uint8_t tolerance_{25};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class RemoteReceiverBinarySensorBase : public binary_sensor::BinarySensor,
 | 
			
		||||
class RemoteReceiverBinarySensorBase : public binary_sensor::BinarySensorInitiallyOff,
 | 
			
		||||
                                       public Component,
 | 
			
		||||
                                       public RemoteReceiverListener {
 | 
			
		||||
 public:
 | 
			
		||||
  explicit RemoteReceiverBinarySensorBase() : BinarySensor() {}
 | 
			
		||||
  explicit RemoteReceiverBinarySensorBase() : BinarySensorInitiallyOff() {}
 | 
			
		||||
  void dump_config() override;
 | 
			
		||||
  virtual bool matches(RemoteReceiveData src) = 0;
 | 
			
		||||
  bool on_receive(RemoteReceiveData src) override {
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -6,10 +6,9 @@ from esphome import automation
 | 
			
		||||
from esphome.components import mqtt
 | 
			
		||||
from esphome.const import CONF_ABOVE, CONF_ACCURACY_DECIMALS, CONF_ALPHA, CONF_BELOW, \
 | 
			
		||||
    CONF_EXPIRE_AFTER, CONF_FILTERS, CONF_FROM, CONF_ICON, CONF_ID, CONF_INTERNAL, \
 | 
			
		||||
    CONF_ON_RAW_VALUE, CONF_ON_VALUE, CONF_ON_VALUE_RANGE, \
 | 
			
		||||
    CONF_SEND_EVERY, CONF_SEND_FIRST_AT, CONF_TO, CONF_TRIGGER_ID, \
 | 
			
		||||
    CONF_UNIT_OF_MEASUREMENT, \
 | 
			
		||||
    CONF_WINDOW_SIZE, CONF_NAME, CONF_MQTT_ID
 | 
			
		||||
    CONF_ON_RAW_VALUE, CONF_ON_VALUE, CONF_ON_VALUE_RANGE, CONF_SEND_EVERY, CONF_SEND_FIRST_AT, \
 | 
			
		||||
    CONF_TO, CONF_TRIGGER_ID, CONF_UNIT_OF_MEASUREMENT, CONF_WINDOW_SIZE, CONF_NAME, CONF_MQTT_ID, \
 | 
			
		||||
    CONF_FORCE_UPDATE
 | 
			
		||||
from esphome.core import CORE, coroutine, coroutine_with_priority
 | 
			
		||||
from esphome.util import Registry
 | 
			
		||||
 | 
			
		||||
@@ -87,6 +86,7 @@ SENSOR_SCHEMA = cv.MQTT_COMPONENT_SCHEMA.extend({
 | 
			
		||||
    cv.Optional(CONF_UNIT_OF_MEASUREMENT): unit_of_measurement,
 | 
			
		||||
    cv.Optional(CONF_ICON): icon,
 | 
			
		||||
    cv.Optional(CONF_ACCURACY_DECIMALS): accuracy_decimals,
 | 
			
		||||
    cv.Optional(CONF_FORCE_UPDATE, default=False): cv.boolean,
 | 
			
		||||
    cv.Optional(CONF_EXPIRE_AFTER): cv.All(cv.requires_component('mqtt'),
 | 
			
		||||
                                           cv.Any(None, cv.positive_time_period_milliseconds)),
 | 
			
		||||
    cv.Optional(CONF_FILTERS): validate_filters,
 | 
			
		||||
@@ -258,7 +258,8 @@ def setup_sensor_core_(var, config):
 | 
			
		||||
        cg.add(var.set_icon(config[CONF_ICON]))
 | 
			
		||||
    if CONF_ACCURACY_DECIMALS in config:
 | 
			
		||||
        cg.add(var.set_accuracy_decimals(config[CONF_ACCURACY_DECIMALS]))
 | 
			
		||||
    if CONF_FILTERS in config:
 | 
			
		||||
    cg.add(var.set_force_update(config[CONF_FORCE_UPDATE]))
 | 
			
		||||
    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,14 +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, "%s  Force Update: YES", prefix); \
 | 
			
		||||
    } \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -142,6 +145,15 @@ class Sensor : public Nameable {
 | 
			
		||||
 | 
			
		||||
  void internal_send_state_to_frontend(float state);
 | 
			
		||||
 | 
			
		||||
  bool get_force_update() const { return force_update_; }
 | 
			
		||||
  /** Set this sensor's force_update mode.
 | 
			
		||||
   *
 | 
			
		||||
   * If the sensor is in force_update mode, the frontend is required to save all
 | 
			
		||||
   * state changes to the database when they are published, even if the state is the
 | 
			
		||||
   * same as before.
 | 
			
		||||
   */
 | 
			
		||||
  void set_force_update(bool force_update) { force_update_ = force_update; }
 | 
			
		||||
 | 
			
		||||
 protected:
 | 
			
		||||
  /** Override this to set the Home Assistant unit of measurement for this sensor.
 | 
			
		||||
   *
 | 
			
		||||
@@ -174,6 +186,7 @@ class Sensor : public Nameable {
 | 
			
		||||
  optional<int8_t> accuracy_decimals_;
 | 
			
		||||
  Filter *filter_list_{nullptr};  ///< Store all active filters.
 | 
			
		||||
  bool has_state_{false};
 | 
			
		||||
  bool force_update_{false};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class PollingSensorComponent : public PollingComponent, public Sensor {
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -29,4 +29,4 @@ def to_code(config):
 | 
			
		||||
 | 
			
		||||
    if CONF_OSCILLATION_OUTPUT in config:
 | 
			
		||||
        oscillation_output = yield cg.get_variable(config[CONF_OSCILLATION_OUTPUT])
 | 
			
		||||
        cg.add(var.set_oscillation(oscillation_output))
 | 
			
		||||
        cg.add(var.set_oscillating(oscillation_output))
 | 
			
		||||
 
 | 
			
		||||
@@ -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() {
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ void StatusBinarySensor::loop() {
 | 
			
		||||
 | 
			
		||||
  this->publish_state(status);
 | 
			
		||||
}
 | 
			
		||||
void StatusBinarySensor::setup() { this->publish_state(false); }
 | 
			
		||||
void StatusBinarySensor::setup() { this->publish_initial_state(false); }
 | 
			
		||||
void StatusBinarySensor::dump_config() { LOG_BINARY_SENSOR("", "Status Binary Sensor", this); }
 | 
			
		||||
 | 
			
		||||
}  // namespace status
 | 
			
		||||
 
 | 
			
		||||
@@ -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,41 +1,18 @@
 | 
			
		||||
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 import climate_ir
 | 
			
		||||
from esphome.const import CONF_ID
 | 
			
		||||
 | 
			
		||||
AUTO_LOAD = ['sensor', 'climate_ir']
 | 
			
		||||
AUTO_LOAD = ['climate_ir']
 | 
			
		||||
 | 
			
		||||
tcl112_ns = cg.esphome_ns.namespace('tcl112')
 | 
			
		||||
Tcl112Climate = tcl112_ns.class_('Tcl112Climate', climate.Climate, cg.Component)
 | 
			
		||||
Tcl112Climate = tcl112_ns.class_('Tcl112Climate', climate_ir.ClimateIR)
 | 
			
		||||
 | 
			
		||||
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({
 | 
			
		||||
CONFIG_SCHEMA = climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA.extend({
 | 
			
		||||
    cv.GenerateID(): cv.declare_id(Tcl112Climate),
 | 
			
		||||
    cv.GenerateID(CONF_TRANSMITTER_ID): cv.use_id(remote_transmitter.RemoteTransmitterComponent),
 | 
			
		||||
    cv.Optional(CONF_RECEIVER_ID): cv.use_id(remote_receiver.RemoteReceiverComponent),
 | 
			
		||||
    cv.Optional(CONF_SUPPORTS_COOL, default=True): cv.boolean,
 | 
			
		||||
    cv.Optional(CONF_SUPPORTS_HEAT, default=True): cv.boolean,
 | 
			
		||||
    cv.Optional(CONF_SENSOR): cv.use_id(sensor.Sensor),
 | 
			
		||||
}).extend(cv.COMPONENT_SCHEMA))
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def to_code(config):
 | 
			
		||||
    var = cg.new_Pvariable(config[CONF_ID])
 | 
			
		||||
    yield cg.register_component(var, config)
 | 
			
		||||
    yield climate.register_climate(var, config)
 | 
			
		||||
 | 
			
		||||
    cg.add(var.set_supports_cool(config[CONF_SUPPORTS_COOL]))
 | 
			
		||||
    cg.add(var.set_supports_heat(config[CONF_SUPPORTS_HEAT]))
 | 
			
		||||
    if CONF_SENSOR in config:
 | 
			
		||||
        sens = yield cg.get_variable(config[CONF_SENSOR])
 | 
			
		||||
        cg.add(var.set_sensor(sens))
 | 
			
		||||
    if CONF_RECEIVER_ID in config:
 | 
			
		||||
        receiver = yield cg.get_variable(config[CONF_RECEIVER_ID])
 | 
			
		||||
        cg.add(receiver.register_listener(var))
 | 
			
		||||
 | 
			
		||||
    transmitter = yield cg.get_variable(config[CONF_TRANSMITTER_ID])
 | 
			
		||||
    cg.add(var.set_transmitter(transmitter))
 | 
			
		||||
    yield climate_ir.register_climate_ir(var, config)
 | 
			
		||||
 
 | 
			
		||||
@@ -9,9 +9,9 @@ namespace tcl112 {
 | 
			
		||||
const float TCL112_TEMP_MAX = 31.0;
 | 
			
		||||
const float TCL112_TEMP_MIN = 16.0;
 | 
			
		||||
 | 
			
		||||
class Tcl112Climate : public climate::ClimateIR {
 | 
			
		||||
class Tcl112Climate : public climate_ir::ClimateIR {
 | 
			
		||||
 public:
 | 
			
		||||
  Tcl112Climate() : climate::ClimateIR(TCL112_TEMP_MIN, TCL112_TEMP_MAX, .5f) {}
 | 
			
		||||
  Tcl112Climate() : climate_ir::ClimateIR(TCL112_TEMP_MIN, TCL112_TEMP_MAX, .5f) {}
 | 
			
		||||
 | 
			
		||||
 protected:
 | 
			
		||||
  /// Transmit via IR the state of this climate controller.
 | 
			
		||||
 
 | 
			
		||||
@@ -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()); \
 | 
			
		||||
    } \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,9 @@ void Tuya::dump_config() {
 | 
			
		||||
    else
 | 
			
		||||
      ESP_LOGCONFIG(TAG, "  Datapoint %d: unknown", info.id);
 | 
			
		||||
  }
 | 
			
		||||
  if (this->datapoints_.empty()) {
 | 
			
		||||
    ESP_LOGCONFIG(TAG, "  Received no datapoints! Please make sure this is a supported Tuya device.");
 | 
			
		||||
  }
 | 
			
		||||
  this->check_uart_settings(9600);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,11 @@
 | 
			
		||||
#include "esphome/core/log.h"
 | 
			
		||||
#include "esphome/core/helpers.h"
 | 
			
		||||
#include "esphome/core/application.h"
 | 
			
		||||
#include "esphome/core/defines.h"
 | 
			
		||||
 | 
			
		||||
#ifdef USE_LOGGER
 | 
			
		||||
#include "esphome/components/logger/logger.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
namespace esphome {
 | 
			
		||||
namespace uart {
 | 
			
		||||
@@ -41,6 +46,12 @@ void UARTComponent::dump_config() {
 | 
			
		||||
  }
 | 
			
		||||
  ESP_LOGCONFIG(TAG, "  Baud Rate: %u baud", this->baud_rate_);
 | 
			
		||||
  ESP_LOGCONFIG(TAG, "  Stop bits: %u", this->stop_bits_);
 | 
			
		||||
#ifdef USE_LOGGER
 | 
			
		||||
  if (this->hw_serial_ == &Serial && logger::global_logger->get_baud_rate() != 0) {
 | 
			
		||||
    ESP_LOGW(TAG, "  You're using the same serial port for logging and the UART component. Please "
 | 
			
		||||
                  "disable logging over the serial port by setting logger->baud_rate to 0.");
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UARTComponent::write_byte(uint8_t data) {
 | 
			
		||||
@@ -145,6 +156,13 @@ void UARTComponent::dump_config() {
 | 
			
		||||
  } else {
 | 
			
		||||
    ESP_LOGCONFIG(TAG, "  Using software serial");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
#ifdef USE_LOGGER
 | 
			
		||||
  if (this->hw_serial_ == &Serial && logger::global_logger->get_baud_rate() != 0) {
 | 
			
		||||
    ESP_LOGW(TAG, "  You're using the same serial port for logging and the UART component. Please "
 | 
			
		||||
                  "disable logging over the serial port by setting logger->baud_rate to 0.");
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UARTComponent::write_byte(uint8_t data) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -416,11 +416,15 @@ void WebServer::handle_light_request(AsyncWebServerRequest *request, UrlMatch ma
 | 
			
		||||
      if (request->hasParam("color_temp"))
 | 
			
		||||
        call.set_color_temperature(request->getParam("color_temp")->value().toFloat());
 | 
			
		||||
 | 
			
		||||
      if (request->hasParam("flash"))
 | 
			
		||||
        call.set_flash_length((uint32_t) request->getParam("flash")->value().toFloat() * 1000);
 | 
			
		||||
      if (request->hasParam("flash")) {
 | 
			
		||||
        float length_s = request->getParam("flash")->value().toFloat();
 | 
			
		||||
        call.set_flash_length(static_cast<uint32_t>(length_s * 1000));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (request->hasParam("transition"))
 | 
			
		||||
        call.set_transition_length((uint32_t) request->getParam("transition")->value().toFloat() * 1000);
 | 
			
		||||
      if (request->hasParam("transition")) {
 | 
			
		||||
        float length_s = request->getParam("transition")->value().toFloat();
 | 
			
		||||
        call.set_transition_length(static_cast<uint32_t>(length_s * 1000));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (request->hasParam("effect")) {
 | 
			
		||||
        const char *effect = request->getParam("effect")->value().c_str();
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,8 @@ import esphome.codegen as cg
 | 
			
		||||
from esphome.const import CONF_ID
 | 
			
		||||
from esphome.core import coroutine_with_priority, CORE
 | 
			
		||||
 | 
			
		||||
DEPENDENCIES = ['network', 'async_tcp']
 | 
			
		||||
DEPENDENCIES = ['network']
 | 
			
		||||
AUTO_LOAD = ['async_tcp']
 | 
			
		||||
 | 
			
		||||
web_server_base_ns = cg.esphome_ns.namespace('web_server_base')
 | 
			
		||||
WebServerBase = web_server_base_ns.class_('WebServerBase', cg.Component)
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -461,6 +461,8 @@ def time_period_str_unit(value):
 | 
			
		||||
    if isinstance(value, int):
 | 
			
		||||
        raise Invalid("Don't know what '{0}' means as it has no time *unit*! Did you mean "
 | 
			
		||||
                      "'{0}s'?".format(value))
 | 
			
		||||
    if isinstance(value, TimePeriod):
 | 
			
		||||
        value = str(value)
 | 
			
		||||
    if not isinstance(value, string_types):
 | 
			
		||||
        raise Invalid("Expected string for time period with unit.")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
 | 
			
		||||
MAJOR_VERSION = 1
 | 
			
		||||
MINOR_VERSION = 14
 | 
			
		||||
PATCH_VERSION = '0b2'
 | 
			
		||||
PATCH_VERSION = '0b5'
 | 
			
		||||
__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,10 +152,11 @@ 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'
 | 
			
		||||
CONF_FORMALDEHYDE = 'formaldehyde'
 | 
			
		||||
CONF_FORMAT = 'format'
 | 
			
		||||
CONF_FREQUENCY = 'frequency'
 | 
			
		||||
@@ -171,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'
 | 
			
		||||
@@ -206,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'
 | 
			
		||||
@@ -217,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'
 | 
			
		||||
@@ -239,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'
 | 
			
		||||
@@ -261,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'
 | 
			
		||||
@@ -287,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'
 | 
			
		||||
@@ -298,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'
 | 
			
		||||
@@ -310,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'
 | 
			
		||||
@@ -352,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'
 | 
			
		||||
@@ -376,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'
 | 
			
		||||
@@ -407,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'
 | 
			
		||||
@@ -424,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'
 | 
			
		||||
@@ -448,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'
 | 
			
		||||
@@ -469,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'
 | 
			
		||||
 | 
			
		||||
@@ -478,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'
 | 
			
		||||
@@ -498,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'
 | 
			
		||||
@@ -528,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'
 | 
			
		||||
 
 | 
			
		||||
@@ -97,7 +97,7 @@ void Application::loop() {
 | 
			
		||||
 | 
			
		||||
  if (this->dump_config_at_ >= 0 && this->dump_config_at_ < this->components_.size()) {
 | 
			
		||||
    if (this->dump_config_at_ == 0) {
 | 
			
		||||
      ESP_LOGI(TAG, "esphome version " ESPHOME_VERSION " compiled on %s", this->compilation_time_.c_str());
 | 
			
		||||
      ESP_LOGI(TAG, "ESPHome version " ESPHOME_VERSION " compiled on %s", this->compilation_time_.c_str());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this->components_[this->dump_config_at_]->dump_config();
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user