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

@luma

Wow! Thanks for that.

That’s basically my set up but my switch is a (more expensive) zwave switch. The tilt sensor is exactly the one I have.

I guess I now have some decisions to make on which way to go on this.

Playing around with this fun but I don’t know enough to really get the most out of it. There are too many “unknown unknowns” for me. Is there a good repository of knowledge on home assistant covering what all of the component/options/keys/possible values are? I feel that is probably the one big thing that is most lacking in this project. The documentation is OK but it just seems to scratch the surface of what is possible.

1 Like

@luma

You mention that the instructions for setting up haaska are out of date.

Do you have a link to a recent/good set of instructions?

are the instructions @ BRUH automation good?

I feel like it’s going to be a while before a canonical source of knowledge like that exists, simply due to the velocity at which this project is moving. My best recommendation would be to jump on Discord and ask the folks in #general if you have any questions - the community around this project is simply unbeatable and everyone is ready to help.

I kinda-followed the directions from the haaska github and fumbled my way through with some Google searches as I wasn’t in a position to be watching Youtube videos (not that I would be screwing around with my Hass setup while at work of course). If you’re familiar with AWS it might be a little more straightforward, but the trouble with AWS (and Azure for that matter) is that constant changes are being made to the management interface which makes creating accurate documentation difficult and time-limited. I’d say run through the BRUH video and if you run into trouble, ask here or in Discord and we can try and help you along.

One thing to note: AWS is a pay service and requires a credit card, but the pieces being deployed here will fall within the “1 million hits free” tier on Lambda so there should be no charge for normal, personal use.

@luma I am also using a Monoprice Tilt sensor with a z-wave relay and have combined them using a cover template and it works very well.

@finity Glad you found it useful

1 Like

The card entry shows the card in the Alexa app.

I had the exact same output last weekend on Alexa development site and had to make these changes with HA 50.1. You are very close to getting Alexa intents workings and I recommend getting it to work and also installing haaska. I suggest getting the example to work and then modifiy it your needs.

I use Alexa intents to say

“Alexa, tell me the location of John”
“Alexa, tell me the status of the front door”
“Alexa, tell me the status of everything on”

I use haaska for

“Alexa, open the garage”
“Alexa, open the lock”
“Alexa, turn off the fireplace”

I eventually got alexa intents to work correctly using the examples provided by @luma with my needed mods.

And now I just got Haaska working today and everything seems to be discoverable. I won’t be able to test it with voice till later when I get home.

I used the github repo files and only modified the config.json file for the IP & password, and the makefile for the “pip” install line to use pip3.

I mostly used the video from @bruhautomation with a little bit of the readme file from github thrown in. It was a little challenging figuring out the changes needed. I had to delete everything (except the logon information) and start over once but in the end, I’m pretty sure it works.

I had to go through all my stuff and hide things that didn’t make sense from haaska and then re-discover everything.

As of now i have the alexa component disabled. I might put it back if I see the need to use it for anything else. I do like the idea of not having to use the extra invocation words in haaska.

I have a write up of what I did if anyone is interested.

1 Like

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.