mirror of
https://github.com/esphome/esphome.git
synced 2025-10-06 20:03:46 +01:00
Add option to use MQTT abbreviations (#2641)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "mqtt_fan.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include "mqtt_const.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_FAN
|
||||
#include "esphome/components/fan/fan_helpers.h"
|
||||
@@ -120,14 +122,14 @@ bool MQTTFanComponent::send_initial_state() { return this->publish_state(); }
|
||||
|
||||
void MQTTFanComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryConfig &config) {
|
||||
if (this->state_->get_traits().supports_oscillation()) {
|
||||
root["oscillation_command_topic"] = this->get_oscillation_command_topic();
|
||||
root["oscillation_state_topic"] = this->get_oscillation_state_topic();
|
||||
root[MQTT_OSCILLATION_COMMAND_TOPIC] = this->get_oscillation_command_topic();
|
||||
root[MQTT_OSCILLATION_STATE_TOPIC] = this->get_oscillation_state_topic();
|
||||
}
|
||||
if (this->state_->get_traits().supports_speed()) {
|
||||
root["speed_level_command_topic"] = this->get_speed_level_command_topic();
|
||||
root["speed_level_state_topic"] = this->get_speed_level_state_topic();
|
||||
root["speed_command_topic"] = this->get_speed_command_topic();
|
||||
root["speed_state_topic"] = this->get_speed_state_topic();
|
||||
root[MQTT_SPEED_COMMAND_TOPIC] = this->get_speed_command_topic();
|
||||
root[MQTT_SPEED_STATE_TOPIC] = this->get_speed_state_topic();
|
||||
}
|
||||
}
|
||||
bool MQTTFanComponent::publish_state() {
|
||||
|
Reference in New Issue
Block a user