ESPHome  2024.12.2
sntp_component.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 namespace esphome {
7 namespace sntp {
8 
16  public:
17  SNTPComponent(const std::vector<std::string> &servers) : servers_(servers) {}
18 
19  // Note: set_servers() has been removed and replaced by a constructor - calling set_servers after setup would
20  // have had no effect anyway, and making the strings immutable avoids the need to strdup their contents.
21 
22  void setup() override;
23  void dump_config() override;
24  float get_setup_priority() const override { return setup_priority::BEFORE_CONNECTION; }
25 
26  void update() override;
27  void loop() override;
28 
29  protected:
30  std::vector<std::string> servers_;
31  bool has_time_{false};
32 };
33 
34 } // namespace sntp
35 } // namespace esphome
const float BEFORE_CONNECTION
For components that should be initialized after WiFi and before API is connected. ...
Definition: component.cpp:25
std::vector< std::string > servers_
The RealTimeClock class exposes common timekeeping functions via the device&#39;s local real-time clock...
SNTPComponent(const std::vector< std::string > &servers)
The SNTP component allows you to configure local timekeeping via Simple Network Time Protocol...
float get_setup_priority() const override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7