Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions homeassistant/components/lastfm/const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Constants for LastFM."""
import logging
from typing import Final

LOGGER = logging.getLogger(__package__)
DOMAIN: Final = "lastfm"
DEFAULT_NAME = "LastFM"

CONF_USERS = "users"

ATTR_LAST_PLAYED = "last_played"
ATTR_PLAY_COUNT = "play_count"
ATTR_TOP_PLAYED = "top_played"

STATE_NOT_SCROBBLING = "Not Scrobbling"
18 changes: 8 additions & 10 deletions homeassistant/components/lastfm/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import annotations

import hashlib
import logging

from pylast import LastFMNetwork, Track, User, WSError
import voluptuous as vol
Expand All @@ -14,15 +13,14 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

LOGGER = logging.getLogger(__name__)

CONF_USERS = "users"

ATTR_LAST_PLAYED = "last_played"
ATTR_PLAY_COUNT = "play_count"
ATTR_TOP_PLAYED = "top_played"

STATE_NOT_SCROBBLING = "Not Scrobbling"
from .const import (
ATTR_LAST_PLAYED,
ATTR_PLAY_COUNT,
ATTR_TOP_PLAYED,
CONF_USERS,
LOGGER,
STATE_NOT_SCROBBLING,
)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
Expand Down
2 changes: 1 addition & 1 deletion tests/components/lastfm/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest

from homeassistant.components import sensor
from homeassistant.components.lastfm.sensor import STATE_NOT_SCROBBLING
from homeassistant.components.lastfm.const import STATE_NOT_SCROBBLING
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component

Expand Down