mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 07:08:20 +00:00
feat: add read_timers_to_log method to log active lamp timers
This commit is contained in:
parent
478bcd6baf
commit
df1cf4eb2f
@ -261,6 +261,21 @@ bool DynamicLampComponent::add_timer(std::string lamp_name, bool timer_active, u
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DynamicLamp::read_timers_to_log() {
|
||||||
|
uint8_t i = 0;
|
||||||
|
for (i = 0; i < 16; i++) {
|
||||||
|
if (this->parent_->active_lamps_[i].active) {
|
||||||
|
char lamp_name_buffer[32];
|
||||||
|
this->parent_->fram_->read(2048, reinterpret_cast<unsigned char *>(lamp_name_buffer), 32);
|
||||||
|
ESP_LOGV(TAG, "Lamp name: %s", lamp_name_buffer);
|
||||||
|
DynamicLampTimer timer;
|
||||||
|
this->parent_->fram_->read((2048 + 32), reinterpret_cast<unsigned char *>(&timer), 24);
|
||||||
|
ESP_LOGV(TAG, "Timer active: %d, mode: %d, hour: %d, minute: %d, monday: %d, tuesday: %d, wednesday: %d, thursday: %d, friday: %d, saturday: %d, sunday: %d",
|
||||||
|
timer.active, timer.mode, timer.hour, timer.minute, timer.monday, timer.tuesday, timer.wednesday, timer.thursday, timer.friday, timer.saturday, timer.sunday);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DynamicLampComponent::write_state_(uint8_t lamp_number, float state) {
|
bool DynamicLampComponent::write_state_(uint8_t lamp_number, float state) {
|
||||||
if (this->active_lamps_[lamp_number].active) {
|
if (this->active_lamps_[lamp_number].active) {
|
||||||
this->active_lamps_[lamp_number].state_ = state;
|
this->active_lamps_[lamp_number].state_ = state;
|
||||||
|
@ -106,6 +106,7 @@ class DynamicLampComponent : public Component {
|
|||||||
bool add_timer(std::string lamp_name, bool timer_active, uint8_t mode, uint8_t hour,
|
bool add_timer(std::string lamp_name, bool timer_active, uint8_t mode, uint8_t hour,
|
||||||
uint8_t minute, bool monday, bool tuesday, bool wednesday, bool thursday,
|
uint8_t minute, bool monday, bool tuesday, bool wednesday, bool thursday,
|
||||||
bool friday, bool saturday, bool sunday);
|
bool friday, bool saturday, bool sunday);
|
||||||
|
void read_timers_to_log();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class DynamicLamp;
|
friend class DynamicLamp;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user