[solved] Howto use hass-momentary?

I’m trying to use GitHub - twrecked/hass-momentary: Momentary Switch Component for Home Assistant

This is what I did so far:

  • Created a ‘custom_components’ folder in the same folder where I have the www and blueprints folders, not sure if this is correct…
  • Added momentary: to configuration.yaml
  • Added the following to switch.yaml
- platform: momentary
  name: Empty House Trigger
  mode: on
  toggle_for: 5
  cancellable: True
  • checked configuration & restarted server
  • searched for this switch but cannot find it

Did you restarted HA? It should show up as


1 Like

Hi @duceduc, I did restart HA multiple times but no switch with that name…

In your custom_components folder you have folder named


with all it’s files and folder of momentary?


1 Like

Yes, this is what I have

That is weird. It looks like you did it correctly. Not sure why it isn’t showing up for you.
I need to update my version as I am still on v.0.4 seeing that the latest is v.0.5.1.

Try v0.5 or v0.4.

1 Like

OK, got it!

The reason was that I had both ‘switch: !include switch.yaml’ (which was empty until now, was just a preparation to split up my config) and some other test switch that I tried some time ago in my configuration.yaml

Sorry for this stupid mistake but thanks a lot for helping! :+1:

Hi @duceduc, would you mind sharing your use/config for this momentary switch?

I am using it to switch between if a guest coming to my house or family members to have alexa greet the person upon arrival.


  - platform: momentary
    name: Activate Guest
    mode: on
    toggle_for: 5
    cancellable: True


- alias: guest trigger
     - platform: state
        - group.guest_presence
       to: 'on'
    - service: switch.turn_on
        entity_id: switch.momentary_activate_guest

- alias: welcome home announcement
     - platform: state
        - binary_sensor.duc_presence
        - binary_sensor.eri_presence
        - binary_sensor.shion_presence
        - binary_sensor.sachiko_presence
       to: 'on'
    - condition: state
      entity_id: binary_sensor.motion_g1_occupancy
      state: 'on'
    - delay:
        seconds: 1
    - service_template: >
           {% if is_state('switch.momentary_activate_guest', 'on') %}
           {% else %}
           {% endif %}

        user: >
         {% set alias = {"Eri":"eddie", "Duc":"duck", "Shion":"she-on"} %}
         {% set p = trigger.to_state.attributes.friendly_name %}
         {% set user = alias.get(p) %}
         {{ user }}
    - condition: or
        - condition: template 
          value_template: "{{ states.sensor.period_of_the_day.state != 'daylight' }}" # Turn on LR lights
        - condition: time
          after: '17:45:00'
          before: '18:30:00'
    - service: script.turn_on_lr_lights