mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Let core resolve entity_id for lastfm from username (#31280)
* Sluggify user * Simplify * Remove unused import
This commit is contained in:
parent
d225fc08fe
commit
ae76b5be5a
@ -58,7 +58,6 @@ class LastfmSensor(Entity):
|
|||||||
self._unique_id = hashlib.sha256(user.encode("utf-8")).hexdigest()
|
self._unique_id = hashlib.sha256(user.encode("utf-8")).hexdigest()
|
||||||
self._user = lastfm_api.get_user(user)
|
self._user = lastfm_api.get_user(user)
|
||||||
self._name = user
|
self._name = user
|
||||||
self._entity_id = user
|
|
||||||
self._lastfm = lastfm_api
|
self._lastfm = lastfm_api
|
||||||
self._state = "Not Scrobbling"
|
self._state = "Not Scrobbling"
|
||||||
self._playcount = None
|
self._playcount = None
|
||||||
@ -76,11 +75,6 @@ class LastfmSensor(Entity):
|
|||||||
"""Return the name of the sensor."""
|
"""Return the name of the sensor."""
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
|
||||||
def entity_id(self):
|
|
||||||
"""Return the entity ID."""
|
|
||||||
return f"sensor.lastfm_{self._entity_id}"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user