ESPHome 2025.5.0
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 {
12namespace mqtt {
13
15 public:
20 explicit MQTTNumberComponent(number::Number *number);
21
22 // ========== INTERNAL METHODS ==========
23 // (In most use cases you won't need these)
25 void setup() override;
26 void dump_config() override;
27
28 void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override;
29
30 bool send_initial_state() override;
31
32 bool publish_state(float value);
33
34 protected:
36 std::string component_type() const override;
37 const EntityBase *get_entity() const override;
38
40};
41
42} // namespace mqtt
43} // namespace esphome
44
45#endif
46#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 EntityBase * get_entity() const override
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
std::string component_type() const override
Override for MQTTComponent, returns "number".
Base-class for all numbers.
Definition number.h:39
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
Simple Helper struct used for Home Assistant MQTT send_discovery().