Last.FM sensor not working

I’ve just added the last.fm sensor, the docs are here:

It’s showing an error in my log:

2019-05-25 04:12:18 ERROR (MainThread) [homeassistant.core] 
Error doing job: Task exception was never retrieved Traceback (most recent call last): 
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 349, 
in _async_add_entity 'Invalid entity id: {}'.format(entity.entity_id)) homeassistant.exceptions.HomeAssistantError: 
Invalid entity id: sensor.lastfm_Wasabibest

Here’s my YAML for the sensor:

# lastfm - see whenever a user starts scrobbling, their play count, last song played, and top song played on Last.fm.
# https://www.home-assistant.io/components/lastfm/
- platform: lastfm
  api_key: !secret lastfm_api_key
  users:
    - Wasabibest

No sensor entity created either, what am I doing wrong here?

Is no one using the last FM sensor at all? Even a ‘works for me!’ post would be nice, that way I’d know that the last FM component isn’t broken.

I know it’s a late reply, and I’m not solving anything. But the sensor is also not working for me. I don’t even have a sensor showing up here.

Better late then never! :slight_smile: Thanks for letting me know, at least now I know it’s not an issue with my API key or anything like that.

It’s a shame Last.FM is broken, it would be quite nice to have some automation for my scrobbles.

EDIT: I’ll make a github issue for this at some point, it may be a simple fix.

Last.FM usernames need to be entered in lower case. This seems to be because home assistant only allows entity id’s with lower case characters so sensor.lastfm_Wasabibest is not valid but sensor.lastfm_wasabibest is.

Developer Note: adding .lower() will fix this. e.g.

@property
    def entity_id(self):
        """Return the entity ID."""
        return "sensor.lastfm_{}".format(self._name.lower())
1 Like