1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-16 10:12:21 +01:00

String manipulation filters for text sensors (#2393)

* initial text sensor filter POC

* fixed verbose logging

* add append, prepend, substitute filters

* add to lower, get to upper working without dummy

* clang lint

* more linting...

* std::move append and prepend filters

* fix verbose filter::input logging

* value.c_str() in input print

* lambda filter verbose log fix

* correct log tag, neaten to upper and to lower

* add on_raw_value automation/trigger
This commit is contained in:
WeekendWarrior1
2021-09-30 07:25:06 +10:00
committed by GitHub
parent 4f5e4f3b86
commit 3dfc8d4291
6 changed files with 373 additions and 5 deletions

View File

@@ -16,6 +16,13 @@ class TextSensorStateTrigger : public Trigger<std::string> {
}
};
class TextSensorStateRawTrigger : public Trigger<std::string> {
public:
explicit TextSensorStateRawTrigger(TextSensor *parent) {
parent->add_on_raw_state_callback([this](std::string value) { this->trigger(std::move(value)); });
}
};
template<typename... Ts> class TextSensorStateCondition : public Condition<Ts...> {
public:
explicit TextSensorStateCondition(TextSensor *parent) : parent_(parent) {}