Service for enabling/disabling Alexa voice control execution

Thanks for your reply.
To be honest, I don’t get from your response if you are pro or contra :wink:

If I switch off the cloud connection by cloud.remote_disconnect, I won’t be able to use the App through Nabu Casa anymore.

Pro of course. As said, if they are advertising the other service in their paid service as security and automation profit, then the voice control switch is even more important for security and automation profit.

Having to hack into my network to do it via app should me more complicated as shouting through the window: all shutters up.

1 Like

Just an FYI
I found a way to deactivate voice control when not at home:
Spook :ghost: a scary powerful toolbox for Home Assistant.

This tool creates services to enable / disable entities.
So, I just need to deactivate the entity I would like to remove from Alexa and it will not be possible to voice control e.g. the door lock.

I am still playing around and wonder if it’s possible to deactivate the code request for locks from alexa…

I know. But did you try to use it? It is not only disabling the execution, but remove all the entities from alexa and you have to enable all of them again and afterwards the alexa internal jobs didn’t work anymore, Szene were not there anymore with old names, etc.

At least what I tested some months ago.

I am still playing around with it, but it seems that I can deactivate the entity and activate it again with a switch.
I must admit, that activation takes much longer until the entity is back to normal.
But we will see…

But you are getting the alex push messages ‘new device’ after re-enabling? And I remember other side effects and disadvantages.

I still would like to see a pure switch, which is only blocking voice action to do anything.

I don’t remember, that I got the Alexa new device message yesterday when I tried it.

However, I try to translate a swith to a lock, because Alexa always requires a PIN Code to unlock.
I don’t know yet, which Helper would be good for this (accepting “Alexa, open the door”)

I had some time to find a work around for my garage door.
I have a input_boolean named Amazon Command Switch used in automations to let the commands through or not.

For the garage door it works well, because I have a cover (exposed to Alexa) with a temporary switch to UP / DOWN / STOP which will be triggered by a toggle helper (or not if the Amazon Command Switch above is OFF).

However, I also have a door lock and I would like to use a switch (or something else) to open / close it.
But on a lock Alexa always asks for a PIN, which is annoying.
(when I am at home, it should work without a PIN).

Do you have any suggestion which kind of helper I can use to tell Alexa open or close (instead of on / off with a input_boolean helper)?

I am trying to use a switch to trigger the lock with this template:

# Helper Switch for locking / unlocking door if at home (Amazon - Echo-Befehle)
- platform: template
  switches:
    gartenhausschlosschalter:
      unique_id: switch_gartenhaus_schlos_schalter
      friendly_name: Gartenhaus (Schloss-Schalter)
      value_template: "{{ is_state('lock.gartenhaus_schlos', 'locked') }}"
      turn_on:
        service: lock.lock
        target:
          entity_id: lock.gartenhaus_schlos
      turn_off:
        service: lock.open
        target:
          entity_id: lock.gartenhaus_schlos

but when I toggle the switch, I get:

Failed to call service/turn_off. Entity lock.gartenhaus_schlos does not support this service.

don’t make a switch, make a cover template. it’s utterances will be open/close.

As for your error, that’s outdated or you’re still exposing your lock with the same name and alexa is using the lock, not the switch.

Thank you for your help.

I tried this before, but for the cover Alexa was asking for a code as well
(because it’s connected to the lock in the background?)
Anyway, I will try this again.

The error was displayed in the Web UI after I triggered the switch itself from an automation.

it’s no different than your template switch

that error makes no sense then. You’ll never get that error with this service call:

So my only guess is that you had it wrong at one point and then corrected it.


cover:
- platform: template
  covers:
    gartenhausschlosschalter:
      unique_id: cover_gartenhaus_schlos_schalter
      friendly_name: Gartenhaus (Schloss-Schalter)
      value_template: "{{ is_state('lock.gartenhaus_schlos', 'locked') }}"
      open_cover:
        service: lock.open
        target:
          entity_id: lock.gartenhaus_schlos
      close_cover:
        service: lock.lock
        target:
          entity_id: lock.gartenhaus_schlos

