diff --git a/components/app_status/app_status.cpp b/components/app_status/app_status.cpp index b0e7649..2d89e0c 100644 --- a/components/app_status/app_status.cpp +++ b/components/app_status/app_status.cpp @@ -18,7 +18,6 @@ void AppStatus::loop() { } this->publish_status_(status); - this->last_status_ = status; } void AppStatus::dump_config() { @@ -40,6 +39,24 @@ void AppStatus::publish_status_(uint8_t status) { if (this->include_warnings_ && (status & STATUS_LED_WARNING)) { result = true; } + if (this->light_ != nullptr) { + if (this->last_status_ == 0 && status != 0) { + this->saved_light_values_ = this->light_->current_values; + auto call = this->light_->turn_on(); + call.set_brightness(0.30); + call.set_rgb(1.0, 0.0, 1.0); + call.set_transition_length(0); + call.set_publish(false); + call.perform(); + } else if (this->last_status_ != 0 && status == 0) { + auto call = this->light_->make_call(); + call.from_light_color_values(this->saved_light_values_); + call.set_transition_length(0); + call.set_publish(false); + call.perform(); + } + } + this->last_status_ = status; this->publish_state(result); } diff --git a/components/app_status/app_status.h b/components/app_status/app_status.h index 8b3067a..0fb01bc 100644 --- a/components/app_status/app_status.h +++ b/components/app_status/app_status.h @@ -24,6 +24,7 @@ class AppStatus : public binary_sensor::BinarySensor, public Component { bool include_warnings_{true}; bool include_errors_{true}; light::LightState *light_{nullptr}; + light::LightColorValues saved_light_values_; uint8_t get_status_() const; void publish_status_(uint8_t status);