ESPHome 2026.1.4
Loading...
Searching...
No Matches
mqtt_date.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_MQTT
6#ifdef USE_DATETIME_DATE
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(uint16_t year, uint8_t month, uint8_t day);
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...
MQTTDateComponent(datetime::DateEntity *date)
Construct this MQTTDateComponent instance with the provided friendly_name and date.
Definition mqtt_date.cpp:17
const char * component_type() const override
const EntityBase * get_entity() const override
datetime::DateEntity * date_
Definition mqtt_date.h:37
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
bool publish_state(uint16_t year, uint8_t month, uint8_t day)
Definition mqtt_date.cpp:55
void setup() override
Override setup.
Definition mqtt_date.cpp:19
uint8_t month
Definition date_entity.h:1
uint16_t year
Definition date_entity.h:0
uint8_t day
Definition date_entity.h:2
Simple Helper struct used for Home Assistant MQTT send_discovery().