mirror of
https://github.com/esphome/esphome.git
synced 2025-11-01 23:51:47 +00:00
Compare commits
64 Commits
jesserockz
...
2022.12.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72c6efd6a0 | ||
|
|
a1f1804112 | ||
|
|
a8b1ceb4e9 | ||
|
|
4fb0f7f8c6 | ||
|
|
958cadeca8 | ||
|
|
00f2655f1a | ||
|
|
074f5029eb | ||
|
|
1691976587 | ||
|
|
60e6b4d21e | ||
|
|
5750591df2 | ||
|
|
a75da54455 | ||
|
|
de7f6c3f5f | ||
|
|
4245480656 | ||
|
|
1824c8131e | ||
|
|
4e9606d2e0 | ||
|
|
78500fa933 | ||
|
|
9c69b98a49 | ||
|
|
e6d8ef98d3 | ||
|
|
3f1af1690b | ||
|
|
84374b6b1e | ||
|
|
391316c9b5 | ||
|
|
705c62ebd7 | ||
|
|
cb520c00a5 | ||
|
|
2f24138345 | ||
|
|
96512b80cc | ||
|
|
fcb9b51978 | ||
|
|
f408f1a368 | ||
|
|
7d8d563c62 | ||
|
|
0a1f705fda | ||
|
|
1952c1880b | ||
|
|
b03967dac1 | ||
|
|
bcae2596a6 | ||
|
|
fc0347c86c | ||
|
|
d9563d4de1 | ||
|
|
cc7e2bf8db | ||
|
|
5d98e2923b | ||
|
|
07197d12f6 | ||
|
|
7b0a298497 | ||
|
|
21679cf2ba | ||
|
|
4be7cd12a1 | ||
|
|
dee4d0ccb7 | ||
|
|
7209dd8bae | ||
|
|
ab736c89bb | ||
|
|
6911639617 | ||
|
|
b9720d0715 | ||
|
|
47b3267ed4 | ||
|
|
e16ba2adb5 | ||
|
|
0a19b1e32c | ||
|
|
bae9a950c0 | ||
|
|
72b2943332 | ||
|
|
4ec0ef7548 | ||
|
|
25bc6761f6 | ||
|
|
81b6562c25 | ||
|
|
ae74189fc2 | ||
|
|
9e516efe10 | ||
|
|
366e29439e | ||
|
|
1c9c700d7f | ||
|
|
b2e6b9d31f | ||
|
|
7623f63846 | ||
|
|
2bfaf9dce3 | ||
|
|
5c2c1560bb | ||
|
|
f7096ab78e | ||
|
|
98f8feb625 | ||
|
|
9944ca414e |
@@ -139,7 +139,7 @@ RUN \
|
||||
clang-tidy-11=1:11.0.1-2 \
|
||||
patch=2.7.6-7 \
|
||||
software-properties-common=0.96.20.2-2.1 \
|
||||
nano=5.4-2+deb11u1 \
|
||||
nano=5.4-2+deb11u2 \
|
||||
build-essential=12.9 \
|
||||
python3-dev=3.9.2-3 \
|
||||
&& rm -rf \
|
||||
|
||||
@@ -4,7 +4,7 @@ import requests
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components.packages import validate_source_shorthand
|
||||
from esphome.const import CONF_WIFI
|
||||
from esphome.const import CONF_WIFI, CONF_REF
|
||||
from esphome.wizard import wizard_file
|
||||
from esphome.yaml_util import dump
|
||||
from esphome import git
|
||||
@@ -21,19 +21,32 @@ CODEOWNERS = ["@esphome/core"]
|
||||
def validate_import_url(value):
|
||||
value = cv.string_strict(value)
|
||||
value = cv.Length(max=255)(value)
|
||||
# ignore result, only check if it's a valid shorthand
|
||||
validate_source_shorthand(value)
|
||||
return value
|
||||
|
||||
|
||||
def validate_full_url(config):
|
||||
if not config[CONF_IMPORT_FULL_CONFIG]:
|
||||
return config
|
||||
source = validate_source_shorthand(config[CONF_PACKAGE_IMPORT_URL])
|
||||
if CONF_REF not in source:
|
||||
raise cv.Invalid(
|
||||
"Must specify a ref (branch or tag) to import from when importing full config"
|
||||
)
|
||||
return config
|
||||
|
||||
|
||||
CONF_PACKAGE_IMPORT_URL = "package_import_url"
|
||||
CONF_IMPORT_FULL_CONFIG = "import_full_config"
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_PACKAGE_IMPORT_URL): validate_import_url,
|
||||
cv.Optional(CONF_IMPORT_FULL_CONFIG, default=False): cv.boolean,
|
||||
}
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_PACKAGE_IMPORT_URL): validate_import_url,
|
||||
cv.Optional(CONF_IMPORT_FULL_CONFIG, default=False): cv.boolean,
|
||||
}
|
||||
),
|
||||
validate_full_url,
|
||||
)
|
||||
|
||||
WIFI_CONFIG = """
|
||||
@@ -49,7 +62,7 @@ async def to_code(config):
|
||||
url = config[CONF_PACKAGE_IMPORT_URL]
|
||||
if config[CONF_IMPORT_FULL_CONFIG]:
|
||||
url += "?full_config"
|
||||
cg.add(dashboard_import_ns.set_package_import_url(config[CONF_PACKAGE_IMPORT_URL]))
|
||||
cg.add(dashboard_import_ns.set_package_import_url(url))
|
||||
|
||||
|
||||
def import_config(
|
||||
|
||||
@@ -95,7 +95,7 @@ void ESP32InternalGPIOPin::pin_mode(gpio::Flags flags) {
|
||||
// can't call gpio_config here because that logs in esp-idf which may cause issues
|
||||
gpio_set_direction(pin_, flags_to_mode(flags));
|
||||
gpio_pull_mode_t pull_mode = GPIO_FLOATING;
|
||||
if (flags & (gpio::FLAG_PULLUP | gpio::FLAG_PULLDOWN)) {
|
||||
if ((flags & gpio::FLAG_PULLUP) && (flags & gpio::FLAG_PULLDOWN)) {
|
||||
pull_mode = GPIO_PULLUP_PULLDOWN;
|
||||
} else if (flags & gpio::FLAG_PULLUP) {
|
||||
pull_mode = GPIO_PULLUP_ONLY;
|
||||
@@ -128,7 +128,7 @@ void IRAM_ATTR ISRInternalGPIOPin::pin_mode(gpio::Flags flags) {
|
||||
auto *arg = reinterpret_cast<ISRPinArg *>(arg_);
|
||||
gpio_set_direction(arg->pin, flags_to_mode(flags));
|
||||
gpio_pull_mode_t pull_mode = GPIO_FLOATING;
|
||||
if (flags & (gpio::FLAG_PULLUP | gpio::FLAG_PULLDOWN)) {
|
||||
if ((flags & gpio::FLAG_PULLUP) && (flags & gpio::FLAG_PULLDOWN)) {
|
||||
pull_mode = GPIO_PULLUP_PULLDOWN;
|
||||
} else if (flags & gpio::FLAG_PULLUP) {
|
||||
pull_mode = GPIO_PULLUP_ONLY;
|
||||
|
||||
@@ -132,16 +132,16 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
this->set_state(espbt::ClientState::IDLE);
|
||||
break;
|
||||
}
|
||||
if (this->connection_type_ == espbt::ConnectionType::V3_WITH_CACHE) {
|
||||
this->set_state(espbt::ClientState::CONNECTED);
|
||||
this->state_ = espbt::ClientState::ESTABLISHED;
|
||||
break;
|
||||
}
|
||||
auto ret = esp_ble_gattc_send_mtu_req(this->gattc_if_, param->open.conn_id);
|
||||
if (ret) {
|
||||
ESP_LOGW(TAG, "[%d] [%s] esp_ble_gattc_send_mtu_req failed, status=%x", this->connection_index_,
|
||||
this->address_str_.c_str(), ret);
|
||||
}
|
||||
if (this->connection_type_ == espbt::ConnectionType::V3_WITH_CACHE) {
|
||||
this->set_state(espbt::ClientState::CONNECTED);
|
||||
this->state_ = espbt::ClientState::ESTABLISHED;
|
||||
break;
|
||||
}
|
||||
esp_ble_gattc_search_service(esp_gattc_if, param->cfg_mtu.conn_id, nullptr);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -706,11 +706,7 @@ void ESPBTDevice::parse_adv_(const esp_ble_gap_cb_param_t::ble_scan_result_evt_p
|
||||
while (offset + 2 < len) {
|
||||
const uint8_t field_length = payload[offset++]; // First byte is length of adv record
|
||||
if (field_length == 0) {
|
||||
if (offset < param.adv_data_len && param.scan_rsp_len > 0) { // Zero padded advertisement data
|
||||
offset = param.adv_data_len;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
continue; // Possible zero padded advertisement data
|
||||
}
|
||||
|
||||
// first byte of adv record is adv record type
|
||||
|
||||
@@ -47,7 +47,7 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
|
||||
uint8_t function_code = raw[1];
|
||||
// Byte 2: Size (with modbus rtu function code 4/3)
|
||||
// See also https://en.wikipedia.org/wiki/Modbus
|
||||
if (at <= 2)
|
||||
if (at == 2)
|
||||
return true;
|
||||
|
||||
uint8_t data_len = raw[2];
|
||||
|
||||
@@ -70,7 +70,7 @@ void SlowPWMOutput::dump_config() {
|
||||
void SlowPWMOutput::write_state(float state) {
|
||||
this->state_ = state;
|
||||
if (this->restart_cycle_on_state_change_)
|
||||
this->restart_cycle();
|
||||
this->period_start_time_ = millis();
|
||||
}
|
||||
|
||||
} // namespace slow_pwm
|
||||
|
||||
@@ -14,7 +14,6 @@ class SlowPWMOutput : public output::FloatOutput, public Component {
|
||||
void set_restart_cycle_on_state_change(bool restart_cycle_on_state_change) {
|
||||
restart_cycle_on_state_change_ = restart_cycle_on_state_change;
|
||||
}
|
||||
void restart_cycle() { this->period_start_time_ = millis(); }
|
||||
|
||||
/// Initialize pin
|
||||
void setup() override;
|
||||
|
||||
@@ -124,6 +124,9 @@ void ToshibaClimate::setup() {
|
||||
// Set supported modes & temperatures based on model
|
||||
this->minimum_temperature_ = this->temperature_min_();
|
||||
this->maximum_temperature_ = this->temperature_max_();
|
||||
this->supports_dry_ = this->toshiba_supports_dry_();
|
||||
this->supports_fan_only_ = this->toshiba_supports_fan_only_();
|
||||
this->fan_modes_ = this->toshiba_fan_modes_();
|
||||
this->swing_modes_ = this->toshiba_swing_modes_();
|
||||
// Never send nan to HA
|
||||
if (std::isnan(this->target_temperature))
|
||||
@@ -175,39 +178,12 @@ void ToshibaClimate::transmit_generic_() {
|
||||
mode = TOSHIBA_MODE_COOL;
|
||||
break;
|
||||
|
||||
case climate::CLIMATE_MODE_DRY:
|
||||
mode = TOSHIBA_MODE_DRY;
|
||||
break;
|
||||
|
||||
case climate::CLIMATE_MODE_FAN_ONLY:
|
||||
mode = TOSHIBA_MODE_FAN_ONLY;
|
||||
break;
|
||||
|
||||
case climate::CLIMATE_MODE_HEAT_COOL:
|
||||
default:
|
||||
mode = TOSHIBA_MODE_AUTO;
|
||||
}
|
||||
|
||||
uint8_t fan;
|
||||
switch (this->fan_mode.value()) {
|
||||
case climate::CLIMATE_FAN_LOW:
|
||||
fan = TOSHIBA_FAN_SPEED_1;
|
||||
break;
|
||||
|
||||
case climate::CLIMATE_FAN_MEDIUM:
|
||||
fan = TOSHIBA_FAN_SPEED_3;
|
||||
break;
|
||||
|
||||
case climate::CLIMATE_FAN_HIGH:
|
||||
fan = TOSHIBA_FAN_SPEED_5;
|
||||
break;
|
||||
|
||||
case climate::CLIMATE_FAN_AUTO:
|
||||
default:
|
||||
fan = TOSHIBA_FAN_SPEED_AUTO;
|
||||
break;
|
||||
}
|
||||
message[6] = fan | mode;
|
||||
message[6] |= mode | TOSHIBA_FAN_SPEED_AUTO;
|
||||
|
||||
// Zero
|
||||
message[7] = 0x00;
|
||||
|
||||
@@ -22,10 +22,7 @@ const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MAX = 86.0;
|
||||
|
||||
class ToshibaClimate : public climate_ir::ClimateIR {
|
||||
public:
|
||||
ToshibaClimate()
|
||||
: climate_ir::ClimateIR(TOSHIBA_GENERIC_TEMP_C_MIN, TOSHIBA_GENERIC_TEMP_C_MAX, 1.0f, true, true,
|
||||
{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM,
|
||||
climate::CLIMATE_FAN_HIGH}) {}
|
||||
ToshibaClimate() : climate_ir::ClimateIR(TOSHIBA_GENERIC_TEMP_C_MIN, TOSHIBA_GENERIC_TEMP_C_MAX, 1.0f) {}
|
||||
|
||||
void setup() override;
|
||||
void set_model(Model model) { this->model_ = model; }
|
||||
@@ -49,6 +46,18 @@ class ToshibaClimate : public climate_ir::ClimateIR {
|
||||
float temperature_max_() {
|
||||
return (this->model_ == MODEL_GENERIC) ? TOSHIBA_GENERIC_TEMP_C_MAX : TOSHIBA_RAC_PT1411HWRU_TEMP_C_MAX;
|
||||
}
|
||||
bool toshiba_supports_dry_() {
|
||||
return ((this->model_ == MODEL_RAC_PT1411HWRU_C) || (this->model_ == MODEL_RAC_PT1411HWRU_F));
|
||||
}
|
||||
bool toshiba_supports_fan_only_() {
|
||||
return ((this->model_ == MODEL_RAC_PT1411HWRU_C) || (this->model_ == MODEL_RAC_PT1411HWRU_F));
|
||||
}
|
||||
std::set<climate::ClimateFanMode> toshiba_fan_modes_() {
|
||||
return (this->model_ == MODEL_GENERIC)
|
||||
? std::set<climate::ClimateFanMode>{}
|
||||
: std::set<climate::ClimateFanMode>{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW,
|
||||
climate::CLIMATE_FAN_MEDIUM, climate::CLIMATE_FAN_HIGH};
|
||||
}
|
||||
std::set<climate::ClimateSwingMode> toshiba_swing_modes_() {
|
||||
return (this->model_ == MODEL_GENERIC)
|
||||
? std::set<climate::ClimateSwingMode>{}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2023.1.0-dev"
|
||||
__version__ = "2022.12.5"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
|
||||
|
||||
@@ -129,9 +129,9 @@ class GitFile:
|
||||
def raw_url(self) -> str:
|
||||
if self.ref is None:
|
||||
raise ValueError("URL has no ref")
|
||||
if self.domain == "github":
|
||||
if self.domain == "github.com":
|
||||
return f"https://raw.githubusercontent.com/{self.owner}/{self.repo}/{self.ref}/{self.filename}"
|
||||
if self.domain == "gitlab":
|
||||
if self.domain == "gitlab.com":
|
||||
return f"https://gitlab.com/{self.owner}/{self.repo}/-/raw/{self.ref}/{self.filename}"
|
||||
raise NotImplementedError(f"Git domain {self.domain} not supported")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user