Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo-deluca committed Apr 10, 2022
1 parent 4e0597c commit 98f2c62
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions bentel-kyo/bentel_kyo32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit 98f2c62

Please sign in to comment.