ratgdo / esphome-ratgdo

ratgdo for ESPHome
GNU General Public License v2.0
357 stars 108 forks source link

Request: "Door Status" on sooner while opening rather than open? #80

Closed alexruffell closed 1 year ago

alexruffell commented 1 year ago

I use the door status output to turn on parking lasers that help with parking the cars in the right spot. I often enter the garage before the door is even fully up so the laser turns on a bit too late. It would be nice if the door status changed sooner as soon as the door starts opening. If you think about it, whether the door is partially or fully open, it is open and someone can enter. If there are use cases that would require that status to be high only when the door is fully open, then it would be nice for this to be configurable.

I am also happy to modify the code on my end as I need to modify it for other things such as being able to turn on the parking lasers manually when needed (mostly troubleshooting). I have also run into issues with the naming of entities (mostly the door as I want it to just use the name of the device since I called it "Overhead Garage Door") which led me to not use the 'package' feature.

mariusmuja commented 1 year ago

Can you give a little more detail on what door status you're using? Is it the state of the door cover entity in home assistant? Something else?

alexruffell commented 1 year ago

On the ratdgo board there are two status outputs that are high when the door is open and when an obstruction is detected. In the base.yaml file, this is where they are defined:

  - platform: gpio
    id: "${id_prefix}_status_door"
    internal: true
    pin:
      number: ${status_door_pin}  # D0 output door status, HIGH for open, LOW for closed
      mode:
        output: true
    name: "Status door"
    entity_category: diagnostic
  - platform: gpio
    id: "${id_prefix}_status_obstruction"
    internal: true
    pin:
      number: ${status_obstruction_pin}  # D8 output for obstruction status, HIGH for obstructed, LOW for clear
      mode:
        output: true
    name: "Status obstruction"
    entity_category: diagnostic

And here is where the status is changed based on the door being open/closed:

cover:
  - platform: ratgdo
    id: ${id_prefix}_garage_door
    device_class: garage
    name: " "
    ratgdo_id: ${id_prefix}
    on_closed:
      - switch.turn_off: ${id_prefix}_status_door
    on_open:
      - switch.turn_on: ${id_prefix}_status_door

If only I could use "on_opening" instead of "on_open" I would be set... but I don't believe that option exists at all in ESPHome even though those are existing states.

mariusmuja commented 1 year ago

Ahh, right! I'm using a trimmed down version of base.yaml and I forgot about those entities.

Yes, I agree on_opening and on_closing triggers could be useful, we can add those.

alexruffell commented 1 year ago

@mariusmuja Thank you for adding it, and so quickly too!

audiato commented 1 year ago

Just wanted to check if this has been merged yet? Mine doesn't show an "opening" status at all at the moment - seems to go straight from closed to open.