ESPHome 2025.5.2
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
pipsolar_output.h
Go to the documentation of this file.
1#pragma once
2
3#include "../pipsolar.h"
6
7#include <vector>
8
9namespace esphome {
10namespace pipsolar {
11
12class Pipsolar;
13
15 public:
17 void set_parent(Pipsolar *parent) { this->parent_ = parent; }
18 void set_set_command(const std::string &command) { this->set_command_ = command; };
19 void set_possible_values(std::vector<float> possible_values) { this->possible_values_ = std::move(possible_values); }
20 void set_value(float value) { this->write_state(value); };
21
22 protected:
23 void write_state(float state) override;
24 std::string set_command_;
26 std::vector<float> possible_values_;
27};
28
29template<typename... Ts> class SetOutputAction : public Action<Ts...> {
30 public:
32
33 TEMPLATABLE_VALUE(float, level)
34
35 void play(Ts... x) override { this->output_->set_value(this->level_.value(x...)); }
36
37 protected:
39};
40
41} // namespace pipsolar
42} // namespace esphome
virtual void play(Ts... x)=0
Base class for all output components that can output a variable level, like PWM.
void set_parent(Pipsolar *parent)
void set_possible_values(std::vector< float > possible_values)
void set_set_command(const std::string &command)
void write_state(float state) override
std::vector< float > possible_values_
TEMPLATABLE_VALUE(float, level) void play(Ts... x) override
SetOutputAction(PipsolarOutput *output)
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5