ESPHome  2024.11.0
tuya_number.h
Go to the documentation of this file.
1 #pragma once
2 
8 
9 namespace esphome {
10 namespace tuya {
11 
12 class TuyaNumber : public number::Number, public Component {
13  public:
14  void setup() override;
15  void dump_config() override;
16  void set_number_id(uint8_t number_id) { this->number_id_ = number_id; }
17  void set_write_multiply(float factor) { multiply_by_ = factor; }
19  void set_datapoint_initial_value(float value) { this->initial_value_ = value; }
20  void set_restore_value(bool restore_value) { this->restore_value_ = restore_value; }
21 
22  void set_tuya_parent(Tuya *parent) { this->parent_ = parent; }
23 
24  protected:
25  void control(float value) override;
26 
28  uint8_t number_id_{0};
29  float multiply_by_{1.0};
32  bool restore_value_{false};
33 
35 };
36 
37 } // namespace tuya
38 } // namespace esphome
void setup() override
Definition: tuya_number.cpp:9
ESPPreferenceObject pref_
Definition: tuya_number.h:34
void set_datapoint_initial_value(float value)
Definition: tuya_number.h:19
TuyaDatapointType
Definition: tuya.h:19
void set_datapoint_type(TuyaDatapointType type)
Definition: tuya_number.h:18
void control(float value) override
Definition: tuya_number.cpp:64
void set_write_multiply(float factor)
Definition: tuya_number.h:17
Base-class for all numbers.
Definition: number.h:39
uint8_t type
void dump_config() override
Definition: tuya_number.cpp:78
void set_restore_value(bool restore_value)
Definition: tuya_number.h:20
optional< float > initial_value_
Definition: tuya_number.h:31
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_tuya_parent(Tuya *parent)
Definition: tuya_number.h:22
optional< TuyaDatapointType > type_
Definition: tuya_number.h:30
void set_number_id(uint8_t number_id)
Definition: tuya_number.h:16