9#ifdef USE_DATETIME_TIME
22 if (root[ESPHOME_F(
"hour")].is<uint8_t>()) {
23 call.set_hour(root[ESPHOME_F(
"hour")]);
25 if (root[ESPHOME_F(
"minute")].is<uint8_t>()) {
26 call.set_minute(root[ESPHOME_F(
"minute")]);
28 if (root[ESPHOME_F(
"second")].is<uint8_t>()) {
29 call.set_second(root[ESPHOME_F(
"second")]);
53 char topic_buf[MQTT_DEFAULT_TOPIC_MAX_LEN];
56 root[ESPHOME_F(
"hour")] =
hour;
57 root[ESPHOME_F(
"minute")] =
minute;
58 root[ESPHOME_F(
"second")] =
second;
void add_on_state_callback(F &&callback)
MQTTTopicSource command_topic_source_() const
The command topic as a subscription source. A lambda topic is read once and copied,...
void subscribe_json(T &&topic, F &&callback, uint8_t qos=0)
Subscribe to a MQTT topic and automatically parse JSON payload.
bool publish_json(const std::string &topic, const json::json_build_t &f)
Construct and send a JSON MQTT message.
StringRef get_state_topic_to_(std::span< char, MQTT_DEFAULT_TOPIC_MAX_LEN > buf) const
Get the MQTT state topic into a buffer (no heap allocation for non-lambda custom topics).
MQTTTimeComponent(datetime::TimeEntity *time)
Construct this MQTTTimeComponent instance with the provided friendly_name and time.
datetime::TimeEntity * time_
bool send_initial_state() override
void dump_config() override
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
void setup() override
Override setup.
bool publish_state(uint8_t hour, uint8_t minute, uint8_t second)
ESPHOME_LOG_TAG(TAG, "alarm_control_panel")
MQTT_COMPONENT_TYPE(MQTTAlarmControlPanelComponent, "alarm_control_panel") const EntityBase *MQTTAlarmControlPanelComponent
Simple Helper struct used for Home Assistant MQTT send_discovery().