ESPHome  2022.9.2
automation.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include "tuya.h"
6 
7 namespace esphome {
8 namespace tuya {
9 
10 class TuyaDatapointUpdateTrigger : public Trigger<TuyaDatapoint> {
11  public:
12  explicit TuyaDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id) {
13  parent->register_listener(sensor_id, [this](const TuyaDatapoint &dp) { this->trigger(dp); });
14  }
15 };
16 
17 class TuyaRawDatapointUpdateTrigger : public Trigger<std::vector<uint8_t>> {
18  public:
19  explicit TuyaRawDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id);
20 };
21 
23  public:
24  explicit TuyaBoolDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id);
25 };
26 
28  public:
29  explicit TuyaIntDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id);
30 };
31 
32 class TuyaUIntDatapointUpdateTrigger : public Trigger<uint32_t> {
33  public:
34  explicit TuyaUIntDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id);
35 };
36 
37 class TuyaStringDatapointUpdateTrigger : public Trigger<std::string> {
38  public:
39  explicit TuyaStringDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id);
40 };
41 
42 class TuyaEnumDatapointUpdateTrigger : public Trigger<uint8_t> {
43  public:
44  explicit TuyaEnumDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id);
45 };
46 
47 class TuyaBitmaskDatapointUpdateTrigger : public Trigger<uint32_t> {
48  public:
49  explicit TuyaBitmaskDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id);
50 };
51 
52 } // namespace tuya
53 } // namespace esphome
void register_listener(uint8_t datapoint_id, const std::function< void(TuyaDatapoint)> &func)
Definition: tuya.cpp:621
TuyaDatapointUpdateTrigger(Tuya *parent, uint8_t sensor_id)
Definition: automation.h:12
void trigger(Ts... x)
Inform the parent automation that the event has triggered.
Definition: automation.h:95
Definition: a4988.cpp:4