Running alexa_remote_control.sh inside Hass.io

Regarding the last line, I’m not sure what you mean? My last_alexa sensor now has underscores in it and everything is working even for those echoes that still have spaces in it? I have two echoes still named “Living Room” and “Echo Plus” in the Alexa app. They now show Living_Room and Echo_Plus in sensor.last_alexa. The only thing I changed was

print((x.decode("utf-8")).replace(" ","_"))

It seems that it is more than just output the terminal, but it is the value that the py script returns to HA for that sensor. My automation works perfectly now with my echoes that contain a space.

thats right.
the sh file outputs that to the terminal and if you use a pyscript to read that output then you see that in your sensor.

but when you use the new names to do something it gives the new names.
if you can send something to living_room and alexa understands living room then you are just lucky.
but you wont have the garantee that it stays that way.

you translate the output from the script but you dont change the input from the script.

Yeah I don’t follow you about being lucky. @lonebaggie 's py script launches the sh script. The sh script returns “Living Room” to the py script. The py script changes the spaces to underscores and passes it to HA. HA never sees anything with spaces.

Edit: HA has always listed it with underscores. Nothing I changed caused that. That’s how they came over when I used Keaton’s Alexa TTS solution (Echo Devices (Alexa) as Media Player - Testers Needed. ) I go to view my alexa media_players, they all have underscores and always have.

That’s why I did what I did. Keatons Alexa TTS solution had underscores automatically, and that’s why I wanted last_alexa sensor to do the same thing.

oke, i didnt know that you only used the sh script to read out the last alexa.
the script is capable of way more then that.

yeah if you only use it that way then it works.

1 Like

As most of you know, Alexa has had the ability to recognize voices for quite some time. Without getting too off-topic, I would like to retrieve the name of the person who was the last person to use the last_alexa. The ability to customize automations based upon who issued the command would be incredible.

Currently if I ask Alexa, “Who am I”, Alexa answers back correctly, which of us is asking.

I don’t think the alexa_remote_control.sh script has that ability. Does anyone know of any other solution to retrieve the “recognized voice” of the last_alexa used?

@lonebaggie @ReneTode

i think the biggest reason why this isnt a part from the script yet is because the developer is german and we still dont have voice recognition here :frowning: :frowning: :frowning:
so i would love to be able to use that, i would love to play with it, but i cannot :frowning:

i think that when the voicerecognitions is available her, the option would be fastly implemented.

i know that the script gets json back. and i know that the person is inside that json.
but i dont know enough about curl to get it out if i could test it at all.

1 Like

Cookie failed again That’s 15 days. Will push the time out to 4 hours

it didnt fail once in that same time for me.

I set my scan interval to 315360000 seconds for sensor.last_alexa (10 years is overkill, but I wondered how big a number I could use for scan_interval).

@ReneTode Have you seen this?

https://newsbeezer.com/germanyeng/amazon-alexa-voice-recognition-begins-in-germany/

no i didnt. thx have been waiting for it.
your link didnt show me anything but this one shows that its real!! yeah
im gonna play with it. :wink:

https://newsbeezer.com/germanyeng/alexa-can-now-also-voice-recognition-my-voice-starts-in-germany/

do you think this control will ever be part of hass.io as “standard” function? would be great to control every echo-device without getting this to work. also haaska could be a standard.

i hope not from hassio but from home assistant.
but i think not for a while, because the only person who tried it untill now (with the mediaplayer component) seems to have little time to develope at the moment.
and somehow i got the feeling that he is trying it on a “none HA way” preventing it from implementing.

1 Like

How long is the cookie lasting for you all? For me its only lasting from 6 to 10 days. This is in spite of setting a very high scan interval. I only update when its needed, roughly 3 times per day.

Any suggestions for changes to my setup to increase cookie life?

Getting much the same here Have setup a sensor which checks for the cookie disappearing 10 days so far previous renews were 15 days and 22 days.

Is your script still working since the most recent update?

I’m in the process of trying to get this to work and have had no luck. Here’s my configuration:

shell_command:
  upstairs_ecobee: 'python3 /config/alexa/alexa_wrapper.py "{{ params }}"'

I consistently receive the following error (which is what I was getting when following the original directions using the direct call to alexa_wrapper.sh) when I try to make a call to the service:

2019-01-11 13:32:46 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `python3 /config/alexa/alexa_wrapper.py "{{ params }}"`, return code: 1
NoneType: None

I should note that alexa_remote_control works fine from the command line. As you, I’m running Hass.io as well.

@lonebaggie The @ keatontaylor custom componentt does not take the place of your component. The sensor.last_alexa works great with your component. It does not work well with the other component.

see

This is not my component, mealy the ability to run the python script in hass.io. I’m not smart enough to write any of this :slight_smile:

I have removed the setup I described above and I am now using the keatontaylor custom component . It has never stopped working , never needed a cookie refresh . It has been very solid. The above is a “fudge” I put up with it for the last alexa options and the ability to run routines.

I use Keaton’s component to send tts. However I am unable to use last_alexa with his component because it doesn’t update quick enough to be used to ask Alexa something that is passed to HA and be able to respond back to the correct echo.

When by my voice, alexa triggers an HA booleon, I can do an entity update on your sensor.last_alexa and immediately get back which echo I asked the question. I cannot do that with Keaton’s component.

I know the sh script isn’t yours but the method you put together with the python script is the only thing I know that works with HA unless you use AppDaemon or something like that. People still need to know how to do this using your method until if and when the other component can provide a quick responding sensor.last_alexa.

Good point . I extended the scan rate on the last alexa script, to preserve the cookie timeout to about a minute so I have not noticed how quickly the new sensor updates

I will play with the scan rate

and report back