ESPHome 2025.5.0
Loading...
Searching...
No Matches
mqtt_datetime.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_MQTT
6#ifdef USE_DATETIME_DATETIME
7
9#include "mqtt_component.h"
10
11namespace esphome {
12namespace mqtt {
13
15 public:
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(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second);
33
34 protected:
35 std::string component_type() const override;
36 const EntityBase *get_entity() const override;
37
39};
40
41} // namespace mqtt
42} // namespace esphome
43
44#endif // USE_DATETIME_DATETIME
45#endif // USE_MQTT
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...
std::string component_type() const override
bool publish_state(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second)
datetime::DateTimeEntity * datetime_
MQTTDateTimeComponent(datetime::DateTimeEntity *datetime)
Construct this MQTTDateTimeComponent instance with the provided friendly_name and time.
const EntityBase * get_entity() const override
void setup() override
Override setup.
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
uint8_t month
Definition date_entity.h:1
uint16_t year
Definition date_entity.h:0
uint8_t day
Definition date_entity.h:2
uint8_t second
uint8_t minute
uint8_t hour
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().