I played arround a little with the sensor.last_alexa and I also tried the example from the wiki.
The thing is as you I would have changed the entity.entity_id in the example.
Try it in your template without changing anything in that example, this way it magically works.
{%- for entity in states.media_player -%}
{%- if state_attr(entity.entity_id, ‘last_called’) == True -%}
{{ entity.entity_id }}
{%- endif -%}
{%- endfor -%}
I think the advantage of this sensor against the one from here is that we don’t have to specify every device. Also if you get new alexa device you don’t have to change something in the code.
EDIT: But I have another issue that I also mentioned here
The last_called true state doesn’t go back to false. So I end up with more than one device having last_called: true.
Does someone else have that?
With the above sensor this will cause two entities in a line. So wrong information.
Could be that issue?
I think so and I have the same behaviour. I think the way it should work is that only one device can be last_called: true so the last one that was true has to be updated and go back to false. Then you will only get one entity in that output.
I could be wrong as I don’t fully understand how it works, but hopefully @alandtse will make clear if this is a (known) bug or a feature
Until than we should keep the other way to do it.
Your output tells that you also have two devices “last_called”. Does your sensor work right, with the code we got from @lonebaggie ? I mean does it update to the latest triggered alexa? Because in that template nothing seems to proof which of the last_called: true alexas was the last one. This is probably confusing, sry. @maurizio53 you could restart ha and try that template again, does it only show the right last_called after the restart (it does for me)?
Could you answer the questions above? Maybe it would help to figure out the issue. If you have the exact same behaviour it is more likely, it’s not me doing somethin wrong.
It’s only a guess. After the restart, all the last_called attributes go to False.
So state of the sensor would be empty (I guess).
The test in the template was before the restart.
Ok, I tried it, I have the same as you. Empty state with that code.
I don’t have any more ideas. Unfortunately this is not the only issue.
We’ll have to wait for someone with better knowledge.
Maybe @BrianHanifin as he posted this example here.
@kpj5425 read the posts from the last three days in this thread.
If you only have one Alexa account, then there should only be one last_called echo. There is a polling thread to determine the last serial number, and all devices will read an event when a new one is discovered and should adjust themselves. If you see more than one returning true (for more than a split second, which is the time for HA to tell every component), that’s a bug. Please file an issue. For multiple accounts, each account should have its own last_called as each account is treated separately for now.
As for the timing interval (that was the problem with reducing the polling), we’ll add an update service that will need to be manually triggered hopefully in the next release.
“email” or “sms”. Can someone update the FAQ for me? This has been asked before.
@Mirai_Hayashi
No that won’t work. 88 broke the component anyway so we took the opportunity to migrate to the new file structure and configuration. You need to follow the wiki.