mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-18 16:10:44 +08:00
fix: hyd.airer.lyjpro light service
This commit is contained in:
parent
96b75fc5e6
commit
61e9897848
@ -156,7 +156,8 @@ async def async_setup_entry(
|
|||||||
device.entity_list[platform].remove(entity)
|
device.entity_list[platform].remove(entity)
|
||||||
entity_id = device.gen_service_entity_id(
|
entity_id = device.gen_service_entity_id(
|
||||||
ha_domain=platform,
|
ha_domain=platform,
|
||||||
siid=entity.spec.iid) # type: ignore
|
siid=entity.spec.iid,
|
||||||
|
description=entity.spec.description)
|
||||||
if er.async_get(entity_id_or_uuid=entity_id):
|
if er.async_get(entity_id_or_uuid=entity_id):
|
||||||
er.async_remove(entity_id=entity_id)
|
er.async_remove(entity_id=entity_id)
|
||||||
if platform in device.prop_list:
|
if platform in device.prop_list:
|
||||||
|
|||||||
@ -345,10 +345,11 @@ class MIoTDevice:
|
|||||||
f'{ha_domain}.{self._model_strs[0][:9]}_{self.did_tag}_'
|
f'{ha_domain}.{self._model_strs[0][:9]}_{self.did_tag}_'
|
||||||
f'{self._model_strs[-1][:20]}')
|
f'{self._model_strs[-1][:20]}')
|
||||||
|
|
||||||
def gen_service_entity_id(self, ha_domain: str, siid: int) -> str:
|
def gen_service_entity_id(self, ha_domain: str, siid: int,
|
||||||
|
description: str) -> str:
|
||||||
return (
|
return (
|
||||||
f'{ha_domain}.{self._model_strs[0][:9]}_{self.did_tag}_'
|
f'{ha_domain}.{self._model_strs[0][:9]}_{self.did_tag}_'
|
||||||
f'{self._model_strs[-1][:20]}_s_{siid}')
|
f'{self._model_strs[-1][:20]}_s_{siid}_{description}')
|
||||||
|
|
||||||
def gen_prop_entity_id(
|
def gen_prop_entity_id(
|
||||||
self, ha_domain: str, spec_name: str, siid: int, piid: int
|
self, ha_domain: str, spec_name: str, siid: int, piid: int
|
||||||
@ -894,7 +895,8 @@ class MIoTServiceEntity(Entity):
|
|||||||
self._attr_name = f' {self.entity_data.spec.description_trans}'
|
self._attr_name = f' {self.entity_data.spec.description_trans}'
|
||||||
elif isinstance(self.entity_data.spec, MIoTSpecService):
|
elif isinstance(self.entity_data.spec, MIoTSpecService):
|
||||||
self.entity_id = miot_device.gen_service_entity_id(
|
self.entity_id = miot_device.gen_service_entity_id(
|
||||||
DOMAIN, siid=self.entity_data.spec.iid)
|
DOMAIN, siid=self.entity_data.spec.iid,
|
||||||
|
description=self.entity_data.spec.description)
|
||||||
self._attr_name = (
|
self._attr_name = (
|
||||||
f'{"* "if self.entity_data.spec.proprietary else " "}'
|
f'{"* "if self.entity_data.spec.proprietary else " "}'
|
||||||
f'{self.entity_data.spec.description_trans}')
|
f'{self.entity_data.spec.description_trans}')
|
||||||
|
|||||||
@ -1093,7 +1093,7 @@ class _SpecFilter:
|
|||||||
|
|
||||||
class _SpecAdd:
|
class _SpecAdd:
|
||||||
"""MIoT-Spec-V2 add for entity conversion."""
|
"""MIoT-Spec-V2 add for entity conversion."""
|
||||||
_SPEC_ADD_FILE = 'specs/spec_add.yaml'
|
_SPEC_ADD_FILE = 'specs/spec_add.json'
|
||||||
_main_loop: asyncio.AbstractEventLoop
|
_main_loop: asyncio.AbstractEventLoop
|
||||||
_data: Optional[dict]
|
_data: Optional[dict]
|
||||||
_selected: Optional[dict]
|
_selected: Optional[dict]
|
||||||
@ -1121,7 +1121,7 @@ class _SpecAdd:
|
|||||||
_LOGGER.error('spec add, invalid spec add content')
|
_LOGGER.error('spec add, invalid spec add content')
|
||||||
return
|
return
|
||||||
for key, value in add_data.items():
|
for key, value in add_data.items():
|
||||||
if not isinstance(key, str) or not isinstance(value, (dict, str)):
|
if not isinstance(key, str) or not isinstance(value, (list, str)):
|
||||||
_LOGGER.error('spec add, invalid spec modify data')
|
_LOGGER.error('spec add, invalid spec modify data')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -145,3 +145,10 @@ urn:miot-spec-v2:device:water-purifier:0000A013:roswan-lte01:1:0000D05A:
|
|||||||
unit: ppm
|
unit: ppm
|
||||||
prop.4.2:
|
prop.4.2:
|
||||||
unit: ppm
|
unit: ppm
|
||||||
|
urn:miot-spec-v2:device:airer:0000A00D:hyd-lyjpro:1:
|
||||||
|
prop.2.3:
|
||||||
|
name: current-position-a
|
||||||
|
prop.2.8:
|
||||||
|
name: target-position-a
|
||||||
|
prop.2.9:
|
||||||
|
name: target-position-b
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user