Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/esphome/esphome into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
clydebarrow committed Apr 20, 2024
2 parents 9851de2 + 655dbc4 commit 8de135c
Show file tree
Hide file tree
Showing 23 changed files with 339 additions and 212 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,16 @@ jobs:
- compile-tests
- clang-tidy
- test-build-components
- list-components
if: always()
steps:
- name: Success
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failure
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
env:
JSON_DOC: ${{ toJSON(needs) }}
run: |
echo $JSON_DOC | jq
exit 1
2 changes: 1 addition & 1 deletion .github/workflows/sync-device-classes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
python ./script/sync-device_class.py
- name: Commit changes
uses: peter-evans/[email protected].3
uses: peter-evans/[email protected].4
with:
commit-message: "Synchronise Device Classes from Home Assistant"
committer: esphomebot <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions esphome/components/lock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ async def setup_lock_core_(var, config):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [], conf)

if CONF_MQTT_ID in config:
mqtt_ = cg.new_Pvariable(config[CONF_MQTT_ID], var)
if mqtt_id := config.get(CONF_MQTT_ID):
mqtt_ = cg.new_Pvariable(mqtt_id, var)
await mqtt.register_mqtt_component(mqtt_, config)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void NextionBinarySensor::process_touch(uint8_t page_id, uint8_t component_id, b
}

void NextionBinarySensor::update() {
if (!this->nextion_->is_setup())
if (!this->nextion_->is_setup() || this->nextion_->is_updating())
return;

if (this->variable_name_.empty()) // This is a touch component
Expand All @@ -37,7 +37,7 @@ void NextionBinarySensor::update() {
}

void NextionBinarySensor::set_state(bool state, bool publish, bool send_to_nextion) {
if (!this->nextion_->is_setup())
if (!this->nextion_->is_setup() || this->nextion_->is_updating())
return;

if (this->component_id_ == 0) // This is a legacy touch component
Expand Down
4 changes: 2 additions & 2 deletions esphome/components/nextion/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
}
),
cv.Optional(CONF_TOUCH_SLEEP_TIMEOUT): cv.int_range(min=3, max=65535),
cv.Optional(CONF_WAKE_UP_PAGE): cv.positive_int,
cv.Optional(CONF_START_UP_PAGE): cv.positive_int,
cv.Optional(CONF_WAKE_UP_PAGE): cv.uint8_t,
cv.Optional(CONF_START_UP_PAGE): cv.uint8_t,
cv.Optional(CONF_AUTO_WAKE_ON_TOUCH, default=True): cv.boolean,
cv.Optional(CONF_EXIT_REPARSE_ON_START, default=False): cv.boolean,
}
Expand Down
25 changes: 19 additions & 6 deletions esphome/components/nextion/nextion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ void Nextion::dump_config() {
}

if (this->wake_up_page_ != -1) {
ESP_LOGCONFIG(TAG, " Wake Up Page: %d", this->wake_up_page_);
ESP_LOGCONFIG(TAG, " Wake Up Page: %" PRId16, this->wake_up_page_);
}

if (this->start_up_page_ != -1) {
ESP_LOGCONFIG(TAG, " Start Up Page: %d", this->start_up_page_);
ESP_LOGCONFIG(TAG, " Start Up Page: %" PRId16, this->start_up_page_);
}
}

Expand Down Expand Up @@ -194,6 +194,17 @@ void Nextion::update_all_components() {
}
}

bool Nextion::send_command(const char *command) {
if ((!this->is_setup() && !this->ignore_is_setup_) || this->is_sleeping())
return false;

if (this->send_command_(command)) {
this->add_no_result_to_queue_("send_command");
return true;
}
return false;
}

bool Nextion::send_command_printf(const char *format, ...) {
if ((!this->is_setup() && !this->ignore_is_setup_) || this->is_sleeping())
return false;
Expand Down Expand Up @@ -1024,23 +1035,23 @@ bool Nextion::add_no_result_to_queue_with_printf_(const std::string &variable_na
* @param is_sleep_safe The command is safe to send when the Nextion is sleeping
*/

void Nextion::add_no_result_to_queue_with_set(NextionComponentBase *component, int state_value) {
void Nextion::add_no_result_to_queue_with_set(NextionComponentBase *component, int32_t state_value) {
this->add_no_result_to_queue_with_set(component->get_variable_name(), component->get_variable_name_to_send(),
state_value);
}

void Nextion::add_no_result_to_queue_with_set(const std::string &variable_name,
const std::string &variable_name_to_send, int state_value) {
const std::string &variable_name_to_send, int32_t state_value) {
this->add_no_result_to_queue_with_set_internal_(variable_name, variable_name_to_send, state_value);
}

void Nextion::add_no_result_to_queue_with_set_internal_(const std::string &variable_name,
const std::string &variable_name_to_send, int state_value,
const std::string &variable_name_to_send, int32_t state_value,
bool is_sleep_safe) {
if ((!this->is_setup() && !this->ignore_is_setup_) || (!is_sleep_safe && this->is_sleeping()))
return;

this->add_no_result_to_queue_with_ignore_sleep_printf_(variable_name, "%s=%d", variable_name_to_send.c_str(),
this->add_no_result_to_queue_with_ignore_sleep_printf_(variable_name, "%s=%" PRId32, variable_name_to_send.c_str(),
state_value);
}

Expand Down Expand Up @@ -1137,5 +1148,7 @@ void Nextion::set_writer(const nextion_writer_t &writer) { this->writer_ = write
ESPDEPRECATED("set_wait_for_ack(bool) is deprecated and has no effect", "v1.20")
void Nextion::set_wait_for_ack(bool wait_for_ack) { ESP_LOGE(TAG, "This command is deprecated"); }

bool Nextion::is_updating() { return this->is_updating_; }

} // namespace nextion
} // namespace esphome
Loading

0 comments on commit 8de135c

Please sign in to comment.