Number mode (#2838)

This commit is contained in:
Jesse Hills
2021-12-01 08:11:38 +13:00
committed by GitHub
parent b5a0e8b2c0
commit d9513e5ff2
9 changed files with 70 additions and 1 deletions
+10
View File
@@ -45,6 +45,16 @@ void MQTTNumberComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryCo
root[MQTT_STEP] = traits.get_step();
if (!this->number_->traits.get_unit_of_measurement().empty())
root[MQTT_UNIT_OF_MEASUREMENT] = this->number_->traits.get_unit_of_measurement();
switch (this->number_->traits.get_mode()) {
case NUMBER_MODE_AUTO:
break;
case NUMBER_MODE_BOX:
root[MQTT_MODE] = "box";
break;
case NUMBER_MODE_SLIDER:
root[MQTT_MODE] = "slider";
break;
}
config.command_topic = true;
}