ESPHome 2025.5.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 {
8namespace template_ {
9
10template<typename... Ts> class TemplateValvePublishAction : public Action<Ts...>, public Parented<TemplateValve> {
11 TEMPLATABLE_VALUE(float, position)
12 TEMPLATABLE_VALUE(valve::ValveOperation, current_operation)
13
14 void play(Ts... x) override {
15 if (this->position_.has_value())
16 this->parent_->position = this->position_.value(x...);
17 if (this->current_operation_.has_value())
18 this->parent_->current_operation = this->current_operation_.value(x...);
19 this->parent_->publish_state();
20 }
21};
22
23} // namespace template_
24} // namespace esphome
virtual void play(Ts... x)=0
Helper class to easily give an object a parent of type T.
Definition helpers.h:538
float position
Definition cover.h:0
ValveOperation
Enum encoding the current operation of a valve.
Definition valve.h:75
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5