Closed simondrake closed 1 month ago
First thing I found with what you posted above is you have a four space indentation after - sensor:
when it should be two spaces.
Try adding mine in addition to yours...
- name: My Last Alexa
unique_id: my_last_alexa
state: |-
{{ expand(integration_entities('alexa_media') | select('search', 'media_player'))
| selectattr('attributes.last_called', 'eq', True) | map(attribute='entity_id') | first }}
availability: |-
{{ expand(integration_entities('alexa_media') | select('search', 'media_player'))
| selectattr('attributes.last_called','eq',True) | first is defined }}
@danielbrunt57 I'll give it a go, but I'd be surprised if it was an indentation issue as yaml doesn't have strict rules around number of spaces.
Thanks! I'll report back
Just tried it - same problem, showing as unavailable.
So you now have two last_alexa sensors? Your original and the new one?
And Dev Tools -> STATES shows media_players.
with last_called
attributes as either true
or false
?
If so, there is seriously something not right with your HA templated entities and their failure to update and that's not really an AMP problem. I'd be having a serious look at any other templated entities you have. No idea what the issue might be...
Do you have only one instance of template:
in configuration.yaml
?
template:
- binary_sensor:
- name:
- name:
- select:
- name:
- name:
- sensor:
- name:
- name:
- trigger:
- name
- name
So you now have two last_alexa sensors? Your original and the new one?
Yeah, I did. But then I removed the my_last_alexa
as both were showing as unavailable.
And Dev Tools -> STATES shows media_players. with last_called attributes as either true or false?
Yep! Here's the living room echo, showing last_called: true
, but the last Alexa is still unavailable
If so, there is seriously something not right with your HA templated entities and their failure to update and that's not really an AMP problem. I'd be having a serious look at any other templated entities you have. No idea what the issue might be...
It's weird, this is the only template entity I have that is defined in the configuration file.
Do you have only one instance of template: in configuration.yaml?
No this is literally the only template sensor I have.
Thanks for the help. I can keep looking around to see if I can figure out where things have gone wrong.
Can you post your full configuration.yaml
file (minus any sensitive info)?
I backed up my configuration.yaml
and made it as bare bones as possible (I've kept the !include
statements). So the following is exhibiting the problem:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
template:
- sensor:
- name: Last Alexa
unique_id: last_alexa
state: |-
{{ expand(integration_entities('alexa_media') | select('search', 'media_player'))
| selectattr('attributes.last_called', 'eq', True) | map(attribute='entity_id') | first }}
availability: |-
{{ expand(integration_entities('alexa_media') | select('search', 'media_player'))
| selectattr('attributes.last_called','eq',True) | first is defined }}
Which gives me a last_alexa
identity that is Unavailable
, but weirdly the history shows that it had state (which the previous didn't) -
I tried talking to the Alexa in my office and running alexa_media.update_last_called
, in case it would kick it into life but that it still didn't update. Even though it definitely does have the right attribute:
And the template editor shows the values correctly:
And, as if by magic, putting back my configuration.yaml
has kicked it into life and now it's working....
Bizarre! Glad it's finally resolved though.
Thank you for the help :)
Describe the bug
For some reason, my
last_alexa
template has been in an unavailable state for the last few weeks and I'm at a loss for why.To Reproduce
Add the following to
configuration.yaml
:Go to the entities page and see that is in
unavailable
, despite trying thealexa_media.update_last_called
action multiple times. Adding the template instate
andavailability
toDeveloper tools > Template
outputs the following:So I'm unsure why HA thinks it's unavailable, as it is reporting the correct values.
Expected behavior
Last alexa is not unavailable
System details
const.py
or HA startup log):4.12.12
pip show alexapy
in homeasssistant container or HA startup log):