ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
mqtt_climate.cpp
Go to the documentation of this file.
1#include "mqtt_climate.h"
2#include "esphome/core/log.h"
3
4#include "mqtt_const.h"
5
6#ifdef USE_MQTT
7#ifdef USE_CLIMATE
8
9namespace esphome {
10namespace mqtt {
11
12static const char *const TAG = "mqtt.climate";
13
14using namespace esphome::climate;
15
17 // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson
18 auto traits = this->device_->get_traits();
19 // current_temperature_topic
20 if (traits.get_supports_current_temperature()) {
21 root[MQTT_CURRENT_TEMPERATURE_TOPIC] = this->get_current_temperature_state_topic();
22 }
23 // current_humidity_topic
24 if (traits.get_supports_current_humidity()) {
25 root[MQTT_CURRENT_HUMIDITY_TOPIC] = this->get_current_humidity_state_topic();
26 }
27 // mode_command_topic
28 root[MQTT_MODE_COMMAND_TOPIC] = this->get_mode_command_topic();
29 // mode_state_topic
30 root[MQTT_MODE_STATE_TOPIC] = this->get_mode_state_topic();
31 // modes
32 JsonArray modes = root[MQTT_MODES].to<JsonArray>();
33 // sort array for nice UI in HA
34 if (traits.supports_mode(CLIMATE_MODE_AUTO))
35 modes.add("auto");
36 modes.add("off");
37 if (traits.supports_mode(CLIMATE_MODE_COOL))
38 modes.add("cool");
39 if (traits.supports_mode(CLIMATE_MODE_HEAT))
40 modes.add("heat");
41 if (traits.supports_mode(CLIMATE_MODE_FAN_ONLY))
42 modes.add("fan_only");
43 if (traits.supports_mode(CLIMATE_MODE_DRY))
44 modes.add("dry");
45 if (traits.supports_mode(CLIMATE_MODE_HEAT_COOL))
46 modes.add("heat_cool");
47
48 if (traits.get_supports_two_point_target_temperature()) {
49 // temperature_low_command_topic
50 root[MQTT_TEMPERATURE_LOW_COMMAND_TOPIC] = this->get_target_temperature_low_command_topic();
51 // temperature_low_state_topic
52 root[MQTT_TEMPERATURE_LOW_STATE_TOPIC] = this->get_target_temperature_low_state_topic();
53 // temperature_high_command_topic
54 root[MQTT_TEMPERATURE_HIGH_COMMAND_TOPIC] = this->get_target_temperature_high_command_topic();
55 // temperature_high_state_topic
56 root[MQTT_TEMPERATURE_HIGH_STATE_TOPIC] = this->get_target_temperature_high_state_topic();
57 } else {
58 // temperature_command_topic
59 root[MQTT_TEMPERATURE_COMMAND_TOPIC] = this->get_target_temperature_command_topic();
60 // temperature_state_topic
61 root[MQTT_TEMPERATURE_STATE_TOPIC] = this->get_target_temperature_state_topic();
62 }
63
64 if (traits.get_supports_target_humidity()) {
65 // target_humidity_command_topic
66 root[MQTT_TARGET_HUMIDITY_COMMAND_TOPIC] = this->get_target_humidity_command_topic();
67 // target_humidity_state_topic
68 root[MQTT_TARGET_HUMIDITY_STATE_TOPIC] = this->get_target_humidity_state_topic();
69 }
70
71 // min_temp
72 root[MQTT_MIN_TEMP] = traits.get_visual_min_temperature();
73 // max_temp
74 root[MQTT_MAX_TEMP] = traits.get_visual_max_temperature();
75 // target_temp_step
76 root[MQTT_TARGET_TEMPERATURE_STEP] = roundf(traits.get_visual_target_temperature_step() * 10) * 0.1;
77 // current_temp_step
78 root[MQTT_CURRENT_TEMPERATURE_STEP] = roundf(traits.get_visual_current_temperature_step() * 10) * 0.1;
79 // temperature units are always coerced to Celsius internally
80 root[MQTT_TEMPERATURE_UNIT] = "C";
81
82 // min_humidity
83 root[MQTT_MIN_HUMIDITY] = traits.get_visual_min_humidity();
84 // max_humidity
85 root[MQTT_MAX_HUMIDITY] = traits.get_visual_max_humidity();
86
87 if (traits.get_supports_presets() || !traits.get_supported_custom_presets().empty()) {
88 // preset_mode_command_topic
89 root[MQTT_PRESET_MODE_COMMAND_TOPIC] = this->get_preset_command_topic();
90 // preset_mode_state_topic
91 root[MQTT_PRESET_MODE_STATE_TOPIC] = this->get_preset_state_topic();
92 // presets
93 JsonArray presets = root["preset_modes"].to<JsonArray>();
94 if (traits.supports_preset(CLIMATE_PRESET_HOME))
95 presets.add("home");
96 if (traits.supports_preset(CLIMATE_PRESET_AWAY))
97 presets.add("away");
98 if (traits.supports_preset(CLIMATE_PRESET_BOOST))
99 presets.add("boost");
100 if (traits.supports_preset(CLIMATE_PRESET_COMFORT))
101 presets.add("comfort");
102 if (traits.supports_preset(CLIMATE_PRESET_ECO))
103 presets.add("eco");
104 if (traits.supports_preset(CLIMATE_PRESET_SLEEP))
105 presets.add("sleep");
106 if (traits.supports_preset(CLIMATE_PRESET_ACTIVITY))
107 presets.add("activity");
108 for (const auto &preset : traits.get_supported_custom_presets())
109 presets.add(preset);
110 }
111
112 if (traits.get_supports_action()) {
113 // action_topic
114 root[MQTT_ACTION_TOPIC] = this->get_action_state_topic();
115 }
116
117 if (traits.get_supports_fan_modes()) {
118 // fan_mode_command_topic
119 root[MQTT_FAN_MODE_COMMAND_TOPIC] = this->get_fan_mode_command_topic();
120 // fan_mode_state_topic
121 root[MQTT_FAN_MODE_STATE_TOPIC] = this->get_fan_mode_state_topic();
122 // fan_modes
123 JsonArray fan_modes = root["fan_modes"].to<JsonArray>();
124 if (traits.supports_fan_mode(CLIMATE_FAN_ON))
125 fan_modes.add("on");
126 if (traits.supports_fan_mode(CLIMATE_FAN_OFF))
127 fan_modes.add("off");
128 if (traits.supports_fan_mode(CLIMATE_FAN_AUTO))
129 fan_modes.add("auto");
130 if (traits.supports_fan_mode(CLIMATE_FAN_LOW))
131 fan_modes.add("low");
132 if (traits.supports_fan_mode(CLIMATE_FAN_MEDIUM))
133 fan_modes.add("medium");
134 if (traits.supports_fan_mode(CLIMATE_FAN_HIGH))
135 fan_modes.add("high");
136 if (traits.supports_fan_mode(CLIMATE_FAN_MIDDLE))
137 fan_modes.add("middle");
138 if (traits.supports_fan_mode(CLIMATE_FAN_FOCUS))
139 fan_modes.add("focus");
140 if (traits.supports_fan_mode(CLIMATE_FAN_DIFFUSE))
141 fan_modes.add("diffuse");
142 if (traits.supports_fan_mode(CLIMATE_FAN_QUIET))
143 fan_modes.add("quiet");
144 for (const auto &fan_mode : traits.get_supported_custom_fan_modes())
145 fan_modes.add(fan_mode);
146 }
147
148 if (traits.get_supports_swing_modes()) {
149 // swing_mode_command_topic
150 root[MQTT_SWING_MODE_COMMAND_TOPIC] = this->get_swing_mode_command_topic();
151 // swing_mode_state_topic
152 root[MQTT_SWING_MODE_STATE_TOPIC] = this->get_swing_mode_state_topic();
153 // swing_modes
154 JsonArray swing_modes = root["swing_modes"].to<JsonArray>();
155 if (traits.supports_swing_mode(CLIMATE_SWING_OFF))
156 swing_modes.add("off");
157 if (traits.supports_swing_mode(CLIMATE_SWING_BOTH))
158 swing_modes.add("both");
159 if (traits.supports_swing_mode(CLIMATE_SWING_VERTICAL))
160 swing_modes.add("vertical");
161 if (traits.supports_swing_mode(CLIMATE_SWING_HORIZONTAL))
162 swing_modes.add("horizontal");
163 }
164
165 config.state_topic = false;
166 config.command_topic = false;
167 // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
168}
170 auto traits = this->device_->get_traits();
171 this->subscribe(this->get_mode_command_topic(), [this](const std::string &topic, const std::string &payload) {
172 auto call = this->device_->make_call();
173 call.set_mode(payload);
174 call.perform();
175 });
176
177 if (traits.get_supports_two_point_target_temperature()) {
178 this->subscribe(this->get_target_temperature_low_command_topic(),
179 [this](const std::string &topic, const std::string &payload) {
180 auto val = parse_number<float>(payload);
181 if (!val.has_value()) {
182 ESP_LOGW(TAG, "Can't convert '%s' to number!", payload.c_str());
183 return;
184 }
185 auto call = this->device_->make_call();
187 call.perform();
188 });
189 this->subscribe(this->get_target_temperature_high_command_topic(),
190 [this](const std::string &topic, const std::string &payload) {
191 auto val = parse_number<float>(payload);
192 if (!val.has_value()) {
193 ESP_LOGW(TAG, "Can't convert '%s' to number!", payload.c_str());
194 return;
195 }
196 auto call = this->device_->make_call();
198 call.perform();
199 });
200 } else {
201 this->subscribe(this->get_target_temperature_command_topic(),
202 [this](const std::string &topic, const std::string &payload) {
203 auto val = parse_number<float>(payload);
204 if (!val.has_value()) {
205 ESP_LOGW(TAG, "Can't convert '%s' to number!", payload.c_str());
206 return;
207 }
208 auto call = this->device_->make_call();
210 call.perform();
211 });
212 }
213
214 if (traits.get_supports_target_humidity()) {
215 this->subscribe(this->get_target_humidity_command_topic(),
216 [this](const std::string &topic, const std::string &payload) {
217 auto val = parse_number<float>(payload);
218 if (!val.has_value()) {
219 ESP_LOGW(TAG, "Can't convert '%s' to number!", payload.c_str());
220 return;
221 }
222 auto call = this->device_->make_call();
224 call.perform();
225 });
226 }
227
228 if (traits.get_supports_presets() || !traits.get_supported_custom_presets().empty()) {
229 this->subscribe(this->get_preset_command_topic(), [this](const std::string &topic, const std::string &payload) {
230 auto call = this->device_->make_call();
231 call.set_preset(payload);
232 call.perform();
233 });
234 }
235
236 if (traits.get_supports_fan_modes()) {
237 this->subscribe(this->get_fan_mode_command_topic(), [this](const std::string &topic, const std::string &payload) {
238 auto call = this->device_->make_call();
239 call.set_fan_mode(payload);
240 call.perform();
241 });
242 }
243
244 if (traits.get_supports_swing_modes()) {
245 this->subscribe(this->get_swing_mode_command_topic(), [this](const std::string &topic, const std::string &payload) {
246 auto call = this->device_->make_call();
247 call.set_swing_mode(payload);
248 call.perform();
249 });
250 }
251
252 this->device_->add_on_state_callback([this](Climate & /*unused*/) { this->publish_state_(); });
253}
256std::string MQTTClimateComponent::component_type() const { return "climate"; }
257const EntityBase *MQTTClimateComponent::get_entity() const { return this->device_; }
258
260 auto traits = this->device_->get_traits();
261 // mode
262 const char *mode_s;
263 switch (this->device_->mode) {
264 case CLIMATE_MODE_OFF:
265 mode_s = "off";
266 break;
268 mode_s = "auto";
269 break;
271 mode_s = "cool";
272 break;
274 mode_s = "heat";
275 break;
277 mode_s = "fan_only";
278 break;
279 case CLIMATE_MODE_DRY:
280 mode_s = "dry";
281 break;
283 mode_s = "heat_cool";
284 break;
285 default:
286 mode_s = "unknown";
287 }
288 bool success = true;
289 if (!this->publish(this->get_mode_state_topic(), mode_s))
290 success = false;
291 int8_t target_accuracy = traits.get_target_temperature_accuracy_decimals();
292 int8_t current_accuracy = traits.get_current_temperature_accuracy_decimals();
293 if (traits.get_supports_current_temperature() && !std::isnan(this->device_->current_temperature)) {
294 std::string payload = value_accuracy_to_string(this->device_->current_temperature, current_accuracy);
295 if (!this->publish(this->get_current_temperature_state_topic(), payload))
296 success = false;
297 }
298 if (traits.get_supports_two_point_target_temperature()) {
299 std::string payload = value_accuracy_to_string(this->device_->target_temperature_low, target_accuracy);
300 if (!this->publish(this->get_target_temperature_low_state_topic(), payload))
301 success = false;
302 payload = value_accuracy_to_string(this->device_->target_temperature_high, target_accuracy);
303 if (!this->publish(this->get_target_temperature_high_state_topic(), payload))
304 success = false;
305 } else {
306 std::string payload = value_accuracy_to_string(this->device_->target_temperature, target_accuracy);
307 if (!this->publish(this->get_target_temperature_state_topic(), payload))
308 success = false;
309 }
310
311 if (traits.get_supports_current_humidity() && !std::isnan(this->device_->current_humidity)) {
312 std::string payload = value_accuracy_to_string(this->device_->current_humidity, 0);
313 if (!this->publish(this->get_current_humidity_state_topic(), payload))
314 success = false;
315 }
316 if (traits.get_supports_target_humidity() && !std::isnan(this->device_->target_humidity)) {
317 std::string payload = value_accuracy_to_string(this->device_->target_humidity, 0);
318 if (!this->publish(this->get_target_humidity_state_topic(), payload))
319 success = false;
320 }
321
322 if (traits.get_supports_presets() || !traits.get_supported_custom_presets().empty()) {
323 std::string payload;
324 if (this->device_->preset.has_value()) {
325 switch (this->device_->preset.value()) {
327 payload = "none";
328 break;
330 payload = "home";
331 break;
333 payload = "away";
334 break;
336 payload = "boost";
337 break;
339 payload = "comfort";
340 break;
342 payload = "eco";
343 break;
345 payload = "sleep";
346 break;
348 payload = "activity";
349 break;
350 default:
351 payload = "unknown";
352 }
353 }
354 if (this->device_->custom_preset.has_value())
355 payload = this->device_->custom_preset.value();
356 if (!this->publish(this->get_preset_state_topic(), payload))
357 success = false;
358 }
359
360 if (traits.get_supports_action()) {
361 const char *payload;
362 switch (this->device_->action) {
364 payload = "off";
365 break;
367 payload = "cooling";
368 break;
370 payload = "heating";
371 break;
373 payload = "idle";
374 break;
376 payload = "drying";
377 break;
379 payload = "fan";
380 break;
381 default:
382 payload = "unknown";
383 }
384 if (!this->publish(this->get_action_state_topic(), payload))
385 success = false;
386 }
387
388 if (traits.get_supports_fan_modes()) {
389 std::string payload;
390 if (this->device_->fan_mode.has_value()) {
391 switch (this->device_->fan_mode.value()) {
392 case CLIMATE_FAN_ON:
393 payload = "on";
394 break;
395 case CLIMATE_FAN_OFF:
396 payload = "off";
397 break;
398 case CLIMATE_FAN_AUTO:
399 payload = "auto";
400 break;
401 case CLIMATE_FAN_LOW:
402 payload = "low";
403 break;
405 payload = "medium";
406 break;
407 case CLIMATE_FAN_HIGH:
408 payload = "high";
409 break;
411 payload = "middle";
412 break;
414 payload = "focus";
415 break;
417 payload = "diffuse";
418 break;
420 payload = "quiet";
421 break;
422 default:
423 payload = "unknown";
424 }
425 }
426 if (this->device_->custom_fan_mode.has_value())
427 payload = this->device_->custom_fan_mode.value();
428 if (!this->publish(this->get_fan_mode_state_topic(), payload))
429 success = false;
430 }
431
432 if (traits.get_supports_swing_modes()) {
433 const char *payload;
434 switch (this->device_->swing_mode) {
436 payload = "off";
437 break;
439 payload = "both";
440 break;
442 payload = "vertical";
443 break;
445 payload = "horizontal";
446 break;
447 default:
448 payload = "unknown";
449 }
450 if (!this->publish(this->get_swing_mode_state_topic(), payload))
451 success = false;
452 }
453
454 return success;
455}
456
457} // namespace mqtt
458} // namespace esphome
459
460#endif
461#endif // USE_MQTT
ClimateCall & set_target_temperature(float target_temperature)
Set the target temperature of the climate device.
Definition climate.cpp:256
ClimateCall & set_swing_mode(ClimateSwingMode swing_mode)
Set the swing mode of the climate device.
Definition climate.cpp:237
ClimateCall & set_target_temperature_low(float target_temperature_low)
Set the low point target temperature of the climate device.
Definition climate.cpp:260
ClimateCall & set_preset(ClimatePreset preset)
Set the preset of the climate device.
Definition climate.cpp:199
ClimateCall & set_fan_mode(ClimateFanMode fan_mode)
Set the fan mode of the climate device.
Definition climate.cpp:157
ClimateCall & set_target_humidity(float target_humidity)
Set the target humidity of the climate device.
Definition climate.cpp:268
ClimateCall & set_target_temperature_high(float target_temperature_high)
Set the high point target temperature of the climate device.
Definition climate.cpp:264
ClimateCall & set_mode(ClimateMode mode)
Set the mode of the climate device.
Definition climate.cpp:133
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:168
ClimateMode mode
The active mode of the climate device.
Definition climate.h:173
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
Definition climate.h:199
ClimateTraits get_traits()
Get the traits of this climate device with all overrides applied.
Definition climate.cpp:440
float target_temperature
The target temperature of the climate device.
Definition climate.h:186
float current_humidity
The current humidity of the climate device, as reported from the integration.
Definition climate.h:182
optional< std::string > custom_fan_mode
The active custom fan mode of the climate device.
Definition climate.h:205
ClimateSwingMode swing_mode
The active swing mode of the climate device.
Definition climate.h:202
float target_temperature_low
The minimum target temperature of the climate device, for climate devices with split target temperatu...
Definition climate.h:189
void add_on_state_callback(std::function< void(Climate &)> &&callback)
Add a callback for the climate device state, each time the state of the climate device is updated (us...
Definition climate.cpp:318
optional< std::string > custom_preset
The active custom preset mode of the climate device.
Definition climate.h:211
float current_temperature
The current temperature of the climate device, as reported from the integration.
Definition climate.h:179
ClimateAction action
The active state of the climate device.
Definition climate.h:176
ClimateCall make_call()
Make a climate device control call, this is used to control the climate device, see the ClimateCall d...
Definition climate.cpp:479
optional< ClimatePreset > preset
The active preset of the climate device.
Definition climate.h:208
float target_humidity
The target humidity of the climate device.
Definition climate.h:196
float target_temperature_high
The maximum target temperature of the climate device, for climate devices with split target temperatu...
Definition climate.h:191
int8_t get_target_temperature_accuracy_decimals() const
MQTTClimateComponent(climate::Climate *device)
state command command command command command command state state state MQTT_COMPONENT_CUSTOM_TOPIC(preset, command) protected bool publish_state_()
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
std::string component_type() const override
bool publish(const std::string &topic, const std::string &payload)
Send a MQTT message.
virtual const EntityBase * get_entity() const =0
Gets the Entity served by this MQTT component.
void subscribe(const std::string &topic, mqtt_callback_t callback, uint8_t qos=0)
Subscribe to a MQTT topic.
bool has_value() const
Definition optional.h:92
value_type const & value() const
Definition optional.h:94
ClimateFanMode fan_mode
Definition climate.h:3
ClimatePreset preset
Definition climate.h:8
mopeka_std_values val[4]
@ CLIMATE_PRESET_NONE
No preset is active.
@ CLIMATE_PRESET_COMFORT
Device is in comfort preset.
@ CLIMATE_PRESET_AWAY
Device is in away preset.
@ CLIMATE_PRESET_BOOST
Device is in boost preset.
@ CLIMATE_PRESET_ACTIVITY
Device is reacting to activity (e.g., movement sensors)
@ CLIMATE_PRESET_SLEEP
Device is prepared for sleep.
@ CLIMATE_PRESET_HOME
Device is in home preset.
@ CLIMATE_PRESET_ECO
Device is running an energy-saving preset.
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_HORIZONTAL
The fan mode is set to Horizontal.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ CLIMATE_SWING_BOTH
The fan mode is set to Both.
@ CLIMATE_MODE_DRY
The climate device is set to dry/humidity mode.
@ CLIMATE_MODE_FAN_ONLY
The climate device only has the fan enabled, no heating or cooling is taking place.
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_COOL
The climate device is set to cool to reach the target temperature.
@ CLIMATE_MODE_HEAT_COOL
The climate device is set to heat/cool to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.
@ CLIMATE_MODE_AUTO
The climate device is adjusting the temperature dynamically.
@ CLIMATE_ACTION_OFF
The climate device is off (inactive or no power)
@ CLIMATE_ACTION_IDLE
The climate device is idle (monitoring climate but no action needed)
@ CLIMATE_ACTION_DRYING
The climate device is drying.
@ CLIMATE_ACTION_HEATING
The climate device is actively heating.
@ CLIMATE_ACTION_COOLING
The climate device is actively cooling.
@ CLIMATE_ACTION_FAN
The climate device is in fan only mode.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_DIFFUSE
The fan mode is set to Diffuse.
@ CLIMATE_FAN_ON
The fan mode is set to On.
@ CLIMATE_FAN_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_FOCUS
The fan mode is set to Focus.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_MIDDLE
The fan mode is set to Middle.
@ CLIMATE_FAN_QUIET
The fan mode is set to Quiet.
@ CLIMATE_FAN_OFF
The fan mode is set to Off.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
constexpr const char *const MQTT_TEMPERATURE_HIGH_COMMAND_TOPIC
Definition mqtt_const.h:242
constexpr const char *const MQTT_TEMPERATURE_LOW_COMMAND_TOPIC
Definition mqtt_const.h:246
constexpr const char *const MQTT_CURRENT_TEMPERATURE_TOPIC
Definition mqtt_const.h:56
constexpr const char *const MQTT_TEMPERATURE_STATE_TOPIC
Definition mqtt_const.h:250
constexpr const char *const MQTT_TARGET_HUMIDITY_STATE_TOPIC
Definition mqtt_const.h:237
constexpr const char *const MQTT_MIN_HUMIDITY
Definition mqtt_const.h:113
constexpr const char *const MQTT_TEMPERATURE_COMMAND_TOPIC
Definition mqtt_const.h:240
constexpr const char *const MQTT_SWING_MODE_STATE_TOPIC
Definition mqtt_const.h:233
constexpr const char *const MQTT_CURRENT_HUMIDITY_TOPIC
Definition mqtt_const.h:53
constexpr const char *const MQTT_TEMPERATURE_UNIT
Definition mqtt_const.h:251
constexpr const char *const MQTT_TARGET_HUMIDITY_COMMAND_TOPIC
Definition mqtt_const.h:235
constexpr const char *const MQTT_MIN_TEMP
Definition mqtt_const.h:115
constexpr const char *const MQTT_FAN_MODE_STATE_TOPIC
Definition mqtt_const.h:86
constexpr const char *const MQTT_TARGET_TEMPERATURE_STEP
Definition mqtt_const.h:238
constexpr const char *const MQTT_PRESET_MODE_STATE_TOPIC
Definition mqtt_const.h:183
constexpr const char *const MQTT_TEMPERATURE_LOW_STATE_TOPIC
Definition mqtt_const.h:248
constexpr const char *const MQTT_TEMPERATURE_HIGH_STATE_TOPIC
Definition mqtt_const.h:244
constexpr const char *const MQTT_CURRENT_TEMPERATURE_STEP
Definition mqtt_const.h:54
constexpr const char *const MQTT_ACTION_TOPIC
Definition mqtt_const.h:13
constexpr const char *const MQTT_FAN_MODE_COMMAND_TOPIC
Definition mqtt_const.h:84
constexpr const char *const MQTT_PRESET_MODE_COMMAND_TOPIC
Definition mqtt_const.h:182
constexpr const char *const MQTT_MAX_HUMIDITY
Definition mqtt_const.h:109
constexpr const char *const MQTT_MODE_STATE_TOPIC
Definition mqtt_const.h:120
constexpr const char *const MQTT_MAX_TEMP
Definition mqtt_const.h:111
constexpr const char *const MQTT_MODES
Definition mqtt_const.h:121
constexpr const char *const MQTT_MODE_COMMAND_TOPIC
Definition mqtt_const.h:118
constexpr const char *const MQTT_SWING_MODE_COMMAND_TOPIC
Definition mqtt_const.h:231
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string value_accuracy_to_string(float value, int8_t accuracy_decimals)
Create a string from a value and an accuracy in decimals.
Definition helpers.cpp:339
optional< T > parse_number(const char *str)
Parse an unsigned decimal number from a null-terminated string.
Definition helpers.h:291
Simple Helper struct used for Home Assistant MQTT send_discovery().
bool command_topic
If the command topic should be included. Default to true.
bool state_topic
If the state topic should be included. Defaults to true.