ESPHome 2025.12.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.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE)) {
21 root[MQTT_CURRENT_TEMPERATURE_TOPIC] = this->get_current_temperature_state_topic();
22 }
23 // current_humidity_topic
24 if (traits.has_feature_flags(climate::CLIMATE_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
50 // temperature_low_command_topic
51 root[MQTT_TEMPERATURE_LOW_COMMAND_TOPIC] = this->get_target_temperature_low_command_topic();
52 // temperature_low_state_topic
53 root[MQTT_TEMPERATURE_LOW_STATE_TOPIC] = this->get_target_temperature_low_state_topic();
54 // temperature_high_command_topic
55 root[MQTT_TEMPERATURE_HIGH_COMMAND_TOPIC] = this->get_target_temperature_high_command_topic();
56 // temperature_high_state_topic
57 root[MQTT_TEMPERATURE_HIGH_STATE_TOPIC] = this->get_target_temperature_high_state_topic();
58 } else {
59 // temperature_command_topic
60 root[MQTT_TEMPERATURE_COMMAND_TOPIC] = this->get_target_temperature_command_topic();
61 // temperature_state_topic
62 root[MQTT_TEMPERATURE_STATE_TOPIC] = this->get_target_temperature_state_topic();
63 }
64
65 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY)) {
66 // target_humidity_command_topic
67 root[MQTT_TARGET_HUMIDITY_COMMAND_TOPIC] = this->get_target_humidity_command_topic();
68 // target_humidity_state_topic
69 root[MQTT_TARGET_HUMIDITY_STATE_TOPIC] = this->get_target_humidity_state_topic();
70 }
71
72 // min_temp
73 root[MQTT_MIN_TEMP] = traits.get_visual_min_temperature();
74 // max_temp
75 root[MQTT_MAX_TEMP] = traits.get_visual_max_temperature();
76 // target_temp_step
77 root[MQTT_TARGET_TEMPERATURE_STEP] = roundf(traits.get_visual_target_temperature_step() * 10) * 0.1;
78 // current_temp_step
79 root[MQTT_CURRENT_TEMPERATURE_STEP] = roundf(traits.get_visual_current_temperature_step() * 10) * 0.1;
80 // temperature units are always coerced to Celsius internally
81 root[MQTT_TEMPERATURE_UNIT] = "C";
82
83 // min_humidity
84 root[MQTT_MIN_HUMIDITY] = traits.get_visual_min_humidity();
85 // max_humidity
86 root[MQTT_MAX_HUMIDITY] = traits.get_visual_max_humidity();
87
88 if (traits.get_supports_presets() || !traits.get_supported_custom_presets().empty()) {
89 // preset_mode_command_topic
90 root[MQTT_PRESET_MODE_COMMAND_TOPIC] = this->get_preset_command_topic();
91 // preset_mode_state_topic
92 root[MQTT_PRESET_MODE_STATE_TOPIC] = this->get_preset_state_topic();
93 // presets
94 JsonArray presets = root["preset_modes"].to<JsonArray>();
95 if (traits.supports_preset(CLIMATE_PRESET_HOME))
96 presets.add("home");
97 if (traits.supports_preset(CLIMATE_PRESET_AWAY))
98 presets.add("away");
99 if (traits.supports_preset(CLIMATE_PRESET_BOOST))
100 presets.add("boost");
101 if (traits.supports_preset(CLIMATE_PRESET_COMFORT))
102 presets.add("comfort");
103 if (traits.supports_preset(CLIMATE_PRESET_ECO))
104 presets.add("eco");
105 if (traits.supports_preset(CLIMATE_PRESET_SLEEP))
106 presets.add("sleep");
107 if (traits.supports_preset(CLIMATE_PRESET_ACTIVITY))
108 presets.add("activity");
109 for (const auto &preset : traits.get_supported_custom_presets())
110 presets.add(preset);
111 }
112
113 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_ACTION)) {
114 // action_topic
115 root[MQTT_ACTION_TOPIC] = this->get_action_state_topic();
116 }
117
118 if (traits.get_supports_fan_modes()) {
119 // fan_mode_command_topic
120 root[MQTT_FAN_MODE_COMMAND_TOPIC] = this->get_fan_mode_command_topic();
121 // fan_mode_state_topic
122 root[MQTT_FAN_MODE_STATE_TOPIC] = this->get_fan_mode_state_topic();
123 // fan_modes
124 JsonArray fan_modes = root["fan_modes"].to<JsonArray>();
125 if (traits.supports_fan_mode(CLIMATE_FAN_ON))
126 fan_modes.add("on");
127 if (traits.supports_fan_mode(CLIMATE_FAN_OFF))
128 fan_modes.add("off");
129 if (traits.supports_fan_mode(CLIMATE_FAN_AUTO))
130 fan_modes.add("auto");
131 if (traits.supports_fan_mode(CLIMATE_FAN_LOW))
132 fan_modes.add("low");
133 if (traits.supports_fan_mode(CLIMATE_FAN_MEDIUM))
134 fan_modes.add("medium");
135 if (traits.supports_fan_mode(CLIMATE_FAN_HIGH))
136 fan_modes.add("high");
137 if (traits.supports_fan_mode(CLIMATE_FAN_MIDDLE))
138 fan_modes.add("middle");
139 if (traits.supports_fan_mode(CLIMATE_FAN_FOCUS))
140 fan_modes.add("focus");
141 if (traits.supports_fan_mode(CLIMATE_FAN_DIFFUSE))
142 fan_modes.add("diffuse");
143 if (traits.supports_fan_mode(CLIMATE_FAN_QUIET))
144 fan_modes.add("quiet");
145 for (const auto &fan_mode : traits.get_supported_custom_fan_modes())
146 fan_modes.add(fan_mode);
147 }
148
149 if (traits.get_supports_swing_modes()) {
150 // swing_mode_command_topic
151 root[MQTT_SWING_MODE_COMMAND_TOPIC] = this->get_swing_mode_command_topic();
152 // swing_mode_state_topic
153 root[MQTT_SWING_MODE_STATE_TOPIC] = this->get_swing_mode_state_topic();
154 // swing_modes
155 JsonArray swing_modes = root["swing_modes"].to<JsonArray>();
156 if (traits.supports_swing_mode(CLIMATE_SWING_OFF))
157 swing_modes.add("off");
158 if (traits.supports_swing_mode(CLIMATE_SWING_BOTH))
159 swing_modes.add("both");
160 if (traits.supports_swing_mode(CLIMATE_SWING_VERTICAL))
161 swing_modes.add("vertical");
162 if (traits.supports_swing_mode(CLIMATE_SWING_HORIZONTAL))
163 swing_modes.add("horizontal");
164 }
165
166 config.state_topic = false;
167 config.command_topic = false;
168 // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
169}
171 auto traits = this->device_->get_traits();
172 this->subscribe(this->get_mode_command_topic(), [this](const std::string &topic, const std::string &payload) {
173 auto call = this->device_->make_call();
174 call.set_mode(payload);
175 call.perform();
176 });
177
178 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
180 this->subscribe(this->get_target_temperature_low_command_topic(),
181 [this](const std::string &topic, const std::string &payload) {
182 auto val = parse_number<float>(payload);
183 if (!val.has_value()) {
184 ESP_LOGW(TAG, "Can't convert '%s' to number!", payload.c_str());
185 return;
186 }
187 auto call = this->device_->make_call();
189 call.perform();
190 });
191 this->subscribe(this->get_target_temperature_high_command_topic(),
192 [this](const std::string &topic, const std::string &payload) {
193 auto val = parse_number<float>(payload);
194 if (!val.has_value()) {
195 ESP_LOGW(TAG, "Can't convert '%s' to number!", payload.c_str());
196 return;
197 }
198 auto call = this->device_->make_call();
200 call.perform();
201 });
202 } else {
203 this->subscribe(this->get_target_temperature_command_topic(),
204 [this](const std::string &topic, const std::string &payload) {
205 auto val = parse_number<float>(payload);
206 if (!val.has_value()) {
207 ESP_LOGW(TAG, "Can't convert '%s' to number!", payload.c_str());
208 return;
209 }
210 auto call = this->device_->make_call();
212 call.perform();
213 });
214 }
215
216 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY)) {
217 this->subscribe(this->get_target_humidity_command_topic(),
218 [this](const std::string &topic, const std::string &payload) {
219 auto val = parse_number<float>(payload);
220 if (!val.has_value()) {
221 ESP_LOGW(TAG, "Can't convert '%s' to number!", payload.c_str());
222 return;
223 }
224 auto call = this->device_->make_call();
226 call.perform();
227 });
228 }
229
230 if (traits.get_supports_presets() || !traits.get_supported_custom_presets().empty()) {
231 this->subscribe(this->get_preset_command_topic(), [this](const std::string &topic, const std::string &payload) {
232 auto call = this->device_->make_call();
233 call.set_preset(payload);
234 call.perform();
235 });
236 }
237
238 if (traits.get_supports_fan_modes()) {
239 this->subscribe(this->get_fan_mode_command_topic(), [this](const std::string &topic, const std::string &payload) {
240 auto call = this->device_->make_call();
241 call.set_fan_mode(payload);
242 call.perform();
243 });
244 }
245
246 if (traits.get_supports_swing_modes()) {
247 this->subscribe(this->get_swing_mode_command_topic(), [this](const std::string &topic, const std::string &payload) {
248 auto call = this->device_->make_call();
249 call.set_swing_mode(payload);
250 call.perform();
251 });
252 }
253
254 this->device_->add_on_state_callback([this](Climate & /*unused*/) { this->publish_state_(); });
255}
258std::string MQTTClimateComponent::component_type() const { return "climate"; }
259const EntityBase *MQTTClimateComponent::get_entity() const { return this->device_; }
260
262 auto traits = this->device_->get_traits();
263 // mode
264 const char *mode_s;
265 switch (this->device_->mode) {
266 case CLIMATE_MODE_OFF:
267 mode_s = "off";
268 break;
270 mode_s = "auto";
271 break;
273 mode_s = "cool";
274 break;
276 mode_s = "heat";
277 break;
279 mode_s = "fan_only";
280 break;
281 case CLIMATE_MODE_DRY:
282 mode_s = "dry";
283 break;
285 mode_s = "heat_cool";
286 break;
287 default:
288 mode_s = "unknown";
289 }
290 bool success = true;
291 if (!this->publish(this->get_mode_state_topic(), mode_s))
292 success = false;
293 int8_t target_accuracy = traits.get_target_temperature_accuracy_decimals();
294 int8_t current_accuracy = traits.get_current_temperature_accuracy_decimals();
295 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE) &&
296 !std::isnan(this->device_->current_temperature)) {
297 std::string payload = value_accuracy_to_string(this->device_->current_temperature, current_accuracy);
298 if (!this->publish(this->get_current_temperature_state_topic(), payload))
299 success = false;
300 }
301 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
303 std::string payload = value_accuracy_to_string(this->device_->target_temperature_low, target_accuracy);
304 if (!this->publish(this->get_target_temperature_low_state_topic(), payload))
305 success = false;
306 payload = value_accuracy_to_string(this->device_->target_temperature_high, target_accuracy);
307 if (!this->publish(this->get_target_temperature_high_state_topic(), payload))
308 success = false;
309 } else {
310 std::string payload = value_accuracy_to_string(this->device_->target_temperature, target_accuracy);
311 if (!this->publish(this->get_target_temperature_state_topic(), payload))
312 success = false;
313 }
314
315 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY) &&
316 !std::isnan(this->device_->current_humidity)) {
317 std::string payload = value_accuracy_to_string(this->device_->current_humidity, 0);
318 if (!this->publish(this->get_current_humidity_state_topic(), payload))
319 success = false;
320 }
321 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY) &&
322 !std::isnan(this->device_->target_humidity)) {
323 std::string payload = value_accuracy_to_string(this->device_->target_humidity, 0);
324 if (!this->publish(this->get_target_humidity_state_topic(), payload))
325 success = false;
326 }
327
328 if (traits.get_supports_presets() || !traits.get_supported_custom_presets().empty()) {
329 std::string payload;
330 if (this->device_->preset.has_value()) {
331 switch (this->device_->preset.value()) {
333 payload = "none";
334 break;
336 payload = "home";
337 break;
339 payload = "away";
340 break;
342 payload = "boost";
343 break;
345 payload = "comfort";
346 break;
348 payload = "eco";
349 break;
351 payload = "sleep";
352 break;
354 payload = "activity";
355 break;
356 default:
357 payload = "unknown";
358 }
359 }
360 if (this->device_->has_custom_preset())
361 payload = this->device_->get_custom_preset();
362 if (!this->publish(this->get_preset_state_topic(), payload))
363 success = false;
364 }
365
366 if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_ACTION)) {
367 const char *payload;
368 switch (this->device_->action) {
370 payload = "off";
371 break;
373 payload = "cooling";
374 break;
376 payload = "heating";
377 break;
379 payload = "idle";
380 break;
382 payload = "drying";
383 break;
385 payload = "fan";
386 break;
387 default:
388 payload = "unknown";
389 }
390 if (!this->publish(this->get_action_state_topic(), payload))
391 success = false;
392 }
393
394 if (traits.get_supports_fan_modes()) {
395 std::string payload;
396 if (this->device_->fan_mode.has_value()) {
397 switch (this->device_->fan_mode.value()) {
398 case CLIMATE_FAN_ON:
399 payload = "on";
400 break;
401 case CLIMATE_FAN_OFF:
402 payload = "off";
403 break;
404 case CLIMATE_FAN_AUTO:
405 payload = "auto";
406 break;
407 case CLIMATE_FAN_LOW:
408 payload = "low";
409 break;
411 payload = "medium";
412 break;
413 case CLIMATE_FAN_HIGH:
414 payload = "high";
415 break;
417 payload = "middle";
418 break;
420 payload = "focus";
421 break;
423 payload = "diffuse";
424 break;
426 payload = "quiet";
427 break;
428 default:
429 payload = "unknown";
430 }
431 }
432 if (this->device_->has_custom_fan_mode())
433 payload = this->device_->get_custom_fan_mode();
434 if (!this->publish(this->get_fan_mode_state_topic(), payload))
435 success = false;
436 }
437
438 if (traits.get_supports_swing_modes()) {
439 const char *payload;
440 switch (this->device_->swing_mode) {
442 payload = "off";
443 break;
445 payload = "both";
446 break;
448 payload = "vertical";
449 break;
451 payload = "horizontal";
452 break;
453 default:
454 payload = "unknown";
455 }
456 if (!this->publish(this->get_swing_mode_state_topic(), payload))
457 success = false;
458 }
459
460 return success;
461}
462
463} // namespace mqtt
464} // namespace esphome
465
466#endif
467#endif // USE_MQTT
ClimateCall & set_target_temperature(float target_temperature)
Set the target temperature of the climate device.
Definition climate.cpp:267
ClimateCall & set_swing_mode(ClimateSwingMode swing_mode)
Set the swing mode of the climate device.
Definition climate.cpp:251
ClimateCall & set_target_temperature_low(float target_temperature_low)
Set the low point target temperature of the climate device.
Definition climate.cpp:272
ClimateCall & set_preset(ClimatePreset preset)
Set the preset of the climate device.
Definition climate.cpp:219
ClimateCall & set_fan_mode(ClimateFanMode fan_mode)
Set the fan mode of the climate device.
Definition climate.cpp:187
ClimateCall & set_target_humidity(float target_humidity)
Set the target humidity of the climate device.
Definition climate.cpp:282
ClimateCall & set_target_temperature_high(float target_temperature_high)
Set the high point target temperature of the climate device.
Definition climate.cpp:277
ClimateCall & set_mode(ClimateMode mode)
Set the mode of the climate device.
Definition climate.cpp:171
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:178
ClimateMode mode
The active mode of the climate device.
Definition climate.h:256
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
Definition climate.h:250
ClimateTraits get_traits()
Get the traits of this climate device with all overrides applied.
Definition climate.cpp:475
float target_temperature
The target temperature of the climate device.
Definition climate.h:237
float current_humidity
The current humidity of the climate device, as reported from the integration.
Definition climate.h:233
const char * get_custom_fan_mode() const
Get the active custom fan mode (read-only access).
Definition climate.h:265
ClimateSwingMode swing_mode
The active swing mode of the climate device.
Definition climate.h:262
float target_temperature_low
The minimum target temperature of the climate device, for climate devices with split target temperatu...
Definition climate.h:240
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:339
const char * get_custom_preset() const
Get the active custom preset (read-only access).
Definition climate.h:268
bool has_custom_preset() const
Check if a custom preset is currently active.
Definition climate.h:227
float current_temperature
The current temperature of the climate device, as reported from the integration.
Definition climate.h:230
ClimateAction action
The active state of the climate device.
Definition climate.h:259
ClimateCall make_call()
Make a climate device control call, this is used to control the climate device, see the ClimateCall d...
Definition climate.cpp:518
bool has_custom_fan_mode() const
Check if a custom fan mode is currently active.
Definition climate.h:224
optional< ClimatePreset > preset
The active preset of the climate device.
Definition climate.h:253
float target_humidity
The target humidity of the climate device.
Definition climate.h:247
float target_temperature_high
The maximum target temperature of the climate device, for climate devices with split target temperatu...
Definition climate.h:242
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_SUPPORTS_CURRENT_HUMIDITY
@ CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE
@ CLIMATE_SUPPORTS_CURRENT_TEMPERATURE
@ CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE
@ 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:384
optional< T > parse_number(const char *str)
Parse an unsigned decimal number from a null-terminated string.
Definition helpers.h:522
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.