ESPHome 2026.1.4
Loading...
Searching...
No Matches
mqtt_time.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_MQTT
6#ifdef USE_DATETIME_TIME
7
9#include "mqtt_component.h"
10
11namespace esphome::mqtt {
12
14 public:
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(uint8_t hour, uint8_t minute, uint8_t second);
32
33 protected:
34 const char *component_type() const override;
35 const EntityBase *get_entity() const override;
36
38};
39
40} // namespace esphome::mqtt
41
42#endif // USE_DATETIME_DATE
43#endif // USE_MQTT
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
MQTTTimeComponent(datetime::TimeEntity *time)
Construct this MQTTTimeComponent instance with the provided friendly_name and time.
Definition mqtt_time.cpp:17
datetime::TimeEntity * time_
Definition mqtt_time.h:37
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
const EntityBase * get_entity() const override
void setup() override
Override setup.
Definition mqtt_time.cpp:19
bool publish_state(uint8_t hour, uint8_t minute, uint8_t second)
Definition mqtt_time.cpp:55
const char * component_type() const override
uint8_t second
uint8_t minute
uint8_t hour
Simple Helper struct used for Home Assistant MQTT send_discovery().