Just another ALEXA question

Hi all,
I’m really new to Home Assistant and need some help to configure an Alexa integration. It MUST work in italian!
I’ve succesfully setup HA to do following:

  • turn on/off a switch via MQTT
  • read a sensor temperature via MQTT

Due I’m moving from OpenHAB, I’ll need to migrate a lot of stuff. But before continue, I would like to check the Alexa integration. I would like to turn on/off a lamp (which works from the HA gui) and get a temperature.
I’ve read the docs but due I’m not proof with english, I need some help.
To accomplish the integration, for now I’ve done the following:

  • setup https with letsencrypt
  • exposed 443 port from the internet (for now filtered and in logging mode)

I’ve tried to set-up a custom skill but I’ve no idea how to setup the skill and the HA configuration.
About the Alexa Skill, due the interface is a little different from the doc, that’s enough to have difficult to follow the guide. I was able to set the following informations:

Maybe if someone could share a json intent, basic and easy to, do 1- read a sensor value, 2- turn on or off a light, that would be easier.
The same for the HA side. I cannot uderstood the interaction to HA, the “names” that links Alexa to the items in HA…

Maybe a simple stupid example could help me.

Thanks a lot!

Simon

why dont you use this first:

My reply may be heresy but, I use Node-Red for most of my Alexa integration. I came to Home Assistant from a Node-red based system, so using Node-Red lessened the learning curve.

In the above flow, I have an Alexa Local node (Hallway Light) that flows to a switch node (On or Off?). If the message is “on”, it goes to the Home Assistant turn-on service call. Off, similarly. I also have an MQTT input so that the light can still be controlled from my original Node-Red UI (on another Pi). The two nodes at the bottom are there to pass the light status (on or off) back to my original Node-Red, so that no matter how I turn the light on or off, my original Node-Red switch will show the status.

I have one Z-Wave dimmer light, but it’s control via Node-Red is a little more complex.

I know this doesn’t answer your question of how to do it all from Home Assistant. Hope this helps.

Sig

Hello @juan11perez .
Thanks for the answer. BTW, could the “Emulated Hue Bridge” act to read temperature sensors as well? AFAIK in that way, Alexa would “see” my devices as local HUE devices, so that would avoid to need a service exposed to the internet. That sounds good, but I would like to have informations from my sensors as well. Can this do it?

And hello @stevemann !
Thanks for your detailed reply. In your case, it would mean to use another service (cloud) and a connector, which, in my case, would be able as Alexa Skill as well. Keep in mind that here in Italy the Alexa was released one month ago, so having a skill is not guarantee… needs to be released for the italian market as well. But Node-Red is available.
BTW, In my mind I would like to have an official HA cloud (which is not free, so not for me) or trying to create my own. And here comes to the issues descrived :slight_smile:

So if someone other can help me for the setup I would like to try, it would be great!

Thanks to all!!!
Simon

you’re welcome.
Use the emulated hue to give instructions to turn on and off.
and then use this component to activate TTS on alexa/echos Echo Devices (Alexa) as Media Player - Testers Needed
then create a script to generate the sensor message and have alexa read it. no need to create a skill or intentscript anymore

Good morning @juan11perez
That sounds very good!!
I’ve some questions in mind, but let me first check the docs.
I’ll need then to set lights at x% brightness or open/close garage. Maybe all that is possible via script and your last link :slight_smile:

Simon

i dont want to spoil the fun, but @xefil said it must work on italian and the TTS part from the mediaplayer component doesnt work with the italian server at this moment.

@xefil i did write a tutorial for skills a while ago (and i know that is outdated as well) to connect appdaemon with alexa.
you can forget about the appdaemon part and you already found the steps to connect to ha.
but maybe the way i described my intents will help you go on.

i am not a real help when it comes to the HA part though.

I’m not sure why you would need an Alexa Skill to just turn a light on or off.

for that you can just use emulated hue, but if you want to do more you need something else ( a skill for example)

Hello @ReneTode
For now I’m testing only emilated_hue. AFTER that, I’ll test something more complex.
Meanwhile, with one sensor it works, but when I ask to turn it on, it does it, but it answers that the light is not answerring. In the logs I see:

2018-11-22 20:43:59 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 390, in start
    resp = await self._request_handler(request)
  File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_app.py", line 366, in _handle
    resp = await handler(request)
  File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_middlewares.py", line 106, in impl
    return await handler(request)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/view.py", line 113, in handle
    result = await result
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/emulated_hue/hue_api.py", line 197, in put
    parsed = parse_hue_api_put_light_body(request_json, entity)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/emulated_hue/hue_api.py", line 344, in parse_hue_api_put_light_body
    return (result, brightness) if report_brightness else (result, None)
UnboundLocalError: local variable 'report_brightness' referenced before assignment

The switch is a MQTT, so it doesn’t support brightness…
How can I solve this issue meanwhile?

Thanks, Simon

OK, how about this?

HA-NR-Simple

My prior example was for a z-wave switch. This is a simple MQTT on/off switch.

i guess that there is a problem in emulated hue in that case.
it shows the switch to alexa as a light.
i got no problems with input_booleans (so to avoid errors its possible to create 1 that connects to the switch)
but i would mention it to the devs.

Hi @ReneTode ,
Where can I ask for the above error? I cannot find a section in the forum or another place.
Meanwhile I’m testing a little my custom skill and it’s… working :slight_smile:
WOW!!
For now I only get a temperature spoken message passing the temperature parameter… “Alexa, ask myhome the temperature”… oh so cool!

@stevemann thanks for your hints as well :wink: I’ll try a little with own skill first :slight_smile:

i think the best place is to add an issue on github

Done!


:wink:
1 Like

Hi @stevemann

I’m interested in this.

Can you tell me a little bit more about the violet node you’re using to detect Alexa commands?

Thanks

In node-Red, open the Palette Manager and install the Alexa Home node. (node-red-contrib-alexa-local)
It’s almost as simple as the comment node. Just give your device a name and tell Alexa to ‘discover’.

This is a simpler interface and only passes “on”, “off”, and “bri” (brightness) messages. So, in my example, I tell Alexa to turn on the Studio Light, and the node injects an “on” message to the flow. I send it straight to the MQTT Out node.

Thanks @stevemann

What about the two node here?

oie_AqaZmgmIckmx

I already use the nodered Alexa skill, very useful.

Maybe you can teach me how to use the Node-Red Alexa Skill- I’ve never gotten it to work and since the Alexa Home node works and does all I need, I haven’t tried again.

“This one” and “This one” are the MQTT in and MQTT out nodes.

I have a strange system here with two Node-red’s running on 2 Pi’s and MQTT to communicate between them. I started with Node-Red and later installed Home Assistant on a different Raspberry Pi. My Home Assistant Raspi is running on Hass.os, so I can’t do apt-get to install some of my more exotic nodes, and on my Node-Red Raspi, I can’t get Home Assistant nodes to work. So I use both.

Steve

Oh, ok, I thought the two nodes were different things

Using The Alexa skill is simle.

Just go here and create an account.
After doing login, just go here and create a new device using the form below.

I’m using it just for switch and light, I’ve tried also with Yeelight RGB bulb, but I haven’t understood how to use color stuff.

Just fill in Name, Description, Action and Application type.

Then in NodeRed after downloading the Alexa skill, just add the alexa-home node, add the account credentials you have previously created and click the reload button to list all the devices you have created before.

43

Now you have to test msg.command with a switch node for the commands you find here.

This example is for a simple light or switch.

18

And now just add the action you want, it can be something related to Home Assistant or not.