I have tried your cover above, but triggering the switch does not change anything.
Even the cover itself stays open all the time (while the door is locked).

The cover changes to Closed, when I unlock the lock.

If I then toggle the cover switch it changes it’s position but stays closed

So no matter what, I cannot control the lock via the cover switch. :frowning:

This doesn’t make sense unless you meant cover.

This also doesn’t make sense if it changed from open to closed.

Are you sure you don’t have a miss understanding on how your lock works?

What integration is creating the lock?

Post a screenshot of your lock entity in developer tools → states page.

Thank you @petro for your help and patience :slight_smile:

Yes, I meant the cover button does not trigger the lock.
(as I have this as “door”, it looks like a switch with two positions and not a slider like a garage door)

My lock is a danalock with z-wave with the two states unlocked and locked:

I also use this in another automation when leaving and the garden shed is still unlocked:

- service: lock.lock
        data: {}
        target:
          entity_id: lock.gartenhaus_schlos

Actually I changes the code above to:

value_template: "{{ is_state('lock.gartenhaus_schlos', 'unlocked') }}"

Now I can lock / unlock with the cover. :slight_smile:
Thank you so much.

Is this how it supposed to be?

It’s supposed to be however you want it. That’s what the value template does. I just copied the logic you originally had, if that wasn’t what you originally intended then that was the problem.

Yes, undestood.
But by changing locked to unlocked above I would expect a mirrored result (closing the cover would open the lock and vice versa), but not failing to control the lock.

Anyway - it’S working so thanks a lot again for your help, @petro

I am sorry, but I need to revive this topic as I cannot control the workaround using alexa voice.

My garage door is working fine:

- platform: cover_rf_time_based
  devices:
    cover_garagentor:
      name: Garagentor
      # unique_id: cover_garagentor does not work
      travelling_time_up: 16
      travelling_time_down: 30
      close_script_entity_id: input_boolean.garagentor_toggle_helper # switch.garagentor_schalter
      stop_script_entity_id: input_boolean.garagentor_toggle_helper # switch.garagentor_schalter
      open_script_entity_id: input_boolean.garagentor_toggle_helper # switch.garagentor_schalter
      send_stop_at_ends: False #optional
      always_confident: False #optional
      device_class: garage #optional

This cover is exposed to Alexa.

The input_boolean.garagentor_toggle_helper triggeres a temporary z-wave switch to activate the garage door motor.

When I am not at home, I prevent the input_boolean.garagentor_toggle_helper to switch the z-wave switch (Alexa command does not work anymore).

I tried the same with the lock of the garden shed:

- platform: template
  covers:
    gartenhausschlos:
#      device_class: garage
      unique_id: gartenhaus_schlos
      friendly_name: Gartenhaus (Schloss Cover)
      value_template: "{{ is_state('lock.gartenhaus_schlos', 'unlocked') }}"
      open_cover:
        service: input_boolean.turn_off
        target:
          entity_id: input_boolean.gartenhaus_toggle_helper
      close_cover:
        service: input_boolean.turn_on
        target:
          entity_id: input_boolean.gartenhaus_toggle_helper

This cover is also exposed to Alexa and the input_boolean.gartenhaus_toggle_helper triggers the lock, when I am at home.

The state sync and triggering manually from the UI works well. and is reflected in Alexa.
I cannot use Alexa voice commands to open/close the “cover”.
Neither as device_class: door nor as device_class: garage

When using door the Alexa App looks like this and I can switch open & close with the round button (geschlossen = closed) perfectly - only the voice command does not translate somehome.

When using device_class: garage Alexa always closed the cover (locks the door) even if I say “Alexa, Gartenhaus open”.

The strange thing is, that the cover for the garage triggers the switch perfectly and that this looks the very same in the Alexa App.

Does someone have a clue why?
Thanks in advance.

No one with an idea?

Is this any help?

How to launch an Alexa skill from Home Assistant.

You can use Alexa routines to simulate voice commands, and you can trigger routines with input_booleans.

Thank you.
That would be a workaround and I will consider this.

However, I am also keen on finding out, why the two cases (Garage door and Garden lock - both as cover behave differently.