ESPHome 2025.12.0
Loading...
Searching...
No Matches
automation.h
Go to the documentation of this file.
1#pragma once
2
3#include "template_valve.h"
4
6
7namespace esphome::template_ {
8
9template<typename... Ts> class TemplateValvePublishAction : public Action<Ts...>, public Parented<TemplateValve> {
10 TEMPLATABLE_VALUE(float, position)
11 TEMPLATABLE_VALUE(valve::ValveOperation, current_operation)
12
13 void play(const Ts &...x) override {
14 if (this->position_.has_value())
15 this->parent_->position = this->position_.value(x...);
16 if (this->current_operation_.has_value())
17 this->parent_->current_operation = this->current_operation_.value(x...);
18 this->parent_->publish_state();
19 }
20};
21
22} // namespace esphome::template_
virtual void play(const Ts &...x)=0
Helper class to easily give an object a parent of type T.
Definition helpers.h:932
float position
Definition cover.h:0
ValveOperation
Enum encoding the current operation of a valve.
Definition valve.h:76
uint16_t x
Definition tt21100.cpp:5