mirror of
https://github.com/esphome/esphome.git
synced 2025-08-03 00:47:47 +00:00
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:
parent
3cca7a6161
commit
d268c14f7e
@ -26,7 +26,7 @@ void MQTTDateComponent::setup() {
|
|||||||
if (root["month"].is<uint8_t>()) {
|
if (root["month"].is<uint8_t>()) {
|
||||||
call.set_month(root["month"]);
|
call.set_month(root["month"]);
|
||||||
}
|
}
|
||||||
if (root["day"].is<uint16_t>()) {
|
if (root["day"].is<uint8_t>()) {
|
||||||
call.set_day(root["day"]);
|
call.set_day(root["day"]);
|
||||||
}
|
}
|
||||||
call.perform();
|
call.perform();
|
||||||
|
@ -29,13 +29,13 @@ void MQTTDateTimeComponent::setup() {
|
|||||||
if (root["day"].is<uint8_t>()) {
|
if (root["day"].is<uint8_t>()) {
|
||||||
call.set_day(root["day"]);
|
call.set_day(root["day"]);
|
||||||
}
|
}
|
||||||
if (root["hour"].is<uint16_t>()) {
|
if (root["hour"].is<uint8_t>()) {
|
||||||
call.set_hour(root["hour"]);
|
call.set_hour(root["hour"]);
|
||||||
}
|
}
|
||||||
if (root["minute"].is<uint16_t>()) {
|
if (root["minute"].is<uint8_t>()) {
|
||||||
call.set_minute(root["minute"]);
|
call.set_minute(root["minute"]);
|
||||||
}
|
}
|
||||||
if (root["second"].is<uint16_t>()) {
|
if (root["second"].is<uint8_t>()) {
|
||||||
call.set_second(root["second"]);
|
call.set_second(root["second"]);
|
||||||
}
|
}
|
||||||
call.perform();
|
call.perform();
|
||||||
|
@ -20,13 +20,13 @@ MQTTTimeComponent::MQTTTimeComponent(TimeEntity *time) : time_(time) {}
|
|||||||
void MQTTTimeComponent::setup() {
|
void MQTTTimeComponent::setup() {
|
||||||
this->subscribe_json(this->get_command_topic_(), [this](const std::string &topic, JsonObject root) {
|
this->subscribe_json(this->get_command_topic_(), [this](const std::string &topic, JsonObject root) {
|
||||||
auto call = this->time_->make_call();
|
auto call = this->time_->make_call();
|
||||||
if (root["hour"].is<uint16_t>()) {
|
if (root["hour"].is<uint8_t>()) {
|
||||||
call.set_hour(root["hour"]);
|
call.set_hour(root["hour"]);
|
||||||
}
|
}
|
||||||
if (root["minute"].is<uint16_t>()) {
|
if (root["minute"].is<uint8_t>()) {
|
||||||
call.set_minute(root["minute"]);
|
call.set_minute(root["minute"]);
|
||||||
}
|
}
|
||||||
if (root["second"].is<uint16_t>()) {
|
if (root["second"].is<uint8_t>()) {
|
||||||
call.set_second(root["second"]);
|
call.set_second(root["second"]);
|
||||||
}
|
}
|
||||||
call.perform();
|
call.perform();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user