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 import automation, core
|
||||||
from esphome.automation import Condition, maybe_simple_id
|
from esphome.automation import Condition, maybe_simple_id
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_DELAY,
|
CONF_DELAY,
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
|
@ -16,6 +14,7 @@ from esphome.const import (
|
||||||
CONF_INVERTED,
|
CONF_INVERTED,
|
||||||
CONF_MAX_LENGTH,
|
CONF_MAX_LENGTH,
|
||||||
CONF_MIN_LENGTH,
|
CONF_MIN_LENGTH,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_CLICK,
|
CONF_ON_CLICK,
|
||||||
CONF_ON_DOUBLE_CLICK,
|
CONF_ON_DOUBLE_CLICK,
|
||||||
CONF_ON_MULTI_CLICK,
|
CONF_ON_MULTI_CLICK,
|
||||||
|
@ -26,7 +25,6 @@ from esphome.const import (
|
||||||
CONF_STATE,
|
CONF_STATE,
|
||||||
CONF_TIMING,
|
CONF_TIMING,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_WEB_SERVER_ID,
|
||||||
DEVICE_CLASS_BATTERY,
|
DEVICE_CLASS_BATTERY,
|
||||||
DEVICE_CLASS_BATTERY_CHARGING,
|
DEVICE_CLASS_BATTERY_CHARGING,
|
||||||
|
@ -59,6 +57,8 @@ from esphome.const import (
|
||||||
DEVICE_CLASS_WINDOW,
|
DEVICE_CLASS_WINDOW,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
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
|
from esphome.util import Registry
|
||||||
|
|
||||||
CODEOWNERS = ["@esphome/core"]
|
CODEOWNERS = ["@esphome/core"]
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import automation
|
from esphome import automation
|
||||||
from esphome.automation import maybe_simple_id
|
from esphome.automation import maybe_simple_id
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_CATEGORY,
|
CONF_ENTITY_CATEGORY,
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_PRESS,
|
CONF_ON_PRESS,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_WEB_SERVER_ID,
|
||||||
DEVICE_CLASS_EMPTY,
|
DEVICE_CLASS_EMPTY,
|
||||||
DEVICE_CLASS_IDENTIFY,
|
DEVICE_CLASS_IDENTIFY,
|
||||||
|
@ -18,8 +18,8 @@ from esphome.const import (
|
||||||
DEVICE_CLASS_UPDATE,
|
DEVICE_CLASS_UPDATE,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.cpp_helpers import setup_entity
|
|
||||||
from esphome.cpp_generator import MockObjClass
|
from esphome.cpp_generator import MockObjClass
|
||||||
|
from esphome.cpp_helpers import setup_entity
|
||||||
|
|
||||||
CODEOWNERS = ["@esphome/core"]
|
CODEOWNERS = ["@esphome/core"]
|
||||||
IS_PLATFORM_COMPONENT = True
|
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
|
from esphome import automation
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ACTION_STATE_TOPIC,
|
CONF_ACTION_STATE_TOPIC,
|
||||||
CONF_AWAY,
|
CONF_AWAY,
|
||||||
|
@ -21,6 +20,7 @@ from esphome.const import (
|
||||||
CONF_MODE,
|
CONF_MODE,
|
||||||
CONF_MODE_COMMAND_TOPIC,
|
CONF_MODE_COMMAND_TOPIC,
|
||||||
CONF_MODE_STATE_TOPIC,
|
CONF_MODE_STATE_TOPIC,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_CONTROL,
|
CONF_ON_CONTROL,
|
||||||
CONF_ON_STATE,
|
CONF_ON_STATE,
|
||||||
CONF_PRESET,
|
CONF_PRESET,
|
||||||
|
@ -33,20 +33,20 @@ from esphome.const import (
|
||||||
CONF_TARGET_HUMIDITY_STATE_TOPIC,
|
CONF_TARGET_HUMIDITY_STATE_TOPIC,
|
||||||
CONF_TARGET_TEMPERATURE,
|
CONF_TARGET_TEMPERATURE,
|
||||||
CONF_TARGET_TEMPERATURE_COMMAND_TOPIC,
|
CONF_TARGET_TEMPERATURE_COMMAND_TOPIC,
|
||||||
CONF_TARGET_TEMPERATURE_STATE_TOPIC,
|
|
||||||
CONF_TARGET_TEMPERATURE_HIGH,
|
CONF_TARGET_TEMPERATURE_HIGH,
|
||||||
CONF_TARGET_TEMPERATURE_HIGH_COMMAND_TOPIC,
|
CONF_TARGET_TEMPERATURE_HIGH_COMMAND_TOPIC,
|
||||||
CONF_TARGET_TEMPERATURE_HIGH_STATE_TOPIC,
|
CONF_TARGET_TEMPERATURE_HIGH_STATE_TOPIC,
|
||||||
CONF_TARGET_TEMPERATURE_LOW,
|
CONF_TARGET_TEMPERATURE_LOW,
|
||||||
CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC,
|
CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC,
|
||||||
CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC,
|
CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC,
|
||||||
|
CONF_TARGET_TEMPERATURE_STATE_TOPIC,
|
||||||
CONF_TEMPERATURE_STEP,
|
CONF_TEMPERATURE_STEP,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_VISUAL,
|
CONF_VISUAL,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_WEB_SERVER_ID,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
|
from esphome.cpp_helpers import setup_entity
|
||||||
|
|
||||||
IS_PLATFORM_COMPONENT = True
|
IS_PLATFORM_COMPONENT = True
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ struct ClimateDeviceRestoreState {
|
||||||
float target_temperature_low;
|
float target_temperature_low;
|
||||||
float target_temperature_high;
|
float target_temperature_high;
|
||||||
};
|
};
|
||||||
};
|
} __attribute__((packed));
|
||||||
float target_humidity;
|
float target_humidity;
|
||||||
|
|
||||||
/// Convert this struct to a climate call that can be performed.
|
/// 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 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
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ID,
|
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_STATE,
|
CONF_ID,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_OPEN,
|
CONF_ON_OPEN,
|
||||||
CONF_POSITION,
|
CONF_POSITION,
|
||||||
CONF_POSITION_COMMAND_TOPIC,
|
CONF_POSITION_COMMAND_TOPIC,
|
||||||
CONF_POSITION_STATE_TOPIC,
|
CONF_POSITION_STATE_TOPIC,
|
||||||
|
CONF_STATE,
|
||||||
|
CONF_STOP,
|
||||||
CONF_TILT,
|
CONF_TILT,
|
||||||
CONF_TILT_COMMAND_TOPIC,
|
CONF_TILT_COMMAND_TOPIC,
|
||||||
CONF_TILT_STATE_TOPIC,
|
CONF_TILT_STATE_TOPIC,
|
||||||
CONF_STOP,
|
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
|
CONF_WEB_SERVER_ID,
|
||||||
DEVICE_CLASS_AWNING,
|
DEVICE_CLASS_AWNING,
|
||||||
DEVICE_CLASS_BLIND,
|
DEVICE_CLASS_BLIND,
|
||||||
DEVICE_CLASS_CURTAIN,
|
DEVICE_CLASS_CURTAIN,
|
||||||
|
|
|
@ -1,32 +1,30 @@
|
||||||
import esphome.codegen as cg
|
|
||||||
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import automation
|
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 (
|
from esphome.const import (
|
||||||
|
CONF_DATE,
|
||||||
|
CONF_DATETIME,
|
||||||
|
CONF_DAY,
|
||||||
|
CONF_HOUR,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
CONF_MINUTE,
|
||||||
|
CONF_MONTH,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_TIME,
|
CONF_ON_TIME,
|
||||||
CONF_ON_VALUE,
|
CONF_ON_VALUE,
|
||||||
|
CONF_SECOND,
|
||||||
|
CONF_TIME,
|
||||||
CONF_TIME_ID,
|
CONF_TIME_ID,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_TYPE,
|
CONF_TYPE,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_WEB_SERVER_ID,
|
||||||
CONF_DATE,
|
|
||||||
CONF_DATETIME,
|
|
||||||
CONF_TIME,
|
|
||||||
CONF_YEAR,
|
CONF_YEAR,
|
||||||
CONF_MONTH,
|
|
||||||
CONF_DAY,
|
|
||||||
CONF_SECOND,
|
|
||||||
CONF_HOUR,
|
|
||||||
CONF_MINUTE,
|
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.cpp_generator import MockObjClass
|
from esphome.cpp_generator import MockObjClass
|
||||||
from esphome.cpp_helpers import setup_entity
|
from esphome.cpp_helpers import setup_entity
|
||||||
|
|
||||||
|
|
||||||
CODEOWNERS = ["@rfdarter", "@jesserockz"]
|
CODEOWNERS = ["@rfdarter", "@jesserockz"]
|
||||||
DEPENDENCIES = ["time"]
|
DEPENDENCIES = ["time"]
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import automation
|
from esphome import automation
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt
|
from esphome.components import mqtt
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_CATEGORY,
|
CONF_ENTITY_CATEGORY,
|
||||||
|
CONF_EVENT_TYPE,
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_EVENT,
|
CONF_ON_EVENT,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_EVENT_TYPE,
|
|
||||||
DEVICE_CLASS_BUTTON,
|
DEVICE_CLASS_BUTTON,
|
||||||
DEVICE_CLASS_DOORBELL,
|
DEVICE_CLASS_DOORBELL,
|
||||||
DEVICE_CLASS_EMPTY,
|
DEVICE_CLASS_EMPTY,
|
||||||
DEVICE_CLASS_MOTION,
|
DEVICE_CLASS_MOTION,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.cpp_helpers import setup_entity
|
|
||||||
from esphome.cpp_generator import MockObjClass
|
from esphome.cpp_generator import MockObjClass
|
||||||
|
from esphome.cpp_helpers import setup_entity
|
||||||
|
|
||||||
CODEOWNERS = ["@nohat"]
|
CODEOWNERS = ["@nohat"]
|
||||||
IS_PLATFORM_COMPONENT = True
|
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 import automation
|
||||||
from esphome.automation import maybe_simple_id
|
from esphome.automation import maybe_simple_id
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
|
CONF_DIRECTION,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_MQTT_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_OFF_SPEED_CYCLE,
|
||||||
CONF_ON_DIRECTION_SET,
|
CONF_ON_DIRECTION_SET,
|
||||||
CONF_ON_OSCILLATING_SET,
|
CONF_ON_OSCILLATING_SET,
|
||||||
|
CONF_ON_PRESET_SET,
|
||||||
CONF_ON_SPEED_SET,
|
CONF_ON_SPEED_SET,
|
||||||
CONF_ON_STATE,
|
CONF_ON_STATE,
|
||||||
CONF_ON_TURN_OFF,
|
CONF_ON_TURN_OFF,
|
||||||
CONF_ON_TURN_ON,
|
CONF_ON_TURN_ON,
|
||||||
CONF_ON_PRESET_SET,
|
CONF_OSCILLATING,
|
||||||
CONF_TRIGGER_ID,
|
CONF_OSCILLATION_COMMAND_TOPIC,
|
||||||
CONF_DIRECTION,
|
CONF_OSCILLATION_STATE_TOPIC,
|
||||||
CONF_RESTORE_MODE,
|
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.core import CORE, coroutine_with_priority
|
||||||
from esphome.cpp_helpers import setup_entity
|
from esphome.cpp_helpers import setup_entity
|
||||||
|
|
|
@ -39,8 +39,8 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->status_clear_warning();
|
|
||||||
uint32_t data = 0;
|
uint32_t data = 0;
|
||||||
|
bool final_dout;
|
||||||
|
|
||||||
{
|
{
|
||||||
InterruptLock lock;
|
InterruptLock lock;
|
||||||
|
@ -59,8 +59,17 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
||||||
this->sck_pin_->digital_write(false);
|
this->sck_pin_->digital_write(false);
|
||||||
delayMicroseconds(1);
|
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) {
|
if (data & 0x800000ULL) {
|
||||||
data |= 0xFF000000ULL;
|
data |= 0xFF000000ULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
import esphome.automation as auto
|
import esphome.automation as auto
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, power_supply, web_server
|
from esphome.components import mqtt, power_supply, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
|
CONF_COLD_WHITE_COLOR_TEMPERATURE,
|
||||||
CONF_COLOR_CORRECT,
|
CONF_COLOR_CORRECT,
|
||||||
CONF_DEFAULT_TRANSITION_LENGTH,
|
CONF_DEFAULT_TRANSITION_LENGTH,
|
||||||
CONF_EFFECTS,
|
CONF_EFFECTS,
|
||||||
|
@ -10,36 +11,36 @@ from esphome.const import (
|
||||||
CONF_GAMMA_CORRECT,
|
CONF_GAMMA_CORRECT,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_MQTT_ID,
|
CONF_MQTT_ID,
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_ON_STATE,
|
||||||
CONF_POWER_SUPPLY,
|
|
||||||
CONF_RESTORE_MODE,
|
|
||||||
CONF_ON_TURN_OFF,
|
CONF_ON_TURN_OFF,
|
||||||
CONF_ON_TURN_ON,
|
CONF_ON_TURN_ON,
|
||||||
CONF_ON_STATE,
|
CONF_POWER_SUPPLY,
|
||||||
|
CONF_RESTORE_MODE,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_COLD_WHITE_COLOR_TEMPERATURE,
|
|
||||||
CONF_WARM_WHITE_COLOR_TEMPERATURE,
|
CONF_WARM_WHITE_COLOR_TEMPERATURE,
|
||||||
|
CONF_WEB_SERVER_ID,
|
||||||
)
|
)
|
||||||
from esphome.core import coroutine_with_priority
|
from esphome.core import coroutine_with_priority
|
||||||
from esphome.cpp_helpers import setup_entity
|
from esphome.cpp_helpers import setup_entity
|
||||||
|
|
||||||
from .automation import light_control_to_code # noqa
|
from .automation import light_control_to_code # noqa
|
||||||
from .effects import (
|
from .effects import (
|
||||||
validate_effects,
|
ADDRESSABLE_EFFECTS,
|
||||||
BINARY_EFFECTS,
|
BINARY_EFFECTS,
|
||||||
|
EFFECTS_REGISTRY,
|
||||||
MONOCHROMATIC_EFFECTS,
|
MONOCHROMATIC_EFFECTS,
|
||||||
RGB_EFFECTS,
|
RGB_EFFECTS,
|
||||||
ADDRESSABLE_EFFECTS,
|
validate_effects,
|
||||||
EFFECTS_REGISTRY,
|
|
||||||
)
|
)
|
||||||
from .types import ( # noqa
|
from .types import ( # noqa
|
||||||
LightState,
|
|
||||||
AddressableLightState,
|
|
||||||
light_ns,
|
|
||||||
LightOutput,
|
|
||||||
AddressableLight,
|
AddressableLight,
|
||||||
LightTurnOnTrigger,
|
AddressableLightState,
|
||||||
LightTurnOffTrigger,
|
LightOutput,
|
||||||
|
LightState,
|
||||||
LightStateTrigger,
|
LightStateTrigger,
|
||||||
|
LightTurnOffTrigger,
|
||||||
|
LightTurnOnTrigger,
|
||||||
|
light_ns,
|
||||||
)
|
)
|
||||||
|
|
||||||
CODEOWNERS = ["@esphome/core"]
|
CODEOWNERS = ["@esphome/core"]
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import automation
|
from esphome import automation
|
||||||
from esphome.automation import Condition, maybe_simple_id
|
from esphome.automation import Condition, maybe_simple_id
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_LOCK,
|
CONF_ON_LOCK,
|
||||||
CONF_ON_UNLOCK,
|
CONF_ON_UNLOCK,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_WEB_SERVER_ID,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
|
|
|
@ -1,9 +1,21 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import automation
|
from esphome import automation
|
||||||
from esphome.automation import LambdaAction
|
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 (
|
from esphome.const import (
|
||||||
CONF_ARGS,
|
CONF_ARGS,
|
||||||
CONF_BAUD_RATE,
|
CONF_BAUD_RATE,
|
||||||
|
@ -18,27 +30,12 @@ from esphome.const import (
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_TX_BUFFER_SIZE,
|
CONF_TX_BUFFER_SIZE,
|
||||||
PLATFORM_BK72XX,
|
PLATFORM_BK72XX,
|
||||||
PLATFORM_RTL87XX,
|
|
||||||
PLATFORM_ESP32,
|
PLATFORM_ESP32,
|
||||||
PLATFORM_ESP8266,
|
PLATFORM_ESP8266,
|
||||||
PLATFORM_RP2040,
|
PLATFORM_RP2040,
|
||||||
|
PLATFORM_RTL87XX,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, EsphomeError, Lambda, coroutine_with_priority
|
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"]
|
CODEOWNERS = ["@esphome/core"]
|
||||||
logger_ns = cg.esphome_ns.namespace("logger")
|
logger_ns = cg.esphome_ns.namespace("logger")
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
|
|
||||||
#ifdef USE_LVGL_BINARY_SENSOR
|
#ifdef USE_BINARY_SENSOR
|
||||||
#include "esphome/components/binary_sensor/binary_sensor.h"
|
#include "esphome/components/binary_sensor/binary_sensor.h"
|
||||||
#endif // USE_LVGL_BINARY_SENSOR
|
#endif // USE_BINARY_SENSOR
|
||||||
#ifdef USE_LVGL_ROTARY_ENCODER
|
#ifdef USE_LVGL_ROTARY_ENCODER
|
||||||
#include "esphome/components/rotary_encoder/rotary_encoder.h"
|
#include "esphome/components/rotary_encoder/rotary_encoder.h"
|
||||||
#endif // USE_LVGL_ROTARY_ENCODER
|
#endif // USE_LVGL_ROTARY_ENCODER
|
||||||
|
|
|
@ -19,7 +19,7 @@ class LVGLNumber : public number::Number {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void control(float value) {
|
void control(float value) override {
|
||||||
if (this->control_lambda_ != nullptr)
|
if (this->control_lambda_ != nullptr)
|
||||||
this->control_lambda_(value);
|
this->control_lambda_(value);
|
||||||
else
|
else
|
||||||
|
|
|
@ -19,7 +19,7 @@ class LVGLSwitch : public switch_::Switch {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void write_state(bool value) {
|
void write_state(bool value) override {
|
||||||
if (this->state_lambda_ != nullptr)
|
if (this->state_lambda_ != nullptr)
|
||||||
this->state_lambda_(value);
|
this->state_lambda_(value);
|
||||||
else
|
else
|
||||||
|
|
|
@ -19,7 +19,7 @@ class LVGLText : public text::Text {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void control(const std::string &value) {
|
void control(const std::string &value) override {
|
||||||
if (this->control_lambda_ != nullptr)
|
if (this->control_lambda_ != nullptr)
|
||||||
this->control_lambda_(value);
|
this->control_lambda_(value);
|
||||||
else
|
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"""
|
"""Generate a list of C++ statements to apply properties to an lv_obj_t"""
|
||||||
if layout := config.get(CONF_LAYOUT):
|
if layout := config.get(CONF_LAYOUT):
|
||||||
layout_type: str = layout[CONF_TYPE]
|
layout_type: str = layout[CONF_TYPE]
|
||||||
|
add_lv_use(layout_type)
|
||||||
lv_obj.set_layout(w.obj, literal(f"LV_LAYOUT_{layout_type.upper()}"))
|
lv_obj.set_layout(w.obj, literal(f"LV_LAYOUT_{layout_type.upper()}"))
|
||||||
if layout_type == TYPE_GRID:
|
if layout_type == TYPE_GRID:
|
||||||
wid = config[CONF_ID]
|
wid = config[CONF_ID]
|
||||||
|
@ -334,7 +335,7 @@ async def set_obj_properties(w: Widget, config):
|
||||||
for key, value in states.items():
|
for key, value in states.items():
|
||||||
if isinstance(value, cv.Lambda):
|
if isinstance(value, cv.Lambda):
|
||||||
lambs[key] = value
|
lambs[key] = value
|
||||||
elif value == "true":
|
elif value:
|
||||||
adds.add(key)
|
adds.add(key)
|
||||||
else:
|
else:
|
||||||
clears.add(key)
|
clears.add(key)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome.components import sensor, spi
|
from esphome.components import sensor, spi
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_MAINS_FILTER,
|
CONF_MAINS_FILTER,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
|
@ -15,8 +15,8 @@ MAX31856Sensor = max31856_ns.class_(
|
||||||
|
|
||||||
MAX31865ConfigFilter = max31856_ns.enum("MAX31856ConfigFilter")
|
MAX31865ConfigFilter = max31856_ns.enum("MAX31856ConfigFilter")
|
||||||
FILTER = {
|
FILTER = {
|
||||||
"50HZ": MAX31865ConfigFilter.FILTER_50HZ,
|
50: MAX31865ConfigFilter.FILTER_50HZ,
|
||||||
"60HZ": MAX31865ConfigFilter.FILTER_60HZ,
|
60: MAX31865ConfigFilter.FILTER_60HZ,
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
|
@ -29,8 +29,8 @@ CONFIG_SCHEMA = (
|
||||||
)
|
)
|
||||||
.extend(
|
.extend(
|
||||||
{
|
{
|
||||||
cv.Optional(CONF_MAINS_FILTER, default="60HZ"): cv.enum(
|
cv.Optional(CONF_MAINS_FILTER, default="60Hz"): cv.All(
|
||||||
FILTER, upper=True, space=""
|
cv.frequency, cv.enum(FILTER, int=True)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
from esphome import automation
|
from esphome import automation
|
||||||
import esphome.config_validation as cv
|
|
||||||
import esphome.codegen as cg
|
|
||||||
|
|
||||||
from esphome.automation import maybe_simple_id
|
from esphome.automation import maybe_simple_id
|
||||||
|
import esphome.codegen as cg
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
CONF_ON_IDLE,
|
||||||
CONF_ON_STATE,
|
CONF_ON_STATE,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_VOLUME,
|
CONF_VOLUME,
|
||||||
CONF_ON_IDLE,
|
|
||||||
)
|
)
|
||||||
from esphome.core import CORE
|
from esphome.core import CORE
|
||||||
from esphome.coroutine import coroutine_with_priority
|
from esphome.coroutine import coroutine_with_priority
|
||||||
from esphome.cpp_helpers import setup_entity
|
from esphome.cpp_helpers import setup_entity
|
||||||
|
|
||||||
|
|
||||||
CODEOWNERS = ["@jesserockz"]
|
CODEOWNERS = ["@jesserockz"]
|
||||||
|
|
||||||
IS_PLATFORM_COMPONENT = True
|
IS_PLATFORM_COMPONENT = True
|
||||||
|
|
|
@ -150,12 +150,40 @@ bool MQTTComponent::send_discovery_() {
|
||||||
const std::string &node_area = App.get_area();
|
const std::string &node_area = App.get_area();
|
||||||
|
|
||||||
JsonObject device_info = root.createNestedObject(MQTT_DEVICE);
|
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_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_MODEL] = ESPHOME_BOARD;
|
||||||
device_info[MQTT_DEVICE_MANUFACTURER] = "espressif";
|
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;
|
||||||
|
#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_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);
|
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_NAME = "name";
|
||||||
constexpr const char *const MQTT_DEVICE_SUGGESTED_AREA = "sa";
|
constexpr const char *const MQTT_DEVICE_SUGGESTED_AREA = "sa";
|
||||||
constexpr const char *const MQTT_DEVICE_SW_VERSION = "sw";
|
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_TEMPLATE = "dock_tpl";
|
||||||
constexpr const char *const MQTT_DOCKED_TOPIC = "dock_t";
|
constexpr const char *const MQTT_DOCKED_TOPIC = "dock_t";
|
||||||
constexpr const char *const MQTT_EFFECT_COMMAND_TOPIC = "fx_cmd_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_NAME = "name";
|
||||||
constexpr const char *const MQTT_DEVICE_SUGGESTED_AREA = "suggested_area";
|
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_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_TEMPLATE = "docked_template";
|
||||||
constexpr const char *const MQTT_DOCKED_TOPIC = "docked_topic";
|
constexpr const char *const MQTT_DOCKED_TOPIC = "docked_topic";
|
||||||
constexpr const char *const MQTT_EFFECT_COMMAND_TOPIC = "effect_command_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 import automation
|
||||||
from esphome.components import mqtt
|
import esphome.codegen as cg
|
||||||
from esphome.components import web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ABOVE,
|
CONF_ABOVE,
|
||||||
CONF_BELOW,
|
CONF_BELOW,
|
||||||
|
CONF_CYCLE,
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_CATEGORY,
|
CONF_ENTITY_CATEGORY,
|
||||||
CONF_ID,
|
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
|
CONF_ID,
|
||||||
CONF_MODE,
|
CONF_MODE,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_VALUE,
|
CONF_ON_VALUE,
|
||||||
CONF_ON_VALUE_RANGE,
|
CONF_ON_VALUE_RANGE,
|
||||||
|
CONF_OPERATION,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_UNIT_OF_MEASUREMENT,
|
CONF_UNIT_OF_MEASUREMENT,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_VALUE,
|
CONF_VALUE,
|
||||||
CONF_OPERATION,
|
|
||||||
CONF_CYCLE,
|
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_WEB_SERVER_ID,
|
||||||
DEVICE_CLASS_APPARENT_POWER,
|
DEVICE_CLASS_APPARENT_POWER,
|
||||||
DEVICE_CLASS_AQI,
|
DEVICE_CLASS_AQI,
|
||||||
|
@ -72,8 +71,8 @@ from esphome.const import (
|
||||||
DEVICE_CLASS_WIND_SPEED,
|
DEVICE_CLASS_WIND_SPEED,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.cpp_helpers import setup_entity
|
|
||||||
from esphome.cpp_generator import MockObjClass
|
from esphome.cpp_generator import MockObjClass
|
||||||
|
from esphome.cpp_helpers import setup_entity
|
||||||
|
|
||||||
CODEOWNERS = ["@esphome/core"]
|
CODEOWNERS = ["@esphome/core"]
|
||||||
DEVICE_CLASSES = [
|
DEVICE_CLASSES = [
|
||||||
|
|
|
@ -49,7 +49,7 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase,
|
||||||
#ifdef USE_ESP32
|
#ifdef USE_ESP32
|
||||||
void configure_rmt_();
|
void configure_rmt_();
|
||||||
|
|
||||||
uint32_t current_carrier_frequency_{UINT32_MAX};
|
uint32_t current_carrier_frequency_{38000};
|
||||||
bool initialized_{false};
|
bool initialized_{false};
|
||||||
std::vector<rmt_item32_t> rmt_temp_;
|
std::vector<rmt_item32_t> rmt_temp_;
|
||||||
esp_err_t error_code_{ESP_OK};
|
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
|
from esphome import automation
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
|
CONF_CYCLE,
|
||||||
CONF_ENTITY_CATEGORY,
|
CONF_ENTITY_CATEGORY,
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
CONF_INDEX,
|
||||||
|
CONF_MODE,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_VALUE,
|
CONF_ON_VALUE,
|
||||||
|
CONF_OPERATION,
|
||||||
CONF_OPTION,
|
CONF_OPTION,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_WEB_SERVER_ID,
|
||||||
CONF_CYCLE,
|
|
||||||
CONF_MODE,
|
|
||||||
CONF_OPERATION,
|
|
||||||
CONF_INDEX,
|
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.cpp_generator import MockObjClass
|
from esphome.cpp_generator import MockObjClass
|
||||||
|
|
|
@ -1,22 +1,27 @@
|
||||||
import math
|
import math
|
||||||
|
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import automation
|
from esphome import automation
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_DEVICE_CLASS,
|
|
||||||
CONF_ABOVE,
|
CONF_ABOVE,
|
||||||
CONF_ACCURACY_DECIMALS,
|
CONF_ACCURACY_DECIMALS,
|
||||||
CONF_ALPHA,
|
CONF_ALPHA,
|
||||||
CONF_BELOW,
|
CONF_BELOW,
|
||||||
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_CATEGORY,
|
CONF_ENTITY_CATEGORY,
|
||||||
CONF_EXPIRE_AFTER,
|
CONF_EXPIRE_AFTER,
|
||||||
CONF_FILTERS,
|
CONF_FILTERS,
|
||||||
|
CONF_FORCE_UPDATE,
|
||||||
CONF_FROM,
|
CONF_FROM,
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_IGNORE_OUT_OF_RANGE,
|
CONF_IGNORE_OUT_OF_RANGE,
|
||||||
|
CONF_MAX_VALUE,
|
||||||
|
CONF_METHOD,
|
||||||
|
CONF_MIN_VALUE,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_MULTIPLE,
|
CONF_MULTIPLE,
|
||||||
CONF_ON_RAW_VALUE,
|
CONF_ON_RAW_VALUE,
|
||||||
CONF_ON_VALUE,
|
CONF_ON_VALUE,
|
||||||
|
@ -30,14 +35,9 @@ from esphome.const import (
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_TYPE,
|
CONF_TYPE,
|
||||||
CONF_UNIT_OF_MEASUREMENT,
|
CONF_UNIT_OF_MEASUREMENT,
|
||||||
CONF_WINDOW_SIZE,
|
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
|
||||||
CONF_FORCE_UPDATE,
|
|
||||||
CONF_VALUE,
|
CONF_VALUE,
|
||||||
CONF_MIN_VALUE,
|
CONF_WEB_SERVER_ID,
|
||||||
CONF_MAX_VALUE,
|
CONF_WINDOW_SIZE,
|
||||||
CONF_METHOD,
|
|
||||||
DEVICE_CLASS_APPARENT_POWER,
|
DEVICE_CLASS_APPARENT_POWER,
|
||||||
DEVICE_CLASS_AQI,
|
DEVICE_CLASS_AQI,
|
||||||
DEVICE_CLASS_ATMOSPHERIC_PRESSURE,
|
DEVICE_CLASS_ATMOSPHERIC_PRESSURE,
|
||||||
|
|
|
@ -7,10 +7,6 @@ namespace spi {
|
||||||
|
|
||||||
const char *const TAG = "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; }
|
bool SPIDelegate::is_ready() { return true; }
|
||||||
|
|
||||||
GPIOPin *const NullPin::NULL_PIN = new NullPin(); // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
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); }
|
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); }
|
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
|
// 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.
|
// a thin wrapper over SPIClass.
|
||||||
class SPIDelegate {
|
class SPIDelegate {
|
||||||
|
@ -250,21 +248,6 @@ class SPIDelegate {
|
||||||
uint32_t data_rate_{1000000};
|
uint32_t data_rate_{1000000};
|
||||||
SPIMode mode_{MODE0};
|
SPIMode mode_{MODE0};
|
||||||
GPIOPin *cs_pin_{NullPin::NULL_PIN};
|
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() {
|
virtual void spi_teardown() {
|
||||||
this->parent_->unregister_device(this);
|
this->parent_->unregister_device(this);
|
||||||
this->delegate_ = SPIDelegate::NULL_DELEGATE;
|
this->delegate_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spi_is_ready() { return this->delegate_->is_ready(); }
|
bool spi_is_ready() { return this->delegate_->is_ready(); }
|
||||||
|
@ -393,7 +376,7 @@ class SPIClient {
|
||||||
uint32_t data_rate_{1000000};
|
uint32_t data_rate_{1000000};
|
||||||
SPIComponent *parent_{nullptr};
|
SPIComponent *parent_{nullptr};
|
||||||
GPIOPin *cs_{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,
|
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||||
spi::DATA_RATE_1MHZ> {
|
spi::DATA_RATE_1MHZ> {
|
||||||
public:
|
public:
|
||||||
void setup() { this->spi_setup(); }
|
void setup() override { this->spi_setup(); }
|
||||||
|
|
||||||
int32_t size() const override { return this->num_leds_; }
|
int32_t size() const override { return this->num_leds_; }
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class SpiLedStrip : public light::AddressableLight,
|
||||||
memset(this->buf_, 0, 4);
|
memset(this->buf_, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_config() {
|
void dump_config() override {
|
||||||
esph_log_config(TAG, "SPI LED Strip:");
|
esph_log_config(TAG, "SPI LED Strip:");
|
||||||
esph_log_config(TAG, " LEDs: %d", this->num_leds_);
|
esph_log_config(TAG, " LEDs: %d", this->num_leds_);
|
||||||
if (this->data_rate_ >= spi::DATA_RATE_1MHZ)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
auto call = this->valve_[valve_number.value()].run_duration_number->make_call();
|
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);
|
call.set_value(run_duration.value() / 60.0);
|
||||||
} else {
|
} else {
|
||||||
call.set_value(run_duration.value());
|
call.set_value(run_duration.value());
|
||||||
|
@ -729,7 +729,7 @@ uint32_t Sprinkler::valve_run_duration(const size_t valve_number) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (this->valve_[valve_number].run_duration_number != nullptr) {
|
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));
|
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state * 60));
|
||||||
} else {
|
} else {
|
||||||
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state));
|
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state));
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace sprinkler {
|
namespace sprinkler {
|
||||||
|
|
||||||
const std::string min_str = "min";
|
const std::string MIN_STR = "min";
|
||||||
|
|
||||||
enum SprinklerState : uint8_t {
|
enum SprinklerState : uint8_t {
|
||||||
// NOTE: these states are used by both SprinklerValveOperator and Sprinkler (the controller)!
|
// 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 import automation
|
||||||
from esphome.automation import Condition, maybe_simple_id
|
from esphome.automation import Condition, maybe_simple_id
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_CATEGORY,
|
CONF_ENTITY_CATEGORY,
|
||||||
|
@ -10,11 +10,11 @@ from esphome.const import (
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_INVERTED,
|
CONF_INVERTED,
|
||||||
CONF_MQTT_ID,
|
CONF_MQTT_ID,
|
||||||
CONF_WEB_SERVER_ID,
|
|
||||||
CONF_ON_TURN_OFF,
|
CONF_ON_TURN_OFF,
|
||||||
CONF_ON_TURN_ON,
|
CONF_ON_TURN_ON,
|
||||||
CONF_RESTORE_MODE,
|
CONF_RESTORE_MODE,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
|
CONF_WEB_SERVER_ID,
|
||||||
DEVICE_CLASS_EMPTY,
|
DEVICE_CLASS_EMPTY,
|
||||||
DEVICE_CLASS_OUTLET,
|
DEVICE_CLASS_OUTLET,
|
||||||
DEVICE_CLASS_SWITCH,
|
DEVICE_CLASS_SWITCH,
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import automation
|
from esphome import automation
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_MODE,
|
CONF_MODE,
|
||||||
|
CONF_MQTT_ID,
|
||||||
CONF_ON_VALUE,
|
CONF_ON_VALUE,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_MQTT_ID,
|
|
||||||
CONF_WEB_SERVER_ID,
|
|
||||||
CONF_VALUE,
|
CONF_VALUE,
|
||||||
|
CONF_WEB_SERVER_ID,
|
||||||
)
|
)
|
||||||
|
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.cpp_helpers import setup_entity
|
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
|
from esphome import automation
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import mqtt, web_server
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_CATEGORY,
|
CONF_ENTITY_CATEGORY,
|
||||||
CONF_FILTERS,
|
CONF_FILTERS,
|
||||||
|
CONF_FROM,
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_ON_VALUE,
|
|
||||||
CONF_ON_RAW_VALUE,
|
|
||||||
CONF_TRIGGER_ID,
|
|
||||||
CONF_MQTT_ID,
|
CONF_MQTT_ID,
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_ON_RAW_VALUE,
|
||||||
|
CONF_ON_VALUE,
|
||||||
CONF_STATE,
|
CONF_STATE,
|
||||||
CONF_FROM,
|
|
||||||
CONF_TO,
|
CONF_TO,
|
||||||
|
CONF_TRIGGER_ID,
|
||||||
|
CONF_WEB_SERVER_ID,
|
||||||
DEVICE_CLASS_DATE,
|
DEVICE_CLASS_DATE,
|
||||||
DEVICE_CLASS_EMPTY,
|
DEVICE_CLASS_EMPTY,
|
||||||
DEVICE_CLASS_TIMESTAMP,
|
DEVICE_CLASS_TIMESTAMP,
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
import logging
|
|
||||||
from importlib import resources
|
from importlib import resources
|
||||||
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import tzlocal
|
import tzlocal
|
||||||
|
|
||||||
|
from esphome import automation
|
||||||
|
from esphome.automation import Condition
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome import automation
|
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ID,
|
CONF_AT,
|
||||||
CONF_CRON,
|
CONF_CRON,
|
||||||
CONF_DAYS_OF_MONTH,
|
CONF_DAYS_OF_MONTH,
|
||||||
CONF_DAYS_OF_WEEK,
|
CONF_DAYS_OF_WEEK,
|
||||||
|
CONF_HOUR,
|
||||||
CONF_HOURS,
|
CONF_HOURS,
|
||||||
|
CONF_ID,
|
||||||
|
CONF_MINUTE,
|
||||||
CONF_MINUTES,
|
CONF_MINUTES,
|
||||||
CONF_MONTHS,
|
CONF_MONTHS,
|
||||||
CONF_ON_TIME,
|
CONF_ON_TIME,
|
||||||
CONF_ON_TIME_SYNC,
|
CONF_ON_TIME_SYNC,
|
||||||
|
CONF_SECOND,
|
||||||
CONF_SECONDS,
|
CONF_SECONDS,
|
||||||
CONF_TIMEZONE,
|
CONF_TIMEZONE,
|
||||||
CONF_TRIGGER_ID,
|
CONF_TRIGGER_ID,
|
||||||
CONF_AT,
|
|
||||||
CONF_SECOND,
|
|
||||||
CONF_HOUR,
|
|
||||||
CONF_MINUTE,
|
|
||||||
)
|
)
|
||||||
from esphome.core import coroutine_with_priority
|
from esphome.core import coroutine_with_priority
|
||||||
from esphome.automation import Condition
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_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 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
|
from esphome.components import mqtt, web_server
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
|
|
@ -91,7 +91,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
# pylint: disable=consider-using-f-string
|
# pylint: disable=consider-using-f-string
|
||||||
VARIABLE_PROG = re.compile(
|
VARIABLE_PROG = re.compile(
|
||||||
"\\$([{0}]+|\\{{[{0}]*\\}})".format(VALID_SUBSTITUTIONS_CHARACTERS)
|
f"\\$([{VALID_SUBSTITUTIONS_CHARACTERS}]+|\\{{[{VALID_SUBSTITUTIONS_CHARACTERS}]*\\}})"
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
|
|
|
@ -336,7 +336,7 @@ class ID:
|
||||||
else:
|
else:
|
||||||
self.is_manual = is_manual
|
self.is_manual = is_manual
|
||||||
self.is_declaration = is_declaration
|
self.is_declaration = is_declaration
|
||||||
self.type: Optional["MockObjClass"] = type
|
self.type: Optional[MockObjClass] = type
|
||||||
|
|
||||||
def resolve(self, registered_ids):
|
def resolve(self, registered_ids):
|
||||||
from esphome.config_validation import RESERVED_IDS
|
from esphome.config_validation import RESERVED_IDS
|
||||||
|
@ -500,7 +500,7 @@ class EsphomeCore:
|
||||||
# The relative path to where all build files are stored
|
# The relative path to where all build files are stored
|
||||||
self.build_path: Optional[str] = None
|
self.build_path: Optional[str] = None
|
||||||
# The validated configuration, this is None until the config has been validated
|
# 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)
|
# The pending tasks in the task queue (mostly for C++ generation)
|
||||||
# This is a priority queue (with heapq)
|
# This is a priority queue (with heapq)
|
||||||
# Each item is a tuple of form: (-priority, unique number, task)
|
# Each item is a tuple of form: (-priority, unique number, task)
|
||||||
|
@ -508,17 +508,17 @@ class EsphomeCore:
|
||||||
# Task counter for pending tasks
|
# Task counter for pending tasks
|
||||||
self.task_counter = 0
|
self.task_counter = 0
|
||||||
# The variable cache, for each ID this holds a MockObj of the variable obj
|
# 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
|
# 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)
|
# 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
|
# A set of platformio libraries to add to the project
|
||||||
self.libraries: list[Library] = []
|
self.libraries: list[Library] = []
|
||||||
# A set of build flags to set in the platformio project
|
# A set of build flags to set in the platformio project
|
||||||
self.build_flags: set[str] = set()
|
self.build_flags: set[str] = set()
|
||||||
# A set of defines to set for the compile process in esphome/core/defines.h
|
# 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
|
# A map of all platformio options to apply
|
||||||
self.platformio_options: dict[str, Union[str, list[str]]] = {}
|
self.platformio_options: dict[str, Union[str, list[str]]] = {}
|
||||||
# A set of strings of names of loaded integrations, used to find namespace ID conflicts
|
# 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};
|
EntityCategory entity_category_{ENTITY_CATEGORY_NONE};
|
||||||
};
|
};
|
||||||
|
|
||||||
class EntityBase_DeviceClass {
|
class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)
|
||||||
public:
|
public:
|
||||||
/// Get the device class, using the manual override if set.
|
/// Get the device class, using the manual override if set.
|
||||||
std::string get_device_class();
|
std::string get_device_class();
|
||||||
|
@ -74,7 +74,7 @@ class EntityBase_DeviceClass {
|
||||||
const char *device_class_{nullptr}; ///< Device class override
|
const char *device_class_{nullptr}; ///< Device class override
|
||||||
};
|
};
|
||||||
|
|
||||||
class EntityBase_UnitOfMeasurement {
|
class EntityBase_UnitOfMeasurement { // NOLINT(readability-identifier-naming)
|
||||||
public:
|
public:
|
||||||
/// Get the unit of measurement, using the manual override if set.
|
/// Get the unit of measurement, using the manual override if set.
|
||||||
std::string get_unit_of_measurement();
|
std::string get_unit_of_measurement();
|
||||||
|
|
|
@ -3,7 +3,6 @@ import hashlib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import ssl
|
import ssl
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import paho.mqtt.client as mqtt
|
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(
|
if config[CONF_MQTT].get(CONF_SSL_FINGERPRINTS) or config[CONF_MQTT].get(
|
||||||
CONF_CERTIFICATE_AUTHORITY
|
CONF_CERTIFICATE_AUTHORITY
|
||||||
):
|
):
|
||||||
if sys.version_info >= (2, 7, 13):
|
|
||||||
tls_version = ssl.PROTOCOL_TLS # pylint: disable=no-member
|
tls_version = ssl.PROTOCOL_TLS # pylint: disable=no-member
|
||||||
else:
|
|
||||||
tls_version = ssl.PROTOCOL_SSLv23
|
|
||||||
client.tls_set(
|
client.tls_set(
|
||||||
ca_certs=None,
|
ca_certs=None,
|
||||||
certfile=None,
|
certfile=None,
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
from collections import defaultdict
|
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.config import get_component, get_platform
|
||||||
from esphome.core import CORE
|
|
||||||
from esphome.const import KEY_CORE, KEY_TARGET_FRAMEWORK
|
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 = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
import argparse
|
||||||
|
import glob
|
||||||
import inspect
|
import inspect
|
||||||
import json
|
import json
|
||||||
import argparse
|
|
||||||
import os
|
import os
|
||||||
import glob
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
# NOTE: Cannot import other esphome components globally as a modification in vol_schema
|
# 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)
|
# Import esphome after loading components (so schema is tracked)
|
||||||
# pylint: disable=wrong-import-position
|
# pylint: disable=wrong-import-position
|
||||||
import esphome.core as esphome_core
|
from esphome import automation, pins
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import automation
|
|
||||||
from esphome import pins
|
|
||||||
from esphome.components import remote_base
|
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.helpers import write_file_if_changed
|
||||||
|
from esphome.loader import CORE_COMPONENTS_PATH, get_platform
|
||||||
from esphome.util import Registry
|
from esphome.util import Registry
|
||||||
|
|
||||||
# pylint: enable=wrong-import-position
|
# pylint: enable=wrong-import-position
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from helpers import (
|
|
||||||
print_error_for_file,
|
|
||||||
get_output,
|
|
||||||
git_ls_files,
|
|
||||||
filter_changed,
|
|
||||||
get_binary,
|
|
||||||
)
|
|
||||||
import argparse
|
import argparse
|
||||||
import click
|
|
||||||
import colorama
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
|
@ -18,6 +9,9 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import threading
|
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):
|
def run_format(executable, args, queue, lock, failed_files):
|
||||||
|
|
|
@ -1,21 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/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 argparse
|
||||||
import click
|
|
||||||
import colorama
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
|
@ -26,6 +11,20 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
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):
|
def clang_options(idedata):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import colorama
|
import colorama
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from helpers import (
|
|
||||||
styled,
|
|
||||||
print_error_for_file,
|
|
||||||
get_output,
|
|
||||||
get_err,
|
|
||||||
git_ls_files,
|
|
||||||
filter_changed,
|
|
||||||
)
|
|
||||||
import argparse
|
import argparse
|
||||||
import colorama
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import colorama
|
||||||
|
from helpers import (
|
||||||
|
filter_changed,
|
||||||
|
get_err,
|
||||||
|
get_output,
|
||||||
|
git_ls_files,
|
||||||
|
print_error_for_file,
|
||||||
|
styled,
|
||||||
|
)
|
||||||
|
|
||||||
curfile = None
|
curfile = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import argparse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
|
||||||
|
|
||||||
from helpers import git_ls_files, changed_files
|
from helpers import changed_files, git_ls_files
|
||||||
from esphome.loader import get_component, get_platform
|
|
||||||
from esphome.core import CORE
|
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
KEY_CORE,
|
KEY_CORE,
|
||||||
KEY_TARGET_FRAMEWORK,
|
KEY_TARGET_FRAMEWORK,
|
||||||
|
@ -13,6 +12,8 @@ from esphome.const import (
|
||||||
PLATFORM_ESP32,
|
PLATFORM_ESP32,
|
||||||
PLATFORM_ESP8266,
|
PLATFORM_ESP8266,
|
||||||
)
|
)
|
||||||
|
from esphome.core import CORE
|
||||||
|
from esphome.loader import get_component, get_platform
|
||||||
|
|
||||||
|
|
||||||
def filter_component_files(str):
|
def filter_component_files(str):
|
||||||
|
|
Loading…
Reference in a new issue