mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-18 20:23:27 +02:00
369d175694
* Create Protobuf Plugin for automatically generating native API stubs * Format * Delete api.proto * Cleanup, use no_delay conditionally * Updates * Update * Lint * Lint * Fixes * Camera * CustomAPIDevice * Fix negative VarInt, Add User-defined services arrays * Home Assistant Event * Fixes * Update custom_api_device.h
27 lines
717 B
C++
27 lines
717 B
C++
#include "homeassistant_time.h"
|
|
#include "esphome/core/log.h"
|
|
|
|
namespace esphome {
|
|
namespace homeassistant {
|
|
|
|
static const char *TAG = "homeassistant.time";
|
|
|
|
void HomeassistantTime::dump_config() {
|
|
ESP_LOGCONFIG(TAG, "Home Assistant Time:");
|
|
ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
|
|
}
|
|
float HomeassistantTime::get_setup_priority() const { return setup_priority::DATA; }
|
|
void HomeassistantTime::setup() {
|
|
global_homeassistant_time = this;
|
|
|
|
this->set_interval(15 * 60 * 1000, []() {
|
|
// re-request time every 15 minutes
|
|
api::global_api_server->request_time();
|
|
});
|
|
}
|
|
|
|
HomeassistantTime *global_homeassistant_time = nullptr;
|
|
|
|
} // namespace homeassistant
|
|
} // namespace esphome
|