1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-05 04:42:21 +01:00

Fix home assistant binary sensor initial state (#632)

* Fix home assistant binary sensor initial state

* Fix send state log message

* fix new_state local name

* lint

* Trigger


Co-authored-by: Guillermo Ruffino <guillermo.ruffino@pampatech.net>
This commit is contained in:
Guillermo Ruffino
2019-06-15 13:02:17 -03:00
committed by Otto Winter
parent dc9f304d94
commit 7abe8875bd
3 changed files with 13 additions and 6 deletions

View File

@@ -30,7 +30,11 @@ void BinarySensor::publish_initial_state(bool state) {
}
}
void BinarySensor::send_state_internal(bool state, bool is_initial) {
ESP_LOGD(TAG, "'%s': Sending state %s", this->get_name().c_str(), state ? "ON" : "OFF");
if (is_initial) {
ESP_LOGD(TAG, "'%s': Sending initial state %s", this->get_name().c_str(), ONOFF(state));
} else {
ESP_LOGD(TAG, "'%s': Sending state %s", this->get_name().c_str(), ONOFF(state));
}
this->has_state_ = true;
this->state = state;
if (!is_initial) {