ESPHome  2024.10.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  void setup() override;
18  void dump_config() override;
20  void set_servers(const std::string &server_1, const std::string &server_2, const std::string &server_3) {
21  this->server_1_ = server_1;
22  this->server_2_ = server_2;
23  this->server_3_ = server_3;
24  }
25  float get_setup_priority() const override { return setup_priority::BEFORE_CONNECTION; }
26 
27  void update() override;
28  void loop() override;
29 
30  protected:
31  std::string server_1_;
32  std::string server_2_;
33  std::string server_3_;
34  bool has_time_{false};
35 };
36 
37 } // namespace sntp
38 } // namespace esphome
const float BEFORE_CONNECTION
For components that should be initialized after WiFi and before API is connected. ...
Definition: component.cpp:25
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock...
void set_servers(const std::string &server_1, const std::string &server_2, const std::string &server_3)
Change the servers used by SNTP for timekeeping.
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