diff --git a/custom_components/xiaomi_home/miot/miot_spec.py b/custom_components/xiaomi_home/miot/miot_spec.py index 8f8a371..52e50ea 100644 --- a/custom_components/xiaomi_home/miot/miot_spec.py +++ b/custom_components/xiaomi_home/miot/miot_spec.py @@ -58,9 +58,7 @@ from slugify import slugify from .const import DEFAULT_INTEGRATION_LANGUAGE, SPEC_STD_LIB_EFFECTIVE_TIME from .common import MIoTHttp, load_yaml_file from .miot_error import MIoTSpecError -from .miot_storage import ( - MIoTStorage, - SpecFilter) +from .miot_storage import MIoTStorage _LOGGER = logging.getLogger(__name__) @@ -1012,6 +1010,113 @@ class _SpecBoolTranslation: return self._data[urn] +class _SpecFilter: + """ + MIoT-Spec-V2 filter for entity conversion. + """ + _SPEC_FILTER_FILE = 'specs/spec_filter.yaml' + _main_loop: asyncio.AbstractEventLoop + _data: Optional[dict[str, dict[str, set]]] + _cache: Optional[dict] + + def __init__(self, loop: Optional[asyncio.AbstractEventLoop]) -> None: + self._main_loop = loop or asyncio.get_event_loop() + self._data = None + self._cache = None + + async def init_async(self) -> None: + if isinstance(self._data, dict): + return + filter_data = None + self._data = {} + try: + filter_data = await self._main_loop.run_in_executor( + None, load_yaml_file, + os.path.join( + os.path.dirname(os.path.abspath(__file__)), + self._SPEC_FILTER_FILE)) + except Exception as err: # pylint: disable=broad-exception-caught + _LOGGER.error('spec filter, load file error, %s', err) + return + if not isinstance(filter_data, dict): + _LOGGER.error('spec filter, invalid spec filter content') + return + for values in list(filter_data.values()): + if not isinstance(values, dict): + _LOGGER.error('spec filter, invalid spec filter data') + return + for value in values.values(): + if not isinstance(value, list): + _LOGGER.error('spec filter, invalid spec filter rules') + return + + self._data = filter_data + + async def deinit_async(self) -> None: + self._cache = None + self._data = None + + async def set_spec_spec(self, urn_key: str) -> None: + """MUST call init_async() first.""" + if not self._data: + return + self._cache = self._data.get(urn_key, None) + + def filter_service(self, siid: int) -> bool: + """Filter service by siid. + MUST call init_async() and set_spec_spec() first.""" + if ( + self._cache + and 'services' in self._cache + and ( + str(siid) in self._cache['services'] + or '*' in self._cache['services']) + ): + return True + + return False + + def filter_property(self, siid: int, piid: int) -> bool: + """Filter property by piid. + MUST call init_async() and set_spec_spec() first.""" + if ( + self._cache + and 'properties' in self._cache + and ( + f'{siid}.{piid}' in self._cache['properties'] + or f'{siid}.*' in self._cache['properties']) + ): + return True + return False + + def filter_event(self, siid: int, eiid: int) -> bool: + """Filter event by eiid. + MUST call init_async() and set_spec_spec() first.""" + if ( + self._cache + and 'events' in self._cache + and ( + f'{siid}.{eiid}' in self._cache['events'] + or f'{siid}.*' in self._cache['events'] + ) + ): + return True + return False + + def filter_action(self, siid: int, aiid: int) -> bool: + """"Filter action by aiid. + MUST call init_async() and set_spec_spec() first.""" + if ( + self._cache + and 'actions' in self._cache + and ( + f'{siid}.{aiid}' in self._cache['actions'] + or f'{siid}.*' in self._cache['actions']) + ): + return True + return False + + class MIoTSpecParser: """MIoT SPEC parser.""" # pylint: disable=inconsistent-quotes @@ -1024,11 +1129,10 @@ class MIoTSpecParser: _std_lib: _SpecStdLib _multi_lang: _MIoTSpecMultiLang _bool_trans: _SpecBoolTranslation + _spec_filter: _SpecFilter _init_done: bool - _spec_filter: SpecFilter - def __init__( self, lang: Optional[str], storage: MIoTStorage, @@ -1040,12 +1144,11 @@ class MIoTSpecParser: self._std_lib = _SpecStdLib(lang=self._lang) self._multi_lang = _MIoTSpecMultiLang( lang=self._lang, storage=self._storage, loop=self._main_loop) - - self._init_done = False - self._bool_trans = _SpecBoolTranslation( lang=self._lang, loop=self._main_loop) - self._spec_filter = SpecFilter(loop=self._main_loop) + self._spec_filter = _SpecFilter(loop=self._main_loop) + + self._init_done = False async def init_async(self) -> None: if self._init_done is True: diff --git a/custom_components/xiaomi_home/miot/miot_storage.py b/custom_components/xiaomi_home/miot/miot_storage.py index bc896e5..e46ed51 100644 --- a/custom_components/xiaomi_home/miot/miot_storage.py +++ b/custom_components/xiaomi_home/miot/miot_storage.py @@ -719,113 +719,6 @@ class MIoTCert: return binascii.hexlify(sha1_hash.finalize()).decode('utf-8') -class SpecFilter: - """ - MIoT-Spec-V2 filter for entity conversion. - """ - SPEC_FILTER_FILE = 'specs/spec_filter.json' - _main_loop: asyncio.AbstractEventLoop - _data: dict[str, dict[str, set]] - _cache: Optional[dict] - - def __init__(self, loop: Optional[asyncio.AbstractEventLoop]) -> None: - self._main_loop = loop or asyncio.get_event_loop() - self._data = None - self._cache = None - - async def init_async(self) -> None: - if isinstance(self._data, dict): - return - filter_data = None - self._data = {} - try: - filter_data = await self._main_loop.run_in_executor( - None, load_json_file, - os.path.join( - os.path.dirname(os.path.abspath(__file__)), - self.SPEC_FILTER_FILE)) - except Exception as err: # pylint: disable=broad-exception-caught - _LOGGER.error('spec filter, load file error, %s', err) - return - if not isinstance(filter_data, dict): - _LOGGER.error('spec filter, invalid spec filter content') - return - for values in list(filter_data.values()): - if not isinstance(values, dict): - _LOGGER.error('spec filter, invalid spec filter data') - return - for value in values.values(): - if not isinstance(value, list): - _LOGGER.error('spec filter, invalid spec filter rules') - return - - self._data = filter_data - - async def deinit_async(self) -> None: - self._cache = None - self._data = None - - async def set_spec_spec(self, urn_key: str) -> None: - """MUST call init_async() first.""" - if not self._data: - return - self._cache = self._data.get(urn_key, None) - - def filter_service(self, siid: int) -> bool: - """Filter service by siid. - MUST call init_async() and set_spec_spec() first.""" - if ( - self._cache - and 'services' in self._cache - and ( - str(siid) in self._cache['services'] - or '*' in self._cache['services']) - ): - return True - - return False - - def filter_property(self, siid: int, piid: int) -> bool: - """Filter property by piid. - MUST call init_async() and set_spec_spec() first.""" - if ( - self._cache - and 'properties' in self._cache - and ( - f'{siid}.{piid}' in self._cache['properties'] - or f'{siid}.*' in self._cache['properties']) - ): - return True - return False - - def filter_event(self, siid: int, eiid: int) -> bool: - """Filter event by eiid. - MUST call init_async() and set_spec_spec() first.""" - if ( - self._cache - and 'events' in self._cache - and ( - f'{siid}.{eiid}' in self._cache['events'] - or f'{siid}.*' in self._cache['events'] - ) - ): - return True - return False - - def filter_action(self, siid: int, aiid: int) -> bool: - """"Filter action by aiid. - MUST call init_async() and set_spec_spec() first.""" - if ( - self._cache - and 'actions' in self._cache - and ( - f'{siid}.{aiid}' in self._cache['actions'] - or f'{siid}.*' in self._cache['actions']) - ): - return True - return False - - class DeviceManufacturer: """Device manufacturer.""" DOMAIN: str = 'miot_specs' diff --git a/custom_components/xiaomi_home/miot/specs/bool_trans.json b/custom_components/xiaomi_home/miot/specs/bool_trans.json deleted file mode 100644 index 0bf193f..0000000 --- a/custom_components/xiaomi_home/miot/specs/bool_trans.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "data": { - "urn:miot-spec-v2:property:air-cooler:000000EB": "open_close", - "urn:miot-spec-v2:property:alarm:00000012": "open_close", - "urn:miot-spec-v2:property:anion:00000025": "open_close", - "urn:miot-spec-v2:property:anti-fake:00000130": "yes_no", - "urn:miot-spec-v2:property:arrhythmia:000000B4": "yes_no", - "urn:miot-spec-v2:property:auto-cleanup:00000124": "open_close", - "urn:miot-spec-v2:property:auto-deodorization:00000125": "open_close", - "urn:miot-spec-v2:property:auto-keep-warm:0000002B": "open_close", - "urn:miot-spec-v2:property:automatic-feeding:000000F0": "open_close", - "urn:miot-spec-v2:property:blow:000000CD": "open_close", - "urn:miot-spec-v2:property:card-insertion-state:00000106": "yes_no", - "urn:miot-spec-v2:property:contact-state:0000007C": "contact_state", - "urn:miot-spec-v2:property:current-physical-control-lock:00000099": "open_close", - "urn:miot-spec-v2:property:delay:0000014F": "yes_no", - "urn:miot-spec-v2:property:deodorization:000000C6": "open_close", - "urn:miot-spec-v2:property:dns-auto-mode:000000DC": "open_close", - "urn:miot-spec-v2:property:driving-status:000000B9": "yes_no", - "urn:miot-spec-v2:property:dryer:00000027": "open_close", - "urn:miot-spec-v2:property:eco:00000024": "open_close", - "urn:miot-spec-v2:property:glimmer-full-color:00000089": "open_close", - "urn:miot-spec-v2:property:guard-mode:000000B6": "open_close", - "urn:miot-spec-v2:property:heater:00000026": "open_close", - "urn:miot-spec-v2:property:heating:000000C7": "open_close", - "urn:miot-spec-v2:property:horizontal-swing:00000017": "open_close", - "urn:miot-spec-v2:property:hot-water-recirculation:0000011C": "open_close", - "urn:miot-spec-v2:property:image-distortion-correction:0000010F": "open_close", - "urn:miot-spec-v2:property:local-storage:0000011E": "yes_no", - "urn:miot-spec-v2:property:motion-detection:00000056": "open_close", - "urn:miot-spec-v2:property:motion-state:0000007D": "motion_state", - "urn:miot-spec-v2:property:motion-tracking:0000008A": "open_close", - "urn:miot-spec-v2:property:motor-reverse:00000072": "yes_no", - "urn:miot-spec-v2:property:mute:00000040": "open_close", - "urn:miot-spec-v2:property:off-delay:00000053": "open_close", - "urn:miot-spec-v2:property:on:00000006": "open_close", - "urn:miot-spec-v2:property:physical-controls-locked:0000001D": "open_close", - "urn:miot-spec-v2:property:plasma:00000132": "yes_no", - "urn:miot-spec-v2:property:preheat:00000103": "open_close", - "urn:miot-spec-v2:property:seating-state:000000B8": "yes_no", - "urn:miot-spec-v2:property:silent-execution:000000FB": "yes_no", - "urn:miot-spec-v2:property:sleep-aid-mode:0000010B": "open_close", - "urn:miot-spec-v2:property:sleep-mode:00000028": "open_close", - "urn:miot-spec-v2:property:snore-state:0000012A": "yes_no", - "urn:miot-spec-v2:property:soft-wind:000000CF": "open_close", - "urn:miot-spec-v2:property:speed-control:000000E8": "open_close", - "urn:miot-spec-v2:property:submersion-state:0000007E": "yes_no", - "urn:miot-spec-v2:property:time-watermark:00000087": "open_close", - "urn:miot-spec-v2:property:un-straight-blowing:00000100": "open_close", - "urn:miot-spec-v2:property:uv:00000029": "open_close", - "urn:miot-spec-v2:property:valve-switch:000000FE": "open_close", - "urn:miot-spec-v2:property:ventilation:000000CE": "open_close", - "urn:miot-spec-v2:property:vertical-swing:00000018": "open_close", - "urn:miot-spec-v2:property:wake-up-mode:00000107": "open_close", - "urn:miot-spec-v2:property:water-pump:000000F2": "open_close", - "urn:miot-spec-v2:property:watering:000000CC": "open_close", - "urn:miot-spec-v2:property:wdr-mode:00000088": "open_close", - "urn:miot-spec-v2:property:wet:0000002A": "open_close", - "urn:miot-spec-v2:property:wifi-band-combine:000000E0": "open_close", - "urn:miot-spec-v2:property:wifi-ssid-hidden:000000E3": "yes_no", - "urn:miot-spec-v2:property:wind-reverse:00000117": "yes_no" - }, - "translate": { - "default": { - "de": { - "true": "Wahr", - "false": "Falsch" - }, - "en": { - "true": "True", - "false": "False" - }, - "es": { - "true": "Verdadero", - "false": "Falso" - }, - "fr": { - "true": "Vrai", - "false": "Faux" - }, - "ja": { - "true": "真", - "false": "偽" - }, - "nl": { - "true": "True", - "false": "False" - }, - "pt": { - "true": "True", - "false": "False" - }, - "pt-BR": { - "true": "True", - "false": "False" - }, - "ru": { - "true": "Истина", - "false": "Ложь" - }, - "zh-Hans": { - "true": "真", - "false": "假" - }, - "zh-Hant": { - "true": "真", - "false": "假" - } - }, - "open_close": { - "de": { - "true": "Öffnen", - "false": "Schließen" - }, - "en": { - "true": "Open", - "false": "Close" - }, - "es": { - "true": "Abierto", - "false": "Cerrado" - }, - "fr": { - "true": "Ouvert", - "false": "Fermer" - }, - "ja": { - "true": "開く", - "false": "閉じる" - }, - "nl": { - "true": "Open", - "false": "Dicht" - }, - "pt": { - "true": "Aberto", - "false": "Fechado" - }, - "pt-BR": { - "true": "Aberto", - "false": "Fechado" - }, - "ru": { - "true": "Открыть", - "false": "Закрыть" - }, - "zh-Hans": { - "true": "开启", - "false": "关闭" - }, - "zh-Hant": { - "true": "開啟", - "false": "關閉" - } - }, - "yes_no": { - "de": { - "true": "Ja", - "false": "Nein" - }, - "en": { - "true": "Yes", - "false": "No" - }, - "es": { - "true": "Sí", - "false": "No" - }, - "fr": { - "true": "Oui", - "false": "Non" - }, - "ja": { - "true": "はい", - "false": "いいえ" - }, - "nl": { - "true": "Ja", - "false": "Nee" - }, - "pt": { - "true": "Sim", - "false": "Não" - }, - "pt-BR": { - "true": "Sim", - "false": "Não" - }, - "ru": { - "true": "Да", - "false": "Нет" - }, - "zh-Hans": { - "true": "是", - "false": "否" - }, - "zh-Hant": { - "true": "是", - "false": "否" - } - }, - "motion_state": { - "de": { - "true": "Bewegung erkannt", - "false": "Keine Bewegung erkannt" - }, - "en": { - "true": "Motion Detected", - "false": "No Motion Detected" - }, - "es": { - "true": "Movimiento detectado", - "false": "No se detecta movimiento" - }, - "fr": { - "true": "Mouvement détecté", - "false": "Aucun mouvement détecté" - }, - "ja": { - "true": "動きを検知", - "false": "動きが検出されません" - }, - "nl": { - "true": "Contact", - "false": "Geen contact" - }, - "pt": { - "true": "Contato", - "false": "Sem contato" - }, - "pt-BR": { - "true": "Contato", - "false": "Sem contato" - }, - "ru": { - "true": "Обнаружено движение", - "false": "Движение не обнаружено" - }, - "zh-Hans": { - "true": "有人", - "false": "无人" - }, - "zh-Hant": { - "true": "有人", - "false": "無人" - } - }, - "contact_state": { - "de": { - "true": "Kontakt", - "false": "Kein Kontakt" - }, - "en": { - "true": "Contact", - "false": "No Contact" - }, - "es": { - "true": "Contacto", - "false": "Sin contacto" - }, - "fr": { - "true": "Contact", - "false": "Pas de contact" - }, - "ja": { - "true": "接触", - "false": "非接触" - }, - "nl": { - "true": "Contact", - "false": "Geen contact" - }, - "pt": { - "true": "Contato", - "false": "Sem contato" - }, - "pt-BR": { - "true": "Contato", - "false": "Sem contato" - }, - "ru": { - "true": "Контакт", - "false": "Нет контакта" - }, - "zh-Hans": { - "true": "接触", - "false": "分离" - }, - "zh-Hant": { - "true": "接觸", - "false": "分離" - } - } - } -} \ No newline at end of file diff --git a/custom_components/xiaomi_home/miot/specs/bool_trans.yaml b/custom_components/xiaomi_home/miot/specs/bool_trans.yaml new file mode 100644 index 0000000..5b9f1c7 --- /dev/null +++ b/custom_components/xiaomi_home/miot/specs/bool_trans.yaml @@ -0,0 +1,231 @@ +data: + urn:miot-spec-v2:property:air-cooler:000000EB: open_close + urn:miot-spec-v2:property:alarm:00000012: open_close + urn:miot-spec-v2:property:anion:00000025: open_close + urn:miot-spec-v2:property:anti-fake:00000130: yes_no + urn:miot-spec-v2:property:arrhythmia:000000B4: yes_no + urn:miot-spec-v2:property:auto-cleanup:00000124: open_close + urn:miot-spec-v2:property:auto-deodorization:00000125: open_close + urn:miot-spec-v2:property:auto-keep-warm:0000002B: open_close + urn:miot-spec-v2:property:automatic-feeding:000000F0: open_close + urn:miot-spec-v2:property:blow:000000CD: open_close + urn:miot-spec-v2:property:card-insertion-state:00000106: yes_no + urn:miot-spec-v2:property:contact-state:0000007C: contact_state + urn:miot-spec-v2:property:current-physical-control-lock:00000099: open_close + urn:miot-spec-v2:property:delay:0000014F: yes_no + urn:miot-spec-v2:property:deodorization:000000C6: open_close + urn:miot-spec-v2:property:dns-auto-mode:000000DC: open_close + urn:miot-spec-v2:property:driving-status:000000B9: yes_no + urn:miot-spec-v2:property:dryer:00000027: open_close + urn:miot-spec-v2:property:eco:00000024: open_close + urn:miot-spec-v2:property:glimmer-full-color:00000089: open_close + urn:miot-spec-v2:property:guard-mode:000000B6: open_close + urn:miot-spec-v2:property:heater:00000026: open_close + urn:miot-spec-v2:property:heating:000000C7: open_close + urn:miot-spec-v2:property:horizontal-swing:00000017: open_close + urn:miot-spec-v2:property:hot-water-recirculation:0000011C: open_close + urn:miot-spec-v2:property:image-distortion-correction:0000010F: open_close + urn:miot-spec-v2:property:local-storage:0000011E: yes_no + urn:miot-spec-v2:property:motion-detection:00000056: open_close + urn:miot-spec-v2:property:motion-state:0000007D: motion_state + urn:miot-spec-v2:property:motion-tracking:0000008A: open_close + urn:miot-spec-v2:property:motor-reverse:00000072: yes_no + urn:miot-spec-v2:property:mute:00000040: open_close + urn:miot-spec-v2:property:off-delay:00000053: open_close + urn:miot-spec-v2:property:on:00000006: open_close + urn:miot-spec-v2:property:physical-controls-locked:0000001D: open_close + urn:miot-spec-v2:property:plasma:00000132: yes_no + urn:miot-spec-v2:property:preheat:00000103: open_close + urn:miot-spec-v2:property:seating-state:000000B8: yes_no + urn:miot-spec-v2:property:silent-execution:000000FB: yes_no + urn:miot-spec-v2:property:sleep-aid-mode:0000010B: open_close + urn:miot-spec-v2:property:sleep-mode:00000028: open_close + urn:miot-spec-v2:property:snore-state:0000012A: yes_no + urn:miot-spec-v2:property:soft-wind:000000CF: open_close + urn:miot-spec-v2:property:speed-control:000000E8: open_close + urn:miot-spec-v2:property:submersion-state:0000007E: yes_no + urn:miot-spec-v2:property:time-watermark:00000087: open_close + urn:miot-spec-v2:property:un-straight-blowing:00000100: open_close + urn:miot-spec-v2:property:uv:00000029: open_close + urn:miot-spec-v2:property:valve-switch:000000FE: open_close + urn:miot-spec-v2:property:ventilation:000000CE: open_close + urn:miot-spec-v2:property:vertical-swing:00000018: open_close + urn:miot-spec-v2:property:wake-up-mode:00000107: open_close + urn:miot-spec-v2:property:water-pump:000000F2: open_close + urn:miot-spec-v2:property:watering:000000CC: open_close + urn:miot-spec-v2:property:wdr-mode:00000088: open_close + urn:miot-spec-v2:property:wet:0000002A: open_close + urn:miot-spec-v2:property:wifi-band-combine:000000E0: open_close + urn:miot-spec-v2:property:wifi-ssid-hidden:000000E3: yes_no + urn:miot-spec-v2:property:wind-reverse:00000117: yes_no +translate: + default: + de: + true: Wahr + false: Falsch + en: + true: True + false: False + es: + true: Verdadero + false: Falso + fr: + true: Vrai + false: Faux + ja: + true: 真 + false: 偽 + nl: + true: True + false: False + pt: + true: True + false: False + pt-BR: + true: True + false: False + ru: + true: Истина + false: Ложь + zh-Hans: + true: 真 + false: 假 + zh-Hant: + true: 真 + false: 假 + open_close: + de: + true: Öffnen + false: Schließen + en: + true: Open + false: Close + es: + true: Abierto + false: Cerrado + fr: + true: Ouvert + false: Fermer + ja: + true: 開く + false: 閉じる + nl: + true: Open + false: Dicht + pt: + true: Aberto + false: Fechado + pt-BR: + true: Aberto + false: Fechado + ru: + true: Открыть + false: Закрыть + zh-Hans: + true: 开启 + false: 关闭 + zh-Hant: + true: 開啟 + false: 關閉 + yes_no: + de: + true: Ja + false: Nein + en: + true: Yes + false: No + es: + true: Sí + false: No + fr: + true: Oui + false: Non + ja: + true: はい + false: いいえ + nl: + true: Ja + false: Nee + pt: + true: Sim + false: Não + pt-BR: + true: Sim + false: Não + ru: + true: Да + false: Нет + zh-Hans: + true: 是 + false: 否 + zh-Hant: + true: 是 + false: 否 + motion_state: + de: + true: Bewegung erkannt + false: Keine Bewegung erkannt + en: + true: Motion Detected + false: No Motion Detected + es: + true: Movimiento detectado + false: No se detecta movimiento + fr: + true: Mouvement détecté + false: Aucun mouvement détecté + ja: + true: 動きを検知 + false: 動きが検出されません + nl: + true: Contact + false: Geen contact + pt: + true: Contato + false: Sem contato + pt-BR: + true: Contato + false: Sem contato + ru: + true: Обнаружено движение + false: Движение не обнаружено + zh-Hans: + true: 有人 + false: 无人 + zh-Hant: + true: 有人 + false: 無人 + contact_state: + de: + true: Kontakt + false: Kein Kontakt + en: + true: Contact + false: No Contact + es: + true: Contacto + false: Sin contacto + fr: + true: Contact + false: Pas de contact + ja: + true: 接触 + false: 非接触 + nl: + true: Contact + false: Geen contact + pt: + true: Contato + false: Sem contato + pt-BR: + true: Contato + false: Sem contato + ru: + true: Контакт + false: Нет контакта + zh-Hans: + true: 接触 + false: 分离 + zh-Hant: + true: 接觸 + false: 分離 diff --git a/custom_components/xiaomi_home/miot/specs/multi_lang.json b/custom_components/xiaomi_home/miot/specs/multi_lang.json deleted file mode 100644 index 5e48bcc..0000000 --- a/custom_components/xiaomi_home/miot/specs/multi_lang.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1": { - "de": { - "service:001": "Geräteinformationen", - "service:001:property:003": "Geräte-ID", - "service:001:property:005": "Seriennummer (SN)", - "service:002": "Gateway", - "service:002:event:001": "Netzwerk geändert", - "service:002:event:002": "Netzwerk geändert", - "service:002:property:001": "Zugriffsmethode", - "service:002:property:001:valuelist:000": "Kabelgebunden", - "service:002:property:001:valuelist:001": "5G Drahtlos", - "service:002:property:001:valuelist:002": "2.4G Drahtlos", - "service:002:property:002": "IP-Adresse", - "service:002:property:003": "WiFi-Netzwerkname", - "service:002:property:004": "Aktuelle Zeit", - "service:002:property:005": "DHCP-Server-MAC-Adresse", - "service:003": "Anzeigelampe", - "service:003:property:001": "Schalter", - "service:004": "Virtueller Dienst", - "service:004:action:001": "Virtuelles Ereignis erzeugen", - "service:004:event:001": "Virtuelles Ereignis aufgetreten", - "service:004:property:001": "Ereignisname" - }, - "en": { - "service:001": "Device Information", - "service:001:property:003": "Device ID", - "service:001:property:005": "Serial Number (SN)", - "service:002": "Gateway", - "service:002:event:001": "Network Changed", - "service:002:event:002": "Network Changed", - "service:002:property:001": "Access Method", - "service:002:property:001:valuelist:000": "Wired", - "service:002:property:001:valuelist:001": "5G Wireless", - "service:002:property:001:valuelist:002": "2.4G Wireless", - "service:002:property:002": "IP Address", - "service:002:property:003": "WiFi Network Name", - "service:002:property:004": "Current Time", - "service:002:property:005": "DHCP Server MAC Address", - "service:003": "Indicator Light", - "service:003:property:001": "Switch", - "service:004": "Virtual Service", - "service:004:action:001": "Generate Virtual Event", - "service:004:event:001": "Virtual Event Occurred", - "service:004:property:001": "Event Name" - }, - "es": { - "service:001": "Información del dispositivo", - "service:001:property:003": "ID del dispositivo", - "service:001:property:005": "Número de serie (SN)", - "service:002": "Puerta de enlace", - "service:002:event:001": "Cambio de red", - "service:002:event:002": "Cambio de red", - "service:002:property:001": "Método de acceso", - "service:002:property:001:valuelist:000": "Cableado", - "service:002:property:001:valuelist:001": "5G inalámbrico", - "service:002:property:001:valuelist:002": "2.4G inalámbrico", - "service:002:property:002": "Dirección IP", - "service:002:property:003": "Nombre de red WiFi", - "service:002:property:004": "Hora actual", - "service:002:property:005": "Dirección MAC del servidor DHCP", - "service:003": "Luz indicadora", - "service:003:property:001": "Interruptor", - "service:004": "Servicio virtual", - "service:004:action:001": "Generar evento virtual", - "service:004:event:001": "Ocurrió un evento virtual", - "service:004:property:001": "Nombre del evento" - }, - "fr": { - "service:001": "Informations sur l'appareil", - "service:001:property:003": "ID de l'appareil", - "service:001:property:005": "Numéro de série (SN)", - "service:002": "Passerelle", - "service:002:event:001": "Changement de réseau", - "service:002:event:002": "Changement de réseau", - "service:002:property:001": "Méthode d'accès", - "service:002:property:001:valuelist:000": "Câblé", - "service:002:property:001:valuelist:001": "Sans fil 5G", - "service:002:property:001:valuelist:002": "Sans fil 2.4G", - "service:002:property:002": "Adresse IP", - "service:002:property:003": "Nom du réseau WiFi", - "service:002:property:004": "Heure actuelle", - "service:002:property:005": "Adresse MAC du serveur DHCP", - "service:003": "Voyant lumineux", - "service:003:property:001": "Interrupteur", - "service:004": "Service virtuel", - "service:004:action:001": "Générer un événement virtuel", - "service:004:event:001": "Événement virtuel survenu", - "service:004:property:001": "Nom de l'événement" - }, - "ja": { - "service:001": "デバイス情報", - "service:001:property:003": "デバイスID", - "service:001:property:005": "シリアル番号 (SN)", - "service:002": "ゲートウェイ", - "service:002:event:001": "ネットワークが変更されました", - "service:002:event:002": "ネットワークが変更されました", - "service:002:property:001": "アクセス方法", - "service:002:property:001:valuelist:000": "有線", - "service:002:property:001:valuelist:001": "5G ワイヤレス", - "service:002:property:001:valuelist:002": "2.4G ワイヤレス", - "service:002:property:002": "IPアドレス", - "service:002:property:003": "WiFiネットワーク名", - "service:002:property:004": "現在の時間", - "service:002:property:005": "DHCPサーバーMACアドレス", - "service:003": "インジケータライト", - "service:003:property:001": "スイッチ", - "service:004": "バーチャルサービス", - "service:004:action:001": "バーチャルイベントを生成", - "service:004:event:001": "バーチャルイベントが発生しました", - "service:004:property:001": "イベント名" - }, - "ru": { - "service:001": "Информация об устройстве", - "service:001:property:003": "ID устройства", - "service:001:property:005": "Серийный номер (SN)", - "service:002": "Шлюз", - "service:002:event:001": "Сеть изменена", - "service:002:event:002": "Сеть изменена", - "service:002:property:001": "Метод доступа", - "service:002:property:001:valuelist:000": "Проводной", - "service:002:property:001:valuelist:001": "5G Беспроводной", - "service:002:property:001:valuelist:002": "2.4G Беспроводной", - "service:002:property:002": "IP Адрес", - "service:002:property:003": "Название WiFi сети", - "service:002:property:004": "Текущее время", - "service:002:property:005": "MAC адрес DHCP сервера", - "service:003": "Световой индикатор", - "service:003:property:001": "Переключатель", - "service:004": "Виртуальная служба", - "service:004:action:001": "Создать виртуальное событие", - "service:004:event:001": "Произошло виртуальное событие", - "service:004:property:001": "Название события" - }, - "zh-Hant": { - "service:001": "設備信息", - "service:001:property:003": "設備ID", - "service:001:property:005": "序號 (SN)", - "service:002": "網關", - "service:002:event:001": "網路發生變化", - "service:002:event:002": "網路發生變化", - "service:002:property:001": "接入方式", - "service:002:property:001:valuelist:000": "有線", - "service:002:property:001:valuelist:001": "5G 無線", - "service:002:property:001:valuelist:002": "2.4G 無線", - "service:002:property:002": "IP地址", - "service:002:property:003": "WiFi網路名稱", - "service:002:property:004": "當前時間", - "service:002:property:005": "DHCP伺服器MAC地址", - "service:003": "指示燈", - "service:003:property:001": "開關", - "service:004": "虛擬服務", - "service:004:action:001": "產生虛擬事件", - "service:004:event:001": "虛擬事件發生", - "service:004:property:001": "事件名稱" - } - }, - "urn:miot-spec-v2:device:switch:0000A003:lumi-acn040:1": { - "en": { - "service:011": "Right Button On and Off", - "service:011:property:001": "Right Button On and Off", - "service:015:action:001": "Left Button Identify", - "service:016:action:001": "Middle Button Identify", - "service:017:action:001": "Right Button Identify" - }, - "zh-Hans": { - "service:015:action:001": "左键确认", - "service:016:action:001": "中键确认", - "service:017:action:001": "右键确认" - } - } -} \ No newline at end of file diff --git a/custom_components/xiaomi_home/miot/specs/spec_filter.json b/custom_components/xiaomi_home/miot/specs/spec_filter.json deleted file mode 100644 index 274fb34..0000000 --- a/custom_components/xiaomi_home/miot/specs/spec_filter.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-ma4": { - "properties": [ - "9.*", - "13.*", - "15.*" - ], - "services": [ - "10" - ] - }, - "urn:miot-spec-v2:device:curtain:0000A00C:lumi-hmcn01": { - "properties": [ - "5.1" - ], - "services": [ - "4", - "7", - "8" - ] - }, - "urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1": { - "events": [ - "2.1" - ] - }, - "urn:miot-spec-v2:device:health-pot:0000A051:chunmi-a1": { - "services": [ - "5" - ] - }, - "urn:miot-spec-v2:device:light:0000A001:philips-strip3": { - "properties": [ - "2.2" - ], - "services": [ - "1", - "3" - ] - }, - "urn:miot-spec-v2:device:light:0000A001:yeelink-color2": { - "properties": [ - "3.*", - "2.5" - ] - }, - "urn:miot-spec-v2:device:light:0000A001:yeelink-dnlight2": { - "services": [ - "3" - ] - }, - "urn:miot-spec-v2:device:light:0000A001:yeelink-mbulb3": { - "services": [ - "3" - ] - }, - "urn:miot-spec-v2:device:motion-sensor:0000A014:xiaomi-pir1": { - "services": [ - "1", - "5" - ] - }, - "urn:miot-spec-v2:device:router:0000A036:xiaomi-rd03": { - "services": [ - "*" - ] - } -} \ No newline at end of file diff --git a/custom_components/xiaomi_home/miot/specs/spec_filter.yaml b/custom_components/xiaomi_home/miot/specs/spec_filter.yaml new file mode 100644 index 0000000..5b416af --- /dev/null +++ b/custom_components/xiaomi_home/miot/specs/spec_filter.yaml @@ -0,0 +1,43 @@ +urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-ma4: + properties: + - "9.*" + - "13.*" + - "15.*" + services: + - "10" +urn:miot-spec-v2:device:curtain:0000A00C:lumi-hmcn01: + properties: + - "5.1" + services: + - "4" + - "7" + - "8" +urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1: + events: + - "2.1" +urn:miot-spec-v2:device:health-pot:0000A051:chunmi-a1: + services: + - "5" +urn:miot-spec-v2:device:light:0000A001:philips-strip3: + properties: + - "2.2" + services: + - "1" + - "3" +urn:miot-spec-v2:device:light:0000A001:yeelink-color2: + properties: + - "3.*" + - "2.5" +urn:miot-spec-v2:device:light:0000A001:yeelink-dnlight2: + services: + - "3" +urn:miot-spec-v2:device:light:0000A001:yeelink-mbulb3: + services: + - "3" +urn:miot-spec-v2:device:motion-sensor:0000A014:xiaomi-pir1: + services: + - "1" + - "5" +urn:miot-spec-v2:device:router:0000A036:xiaomi-rd03: + services: + - "*"