Fix light partition (#584)

* Fix light partition

Fixes https://github.com/esphome/issues/issues/365

* Lint
This commit is contained in:
Otto Winter
2019-05-31 13:38:56 +02:00
parent 6535b0966e
commit d02e280c3c
9 changed files with 44 additions and 9 deletions

View File

@@ -4,6 +4,8 @@
namespace esphome {
namespace light {
static const char *TAG = "light.addressable";
const ESPColor ESPColor::BLACK = ESPColor(0, 0, 0, 0);
const ESPColor ESPColor::WHITE = ESPColor(255, 255, 255, 255);
@@ -92,5 +94,24 @@ int32_t HOT interpret_index(int32_t index, int32_t size) {
return index;
}
void AddressableLight::call_setup() {
this->setup_internal_();
this->setup();
#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
this->set_interval(5000, [this]() {
const char *name = this->state_parent_ == nullptr ? "" : this->state_parent_->get_name().c_str();
ESP_LOGVV(TAG, "Addressable Light '%s' (effect_active=%s next_show=%s)", name, YESNO(this->effect_active_),
YESNO(this->next_show_));
for (int i = 0; i < this->size(); i++) {
auto color = this->get(i);
ESP_LOGVV(TAG, " [%2d] Color: R=%3u G=%3u B=%3u W=%3u", i, color.get_red_raw(), color.get_green_raw(),
color.get_blue_raw(), color.get_white_raw());
}
ESP_LOGVV(TAG, "");
});
#endif
}
} // namespace light
} // namespace esphome