1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 15:55:46 +00:00

duty_time: fix build without binary_sensor. Parented in automations. (#5156)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Sergey Dudanov
2023-07-31 01:30:11 +04:00
committed by GitHub
parent fdb20e4a30
commit 9ff0471274
3 changed files with 32 additions and 38 deletions

View File

@@ -6,9 +6,11 @@ namespace duty_time_sensor {
static const char *const TAG = "duty_time_sensor";
#ifdef USE_BINARY_SENSOR
void DutyTimeSensor::set_sensor(binary_sensor::BinarySensor *const sensor) {
sensor->add_on_state_callback([this](bool state) { this->process_state_(state); });
}
#endif
void DutyTimeSensor::start() {
if (!this->last_state_)