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