mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Bump spotifyaio to 0.8.1 (#129573)
This commit is contained in:
parent
b25ab04d2c
commit
df2506bfbb
@ -9,6 +9,6 @@
|
|||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["spotipy"],
|
"loggers": ["spotipy"],
|
||||||
"quality_scale": "silver",
|
"quality_scale": "silver",
|
||||||
"requirements": ["spotifyaio==0.7.1"],
|
"requirements": ["spotifyaio==0.8.1"],
|
||||||
"zeroconf": ["_spotify-connect._tcp.local."]
|
"zeroconf": ["_spotify-connect._tcp.local."]
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from spotifyaio.models import AudioFeatures
|
from spotifyaio.models import AudioFeatures, Key
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
SensorDeviceClass,
|
SensorDeviceClass,
|
||||||
@ -25,14 +25,28 @@ class SpotifyAudioFeaturesSensorEntityDescription(SensorEntityDescription):
|
|||||||
value_fn: Callable[[AudioFeatures], float | str | None]
|
value_fn: Callable[[AudioFeatures], float | str | None]
|
||||||
|
|
||||||
|
|
||||||
|
KEYS: dict[Key, str] = {
|
||||||
|
Key.C: "C",
|
||||||
|
Key.C_SHARP_D_FLAT: "C♯/D♭",
|
||||||
|
Key.D: "D",
|
||||||
|
Key.D_SHARP_E_FLAT: "D♯/E♭",
|
||||||
|
Key.E: "E",
|
||||||
|
Key.F: "F",
|
||||||
|
Key.F_SHARP_G_FLAT: "F♯/G♭",
|
||||||
|
Key.G: "G",
|
||||||
|
Key.G_SHARP_A_FLAT: "G♯/A♭",
|
||||||
|
Key.A: "A",
|
||||||
|
Key.A_SHARP_B_FLAT: "A♯/B♭",
|
||||||
|
Key.B: "B",
|
||||||
|
}
|
||||||
|
|
||||||
|
KEY_OPTIONS = list(KEYS.values())
|
||||||
|
|
||||||
|
|
||||||
def _get_key(audio_features: AudioFeatures) -> str | None:
|
def _get_key(audio_features: AudioFeatures) -> str | None:
|
||||||
if audio_features.key is None:
|
if audio_features.key is None:
|
||||||
return None
|
return None
|
||||||
key_name = audio_features.key.name
|
return KEYS[audio_features.key]
|
||||||
base = key_name[0]
|
|
||||||
if len(key_name) > 1:
|
|
||||||
base = f"{base}♯"
|
|
||||||
return base
|
|
||||||
|
|
||||||
|
|
||||||
AUDIO_FEATURE_SENSORS: tuple[SpotifyAudioFeaturesSensorEntityDescription, ...] = (
|
AUDIO_FEATURE_SENSORS: tuple[SpotifyAudioFeaturesSensorEntityDescription, ...] = (
|
||||||
@ -119,7 +133,7 @@ AUDIO_FEATURE_SENSORS: tuple[SpotifyAudioFeaturesSensorEntityDescription, ...] =
|
|||||||
key="key",
|
key="key",
|
||||||
translation_key="key",
|
translation_key="key",
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
options=["C", "C♯", "D", "D♯", "E", "F", "F♯", "G", "G♯", "A", "A♯", "B"],
|
options=KEY_OPTIONS,
|
||||||
value_fn=_get_key,
|
value_fn=_get_key,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
|
@ -2707,7 +2707,7 @@ speak2mary==1.4.0
|
|||||||
speedtest-cli==2.1.3
|
speedtest-cli==2.1.3
|
||||||
|
|
||||||
# homeassistant.components.spotify
|
# homeassistant.components.spotify
|
||||||
spotifyaio==0.7.1
|
spotifyaio==0.8.1
|
||||||
|
|
||||||
# homeassistant.components.sql
|
# homeassistant.components.sql
|
||||||
sqlparse==0.5.0
|
sqlparse==0.5.0
|
||||||
|
@ -2159,7 +2159,7 @@ speak2mary==1.4.0
|
|||||||
speedtest-cli==2.1.3
|
speedtest-cli==2.1.3
|
||||||
|
|
||||||
# homeassistant.components.spotify
|
# homeassistant.components.spotify
|
||||||
spotifyaio==0.7.1
|
spotifyaio==0.8.1
|
||||||
|
|
||||||
# homeassistant.components.sql
|
# homeassistant.components.sql
|
||||||
sqlparse==0.5.0
|
sqlparse==0.5.0
|
||||||
|
@ -207,16 +207,16 @@
|
|||||||
'capabilities': dict({
|
'capabilities': dict({
|
||||||
'options': list([
|
'options': list([
|
||||||
'C',
|
'C',
|
||||||
'C♯',
|
'C♯/D♭',
|
||||||
'D',
|
'D',
|
||||||
'D♯',
|
'D♯/E♭',
|
||||||
'E',
|
'E',
|
||||||
'F',
|
'F',
|
||||||
'F♯',
|
'F♯/G♭',
|
||||||
'G',
|
'G',
|
||||||
'G♯',
|
'G♯/A♭',
|
||||||
'A',
|
'A',
|
||||||
'A♯',
|
'A♯/B♭',
|
||||||
'B',
|
'B',
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
@ -254,16 +254,16 @@
|
|||||||
'friendly_name': 'Spotify spotify_1 Song key',
|
'friendly_name': 'Spotify spotify_1 Song key',
|
||||||
'options': list([
|
'options': list([
|
||||||
'C',
|
'C',
|
||||||
'C♯',
|
'C♯/D♭',
|
||||||
'D',
|
'D',
|
||||||
'D♯',
|
'D♯/E♭',
|
||||||
'E',
|
'E',
|
||||||
'F',
|
'F',
|
||||||
'F♯',
|
'F♯/G♭',
|
||||||
'G',
|
'G',
|
||||||
'G♯',
|
'G♯/A♭',
|
||||||
'A',
|
'A',
|
||||||
'A♯',
|
'A♯/B♭',
|
||||||
'B',
|
'B',
|
||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
@ -272,7 +272,7 @@
|
|||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_reported': <ANY>,
|
'last_reported': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': 'D♯',
|
'state': 'D♯/E♭',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
# name: test_entities[sensor.spotify_spotify_1_song_liveness-entry]
|
# name: test_entities[sensor.spotify_spotify_1_song_liveness-entry]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user