In line 111 where is
playlist_type = "user"
locale = "en"
limit = 10
account = None
Can i change also the locale?
In line 111 where is
playlist_type = "user"
locale = "en"
limit = 10
account = None
Can i change also the locale?
I believe what you have screenshotted there is the github README, not the release notes. And it appears you are correct that this sensor is not documented there. An oversight Iām sure. A perfect opportunity to do a quick PR and help him out!
I promise you this sensor is being created by Spotcast. This is the file that does this.
class ChromecastPlaylistSensor(SensorEntity):
def __init__(self, hass: ha_core, country=None):
self.hass = hass
self._state = STATE_UNKNOWN
self.country = country
self._attributes = {"playlists": [], "last_update": None}
_LOGGER.debug("initiating playlist sensor")
@property
def name(self):
return "Playlists sensor"
@property
def state(self):
return self._state
@property
def extra_state_attributes(self):
"""Return the state attributes."""
return self._attributes
def update(self):
_LOGGER.debug("Getting playlists")
if self.country is not None:
country_code = self.country
else:
# kept the country code to SE if not provided by the user for retrocompatibility
country_code = "SE"
playlist_type = "user"
locale = "en"
limit = 10
account = None
resp = self.hass.data[DOMAIN]["controller"].get_playlists(
account, playlist_type, country_code, locale, limit
)
self._attributes["playlists"] = [{ "uri": x['uri'], "name": x['name']} for x in resp['items'] ]
self._attributes["last_update"] = dt.now().isoformat("T")
self._state = STATE_OK
In that file you can change limit = 10
to a reasonable number and you will get more playlists in the sensor.
Ah I see you already found it.
I havenāt looked to see where that comes from or how itās used.
Give it a shot. Worst that can happen is it wonāt workā¦
Ok, thanksā¦ butā¦ which is the real use of that sensor? How do you use it?
I load the playlist names into an input_select (which Iāll probably eventually update to use the new template select ). Then when spotcast.start is called it grabs the URI to use by matching it to the playlist that is selected in the input_select.
Hereās the automations where I populate the input_select. (It also stores the selection and recalls it after the list has been reloaded).
Hereās the script where I call spotcast.
PS Donāt judge the playlists. Those are mostly my wifeās showing
Thanks a lot, iāll study it and make usable on my environmentā¦
Riiiiiiiiiiiight
Hmm. Iām feeling a little judged!
Oh no, i am not so expertā¦ i like to study to improveā¦
I think you misunderstood. petro was laughing at me for denying the playlists in my screenshot were my personal preferences. My wife is a fan of country music, I shall we say - am not.
If you need help figuring out those automations ask away, happy to help you out.
Yes, I was laughing at the playlist
Thanks, just a question:
How you set the input_select?
same way you set any other input_select, with the select_option service or through the dropdown.
Ok, but as options i must put all the playlists or not?
He posted the automation that updates the input_select
Yes, itās in the automation I posted. Keep in mind in that automation Iām also populating a bunch of additional input_selects in my automation (I have several playlist "presets " for different things).
Your service call to populate the input_select will look something like this which loops through all the playlist names and puts them in the input select.
- service: input_select.set_options
target:
entity_id: input_select.spotify_playlist
data:
options: >
{% set options = namespace(value=[]) %}
{% for item in playlists -%}
{% set options.value = options.value + [item.name] %}
{% endfor %}
{{ options.value }}
Not sure if this was resolved or figured out, but under Developer Tools/STATISTICS is where I deleted mine from, and now I no longer have the unwanted sensors I created. If this was resolved, please ignore.
I have the same issue, last night my DB crashed so Ive started all from scratch as i had some very outdated full backup that was unusefull.
Today ive created sensor for enerty monthy discount in templates.yaml, after that i renamed its unique_ID, but its appearing in Developer> states, so i deleted that sensor from templates.yaml the only place ive coded it, after deletion its still here, nor restart nor hard restart helped. Ive created second sensor with same unique_id and now newly created sesoor has the suffix _2
,ā¦
I can see that āoldā changed/ deleted sensors have key:value restored: true
, note that this āphantomā sensors are not used anywhere else still as everything is from scratch as i said. No appearance in any config/template/automation YAMLsā¦ So it stores is somewhere even its not used in UI, or anywhere else