Fixes
This commit is contained in:
@@ -57,7 +57,7 @@ class SispmctlHost:
|
||||
|
||||
async def update_state(self):
|
||||
url = f"http://{self.hostname}:{self.port}"
|
||||
async with self._session.get(url, timeout=20) as resp:
|
||||
async with self._session.get(url, timeout=3) as resp:
|
||||
if resp.status == 200:
|
||||
result = await resp.json()
|
||||
await self.notify_switches(result)
|
||||
|
||||
@@ -12,4 +12,4 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
sensor = IsConnectedSensor(connection.get_name() + "_connected")
|
||||
connection.connected_sensor = sensor
|
||||
sensors.append(sensor)
|
||||
async_add_entities(sensors)
|
||||
async_add_entities(sensors)
|
||||
@@ -57,7 +57,13 @@ def find_local_radio_url_by_name(search_name):
|
||||
if search_name.startswith('http'):
|
||||
return search_name
|
||||
|
||||
for radioId, radio in find_local_radio_url_by_name.stations.items():
|
||||
# first try: find a station that starts with the search expression
|
||||
for radio_id, radio in find_local_radio_url_by_name.stations.items():
|
||||
if radio['name'].lower().startswith(search_name):
|
||||
return radio['url']
|
||||
|
||||
# second try: containment is enough
|
||||
for radio_id, radio in find_local_radio_url_by_name.stations.items():
|
||||
if search_name in radio['name'].lower():
|
||||
return radio['url']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user