ESPHome  2024.11.1
automation.h
Go to the documentation of this file.
1 #pragma once
2 #include <utility>
3 
5 #include "ezo.h"
6 
7 namespace esphome {
8 namespace ezo {
9 
10 class LedTrigger : public Trigger<bool> {
11  public:
12  explicit LedTrigger(EZOSensor *ezo) {
13  ezo->add_led_state_callback([this](bool value) { this->trigger(value); });
14  }
15 };
16 
17 class CustomTrigger : public Trigger<std::string> {
18  public:
19  explicit CustomTrigger(EZOSensor *ezo) {
20  ezo->add_custom_callback([this](std::string value) { this->trigger(std::move(value)); });
21  }
22 };
23 
24 class TTrigger : public Trigger<std::string> {
25  public:
26  explicit TTrigger(EZOSensor *ezo) {
27  ezo->add_t_callback([this](std::string value) { this->trigger(std::move(value)); });
28  }
29 };
30 
31 class CalibrationTrigger : public Trigger<std::string> {
32  public:
33  explicit CalibrationTrigger(EZOSensor *ezo) {
34  ezo->add_calibration_callback([this](std::string value) { this->trigger(std::move(value)); });
35  }
36 };
37 
38 class SlopeTrigger : public Trigger<std::string> {
39  public:
40  explicit SlopeTrigger(EZOSensor *ezo) {
41  ezo->add_slope_callback([this](std::string value) { this->trigger(std::move(value)); });
42  }
43 };
44 
45 class DeviceInformationTrigger : public Trigger<std::string> {
46  public:
48  ezo->add_device_infomation_callback([this](std::string value) { this->trigger(std::move(value)); });
49  }
50 };
51 
52 } // namespace ezo
53 } // namespace esphome
CustomTrigger(EZOSensor *ezo)
Definition: automation.h:19
void add_led_state_callback(std::function< void(bool)> &&callback)
Definition: ezo.h:84
This class implements support for the EZO circuits in i2c mode.
Definition: ezo.h:36
TTrigger(EZOSensor *ezo)
Definition: automation.h:26
void trigger(Ts... x)
Inform the parent automation that the event has triggered.
Definition: automation.h:95
void add_calibration_callback(std::function< void(std::string)> &&callback)
Definition: ezo.h:77
CalibrationTrigger(EZOSensor *ezo)
Definition: automation.h:33
void add_slope_callback(std::function< void(std::string)> &&callback)
Definition: ezo.h:60
SlopeTrigger(EZOSensor *ezo)
Definition: automation.h:40
LedTrigger(EZOSensor *ezo)
Definition: automation.h:12
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void add_custom_callback(std::function< void(std::string)> &&callback)
Definition: ezo.h:88
void add_t_callback(std::function< void(std::string)> &&callback)
Definition: ezo.h:68
void add_device_infomation_callback(std::function< void(std::string)> &&callback)
Definition: ezo.h:48