My last_alexa sensor doesn’t work reliable now, but I think it will soon.
You can find two examples of automations I came up with (using the new service) here
Hopefully the last_alexa sensor will work soon to make those automations useful.
Suggestions to make it more compactor smarter are welcome.
Also not sure if the delay’s are necessary @alandtse?
I know that there are other solution like this, but as for now I just want to keep it simple and keep it in home assistant.
I am using 0.10.2 to implement the last_alexa using the example on the wiki. While there are multiple accounts in the household, I’ve only configured one. I’m adding the last_alexa sensor so that if I ask Alexa to run a routine that HA will speak back the info, it speaks back on the Alexa that was used to invoke the routine. (I hope this makes sense.) So the configuration.yaml entry looks like the one in the wiki:
sensor:
- platform: template
sensors:
last_alexa:
value_template: >
{%- for entity in states.media_player -%}
{%- if state_attr(entity.entity_id, ‘last_called’) == True -%}
{{ entity.entity_id }}
{%- endif -%}
{%- endfor -%}
yet the current value shows up as blank in the dev-states page. When I put the sensor into my UI it shows up as blank, then when I click on it for details, it will take a few seconds then show “unknown”.
When I look at the states of each media_player device, I see the last_called attribute in what appears to be the correct state, but mixed in with all media_players are other devices like a Google Home mini and a Vizio TV which do not have the last_called attribute.
I’ve seen that others are having this same issue but I haven’t seen if there is a fix or if I’m doing something incorrectly. One thing I noticed, it that the attribute last_call shows “true” or “false” but not “True” or “False” (no first cap). So I tried
== true -%
then
== ‘true’ -%
in configuration.yaml with no luck. The ‘== ‘true’ -%’ version does not even show “unknown”.
Any hints or guidance is appreciated.
Thanks.
Edit: Sorry, I still haven’t figured out how to get the indentations properly put in here when pasting yaml code. I used the </> symbol but it didn’t work.
Er… problem?
I’m trying to use the value of sensor.last_alexa for an entity_id in a script like this:
name: scripname
Alias: aliasname
sequence:
service: media_player.alexa_tts
entity_id: sensor.last_alexa
data_template:
message: ‘The temperature is {{states(“sensor.house_temp”)|replace(".", " point") }} degrees.’
The house_temp value is fine, but the script does not have any output even though the value of sensor.last_alexa is the echo dot I spoke to.
I have a few more things to learn about yaml I suppose. What am I doing wrong?
Thanks.
Invalid config for [script]: not a valid value for dictionary value @ data[‘script’][‘house_temp’][‘sequence’][0][‘entity_id’]. Got ‘{{ states.sensor.last_alexa.state }}’
My script looks like :
house_temp:
alias: House temp
sequence:
- service: media_player.alexa_tts
entity_id: '{{ states.sensor.last_alexa.state }}'
data_template:
message: 'The temperature is {{states("sensor.house_temp")|replace(".", " point") }} degrees.'
Not sure how to fix it yet but will try a few things.
house_temp:
alias: House temp
sequence:
- service: media_player.alexa_tts
data_template:
entity_id: '{{states.sensor.last_alexa.state}}'
message: 'The temperature is {{states("sensor.house_temp")|replace(".", " point") }} degrees.'
However, the last_alexa is updated either too late or it has the “previous” alexa value. For instance. If I’m in my office and I ask for house temp, I get the reply in the office. If I then go to the kitchen and ask, the office dot speaks the result. If I ask again in the kitchen, the kitchen will respond. I’m thinking of combining it with another dummy script, that essentially allows the last_alexa to be updated…
So, more digging is necessary but this is moving forward.
Anyone know what happened to the custom_components.json for the master branch for use by custom updater? According to the wiki, its supposed to be here:
still cant get my alexa media player fixed after changing file structure to alexa_media/ and then the 3 files.
Error: INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
Failed config
General Errors:
- Component not found: alexa_media
Successful config (partial
i changed the config also as instructed
You do know its not under media_player: any longer, correct? Its under its own domain, so alexa_media: should have no spaces to the left of it in configuration.yaml. Is that the way you have it now?
yes i remember using the raw editor but will go ahead and try again to eliminate the possiblity. There is no other media_player folder because i tried to adhere to the new file structure