Momentary switch programming

I’ve been trying to do the “garage door” momentary switch programming to no avail. If it was ladder logic or PLC programming I’d have no problem. There have been many great suggestions from using the Momentary Switch from GitHub to using a blueprint created by another user. But while trying to learn how to use YAML, the process is becoming mind numbing. Can anybody define in maybe a step by step instruction, where files go and what is the procedure to complete this? Hitting a few brick walls while trying to learn YAML. Thanks.

While I could do some wild guess what you mean by that, it would be useless because we don ot now what entities you have to work with. Are you saying you have a single physical momentary switch that you want to use to control a cover entity? What behavior would you want exactly (and why: multiple buttons is so much more user friendly). And does the momentary button provide a button entity, or an event entity, or no entitity, just events? Does the cover entity provide position information, or is is a remote without feedback?

Aww and I used to get mad at engineers when they didn’t give me enough information lol. I have a ZOOZ Smart Plug ZEN04 800LR I am trying to control. I have it setup to turn on and off through Home Assistant. I have a 120VAC relay wired with a 2 prong male feeding the coil of the relay. I will then use the Smart Plug to turn the relay on and then run two wires to an open set of contacts on the relay. I’m not sure what else is needed as I’m new to this still (give me a PLC or have me hard wire it and it’d be simple to me. I’m currently looking at my daughters dryer and reading an electrical schematic which is no problem for me. Go figure).

I would like to use it as a one touch, momentary switch, I actually had a working configuration using UP-Link and a Kasa Smart Plug but the Kasa units were not dependabile. I had a working model but deleted the entire button and was unable

I still struggle a bit to understand how you want to control a garage door with it, but if I’m correct it is one simple automation. There are all in one controllable relay units, so this seems like a bit overcomplicated. But if this is what you have lying around and don’t want to spend money on something else, I would create an automation that turns off the zooz when it is turned on, possibly with a small delay like a second. Then turning in the zooz will always be a short pulse. You could also create a new entity that is like a button if you do not like the switch interface using a template button.

The automation to turn the zooz on/off switch into a momentary switch would be something like this. If you add a new empty automation in the gui, switch to yaml mode in the top right menu and paste this in the editor, then all you need is to replace zooz with the actual entity id:

trigger:
  - platform: state
    entity_id: switch.zooz
    to: "on"
    for:
      hours: 0
      minutes: 0
      seconds: 1
condition: []
action:
  - service: switch.turn_off
    target:
      entity_id: switch.zooz
    data: {}

Thanks. Yes, without purchasing a new device, I have a 120VAC relay and a Z_Wave Smart Plug. I planned on just paralleling the low voltage door opener wiring that goes to the garage door button on the garage wall. But I needed a momentary operation.

The above automation turns the relay off 1 second after you turn it on. That makes it momentary in my book.

And you would be correct. I just have to figure out where to put it and learn YAML. I’m 68 years old, retired, with 21 years as a SCADA Technician in the water filtration industry. I remember the frustration when I had to teach myself various PLC programming, instrumentation setup and programming, and teach myself the HMI software. My company would not provide any training (my manager I think wanted to see failure and hire an outside integration company. He recently retired and now consults for this integration company). But I taught myself at work which was a win-win. Being retired I can’t seem to be disciplined enough to teach myself YAML (which I am trying to) and how it works with Home Assistant. Home Assistant’s plug-n-play ability is a big help but there are limitations. There is a Momentary in HACS which I’ve installed but have to figure out how to use it. So its probably going to be a long process, but as lone as I’m moving forward. Thanks.

I gave a quick idea on how to get it in Home assistant in my post above. Sharing yaml is the easiest way to share automations and configuration. But most automations can also be entered completely by user interface. No need to write yaml by hand. So another way would be to just recreate the automation by using the automation editor.

You can switch between the user interface and yaml at any time, and by doing so learn the yaml. But I did not create the example in yaml either.

More and more sensors can also be created via the user interface. You find them in the settings, in the helper section. So luckily you can ease in to it, one step at a time.

Can’t thank you enough.

1 Like