diff --git a/bentel-kyo/bentel_kyo32.h b/bentel-kyo/bentel_kyo32.h index f1e03c0..a7e7d94 100644 --- a/bentel-kyo/bentel_kyo32.h +++ b/bentel-kyo/bentel_kyo32.h @@ -65,7 +65,6 @@ class Bentel_Kyo32 : public esphome::PollingComponent, public uart::UARTDevice, register_service(&Bentel_Kyo32::activate_output, "activate_output", {"output_number"}); register_service(&Bentel_Kyo32::deactivate_output, "deactivate_output", {"output_number"}); register_service(&Bentel_Kyo32::debug_command, "debug_command", {"serial_trace", "log_trace", "polling_kyo"}); - register_service(&Bentel_Kyo32::update_datetime, "update_datetime", {"day", "month", "year", "hours", "minutes", "seconds"}); pollingState = PollingStateEnum::Init; kyo_comunication->publish_state(false); @@ -201,33 +200,6 @@ class Bentel_Kyo32 : public esphome::PollingComponent, public uart::UARTDevice, int Count = sendMessageToKyo(cmdDeactivateOutput, sizeof(cmdDeactivateOutput), Rx, 80); ESP_LOGD("deactivate_output", "kyo respond %i", Count); } - - void update_datetime(int day, int month, int year, int hours, int minutes, int seconds) - { - if (day <= 0 || day > 31 || month <= 0 || month > 12 || year < 2000 || year > 2099 || - minutes < 0 || minutes > 59 || seconds < 0 || seconds > 59) - { - ESP_LOGE("update_datetime", "invalid datetime"); - return; - } - - ESP_LOGI("update_datetime", "recive %d/%d/%d %d:%d:%d", day, month, year, hours, minutes, seconds); - - byte cmdUpdateDateTime[13] = {0x0f, 0x03, 0xf0, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}; - - cmdUpdateDateTime[6] = day; - cmdUpdateDateTime[7] = month; - cmdUpdateDateTime[8] = year-2000; - cmdUpdateDateTime[9] = hours; - cmdUpdateDateTime[10] = minutes; - cmdUpdateDateTime[11] = seconds; - - cmdUpdateDateTime[12] = calculateChecksum(cmdUpdateDateTime, 11); - - byte Rx[255]; - int Count = sendMessageToKyo(cmdUpdateDateTime, sizeof(cmdUpdateDateTime), Rx, 200); - ESP_LOGD("update_datetime", "kyo respond %i", Count); - } void update() override {