mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 01:34:18 +01:00
Merge branch 'dev' into dev
This commit is contained in:
commit
aa9e83f644
47 changed files with 262 additions and 261 deletions
|
@ -1,10 +1,8 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.cpp_generator import MockObjClass
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
from esphome import automation, core
|
||||
from esphome.automation import Condition, maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DELAY,
|
||||
CONF_DEVICE_CLASS,
|
||||
|
@ -16,6 +14,7 @@ from esphome.const import (
|
|||
CONF_INVERTED,
|
||||
CONF_MAX_LENGTH,
|
||||
CONF_MIN_LENGTH,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_CLICK,
|
||||
CONF_ON_DOUBLE_CLICK,
|
||||
CONF_ON_MULTI_CLICK,
|
||||
|
@ -26,7 +25,6 @@ from esphome.const import (
|
|||
CONF_STATE,
|
||||
CONF_TIMING,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
DEVICE_CLASS_BATTERY,
|
||||
DEVICE_CLASS_BATTERY_CHARGING,
|
||||
|
@ -59,6 +57,8 @@ from esphome.const import (
|
|||
DEVICE_CLASS_WINDOW,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_generator import MockObjClass
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
from esphome.util import Registry
|
||||
|
||||
CODEOWNERS = ["@esphome/core"]
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ENTITY_CATEGORY,
|
||||
CONF_ICON,
|
||||
CONF_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_PRESS,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_IDENTIFY,
|
||||
|
@ -18,8 +18,8 @@ from esphome.const import (
|
|||
DEVICE_CLASS_UPDATE,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
from esphome.cpp_generator import MockObjClass
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
||||
CODEOWNERS = ["@esphome/core"]
|
||||
IS_PLATFORM_COMPONENT = True
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
from esphome import automation
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ACTION_STATE_TOPIC,
|
||||
CONF_AWAY,
|
||||
|
@ -21,6 +20,7 @@ from esphome.const import (
|
|||
CONF_MODE,
|
||||
CONF_MODE_COMMAND_TOPIC,
|
||||
CONF_MODE_STATE_TOPIC,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_CONTROL,
|
||||
CONF_ON_STATE,
|
||||
CONF_PRESET,
|
||||
|
@ -33,20 +33,20 @@ from esphome.const import (
|
|||
CONF_TARGET_HUMIDITY_STATE_TOPIC,
|
||||
CONF_TARGET_TEMPERATURE,
|
||||
CONF_TARGET_TEMPERATURE_COMMAND_TOPIC,
|
||||
CONF_TARGET_TEMPERATURE_STATE_TOPIC,
|
||||
CONF_TARGET_TEMPERATURE_HIGH,
|
||||
CONF_TARGET_TEMPERATURE_HIGH_COMMAND_TOPIC,
|
||||
CONF_TARGET_TEMPERATURE_HIGH_STATE_TOPIC,
|
||||
CONF_TARGET_TEMPERATURE_LOW,
|
||||
CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC,
|
||||
CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC,
|
||||
CONF_TARGET_TEMPERATURE_STATE_TOPIC,
|
||||
CONF_TEMPERATURE_STEP,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_VISUAL,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
||||
IS_PLATFORM_COMPONENT = True
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ struct ClimateDeviceRestoreState {
|
|||
float target_temperature_low;
|
||||
float target_temperature_high;
|
||||
};
|
||||
};
|
||||
} __attribute__((packed));
|
||||
float target_humidity;
|
||||
|
||||
/// Convert this struct to a climate call that can be performed.
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import maybe_simple_id, Condition
|
||||
from esphome.automation import Condition, maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_STATE,
|
||||
CONF_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_OPEN,
|
||||
CONF_POSITION,
|
||||
CONF_POSITION_COMMAND_TOPIC,
|
||||
CONF_POSITION_STATE_TOPIC,
|
||||
CONF_STATE,
|
||||
CONF_STOP,
|
||||
CONF_TILT,
|
||||
CONF_TILT_COMMAND_TOPIC,
|
||||
CONF_TILT_STATE_TOPIC,
|
||||
CONF_STOP,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
DEVICE_CLASS_AWNING,
|
||||
DEVICE_CLASS_BLIND,
|
||||
DEVICE_CLASS_CURTAIN,
|
||||
|
|
|
@ -1,32 +1,30 @@
|
|||
import esphome.codegen as cg
|
||||
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.components import mqtt, web_server, time
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, time, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DATE,
|
||||
CONF_DATETIME,
|
||||
CONF_DAY,
|
||||
CONF_HOUR,
|
||||
CONF_ID,
|
||||
CONF_MINUTE,
|
||||
CONF_MONTH,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_TIME,
|
||||
CONF_ON_VALUE,
|
||||
CONF_SECOND,
|
||||
CONF_TIME,
|
||||
CONF_TIME_ID,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_TYPE,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_DATE,
|
||||
CONF_DATETIME,
|
||||
CONF_TIME,
|
||||
CONF_YEAR,
|
||||
CONF_MONTH,
|
||||
CONF_DAY,
|
||||
CONF_SECOND,
|
||||
CONF_HOUR,
|
||||
CONF_MINUTE,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_generator import MockObjClass
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
||||
|
||||
CODEOWNERS = ["@rfdarter", "@jesserockz"]
|
||||
DEPENDENCIES = ["time"]
|
||||
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ENTITY_CATEGORY,
|
||||
CONF_EVENT_TYPE,
|
||||
CONF_ICON,
|
||||
CONF_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_EVENT,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_EVENT_TYPE,
|
||||
DEVICE_CLASS_BUTTON,
|
||||
DEVICE_CLASS_DOORBELL,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_MOTION,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
from esphome.cpp_generator import MockObjClass
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
||||
CODEOWNERS = ["@nohat"]
|
||||
IS_PLATFORM_COMPONENT = True
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DIRECTION,
|
||||
CONF_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_OSCILLATING,
|
||||
CONF_OSCILLATION_COMMAND_TOPIC,
|
||||
CONF_OSCILLATION_STATE_TOPIC,
|
||||
CONF_SPEED,
|
||||
CONF_SPEED_LEVEL_COMMAND_TOPIC,
|
||||
CONF_SPEED_LEVEL_STATE_TOPIC,
|
||||
CONF_SPEED_COMMAND_TOPIC,
|
||||
CONF_SPEED_STATE_TOPIC,
|
||||
CONF_OFF_SPEED_CYCLE,
|
||||
CONF_ON_DIRECTION_SET,
|
||||
CONF_ON_OSCILLATING_SET,
|
||||
CONF_ON_PRESET_SET,
|
||||
CONF_ON_SPEED_SET,
|
||||
CONF_ON_STATE,
|
||||
CONF_ON_TURN_OFF,
|
||||
CONF_ON_TURN_ON,
|
||||
CONF_ON_PRESET_SET,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_DIRECTION,
|
||||
CONF_OSCILLATING,
|
||||
CONF_OSCILLATION_COMMAND_TOPIC,
|
||||
CONF_OSCILLATION_STATE_TOPIC,
|
||||
CONF_RESTORE_MODE,
|
||||
CONF_SPEED,
|
||||
CONF_SPEED_COMMAND_TOPIC,
|
||||
CONF_SPEED_LEVEL_COMMAND_TOPIC,
|
||||
CONF_SPEED_LEVEL_STATE_TOPIC,
|
||||
CONF_SPEED_STATE_TOPIC,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
|
|
@ -39,8 +39,8 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
|||
return false;
|
||||
}
|
||||
|
||||
this->status_clear_warning();
|
||||
uint32_t data = 0;
|
||||
bool final_dout;
|
||||
|
||||
{
|
||||
InterruptLock lock;
|
||||
|
@ -59,8 +59,17 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
|||
this->sck_pin_->digital_write(false);
|
||||
delayMicroseconds(1);
|
||||
}
|
||||
final_dout = this->dout_pin_->digital_read();
|
||||
}
|
||||
|
||||
if (!final_dout) {
|
||||
ESP_LOGW(TAG, "HX711 DOUT pin not high after reading (data 0x%" PRIx32 ")!", data);
|
||||
this->status_set_warning();
|
||||
return false;
|
||||
}
|
||||
|
||||
this->status_clear_warning();
|
||||
|
||||
if (data & 0x800000ULL) {
|
||||
data |= 0xFF000000ULL;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
import esphome.automation as auto
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, power_supply, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_COLD_WHITE_COLOR_TEMPERATURE,
|
||||
CONF_COLOR_CORRECT,
|
||||
CONF_DEFAULT_TRANSITION_LENGTH,
|
||||
CONF_EFFECTS,
|
||||
|
@ -10,36 +11,36 @@ from esphome.const import (
|
|||
CONF_GAMMA_CORRECT,
|
||||
CONF_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_POWER_SUPPLY,
|
||||
CONF_RESTORE_MODE,
|
||||
CONF_ON_STATE,
|
||||
CONF_ON_TURN_OFF,
|
||||
CONF_ON_TURN_ON,
|
||||
CONF_ON_STATE,
|
||||
CONF_POWER_SUPPLY,
|
||||
CONF_RESTORE_MODE,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_COLD_WHITE_COLOR_TEMPERATURE,
|
||||
CONF_WARM_WHITE_COLOR_TEMPERATURE,
|
||||
CONF_WEB_SERVER_ID,
|
||||
)
|
||||
from esphome.core import coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
||||
from .automation import light_control_to_code # noqa
|
||||
from .effects import (
|
||||
validate_effects,
|
||||
ADDRESSABLE_EFFECTS,
|
||||
BINARY_EFFECTS,
|
||||
EFFECTS_REGISTRY,
|
||||
MONOCHROMATIC_EFFECTS,
|
||||
RGB_EFFECTS,
|
||||
ADDRESSABLE_EFFECTS,
|
||||
EFFECTS_REGISTRY,
|
||||
validate_effects,
|
||||
)
|
||||
from .types import ( # noqa
|
||||
LightState,
|
||||
AddressableLightState,
|
||||
light_ns,
|
||||
LightOutput,
|
||||
AddressableLight,
|
||||
LightTurnOnTrigger,
|
||||
LightTurnOffTrigger,
|
||||
AddressableLightState,
|
||||
LightOutput,
|
||||
LightState,
|
||||
LightStateTrigger,
|
||||
LightTurnOffTrigger,
|
||||
LightTurnOnTrigger,
|
||||
light_ns,
|
||||
)
|
||||
|
||||
CODEOWNERS = ["@esphome/core"]
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import Condition, maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_LOCK,
|
||||
CONF_ON_UNLOCK,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
import re
|
||||
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import LambdaAction
|
||||
import esphome.codegen as cg
|
||||
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant
|
||||
from esphome.components.esp32.const import (
|
||||
VARIANT_ESP32,
|
||||
VARIANT_ESP32C2,
|
||||
VARIANT_ESP32C3,
|
||||
VARIANT_ESP32C6,
|
||||
VARIANT_ESP32H2,
|
||||
VARIANT_ESP32S2,
|
||||
VARIANT_ESP32S3,
|
||||
)
|
||||
from esphome.components.libretiny import get_libretiny_component, get_libretiny_family
|
||||
from esphome.components.libretiny.const import COMPONENT_BK72XX, COMPONENT_RTL87XX
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ARGS,
|
||||
CONF_BAUD_RATE,
|
||||
|
@ -18,27 +30,12 @@ from esphome.const import (
|
|||
CONF_TRIGGER_ID,
|
||||
CONF_TX_BUFFER_SIZE,
|
||||
PLATFORM_BK72XX,
|
||||
PLATFORM_RTL87XX,
|
||||
PLATFORM_ESP32,
|
||||
PLATFORM_ESP8266,
|
||||
PLATFORM_RP2040,
|
||||
PLATFORM_RTL87XX,
|
||||
)
|
||||
from esphome.core import CORE, EsphomeError, Lambda, coroutine_with_priority
|
||||
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant
|
||||
from esphome.components.esp32.const import (
|
||||
VARIANT_ESP32,
|
||||
VARIANT_ESP32S2,
|
||||
VARIANT_ESP32C3,
|
||||
VARIANT_ESP32S3,
|
||||
VARIANT_ESP32C2,
|
||||
VARIANT_ESP32C6,
|
||||
VARIANT_ESP32H2,
|
||||
)
|
||||
from esphome.components.libretiny import get_libretiny_component, get_libretiny_family
|
||||
from esphome.components.libretiny.const import (
|
||||
COMPONENT_BK72XX,
|
||||
COMPONENT_RTL87XX,
|
||||
)
|
||||
|
||||
CODEOWNERS = ["@esphome/core"]
|
||||
logger_ns = cg.esphome_ns.namespace("logger")
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_LVGL_BINARY_SENSOR
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
#include "esphome/components/binary_sensor/binary_sensor.h"
|
||||
#endif // USE_LVGL_BINARY_SENSOR
|
||||
#endif // USE_BINARY_SENSOR
|
||||
#ifdef USE_LVGL_ROTARY_ENCODER
|
||||
#include "esphome/components/rotary_encoder/rotary_encoder.h"
|
||||
#endif // USE_LVGL_ROTARY_ENCODER
|
||||
|
|
|
@ -19,7 +19,7 @@ class LVGLNumber : public number::Number {
|
|||
}
|
||||
|
||||
protected:
|
||||
void control(float value) {
|
||||
void control(float value) override {
|
||||
if (this->control_lambda_ != nullptr)
|
||||
this->control_lambda_(value);
|
||||
else
|
||||
|
|
|
@ -19,7 +19,7 @@ class LVGLSwitch : public switch_::Switch {
|
|||
}
|
||||
|
||||
protected:
|
||||
void write_state(bool value) {
|
||||
void write_state(bool value) override {
|
||||
if (this->state_lambda_ != nullptr)
|
||||
this->state_lambda_(value);
|
||||
else
|
||||
|
|
|
@ -19,7 +19,7 @@ class LVGLText : public text::Text {
|
|||
}
|
||||
|
||||
protected:
|
||||
void control(const std::string &value) {
|
||||
void control(const std::string &value) override {
|
||||
if (this->control_lambda_ != nullptr)
|
||||
this->control_lambda_(value);
|
||||
else
|
||||
|
|
|
@ -271,6 +271,7 @@ async def set_obj_properties(w: Widget, config):
|
|||
"""Generate a list of C++ statements to apply properties to an lv_obj_t"""
|
||||
if layout := config.get(CONF_LAYOUT):
|
||||
layout_type: str = layout[CONF_TYPE]
|
||||
add_lv_use(layout_type)
|
||||
lv_obj.set_layout(w.obj, literal(f"LV_LAYOUT_{layout_type.upper()}"))
|
||||
if layout_type == TYPE_GRID:
|
||||
wid = config[CONF_ID]
|
||||
|
@ -334,7 +335,7 @@ async def set_obj_properties(w: Widget, config):
|
|||
for key, value in states.items():
|
||||
if isinstance(value, cv.Lambda):
|
||||
lambs[key] = value
|
||||
elif value == "true":
|
||||
elif value:
|
||||
adds.add(key)
|
||||
else:
|
||||
clears.add(key)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import sensor, spi
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_MAINS_FILTER,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
|
@ -15,8 +15,8 @@ MAX31856Sensor = max31856_ns.class_(
|
|||
|
||||
MAX31865ConfigFilter = max31856_ns.enum("MAX31856ConfigFilter")
|
||||
FILTER = {
|
||||
"50HZ": MAX31865ConfigFilter.FILTER_50HZ,
|
||||
"60HZ": MAX31865ConfigFilter.FILTER_60HZ,
|
||||
50: MAX31865ConfigFilter.FILTER_50HZ,
|
||||
60: MAX31865ConfigFilter.FILTER_60HZ,
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
|
@ -29,8 +29,8 @@ CONFIG_SCHEMA = (
|
|||
)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(CONF_MAINS_FILTER, default="60HZ"): cv.enum(
|
||||
FILTER, upper=True, space=""
|
||||
cv.Optional(CONF_MAINS_FILTER, default="60Hz"): cv.All(
|
||||
cv.frequency, cv.enum(FILTER, int=True)
|
||||
),
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
from esphome import automation
|
||||
import esphome.config_validation as cv
|
||||
import esphome.codegen as cg
|
||||
|
||||
from esphome.automation import maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_ON_IDLE,
|
||||
CONF_ON_STATE,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_VOLUME,
|
||||
CONF_ON_IDLE,
|
||||
)
|
||||
from esphome.core import CORE
|
||||
from esphome.coroutine import coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
||||
|
||||
CODEOWNERS = ["@jesserockz"]
|
||||
|
||||
IS_PLATFORM_COMPONENT = True
|
||||
|
|
|
@ -150,12 +150,40 @@ bool MQTTComponent::send_discovery_() {
|
|||
const std::string &node_area = App.get_area();
|
||||
|
||||
JsonObject device_info = root.createNestedObject(MQTT_DEVICE);
|
||||
device_info[MQTT_DEVICE_IDENTIFIERS] = get_mac_address();
|
||||
const auto mac = get_mac_address();
|
||||
device_info[MQTT_DEVICE_IDENTIFIERS] = mac;
|
||||
device_info[MQTT_DEVICE_NAME] = node_friendly_name;
|
||||
device_info[MQTT_DEVICE_SW_VERSION] = "esphome v" ESPHOME_VERSION " " + App.get_compilation_time();
|
||||
#ifdef ESPHOME_PROJECT_NAME
|
||||
device_info[MQTT_DEVICE_SW_VERSION] = ESPHOME_PROJECT_VERSION " (ESPHome " ESPHOME_VERSION ")";
|
||||
const char *model = std::strchr(ESPHOME_PROJECT_NAME, '.');
|
||||
if (model == nullptr) { // must never happen but check anyway
|
||||
device_info[MQTT_DEVICE_MODEL] = ESPHOME_BOARD;
|
||||
device_info[MQTT_DEVICE_MANUFACTURER] = ESPHOME_PROJECT_NAME;
|
||||
} else {
|
||||
device_info[MQTT_DEVICE_MODEL] = model + 1;
|
||||
device_info[MQTT_DEVICE_MANUFACTURER] = std::string(ESPHOME_PROJECT_NAME, model - ESPHOME_PROJECT_NAME);
|
||||
}
|
||||
#else
|
||||
device_info[MQTT_DEVICE_SW_VERSION] = ESPHOME_VERSION " (" + App.get_compilation_time() + ")";
|
||||
device_info[MQTT_DEVICE_MODEL] = ESPHOME_BOARD;
|
||||
device_info[MQTT_DEVICE_MANUFACTURER] = "espressif";
|
||||
device_info[MQTT_DEVICE_SUGGESTED_AREA] = node_area;
|
||||
#if defined(USE_ESP8266) || defined(USE_ESP32)
|
||||
device_info[MQTT_DEVICE_MANUFACTURER] = "Espressif";
|
||||
#elif defined(USE_RP2040)
|
||||
device_info[MQTT_DEVICE_MANUFACTURER] = "Raspberry Pi";
|
||||
#elif defined(USE_BK72XX)
|
||||
device_info[MQTT_DEVICE_MANUFACTURER] = "Beken";
|
||||
#elif defined(USE_RTL87XX)
|
||||
device_info[MQTT_DEVICE_MANUFACTURER] = "Realtek";
|
||||
#elif defined(USE_HOST)
|
||||
device_info[MQTT_DEVICE_MANUFACTURER] = "Host";
|
||||
#endif
|
||||
#endif
|
||||
if (!node_area.empty()) {
|
||||
device_info[MQTT_DEVICE_SUGGESTED_AREA] = node_area;
|
||||
}
|
||||
|
||||
device_info[MQTT_DEVICE_CONNECTIONS][0][0] = "mac";
|
||||
device_info[MQTT_DEVICE_CONNECTIONS][0][1] = mac;
|
||||
},
|
||||
this->qos_, discovery_info.retain);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ constexpr const char *const MQTT_DEVICE_MODEL = "mdl";
|
|||
constexpr const char *const MQTT_DEVICE_NAME = "name";
|
||||
constexpr const char *const MQTT_DEVICE_SUGGESTED_AREA = "sa";
|
||||
constexpr const char *const MQTT_DEVICE_SW_VERSION = "sw";
|
||||
constexpr const char *const MQTT_DEVICE_HW_VERSION = "hw";
|
||||
constexpr const char *const MQTT_DOCKED_TEMPLATE = "dock_tpl";
|
||||
constexpr const char *const MQTT_DOCKED_TOPIC = "dock_t";
|
||||
constexpr const char *const MQTT_EFFECT_COMMAND_TOPIC = "fx_cmd_t";
|
||||
|
@ -322,6 +323,7 @@ constexpr const char *const MQTT_DEVICE_MODEL = "model";
|
|||
constexpr const char *const MQTT_DEVICE_NAME = "name";
|
||||
constexpr const char *const MQTT_DEVICE_SUGGESTED_AREA = "suggested_area";
|
||||
constexpr const char *const MQTT_DEVICE_SW_VERSION = "sw_version";
|
||||
constexpr const char *const MQTT_DEVICE_HW_VERSION = "hw_version";
|
||||
constexpr const char *const MQTT_DOCKED_TEMPLATE = "docked_template";
|
||||
constexpr const char *const MQTT_DOCKED_TOPIC = "docked_topic";
|
||||
constexpr const char *const MQTT_EFFECT_COMMAND_TOPIC = "effect_command_topic";
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.components import mqtt
|
||||
from esphome.components import web_server
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ABOVE,
|
||||
CONF_BELOW,
|
||||
CONF_CYCLE,
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ENTITY_CATEGORY,
|
||||
CONF_ID,
|
||||
CONF_ICON,
|
||||
CONF_ID,
|
||||
CONF_MODE,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_VALUE,
|
||||
CONF_ON_VALUE_RANGE,
|
||||
CONF_OPERATION,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_MQTT_ID,
|
||||
CONF_VALUE,
|
||||
CONF_OPERATION,
|
||||
CONF_CYCLE,
|
||||
CONF_WEB_SERVER_ID,
|
||||
DEVICE_CLASS_APPARENT_POWER,
|
||||
DEVICE_CLASS_AQI,
|
||||
|
@ -72,8 +71,8 @@ from esphome.const import (
|
|||
DEVICE_CLASS_WIND_SPEED,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
from esphome.cpp_generator import MockObjClass
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
||||
CODEOWNERS = ["@esphome/core"]
|
||||
DEVICE_CLASSES = [
|
||||
|
|
|
@ -49,7 +49,7 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase,
|
|||
#ifdef USE_ESP32
|
||||
void configure_rmt_();
|
||||
|
||||
uint32_t current_carrier_frequency_{UINT32_MAX};
|
||||
uint32_t current_carrier_frequency_{38000};
|
||||
bool initialized_{false};
|
||||
std::vector<rmt_item32_t> rmt_temp_;
|
||||
esp_err_t error_code_{ESP_OK};
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_CYCLE,
|
||||
CONF_ENTITY_CATEGORY,
|
||||
CONF_ICON,
|
||||
CONF_ID,
|
||||
CONF_INDEX,
|
||||
CONF_MODE,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_VALUE,
|
||||
CONF_OPERATION,
|
||||
CONF_OPTION,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_CYCLE,
|
||||
CONF_MODE,
|
||||
CONF_OPERATION,
|
||||
CONF_INDEX,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_generator import MockObjClass
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
import math
|
||||
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ABOVE,
|
||||
CONF_ACCURACY_DECIMALS,
|
||||
CONF_ALPHA,
|
||||
CONF_BELOW,
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ENTITY_CATEGORY,
|
||||
CONF_EXPIRE_AFTER,
|
||||
CONF_FILTERS,
|
||||
CONF_FORCE_UPDATE,
|
||||
CONF_FROM,
|
||||
CONF_ICON,
|
||||
CONF_ID,
|
||||
CONF_IGNORE_OUT_OF_RANGE,
|
||||
CONF_MAX_VALUE,
|
||||
CONF_METHOD,
|
||||
CONF_MIN_VALUE,
|
||||
CONF_MQTT_ID,
|
||||
CONF_MULTIPLE,
|
||||
CONF_ON_RAW_VALUE,
|
||||
CONF_ON_VALUE,
|
||||
|
@ -30,14 +35,9 @@ from esphome.const import (
|
|||
CONF_TRIGGER_ID,
|
||||
CONF_TYPE,
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_WINDOW_SIZE,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_FORCE_UPDATE,
|
||||
CONF_VALUE,
|
||||
CONF_MIN_VALUE,
|
||||
CONF_MAX_VALUE,
|
||||
CONF_METHOD,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_WINDOW_SIZE,
|
||||
DEVICE_CLASS_APPARENT_POWER,
|
||||
DEVICE_CLASS_AQI,
|
||||
DEVICE_CLASS_ATMOSPHERIC_PRESSURE,
|
||||
|
|
|
@ -7,10 +7,6 @@ namespace spi {
|
|||
|
||||
const char *const TAG = "spi";
|
||||
|
||||
SPIDelegate *const SPIDelegate::NULL_DELEGATE = // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
new SPIDelegateDummy();
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=48040
|
||||
|
||||
bool SPIDelegate::is_ready() { return true; }
|
||||
|
||||
GPIOPin *const NullPin::NULL_PIN = new NullPin(); // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
@ -79,8 +75,6 @@ void SPIComponent::dump_config() {
|
|||
}
|
||||
}
|
||||
|
||||
void SPIDelegateDummy::begin_transaction() { ESP_LOGE(TAG, "SPIDevice not initialised - did you call spi_setup()?"); }
|
||||
|
||||
uint8_t SPIDelegateBitBash::transfer(uint8_t data) { return this->transfer_(data, 8); }
|
||||
|
||||
void SPIDelegateBitBash::write(uint16_t data, size_t num_bits) { this->transfer_(data, num_bits); }
|
||||
|
|
|
@ -163,8 +163,6 @@ class Utility {
|
|||
}
|
||||
};
|
||||
|
||||
class SPIDelegateDummy;
|
||||
|
||||
// represents a device attached to an SPI bus, with a defined clock rate, mode and bit order. On Arduino this is
|
||||
// a thin wrapper over SPIClass.
|
||||
class SPIDelegate {
|
||||
|
@ -250,21 +248,6 @@ class SPIDelegate {
|
|||
uint32_t data_rate_{1000000};
|
||||
SPIMode mode_{MODE0};
|
||||
GPIOPin *cs_pin_{NullPin::NULL_PIN};
|
||||
static SPIDelegate *const NULL_DELEGATE; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
};
|
||||
|
||||
/**
|
||||
* A dummy SPIDelegate that complains if it's used.
|
||||
*/
|
||||
|
||||
class SPIDelegateDummy : public SPIDelegate {
|
||||
public:
|
||||
SPIDelegateDummy() = default;
|
||||
|
||||
uint8_t transfer(uint8_t data) override { return 0; }
|
||||
void end_transaction() override{};
|
||||
|
||||
void begin_transaction() override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -382,7 +365,7 @@ class SPIClient {
|
|||
|
||||
virtual void spi_teardown() {
|
||||
this->parent_->unregister_device(this);
|
||||
this->delegate_ = SPIDelegate::NULL_DELEGATE;
|
||||
this->delegate_ = nullptr;
|
||||
}
|
||||
|
||||
bool spi_is_ready() { return this->delegate_->is_ready(); }
|
||||
|
@ -393,7 +376,7 @@ class SPIClient {
|
|||
uint32_t data_rate_{1000000};
|
||||
SPIComponent *parent_{nullptr};
|
||||
GPIOPin *cs_{nullptr};
|
||||
SPIDelegate *delegate_{SPIDelegate::NULL_DELEGATE};
|
||||
SPIDelegate *delegate_{nullptr};
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@ class SpiLedStrip : public light::AddressableLight,
|
|||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
void setup() { this->spi_setup(); }
|
||||
void setup() override { this->spi_setup(); }
|
||||
|
||||
int32_t size() const override { return this->num_leds_; }
|
||||
|
||||
|
@ -43,7 +43,7 @@ class SpiLedStrip : public light::AddressableLight,
|
|||
memset(this->buf_, 0, 4);
|
||||
}
|
||||
|
||||
void dump_config() {
|
||||
void dump_config() override {
|
||||
esph_log_config(TAG, "SPI LED Strip:");
|
||||
esph_log_config(TAG, " LEDs: %d", this->num_leds_);
|
||||
if (this->data_rate_ >= spi::DATA_RATE_1MHZ)
|
||||
|
|
|
@ -647,7 +647,7 @@ void Sprinkler::set_valve_run_duration(const optional<size_t> valve_number, cons
|
|||
return;
|
||||
}
|
||||
auto call = this->valve_[valve_number.value()].run_duration_number->make_call();
|
||||
if (this->valve_[valve_number.value()].run_duration_number->traits.get_unit_of_measurement() == min_str) {
|
||||
if (this->valve_[valve_number.value()].run_duration_number->traits.get_unit_of_measurement() == MIN_STR) {
|
||||
call.set_value(run_duration.value() / 60.0);
|
||||
} else {
|
||||
call.set_value(run_duration.value());
|
||||
|
@ -729,7 +729,7 @@ uint32_t Sprinkler::valve_run_duration(const size_t valve_number) {
|
|||
return 0;
|
||||
}
|
||||
if (this->valve_[valve_number].run_duration_number != nullptr) {
|
||||
if (this->valve_[valve_number].run_duration_number->traits.get_unit_of_measurement() == min_str) {
|
||||
if (this->valve_[valve_number].run_duration_number->traits.get_unit_of_measurement() == MIN_STR) {
|
||||
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state * 60));
|
||||
} else {
|
||||
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state));
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace esphome {
|
||||
namespace sprinkler {
|
||||
|
||||
const std::string min_str = "min";
|
||||
const std::string MIN_STR = "min";
|
||||
|
||||
enum SprinklerState : uint8_t {
|
||||
// NOTE: these states are used by both SprinklerValveOperator and Sprinkler (the controller)!
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import Condition, maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ENTITY_CATEGORY,
|
||||
|
@ -10,11 +10,11 @@ from esphome.const import (
|
|||
CONF_ID,
|
||||
CONF_INVERTED,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_ON_TURN_OFF,
|
||||
CONF_ON_TURN_ON,
|
||||
CONF_RESTORE_MODE,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_OUTLET,
|
||||
DEVICE_CLASS_SWITCH,
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
from typing import Optional
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
|
||||
from esphome import automation
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_MODE,
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_VALUE,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_VALUE,
|
||||
CONF_WEB_SERVER_ID,
|
||||
)
|
||||
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ENTITY_CATEGORY,
|
||||
CONF_FILTERS,
|
||||
CONF_FROM,
|
||||
CONF_ICON,
|
||||
CONF_ID,
|
||||
CONF_ON_VALUE,
|
||||
CONF_ON_RAW_VALUE,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_ON_RAW_VALUE,
|
||||
CONF_ON_VALUE,
|
||||
CONF_STATE,
|
||||
CONF_FROM,
|
||||
CONF_TO,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
DEVICE_CLASS_DATE,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_TIMESTAMP,
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
import logging
|
||||
from importlib import resources
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
import tzlocal
|
||||
|
||||
from esphome import automation
|
||||
from esphome.automation import Condition
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_AT,
|
||||
CONF_CRON,
|
||||
CONF_DAYS_OF_MONTH,
|
||||
CONF_DAYS_OF_WEEK,
|
||||
CONF_HOUR,
|
||||
CONF_HOURS,
|
||||
CONF_ID,
|
||||
CONF_MINUTE,
|
||||
CONF_MINUTES,
|
||||
CONF_MONTHS,
|
||||
CONF_ON_TIME,
|
||||
CONF_ON_TIME_SYNC,
|
||||
CONF_SECOND,
|
||||
CONF_SECONDS,
|
||||
CONF_TIMEZONE,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_AT,
|
||||
CONF_SECOND,
|
||||
CONF_HOUR,
|
||||
CONF_MINUTE,
|
||||
)
|
||||
from esphome.core import coroutine_with_priority
|
||||
from esphome.automation import Condition
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.automation import maybe_simple_id, Condition
|
||||
from esphome.automation import Condition, maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ID,
|
||||
|
|
|
@ -91,7 +91,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
# pylint: disable=consider-using-f-string
|
||||
VARIABLE_PROG = re.compile(
|
||||
"\\$([{0}]+|\\{{[{0}]*\\}})".format(VALID_SUBSTITUTIONS_CHARACTERS)
|
||||
f"\\$([{VALID_SUBSTITUTIONS_CHARACTERS}]+|\\{{[{VALID_SUBSTITUTIONS_CHARACTERS}]*\\}})"
|
||||
)
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
|
|
|
@ -336,7 +336,7 @@ class ID:
|
|||
else:
|
||||
self.is_manual = is_manual
|
||||
self.is_declaration = is_declaration
|
||||
self.type: Optional["MockObjClass"] = type
|
||||
self.type: Optional[MockObjClass] = type
|
||||
|
||||
def resolve(self, registered_ids):
|
||||
from esphome.config_validation import RESERVED_IDS
|
||||
|
@ -500,7 +500,7 @@ class EsphomeCore:
|
|||
# The relative path to where all build files are stored
|
||||
self.build_path: Optional[str] = None
|
||||
# The validated configuration, this is None until the config has been validated
|
||||
self.config: Optional["ConfigType"] = None
|
||||
self.config: Optional[ConfigType] = None
|
||||
# The pending tasks in the task queue (mostly for C++ generation)
|
||||
# This is a priority queue (with heapq)
|
||||
# Each item is a tuple of form: (-priority, unique number, task)
|
||||
|
@ -508,17 +508,17 @@ class EsphomeCore:
|
|||
# Task counter for pending tasks
|
||||
self.task_counter = 0
|
||||
# The variable cache, for each ID this holds a MockObj of the variable obj
|
||||
self.variables: dict[str, "MockObj"] = {}
|
||||
self.variables: dict[str, MockObj] = {}
|
||||
# A list of statements that go in the main setup() block
|
||||
self.main_statements: list["Statement"] = []
|
||||
self.main_statements: list[Statement] = []
|
||||
# A list of statements to insert in the global block (includes and global variables)
|
||||
self.global_statements: list["Statement"] = []
|
||||
self.global_statements: list[Statement] = []
|
||||
# A set of platformio libraries to add to the project
|
||||
self.libraries: list[Library] = []
|
||||
# A set of build flags to set in the platformio project
|
||||
self.build_flags: set[str] = set()
|
||||
# A set of defines to set for the compile process in esphome/core/defines.h
|
||||
self.defines: set["Define"] = set()
|
||||
self.defines: set[Define] = set()
|
||||
# A map of all platformio options to apply
|
||||
self.platformio_options: dict[str, Union[str, list[str]]] = {}
|
||||
# A set of strings of names of loaded integrations, used to find namespace ID conflicts
|
||||
|
|
|
@ -63,7 +63,7 @@ class EntityBase {
|
|||
EntityCategory entity_category_{ENTITY_CATEGORY_NONE};
|
||||
};
|
||||
|
||||
class EntityBase_DeviceClass {
|
||||
class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)
|
||||
public:
|
||||
/// Get the device class, using the manual override if set.
|
||||
std::string get_device_class();
|
||||
|
@ -74,7 +74,7 @@ class EntityBase_DeviceClass {
|
|||
const char *device_class_{nullptr}; ///< Device class override
|
||||
};
|
||||
|
||||
class EntityBase_UnitOfMeasurement {
|
||||
class EntityBase_UnitOfMeasurement { // NOLINT(readability-identifier-naming)
|
||||
public:
|
||||
/// Get the unit of measurement, using the manual override if set.
|
||||
std::string get_unit_of_measurement();
|
||||
|
|
|
@ -3,7 +3,6 @@ import hashlib
|
|||
import json
|
||||
import logging
|
||||
import ssl
|
||||
import sys
|
||||
import time
|
||||
|
||||
import paho.mqtt.client as mqtt
|
||||
|
@ -103,10 +102,7 @@ def prepare(
|
|||
if config[CONF_MQTT].get(CONF_SSL_FINGERPRINTS) or config[CONF_MQTT].get(
|
||||
CONF_CERTIFICATE_AUTHORITY
|
||||
):
|
||||
if sys.version_info >= (2, 7, 13):
|
||||
tls_version = ssl.PROTOCOL_TLS # pylint: disable=no-member
|
||||
else:
|
||||
tls_version = ssl.PROTOCOL_SSLv23
|
||||
tls_version = ssl.PROTOCOL_TLS # pylint: disable=no-member
|
||||
client.tls_set(
|
||||
ca_certs=None,
|
||||
certfile=None,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#!/usr/bin/env python3
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import argparse
|
||||
from collections import defaultdict
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
from esphome.helpers import write_file_if_changed
|
||||
from esphome.config import get_component, get_platform
|
||||
from esphome.core import CORE
|
||||
from esphome.const import KEY_CORE, KEY_TARGET_FRAMEWORK
|
||||
from esphome.core import CORE
|
||||
from esphome.helpers import write_file_if_changed
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import argparse
|
||||
import glob
|
||||
import inspect
|
||||
import json
|
||||
import argparse
|
||||
import os
|
||||
import glob
|
||||
import re
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
# NOTE: Cannot import other esphome components globally as a modification in vol_schema
|
||||
|
@ -94,13 +95,12 @@ load_components()
|
|||
|
||||
# Import esphome after loading components (so schema is tracked)
|
||||
# pylint: disable=wrong-import-position
|
||||
import esphome.core as esphome_core
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome import pins
|
||||
from esphome import automation, pins
|
||||
from esphome.components import remote_base
|
||||
from esphome.loader import get_platform, CORE_COMPONENTS_PATH
|
||||
import esphome.config_validation as cv
|
||||
import esphome.core as esphome_core
|
||||
from esphome.helpers import write_file_if_changed
|
||||
from esphome.loader import CORE_COMPONENTS_PATH, get_platform
|
||||
from esphome.util import Registry
|
||||
|
||||
# pylint: enable=wrong-import-position
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from helpers import (
|
||||
print_error_for_file,
|
||||
get_output,
|
||||
git_ls_files,
|
||||
filter_changed,
|
||||
get_binary,
|
||||
)
|
||||
import argparse
|
||||
import click
|
||||
import colorama
|
||||
import multiprocessing
|
||||
import os
|
||||
import queue
|
||||
|
@ -18,6 +9,9 @@ import subprocess
|
|||
import sys
|
||||
import threading
|
||||
|
||||
import click
|
||||
import colorama
|
||||
from helpers import filter_changed, get_binary, git_ls_files, print_error_for_file
|
||||
|
||||
|
||||
def run_format(executable, args, queue, lock, failed_files):
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from helpers import (
|
||||
print_error_for_file,
|
||||
get_output,
|
||||
filter_grep,
|
||||
build_all_include,
|
||||
temp_header_file,
|
||||
git_ls_files,
|
||||
filter_changed,
|
||||
load_idedata,
|
||||
root_path,
|
||||
basepath,
|
||||
get_binary,
|
||||
)
|
||||
import argparse
|
||||
import click
|
||||
import colorama
|
||||
import multiprocessing
|
||||
import os
|
||||
import queue
|
||||
|
@ -26,6 +11,20 @@ import sys
|
|||
import tempfile
|
||||
import threading
|
||||
|
||||
import click
|
||||
import colorama
|
||||
from helpers import (
|
||||
basepath,
|
||||
build_all_include,
|
||||
filter_changed,
|
||||
filter_grep,
|
||||
get_binary,
|
||||
git_ls_files,
|
||||
load_idedata,
|
||||
print_error_for_file,
|
||||
root_path,
|
||||
temp_header_file,
|
||||
)
|
||||
|
||||
|
||||
def clang_options(idedata):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import json
|
||||
import os.path
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import colorama
|
||||
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from helpers import (
|
||||
styled,
|
||||
print_error_for_file,
|
||||
get_output,
|
||||
get_err,
|
||||
git_ls_files,
|
||||
filter_changed,
|
||||
)
|
||||
import argparse
|
||||
import colorama
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import colorama
|
||||
from helpers import (
|
||||
filter_changed,
|
||||
get_err,
|
||||
get_output,
|
||||
git_ls_files,
|
||||
print_error_for_file,
|
||||
styled,
|
||||
)
|
||||
|
||||
curfile = None
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
from helpers import git_ls_files, changed_files
|
||||
from esphome.loader import get_component, get_platform
|
||||
from esphome.core import CORE
|
||||
from helpers import changed_files, git_ls_files
|
||||
|
||||
from esphome.const import (
|
||||
KEY_CORE,
|
||||
KEY_TARGET_FRAMEWORK,
|
||||
|
@ -13,6 +12,8 @@ from esphome.const import (
|
|||
PLATFORM_ESP32,
|
||||
PLATFORM_ESP8266,
|
||||
)
|
||||
from esphome.core import CORE
|
||||
from esphome.loader import get_component, get_platform
|
||||
|
||||
|
||||
def filter_component_files(str):
|
||||
|
|
Loading…
Reference in a new issue