09-23-2024, 10:19 PM
ESPHome has Pulse Counter Sensor.
In yaml I can set count_mode to increment or decrement.
Can I change count_mode in runtime
My yaml file:
I want add precise position to "Feedback Cover" by counting impulses from motor sensor.
But this konfiguration always count up in opening and closing cover.
In yaml I can set count_mode to increment or decrement.
Can I change count_mode in runtime
My yaml file:
Code:
sensor:
- platform: pulse_counter
name: "impulse_counter"
id: motor_pulse_counter
pin:
...
update_interval: 1s
total:
name: "Total"
binary_sensor:
- platform: gpio
name: "input01"
id: opening
pin: ...
on_press:
then:
- lambda: |
id(motor_pulse_counter).set_rising_edge_mode(esphome::pulse_counter::PulseCounterCountMode::PULSE_COUNTER_INCREMENT);
- platform: gpio
name: "input02"
id: closing
pin: ...
on_press:
then:
- lambda: |
id(motor_pulse_counter).set_rising_edge_mode(esphome::pulse_counter::PulseCounterCountMode::PULSE_COUNTER_DECREMENT);
I want add precise position to "Feedback Cover" by counting impulses from motor sensor.
But this konfiguration always count up in opening and closing cover.