Virtual Dummy Switch for Alexa to trigger? I have Nabu Casa

Hi all

I’m trying to do a very basic automation. I have Nabu Casa.
I want a virtual switch aka ‘dummy switch’ on Home Assistant so I can do the following.

Alexa Routine > When this happens > Select ‘Smart Home’ > Select ‘Virtual Switch On’ > Action > ‘Alexa Says’ “[Name] has arrived home”.

In the UK we do not have geofencing on Alexa, so I need to add the Virtual Switch to my geofencing HA Automation setup.

I use dummy switches for a lot of my automation, the basic layout is to create a switch template (there are a lot more options you can enable, this is a super basic example):

dummy_switch_1:
  friendly_name: "Dummy Switch 1"
  turn_on:
    service: [alexa action name]
    data:
      [alexa action parameters]
  turn_off:
    service: switch.turn_off
    entity_id: switch.dummy_curtain_outlet_1
1 Like

Thank you. Where do I do this at within the UI of Home Assistant?
Example: When I do my automations I go to Configuration > Automations > Add Automation.

You first have to define a template device and then you treat that device like any other in Home Assistant. You can read up on template switches at HERE.

Once you have the template device added and you either restart HASS or reload template entities from the Configuration -> Server Controls section then you just create your automation and turn on/off the device like you would a discovered switch.

Thank you for your help, much appreciated.

Question, the link you sent and many other instructions links I read say to add to “configuration.yaml”. Which I have been doing, but my configuration.yaml is getting quite long now with code. Is there a best practise method to organise new files that relate to configuration.yaml? So example, for lights only, can I create a new file and make my edits in there? Or does every single code have to be within the single configuration.yaml file?

Sorry for the amateur question!

Yes, you can (and probably should) break it up. You can read how to do that HERE. I use a combo of reading other files and reading the contents of subfolders, depending on what I’m doing. Because I have so many template entities defined, I actually use a folder full of them, it’s easier for me to manage:

cover: !include devices/cover.yaml
switch: !include devices/switch.yaml
sensor: !include devices/sensor.yaml
binary_sensor: !include devices/binary_sensor.yaml
light: !include devices/light.yaml
camera: !include devices/camera.yaml
script: !include_dir_merge_named scripts/

Whereas for other things I just simply use a file:

group: !include groups.yaml
automation: !include automations.yaml
scene: !include scenes.yaml
rest_command: !include rest_command.yaml
1 Like

Thank you very helpful.

I did the light: !include devices/light.yaml and moved my light code there.
Now my Zigbee Lights have become unavailable via Deconz. Wifi lights are ok, but Zigbee has killed my devices.

What do you think may of happened?

You can also just use a Helper toggle for this example.

Can you explain further please? I created a Helper toggle and Alexa couldn’t discover the toggle

Under the Home Assistant Cloud settings, did you expose the helper toggle to Alexa?

Edit: It’s under manage entities, then “expose”.

Thank you, that does bring it to Alexa so that’s fantastic to know. But it brings it into the actions of Alexa. I want it to be trigger in Alexa to then action Alexa Say “Name has arrived home”

Sure enough! I’m stuck on this as I use alexa media player entities to TTS through node-red.

see