mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Use f-strings in integrations starting with "M" (#32271)
* Use f-strings in integrations starting with "M" * Format mqtt light init with black * Fix lint error * Fix pylint error * Restore constants * Update homeassistant/components/mqtt/discovery.py * Update homeassistant/components/mqtt/discovery.py * Update homeassistant/components/mqtt/discovery.py * Update homeassistant/components/mqtt/discovery.py * Format with Black
This commit is contained in:
parent
bbe0f75336
commit
ba0aaeeddb
@ -154,18 +154,12 @@ class MagicSeaweedSensor(Entity):
|
||||
elif self.type == "max_breaking_swell":
|
||||
self._state = forecast.swell_maxBreakingHeight
|
||||
elif self.type == "swell_forecast":
|
||||
summary = "{} - {}".format(
|
||||
forecast.swell_minBreakingHeight, forecast.swell_maxBreakingHeight
|
||||
)
|
||||
summary = f"{forecast.swell_minBreakingHeight} - {forecast.swell_maxBreakingHeight}"
|
||||
self._state = summary
|
||||
if self.hour is None:
|
||||
for hour, data in self.data.hourly.items():
|
||||
occurs = hour
|
||||
hr_summary = "{} - {} {}".format(
|
||||
data.swell_minBreakingHeight,
|
||||
data.swell_maxBreakingHeight,
|
||||
data.swell_unit,
|
||||
)
|
||||
hr_summary = f"{data.swell_minBreakingHeight} - {data.swell_maxBreakingHeight} {data.swell_unit}"
|
||||
self._attrs[occurs] = hr_summary
|
||||
|
||||
if self.type != "swell_forecast":
|
||||
|
@ -25,7 +25,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||
# Images to attach to notification
|
||||
ATTR_IMAGES = "images"
|
||||
|
||||
DEFAULT_SENDER = "hass@{domain}"
|
||||
DEFAULT_SANDBOX = False
|
||||
|
||||
# pylint: disable=no-value-for-parameter
|
||||
@ -69,7 +68,7 @@ class MailgunNotificationService(BaseNotificationService):
|
||||
_LOGGER.debug("Mailgun domain: %s", self._client.domain)
|
||||
self._domain = self._client.domain
|
||||
if not self._sender:
|
||||
self._sender = DEFAULT_SENDER.format(domain=self._domain)
|
||||
self._sender = f"hass@{self._domain}"
|
||||
|
||||
def connection_is_valid(self):
|
||||
"""Check whether the provided credentials are valid."""
|
||||
|
@ -65,9 +65,7 @@ def setup(hass, config):
|
||||
except timeout as ex:
|
||||
_LOGGER.error("Unable to connect to Max!Cube gateway: %s", str(ex))
|
||||
hass.components.persistent_notification.create(
|
||||
"Error: {}<br />"
|
||||
"You will need to restart Home Assistant after fixing."
|
||||
"".format(ex),
|
||||
f"Error: {ex}<br />You will need to restart Home Assistant after fixing.",
|
||||
title=NOTIFICATION_TITLE,
|
||||
notification_id=NOTIFICATION_ID,
|
||||
)
|
||||
|
@ -14,7 +14,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
for handler in hass.data[DATA_KEY].values():
|
||||
cube = handler.cube
|
||||
for device in cube.devices:
|
||||
name = "{} {}".format(cube.room_by_id(device.room_id).name, device.name)
|
||||
name = f"{cube.room_by_id(device.room_id).name} {device.name}"
|
||||
|
||||
# Only add Window Shutters
|
||||
if cube.is_windowshutter(device):
|
||||
|
@ -34,7 +34,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
for handler in hass.data[DATA_KEY].values():
|
||||
cube = handler.cube
|
||||
for device in cube.devices:
|
||||
name = "{} {}".format(cube.room_by_id(device.room_id).name, device.name)
|
||||
name = f"{cube.room_by_id(device.room_id).name} {device.name}"
|
||||
|
||||
if cube.is_thermostat(device) or cube.is_wallthermostat(device):
|
||||
devices.append(MaxCubeClimate(handler, name, device.rf_address))
|
||||
|
@ -104,7 +104,6 @@ _RND = SystemRandom()
|
||||
|
||||
ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
||||
|
||||
ENTITY_IMAGE_URL = "/api/media_player_proxy/{0}?token={1}&cache={2}"
|
||||
CACHE_IMAGES = "images"
|
||||
CACHE_MAXSIZE = "maxsize"
|
||||
CACHE_LOCK = "lock"
|
||||
@ -767,7 +766,10 @@ class MediaPlayerDevice(Entity):
|
||||
if image_hash is None:
|
||||
return None
|
||||
|
||||
return ENTITY_IMAGE_URL.format(self.entity_id, self.access_token, image_hash)
|
||||
return (
|
||||
f"/api/media_player_proxy/{self.entity_id}?"
|
||||
f"token={self.access_token}&cache={image_hash}"
|
||||
)
|
||||
|
||||
@property
|
||||
def capability_attributes(self):
|
||||
|
@ -147,7 +147,7 @@ class MediaroomDevice(MediaPlayerDevice):
|
||||
self._channel = None
|
||||
self._optimistic = optimistic
|
||||
self._state = STATE_PLAYING if optimistic else STATE_STANDBY
|
||||
self._name = "Mediaroom {}".format(device_id if device_id else host)
|
||||
self._name = f"Mediaroom {device_id if device_id else host}"
|
||||
self._available = True
|
||||
if device_id:
|
||||
self._unique_id = device_id
|
||||
|
@ -9,7 +9,6 @@ HOME_LOCATION_NAME = "Home"
|
||||
|
||||
CONF_TRACK_HOME = "track_home"
|
||||
|
||||
ENTITY_ID_SENSOR_FORMAT = WEATHER_DOMAIN + ".met_{}"
|
||||
ENTITY_ID_SENSOR_FORMAT_HOME = ENTITY_ID_SENSOR_FORMAT.format(HOME_LOCATION_NAME)
|
||||
ENTITY_ID_SENSOR_FORMAT_HOME = f"{WEATHER_DOMAIN}.met_{HOME_LOCATION_NAME}"
|
||||
|
||||
_LOGGER = logging.getLogger(".")
|
||||
|
@ -168,7 +168,7 @@ class MetWeather(WeatherEntity):
|
||||
if self.track_home:
|
||||
return "home"
|
||||
|
||||
return "{}-{}".format(self._config[CONF_LATITUDE], self._config[CONF_LONGITUDE])
|
||||
return f"{self._config[CONF_LATITUDE]}-{self._config[CONF_LONGITUDE]}"
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -141,7 +141,7 @@ class MetOfficeCurrentSensor(Entity):
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
return "{} {}".format(self._name, SENSOR_TYPES[self._condition][0])
|
||||
return f"{self._name} {SENSOR_TYPES[self._condition][0]}"
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
|
@ -85,7 +85,7 @@ class MHZ19Sensor(Entity):
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
return "{}: {}".format(self._name, SENSOR_TYPES[self._sensor_type][0])
|
||||
return f"{self._name}: {SENSOR_TYPES[self._sensor_type][0]}"
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
|
@ -73,7 +73,7 @@ class MicrosoftFaceDetectEntity(ImageProcessingFaceEntity):
|
||||
if name:
|
||||
self._name = name
|
||||
else:
|
||||
self._name = "MicrosoftFace {0}".format(split_entity_id(camera_entity)[1])
|
||||
self._name = f"MicrosoftFace {split_entity_id(camera_entity)[1]}"
|
||||
|
||||
@property
|
||||
def camera_entity(self):
|
||||
|
@ -61,7 +61,7 @@ class MicrosoftFaceIdentifyEntity(ImageProcessingFaceEntity):
|
||||
if name:
|
||||
self._name = name
|
||||
else:
|
||||
self._name = "MicrosoftFace {0}".format(split_entity_id(camera_entity)[1])
|
||||
self._name = f"MicrosoftFace {split_entity_id(camera_entity)[1]}"
|
||||
|
||||
@property
|
||||
def confidence(self):
|
||||
|
@ -115,9 +115,7 @@ class MinMaxSensor(Entity):
|
||||
if name:
|
||||
self._name = name
|
||||
else:
|
||||
self._name = "{} sensor".format(
|
||||
next(v for k, v in SENSOR_TYPES.items() if self._sensor_type == v)
|
||||
).capitalize()
|
||||
self._name = f"{next(v for k, v in SENSOR_TYPES.items() if self._sensor_type == v)} sensor".capitalize()
|
||||
self._unit_of_measurement = None
|
||||
self._unit_of_measurement_mismatch = False
|
||||
self.min_value = self.max_value = self.mean = self.last = None
|
||||
|
@ -93,7 +93,7 @@ async def async_setup_entry(hass, entry):
|
||||
|
||||
hass.data[DOMAIN][DATA_DEVICES][webhook_id] = device
|
||||
|
||||
registration_name = "Mobile App: {}".format(registration[ATTR_DEVICE_NAME])
|
||||
registration_name = f"Mobile App: {registration[ATTR_DEVICE_NAME]}"
|
||||
webhook_register(hass, DOMAIN, registration_name, webhook_id, handle_webhook)
|
||||
|
||||
for domain in PLATFORMS:
|
||||
|
@ -139,8 +139,8 @@ class MobileAppNotificationService(BaseNotificationService):
|
||||
continue
|
||||
|
||||
fallback_error = result.get("errorMessage", "Unknown error")
|
||||
fallback_message = "Internal server error, please try again later: {}".format(
|
||||
fallback_error
|
||||
fallback_message = (
|
||||
f"Internal server error, please try again later: {fallback_error}"
|
||||
)
|
||||
message = result.get("message", fallback_message)
|
||||
if response.status == 429:
|
||||
|
@ -381,7 +381,7 @@ async def webhook_register_sensor(hass, config_entry, data):
|
||||
_LOGGER.error("Error registering sensor: %s", ex)
|
||||
return empty_okay_response()
|
||||
|
||||
register_signal = "{}_{}_register".format(DOMAIN, data[ATTR_SENSOR_TYPE])
|
||||
register_signal = f"{DOMAIN}_{data[ATTR_SENSOR_TYPE]}_register"
|
||||
async_dispatcher_send(hass, register_signal, data)
|
||||
|
||||
return webhook_response(
|
||||
|
@ -162,7 +162,7 @@ class ModbusThermostat(ClimateDevice):
|
||||
DATA_TYPE_FLOAT: {1: "e", 2: "f", 4: "d"},
|
||||
}
|
||||
|
||||
self._structure = ">{}".format(data_types[self._data_type][self._count])
|
||||
self._structure = f">{data_types[self._data_type][self._count]}"
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
|
@ -99,8 +99,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
structure = ">i"
|
||||
if register[CONF_DATA_TYPE] != DATA_TYPE_CUSTOM:
|
||||
try:
|
||||
structure = ">{}".format(
|
||||
data_types[register[CONF_DATA_TYPE]][register[CONF_COUNT]]
|
||||
structure = (
|
||||
f">{data_types[register[CONF_DATA_TYPE]][register[CONF_COUNT]]}"
|
||||
)
|
||||
except KeyError:
|
||||
_LOGGER.error(
|
||||
|
@ -344,7 +344,7 @@ class MoldIndicator(Entity):
|
||||
elif crit_humidity < 0:
|
||||
self._state = "0"
|
||||
else:
|
||||
self._state = "{0:d}".format(int(crit_humidity))
|
||||
self._state = f"{int(crit_humidity):d}"
|
||||
|
||||
_LOGGER.debug("Mold indicator humidity: %s", self._state)
|
||||
|
||||
|
@ -127,7 +127,7 @@ class MoparData:
|
||||
vehicle = self.vehicles[index]
|
||||
if not vehicle:
|
||||
return None
|
||||
return "{} {} {}".format(vehicle["year"], vehicle["make"], vehicle["model"])
|
||||
return f"{vehicle['year']} {vehicle['make']} {vehicle['model']}"
|
||||
|
||||
def actuate(self, command, index):
|
||||
"""Run a command on the specified Mopar vehicle."""
|
||||
|
@ -22,7 +22,7 @@ class MoparLock(LockDevice):
|
||||
def __init__(self, data, index):
|
||||
"""Initialize the Mopar lock."""
|
||||
self._index = index
|
||||
self._name = "{} Lock".format(data.get_vehicle_name(self._index))
|
||||
self._name = f"{data.get_vehicle_name(self._index)} Lock"
|
||||
self._actuate = data.actuate
|
||||
self._state = None
|
||||
|
||||
|
@ -22,7 +22,7 @@ class MoparSwitch(SwitchDevice):
|
||||
def __init__(self, data, index):
|
||||
"""Initialize the Switch."""
|
||||
self._index = index
|
||||
self._name = "{} Switch".format(data.get_vehicle_name(self._index))
|
||||
self._name = f"{data.get_vehicle_name(self._index)} Switch"
|
||||
self._actuate = data.actuate
|
||||
self._state = None
|
||||
|
||||
|
@ -437,8 +437,9 @@ async def async_subscribe(
|
||||
topic,
|
||||
catch_log_exception(
|
||||
wrapped_msg_callback,
|
||||
lambda msg: "Exception in {} when handling msg on '{}': '{}'".format(
|
||||
msg_callback.__name__, msg.topic, msg.payload
|
||||
lambda msg: (
|
||||
f"Exception in {msg_callback.__name__} when handling msg on "
|
||||
f"'{msg.topic}': '{msg.payload}'"
|
||||
),
|
||||
),
|
||||
qos,
|
||||
@ -1014,7 +1015,7 @@ def _raise_on_error(result_code: int) -> None:
|
||||
|
||||
if result_code != 0:
|
||||
raise HomeAssistantError(
|
||||
"Error talking to MQTT: {}".format(mqtt.error_string(result_code))
|
||||
f"Error talking to MQTT: {mqtt.error_string(result_code)}"
|
||||
)
|
||||
|
||||
|
||||
|
@ -126,9 +126,9 @@ async def async_start(
|
||||
for key, value in payload.items():
|
||||
if isinstance(value, str) and value:
|
||||
if value[0] == TOPIC_BASE and key.endswith("_topic"):
|
||||
payload[key] = "{}{}".format(base, value[1:])
|
||||
payload[key] = f"{base}{value[1:]}"
|
||||
if value[-1] == TOPIC_BASE and key.endswith("_topic"):
|
||||
payload[key] = "{}{}".format(value[:-1], base)
|
||||
payload[key] = f"{value[:-1]}{base}"
|
||||
|
||||
# If present, the node_id will be included in the discovered object id
|
||||
discovery_id = " ".join((node_id, object_id)) if node_id else object_id
|
||||
@ -163,12 +163,10 @@ async def async_start(
|
||||
and component in IMPLICIT_STATE_TOPIC_COMPONENTS
|
||||
):
|
||||
# state_topic not specified, infer from discovery topic
|
||||
payload[CONF_STATE_TOPIC] = "{}/{}/{}{}/state".format(
|
||||
discovery_topic,
|
||||
component,
|
||||
"%s/" % node_id if node_id else "",
|
||||
object_id,
|
||||
)
|
||||
fmt_node_id = f"{node_id}/" if node_id else ""
|
||||
payload[
|
||||
CONF_STATE_TOPIC
|
||||
] = f"{discovery_topic}/{component}/{fmt_node_id}{object_id}/state"
|
||||
_LOGGER.warning(
|
||||
'implicit %s is deprecated, add "%s":"%s" to '
|
||||
"%s discovery message",
|
||||
@ -199,7 +197,7 @@ async def async_start(
|
||||
await async_load_platform(hass, component, "mqtt", payload, hass_config)
|
||||
return
|
||||
|
||||
config_entries_key = "{}.{}".format(component, "mqtt")
|
||||
config_entries_key = f"{component}.mqtt"
|
||||
async with hass.data[DATA_CONFIG_ENTRY_LOCK]:
|
||||
if config_entries_key not in hass.data[CONFIG_ENTRY_IS_SETUP]:
|
||||
if component == "device_automation":
|
||||
|
@ -675,7 +675,7 @@ class MqttLight(
|
||||
{"red": rgb[0], "green": rgb[1], "blue": rgb[2]}
|
||||
)
|
||||
else:
|
||||
rgb_color_str = "{},{},{}".format(*rgb)
|
||||
rgb_color_str = f"{rgb[0]},{rgb[1]},{rgb[2]}"
|
||||
|
||||
mqtt.async_publish(
|
||||
self.hass,
|
||||
@ -695,7 +695,7 @@ class MqttLight(
|
||||
mqtt.async_publish(
|
||||
self.hass,
|
||||
self._topic[CONF_HS_COMMAND_TOPIC],
|
||||
"{},{}".format(*hs_color),
|
||||
f"{hs_color[0]},{hs_color[1]}",
|
||||
self._config[CONF_QOS],
|
||||
self._config[CONF_RETAIN],
|
||||
)
|
||||
@ -710,7 +710,7 @@ class MqttLight(
|
||||
mqtt.async_publish(
|
||||
self.hass,
|
||||
self._topic[CONF_XY_COMMAND_TOPIC],
|
||||
"{},{}".format(*xy_color),
|
||||
f"{xy_color[0]},{xy_color[1]}",
|
||||
self._config[CONF_QOS],
|
||||
self._config[CONF_RETAIN],
|
||||
)
|
||||
@ -753,7 +753,7 @@ class MqttLight(
|
||||
{"red": rgb[0], "green": rgb[1], "blue": rgb[2]}
|
||||
)
|
||||
else:
|
||||
rgb_color_str = "{},{},{}".format(*rgb)
|
||||
rgb_color_str = f"{rgb[0]},{rgb[1]},{rgb[2]}"
|
||||
|
||||
mqtt.async_publish(
|
||||
self.hass,
|
||||
|
@ -85,9 +85,7 @@ def generate_config(hass, passwd, password):
|
||||
|
||||
# Encrypt with what hbmqtt uses to verify
|
||||
passwd.write(
|
||||
"homeassistant:{}\n".format(custom_app_context.encrypt(password)).encode(
|
||||
"utf-8"
|
||||
)
|
||||
f"homeassistant:{custom_app_context.encrypt(password)}\n".encode("utf-8")
|
||||
)
|
||||
passwd.flush()
|
||||
|
||||
|
@ -73,7 +73,7 @@ class MQTTRoomSensor(Entity):
|
||||
"""Initialize the sensor."""
|
||||
self._state = STATE_NOT_HOME
|
||||
self._name = name
|
||||
self._state_topic = "{}{}".format(state_topic, "/+")
|
||||
self._state_topic = f"{state_topic}/+"
|
||||
self._device_id = slugify(device_id).upper()
|
||||
self._timeout = timeout
|
||||
self._consider_home = (
|
||||
|
@ -1,7 +1,10 @@
|
||||
"""Support for MyChevy binary sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySensorDevice
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DOMAIN as BINARY_SENSOR_DOMAIN,
|
||||
BinarySensorDevice,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.util import slugify
|
||||
|
||||
@ -42,11 +45,7 @@ class EVBinarySensor(BinarySensorDevice):
|
||||
self._type = config.device_class
|
||||
self._is_on = None
|
||||
self._car_vid = car_vid
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(
|
||||
"{}_{}_{}".format(
|
||||
MYCHEVY_DOMAIN, slugify(self._car.name), slugify(self._name)
|
||||
)
|
||||
)
|
||||
self.entity_id = f"{BINARY_SENSOR_DOMAIN}.{MYCHEVY_DOMAIN}_{slugify(self._car.name)}_{slugify(self._name)}"
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Support for MyChevy sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import ENTITY_ID_FORMAT
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.const import UNIT_PERCENTAGE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@ -123,11 +123,7 @@ class EVSensor(Entity):
|
||||
self._state_attributes = {}
|
||||
self._car_vid = car_vid
|
||||
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(
|
||||
"{}_{}_{}".format(
|
||||
MYCHEVY_DOMAIN, slugify(self._car.name), slugify(self._name)
|
||||
)
|
||||
)
|
||||
self.entity_id = f"{SENSOR_DOMAIN}.{MYCHEVY_DOMAIN}_{slugify(self._car.name)}_{slugify(self._name)}"
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Register callbacks."""
|
||||
|
@ -129,7 +129,7 @@ async def async_setup(hass, config):
|
||||
|
||||
def _get_mysensors_name(gateway, node_id, child_id):
|
||||
"""Return a name for a node child."""
|
||||
node_name = "{} {}".format(gateway.sensors[node_id].sketch_name, node_id)
|
||||
node_name = f"{gateway.sensors[node_id].sketch_name} {node_id}"
|
||||
node_name = next(
|
||||
(
|
||||
node[CONF_NODE_NAME]
|
||||
|
@ -42,7 +42,7 @@ MQTT_COMPONENT = "mqtt"
|
||||
def is_serial_port(value):
|
||||
"""Validate that value is a windows serial port or a unix device."""
|
||||
if sys.platform.startswith("win"):
|
||||
ports = ("COM{}".format(idx + 1) for idx in range(256))
|
||||
ports = (f"COM{idx + 1}" for idx in range(256))
|
||||
if value in ports:
|
||||
return value
|
||||
raise vol.Invalid(f"{value} is not a serial port")
|
||||
@ -73,8 +73,7 @@ async def setup_gateways(hass, config):
|
||||
|
||||
for index, gateway_conf in enumerate(conf[CONF_GATEWAYS]):
|
||||
persistence_file = gateway_conf.get(
|
||||
CONF_PERSISTENCE_FILE,
|
||||
hass.config.path("mysensors{}.pickle".format(index + 1)),
|
||||
CONF_PERSISTENCE_FILE, hass.config.path(f"mysensors{index + 1}.pickle"),
|
||||
)
|
||||
ready_gateway = await _get_gateway(hass, config, gateway_conf, persistence_file)
|
||||
if ready_gateway is not None:
|
||||
|
@ -92,8 +92,8 @@ def invalid_msg(gateway, child, value_type_name):
|
||||
"""Return a message for an invalid child during schema validation."""
|
||||
pres = gateway.const.Presentation
|
||||
set_req = gateway.const.SetReq
|
||||
return "{} requires value_type {}".format(
|
||||
pres(child.type).name, set_req[value_type_name].name
|
||||
return (
|
||||
f"{pres(child.type).name} requires value_type {set_req[value_type_name].name}"
|
||||
)
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ import logging
|
||||
from pyps4_2ndscreen.errors import NotReady, PSDataIncomplete
|
||||
import pyps4_2ndscreen.ps4 as pyps4
|
||||
|
||||
from homeassistant.components.media_player import ENTITY_IMAGE_URL, MediaPlayerDevice
|
||||
from homeassistant.components.media_player import MediaPlayerDevice
|
||||
from homeassistant.components.media_player.const import (
|
||||
ATTR_MEDIA_CONTENT_TYPE,
|
||||
ATTR_MEDIA_TITLE,
|
||||
@ -387,8 +387,9 @@ class PS4Device(MediaPlayerDevice):
|
||||
if self._state == STATE_PLAYING and self._media_content_id is not None:
|
||||
image_hash = self.media_image_hash
|
||||
if image_hash is not None:
|
||||
return ENTITY_IMAGE_URL.format(
|
||||
self.entity_id, self.access_token, image_hash
|
||||
return (
|
||||
f"/api/media_player_proxy/{self.entity_id}?"
|
||||
f"token={self.access_token}&cache={image_hash}"
|
||||
)
|
||||
return MEDIA_IMAGE_DEFAULT
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user