Alexa intents, scripts & HA - tying it all together?

I got a chance to test haaska and it mostly works.

It recognized the garage door opener as a cover device. I can tell alexa to open the garage door and it does. But when i say to close the garage door it says “ok” but nothing happens. I can the say to open the garage door (with it already open) an the door closes. I try to query the status or position of the garage door but it doesn’t understand that.

So it doesn’t know the position and it won’t operate the switch when I issue the “close” command.

Is there anything I can do to troubleshoot this? Is all of the code for this on the AWS lamda site or is there any code locally I can look at?

Everything else works fine. But then again it worked fine before haaska too.

If you have the notes, you should definitely post it.

Here are my installation notes for Haaska. They worked for me as of 8/5/2017.

https://pastebin.com/Dzzr9K8X

If for some reason the link doesn’t work let me know. I’ve never used pastebin before so i may be doing something incorrectly there.

and to update the garage door operation:

i realized that the in the cover implementation i had the garage door operator switch get turned on to open the door and turned off to close the door. this was incorrect because the switch is already off after the call to operate the door is made. I’m using it to simulate a button press. i needed to change the actions to turn on the door switch for whatever operation call was used.

And I needed to change the implementation to use a script to check the status of the garage door before before operation to prevent it from un-smartly “opening” the door if it was already actually open.

- platform: template
    covers:
      north_garage_door:
        friendly_name: 'North Garage Door'
        value_template: "{{ is_state('binary_sensor.garage_door_north_position_sensor', 'on') }}"
        open_cover:
          service: script.turn_on
          entity_id: script.open_gdn
        close_cover:
          service: script.turn_on
          entity_id: script.close_gdn
        stop_cover:
          service: switch.turn_on
          entity_id: switch.garage_door_north_operator_switch
        icon_template: "{% if not is_state('binary_sensor.garage_door_north_position_sensor', 'off') %}mdi:garage-open{% else %}mdi:garage{% endif %}"

It works fine now

Hi @RobDYI

I have just managed to install haaska and got it running.

I was wondering from the examples of the Alexa intents you gave, is it possible for you to share your intents? How have you set them up because surely to do that you need to use an invocation i.e. “home assistant” etc?

Thanks.

Let me know if you need more than this.

Intent Schema

{
  "intents": [
    {
      "slots": [
        {
          "name": "ASensor",
          "type": "ASensors"
        }
      ],
      "intent": "allsensors"
    },
    {
      "intent": "AMAZON.CancelIntent"
    },
    {
      "intent": "AMAZON.HelpIntent"
    },
    {
      "intent": "AMAZON.StopIntent"
    },
    {
      "slots": [
        {
          "name": "Sensor",
          "type": "Sensors"
        }
      ],
      "intent": "statussensor"
    }
  ]
}

configuration.yaml

alexa:
intent_script:
  statussensor:
    speech:
      type: plain
      text: >
        {%- for state in states -%}
          {%- if state.name.lower() == Sensor.lower() -%}
            {%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
            {{ state.name }} status is {{ state.state }} {{- state.attributes.unit_of_measurement}}
          {%- endif -%}
        {%- else -%}
          Sorry, I can't find the status of {{ state.name }}
        {%- endfor -%}
  allsensors:
    speech:
      type: plain
      text: >
        {%- for state in states.switch -%}
          {%- if state.state == ASensor.lower() -%}
            {%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
              {{ state.name }} status is {{ state.state }} {{- state.attributes.unit_of_measurement}}
          {%- endif -%}
        {%- else -%}
          Sorry, I can't find anything in state of {{ ASensor }}
        {%- endfor -%}
        {%- for state in states.binary_sensor -%}
          {%- if state.state == ASensor.lower() -%}
          {%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
            {{ state.name }} status is {{ state.state }} {{- state.attributes.unit_of_measurement}}
          {%- endif -%}
        {%- else -%}
          Sorry, I can't find anything in state of {{ ASensor }}
        {%- endfor -%}

Thanks.

I was wondering if you use the invocation name? from your previous post you mentioned you use Alexa intents without the invocation ? if that is correct then how do you manage that?

Thanks

I use alexa intent with an invocation name but not the “homeassistant” invocation name. I changed “homeassistant” invocation name to “me the status” so the invocation is “tell me the status”.

Alexa, ask “home assistant”

to

Alexa, tell “me the status”

Click the yellow “Add a new skill” button in the top right
Skill Type: Custom Interaction Model (default)
Name: Home Assistant
Invocation name: home assistant (or be creative, up to you)
Version: 1.0
Endpoint:
https
https://YOUR_HOST/api/alexa?api_password=YOUR_API_PASSWORD

1 Like

That’s smart !

So I take it as this all works via haaska? I am facing problems with haaska and the sql.

And so I am thinking of going back to emulated_hue and intents.

I am trying my invocation as “is the temperature” and saying to Alexa: what is the temperature in the nursery?” I dont think she understands!!

There are three methods to use Alexa with HA

  1. Hasska - turn on and off etc, no responses, SSL and amazon account req, no invocation names
  2. Emulated hue - turn on and off etc, no responses, no SSL and no amazon account req, no invocation names
  3. HA Skill with Intents - turn on off / responses, custom skills, SSL and amazon account req., invocation name required.

To use number 3 like I did with “Alexa, tell me the status of”, the “me the status” is the invocation name. The “tell” is an accepted launch phrase. (“what” in your example is not)

Here is some more info on launch phrases

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill

2 Likes

Thanks buddy

I think you can change your invocation name to "what is the temperature " and that should work based on this.

Invoking the skill using just the invocation name and nothing else: “Alexa, Daily Horoscopes”.

Nope it doesnt like “what is the temperature” as the invocation it replies by saying “it doesnt look like your device supports that yet”

However “Alexa tell me the temperature of” works flawlessly.

Thanks.

Are phrases in haaska working for “Open the garage” “Close the garage” or are you all finding that you need to say “Turn the garage on/off”?

I’m running haaska and was hoping to fix this … I’m a little lost with intent_scripts, but have had haaska running for some time now. The trick of adding “me the status” etc. is brilliant! - I will definitely try that…but trying to remember (and teach the wife) “Turn off the shade” for roller shades is just unnatural … any tips or examples to solve this are appreciated.

Thanks!

You have to create a “cover” component then write a script to define its operation.

See my last post above for the script I used for the “cover” template.

After that saying “open” or “close” works.

Arsaboo. I know that this post is two years old but I hope that you can help me. I replicated your example to control my garage. Everything works fine as long as the garage is closed and I open it or the garage is open and I close it.
However, if I ask Alexa to open garage and the garage is already open, then I get a response: ‘Invalid slot information received for this intent’. I get the same behavior for closing the garage when already closed.
Do you have any idea why is this happening? Any feedback would be greatly appreciated.
Thanks in advance!