ESPHome 2026.1.4
Loading...
Searching...
No Matches
mqtt_number.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_MQTT
6#ifdef USE_NUMBER
7
9#include "mqtt_component.h"
10
11namespace esphome::mqtt {
12
14 public:
19 explicit MQTTNumberComponent(number::Number *number);
20
21 // ========== INTERNAL METHODS ==========
22 // (In most use cases you won't need these)
24 void setup() override;
25 void dump_config() override;
26
27 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
28
29 bool send_initial_state() override;
30
31 bool publish_state(float value);
32
33 protected:
35 const char *component_type() const override;
36 const EntityBase *get_entity() const override;
37
39};
40
41} // namespace esphome::mqtt
42
43#endif
44#endif // USE_MQTT
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
MQTTNumberComponent(number::Number *number)
Construct this MQTTNumberComponent instance with the provided friendly_name and number.
void setup() override
Override setup.
const char * component_type() const override
Override for MQTTComponent, returns "number".
const EntityBase * get_entity() const override
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
Base-class for all numbers.
Definition number.h:29
Simple Helper struct used for Home Assistant MQTT send_discovery().