Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pulse Counter Sensor
#1
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:

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)