Skip to content

Commit 0ede79c

Browse files
committed
Добавлена поддержка ТВ Станции
1 parent 7da8fd7 commit 0ede79c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

custom_components/yandex_station_intents/yandex_quasar.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async def async_init(self):
133133
room_name = room['name']
134134

135135
for device in room['devices']:
136-
if device['type'].startswith('devices.types.smart_speaker') or device['type'].endswith('yandex.module'):
136+
if self._is_supported_device(device):
137137
device['room'] = room_name
138138
self.devices.append(Device.from_dict(device))
139139

@@ -236,6 +236,25 @@ async def clear_scenarios(self):
236236
except Exception:
237237
_LOGGER.exception(f'Ошибка удаления сценария {scenario_name!r}')
238238

239+
@staticmethod
240+
def _is_supported_device(device: dict[str, Any]) -> bool:
241+
device_type = device.get('type', '')
242+
243+
# devices.types.smart_speaker.yandex.station.mini_2
244+
# devices.types.smart_speaker.yandex.station_2
245+
if device_type.startswith('devices.types.smart_speaker'):
246+
return True
247+
248+
# devices.types.media_device.tv.yandex.magritte
249+
if device_type.startswith('devices.types.media_device.tv.yandex'):
250+
return True
251+
252+
# devices.types.media_device.dongle.yandex.module_2
253+
if 'dongle.yandex.module' in device_type:
254+
return True
255+
256+
return False
257+
239258

240259
class EventStream:
241260
def __init__(
@@ -319,6 +338,8 @@ async def _on_message(self, payload: dict[Any, Any]):
319338
continue
320339

321340
if cap_state['instance'] in ['text_action', 'phrase_action'] and INTENT_ID_MARKER in cap_state['value']:
341+
_LOGGER.debug(f'Интент обнаружен в событии: {dev!r}')
342+
322343
for device in self._quasar.devices:
323344
if device.id != dev['id'] or not device.yandex_station_id:
324345
continue

0 commit comments

Comments
 (0)