Apply suggestions from code review

Fixes unsigned integer wrong type

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Kevin Ahrendt 2025-07-14 20:20:46 -04:00 committed by GitHub
parent 3cca7a6161
commit d268c14f7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View File

@ -26,7 +26,7 @@ void MQTTDateComponent::setup() {
if (root["month"].is<uint8_t>()) {
call.set_month(root["month"]);
}
if (root["day"].is<uint16_t>()) {
if (root["day"].is<uint8_t>()) {
call.set_day(root["day"]);
}
call.perform();

View File

@ -29,13 +29,13 @@ void MQTTDateTimeComponent::setup() {
if (root["day"].is<uint8_t>()) {
call.set_day(root["day"]);
}
if (root["hour"].is<uint16_t>()) {
if (root["hour"].is<uint8_t>()) {
call.set_hour(root["hour"]);
}
if (root["minute"].is<uint16_t>()) {
if (root["minute"].is<uint8_t>()) {
call.set_minute(root["minute"]);
}
if (root["second"].is<uint16_t>()) {
if (root["second"].is<uint8_t>()) {
call.set_second(root["second"]);
}
call.perform();

View File

@ -20,13 +20,13 @@ MQTTTimeComponent::MQTTTimeComponent(TimeEntity *time) : time_(time) {}
void MQTTTimeComponent::setup() {
this->subscribe_json(this->get_command_topic_(), [this](const std::string &topic, JsonObject root) {
auto call = this->time_->make_call();
if (root["hour"].is<uint16_t>()) {
if (root["hour"].is<uint8_t>()) {
call.set_hour(root["hour"]);
}
if (root["minute"].is<uint16_t>()) {
if (root["minute"].is<uint8_t>()) {
call.set_minute(root["minute"]);
}
if (root["second"].is<uint16_t>()) {
if (root["second"].is<uint8_t>()) {
call.set_second(root["second"]);
}
call.perform();