ESPHome  2024.10.2
mqtt_date.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/defines.h"
4 
5 #ifdef USE_MQTT
6 #ifdef USE_DATETIME_DATE
7 
9 #include "mqtt_component.h"
10 
11 namespace esphome {
12 namespace 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);
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_DATE
45 #endif // USE_MQTT
uint16_t year
Definition: date_entity.h:122
bool publish_state(uint16_t year, uint8_t month, uint8_t day)
Definition: mqtt_date.cpp:56
void setup() override
Override setup.
Definition: mqtt_date.cpp:20
datetime::DateEntity * date_
Definition: mqtt_date.h:38
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
Definition: mqtt_date.cpp:46
uint8_t day
Definition: date_entity.h:124
Simple Helper struct used for Home Assistant MQTT send_discovery().
const EntityBase * get_entity() const override
Definition: mqtt_date.cpp:44
bool send_initial_state() override
Definition: mqtt_date.cpp:49
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
std::string component_type() const override
Definition: mqtt_date.cpp:43
MQTTDateComponent(datetime::DateEntity *date)
Construct this MQTTDateComponent instance with the provided friendly_name and date.
Definition: mqtt_date.cpp:18
uint8_t month
Definition: date_entity.h:123
MQTTComponent is the base class for all components that interact with MQTT to expose certain function...