mirror of
https://github.com/esphome/esphome.git
synced 2026-10-01 17:00:21 +00:00
[sensor] Remove USE_SENSOR_FILTER guard from SensorRawStateTrigger
add_on_raw_state_callback is always available now (delegates to callback_ without filters). SensorRawStateTrigger doesn't need the guard, and on_raw_value doesn't need to set USE_SENSOR_FILTER. Without filters raw == filtered, so the trigger fires with the correct value either way — no wasted RAM on filter infrastructure.
This commit is contained in:
@@ -901,7 +901,6 @@ async def _build_sensor_automations(var, config):
|
||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||
await automation.build_automation(trigger, [(float, "x")], conf)
|
||||
for conf in config.get(CONF_ON_RAW_VALUE, []):
|
||||
cg.add_define("USE_SENSOR_FILTER")
|
||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||
await automation.build_automation(trigger, [(float, "x")], conf)
|
||||
for conf in config.get(CONF_ON_VALUE_RANGE, []):
|
||||
|
||||
@@ -13,14 +13,12 @@ class SensorStateTrigger : public Trigger<float> {
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef USE_SENSOR_FILTER
|
||||
class SensorRawStateTrigger : public Trigger<float> {
|
||||
public:
|
||||
explicit SensorRawStateTrigger(Sensor *parent) {
|
||||
parent->add_on_raw_state_callback([this](float value) { this->trigger(value); });
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename... Ts> class SensorPublishAction : public Action<Ts...> {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user