Let core resolve entity_id for lastfm from username (#31280)

* Sluggify user

* Simplify

* Remove unused import
This commit is contained in:
Malachi Soord 2020-01-31 23:23:42 +01:00 committed by GitHub
parent d225fc08fe
commit ae76b5be5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,6 @@ class LastfmSensor(Entity):
self._unique_id = hashlib.sha256(user.encode("utf-8")).hexdigest()
self._user = lastfm_api.get_user(user)
self._name = user
self._entity_id = user
self._lastfm = lastfm_api
self._state = "Not Scrobbling"
self._playcount = None
@ -76,11 +75,6 @@ class LastfmSensor(Entity):
"""Return the name of the sensor."""
return self._name
@property
def entity_id(self):
"""Return the entity ID."""
return f"sensor.lastfm_{self._entity_id}"
@property
def state(self):
"""Return the state of the sensor."""