From 2f4540f7a798faf48971dce35f21c6460da771ae Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 27 Mar 2024 13:00:18 +0800 Subject: [PATCH 01/24] =?UTF-8?q?=F0=9F=94=A7=20fix=20tds=20sensor=20for?= =?UTF-8?q?=20water=20purifier=20(#1582)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index bf39e46b4..522f2beae 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1237,7 +1237,7 @@ 'smith.waterpuri.cxr800': { 'chunk_properties': 1, 'state_property': 'chanitex_wp_gs.rsysstate', - 'sensor_properties': 'rwaterconsumption,rfilterwaterlifei,rfilterwaterlifeii,rfilterwaterlifeiii', + 'sensor_properties': 'tds_in,tds_out,rwaterconsumption,rfilterwaterlifei,rfilterwaterlifeii,rfilterwaterlifeiii', }, 'shuii.humidifier.jsq002': { 'brightness_for_on': 3, @@ -1467,11 +1467,11 @@ }, 'yunmi.waterpuri.*': { 'number_properties': 'tds_warn_thd', - 'sensor_properties': 'rinse,filter_remaining', + 'sensor_properties': 'tds_in,tds_out,rinse,filter_remaining', 'switch_properties': 'light_mode', }, 'yunmi.waterpuri.s20': { - 'sensor_properties': 'water_purifier.temperature,current_team,flow_in,flow_out', + 'sensor_properties': 'tds_in,tds_out,water_purifier.temperature,current_team,flow_in,flow_out', 'switch_properties': 'child_lock', }, 'yyunyi.wopener.yypy24': { From 98dd0399ea7a2942d69321cffb7d2ddab6045349 Mon Sep 17 00:00:00 2001 From: ptbsare <496725701@qq.com> Date: Wed, 27 Mar 2024 13:24:38 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=F0=9F=91=A8=E2=80=8D=F0=9F=8D=B3=20impro?= =?UTF-8?q?ve=20for=20viomi.oven.so1=20(#1598)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/miio2miot_specs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/core/miio2miot_specs.py b/custom_components/xiaomi_miot/core/miio2miot_specs.py index fff952e20..b88546297 100644 --- a/custom_components/xiaomi_miot/core/miio2miot_specs.py +++ b/custom_components/xiaomi_miot/core/miio2miot_specs.py @@ -1330,7 +1330,8 @@ def cbk(prop, params, props, **kwargs): 'viomi.oven.so1': { # methods: # ['get_prop', 'setDish', 'deleteDish', 'getDishs', 'setStartDish', 'setStartMode', 'setPrepareDish', 'setPrepareMode', 'setPause', 'canclePrepare', 'setEnd', 'setBootUp', 'setTurnOff']; - 'entity_attrs': ['hwInfo', 'swInfo', 'error', 'dishId', 'dishName', 'status', 'mode', 'workTime', 'temp', 'leftTime', 'tempSetZ', 'timeSetZ', 'tempSetK', 'timeSetK', 'waterTank', 'prepareTime', 'doorIsOpen'], + 'miio_props': ['hwInfo', 'swInfo', 'error', 'dishId', 'dishName', 'tempSetZ', 'timeSetZ', 'tempSetK', 'timeSetK', 'waterTank', 'prepareTime', 'doorIsOpen'], + 'entity_attrs': ['hwInfo', 'swInfo', 'error', 'dishId', 'dishName', 'tempSetZ', 'timeSetZ', 'tempSetK', 'timeSetK', 'waterTank', 'prepareTime', 'doorIsOpen'], 'chunk_properties': 1, 'miio_specs': { 'prop.2.1': {'prop': 'status', 'dict': { From 6b4aff5664594536ea83e695fc12b65fdcd54879 Mon Sep 17 00:00:00 2001 From: ptbsare <496725701@qq.com> Date: Wed, 27 Mar 2024 13:26:22 +0800 Subject: [PATCH 03/24] =?UTF-8?q?=F0=9F=A5=A4=20improve=20for=20viomi.juic?= =?UTF-8?q?er.v1=20(#1597)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/miio2miot_specs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/core/miio2miot_specs.py b/custom_components/xiaomi_miot/core/miio2miot_specs.py index b88546297..98789c673 100644 --- a/custom_components/xiaomi_miot/core/miio2miot_specs.py +++ b/custom_components/xiaomi_miot/core/miio2miot_specs.py @@ -1267,7 +1267,8 @@ def cbk(prop, params, props, **kwargs): 'viomi.juicer.v1': { # ["work_status","run_status","mode","cooked_time","curr_tempe","cook_start","rev","stand_top_num","mode_sort" ,"cook_status","warm_time","cook_time","left_time","voice"] # [0, ,768 ,7 ,0 ,-300 ,1699143554 ,0 ,0 ,'7-8-9-4-3-1-5-2-6',1 ,6514 ,1668 ,0 ,0 ] - 'entity_attrs': ['work_status', 'run_status', 'mode', 'cooked_time', 'curr_tempe', 'cook_start', 'rev', 'stand_top_num', 'mode_sort', 'cook_status', 'warm_time', 'cook_time', 'left_time', 'voice'], + 'miio_props': ['work_status', 'run_status', 'mode', 'cooked_time', 'cook_start', 'rev', 'stand_top_num', 'mode_sort', 'warm_time', 'cook_time', 'voice'], + 'entity_attrs': ['work_status', 'run_status', 'mode', 'cooked_time', 'cook_start', 'rev', 'stand_top_num', 'mode_sort', 'warm_time', 'cook_time', 'voice'], 'chunk_properties': 1, 'miio_specs': { 'prop.2.1': {'prop': 'cook_status'}, From 480b55128fca313ea390e2372bdc8a1e841b9026 Mon Sep 17 00:00:00 2001 From: ptbsare <496725701@qq.com> Date: Wed, 27 Mar 2024 22:22:04 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=F0=9F=8C=A1=EF=B8=8F=20improve=20for=20v?= =?UTF-8?q?iomi.fridge.m1=20(#1596)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaomi_miot/core/device_customizes.py | 3 +++ .../xiaomi_miot/core/miio2miot_specs.py | 11 ++++------- .../xiaomi_miot/core/miot_specs_extend.json | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 522f2beae..7e294546d 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1271,6 +1271,9 @@ 2: 0, # Descent-limit }, }, + 'viomi.fridge.m1': { + 'sensor_properties': 'fridge.temperature', + }, 'viomi.hood.v1': { 'main_miot_services': 'hood-2', 'number_properties': 'off_delay_time', diff --git a/custom_components/xiaomi_miot/core/miio2miot_specs.py b/custom_components/xiaomi_miot/core/miio2miot_specs.py index 98789c673..f965796ae 100644 --- a/custom_components/xiaomi_miot/core/miio2miot_specs.py +++ b/custom_components/xiaomi_miot/core/miio2miot_specs.py @@ -1243,13 +1243,9 @@ def cbk(prop, params, props, **kwargs): # ["Mode","RCSetTemp","FCSetTemp","RCSet","Error","IndoorTemp","SmartCool","SmartFreeze"] # ["none",8 ,-15 ,"on" ,0 ,30 ,"off" ,"off"] # 'chunk_properties': 8, - 'miio_commands': [ - { - 'method': 'get_prop', - 'params': ['RCSetTemp','FCSetTemp', 'RCSet', 'ScreenOn', 'Error', 'SmartCool', 'SmartFreeze', 'IndoorTemp'], - 'values': ['RCSetTemp','FCSetTemp', 'RCSet', 'ScreenOn', 'Error', 'SmartCool', 'SmartFreeze', 'IndoorTemp'], - }, - ], + 'chunk_properties': 1, + 'miio_props': ['ScreenOn', 'Error', 'SmartCool', 'SmartFreeze'], + 'entity_attrs': ['ScreenOn', 'Error', 'SmartCool', 'SmartFreeze'], 'miio_specs': { 'prop.2.1': {'prop': 'Mode', 'setter': 'setMode', 'dict': { 'smart': 1, @@ -1262,6 +1258,7 @@ def cbk(prop, params, props, **kwargs): 'prop.3.3': {'prop': 'RCSetTemp'}, 'prop.4.1': {'prop': 'FCSetTemp', 'setter': 'setFCSetTemp'}, 'prop.4.2': {'prop': 'FCSetTemp'}, + 'prop.2.2': {'prop': 'IndoorTemp'}, }, }, 'viomi.juicer.v1': { diff --git a/custom_components/xiaomi_miot/core/miot_specs_extend.json b/custom_components/xiaomi_miot/core/miot_specs_extend.json index 77a3d5386..53d0582b0 100644 --- a/custom_components/xiaomi_miot/core/miot_specs_extend.json +++ b/custom_components/xiaomi_miot/core/miot_specs_extend.json @@ -766,6 +766,22 @@ ] } ], + "viomi.fridge.m1": [ + { + "iid": 2, + "properties": [ + { + "iid": 2, + "type": "urn:miot-spec-v2:property:temperature", + "description": "Indoor Temperature", + "format": "float", + "access": ["read"], + "unit": "celsius", + "value-range": [-40, 125, 1] + } + ] + } + ], "viomi.vacuum.v7": [ { From 01c2ed8c4d509a55f2cfb466970f2382cf4510cf Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 27 Mar 2024 22:31:41 +0800 Subject: [PATCH 05/24] =?UTF-8?q?=F0=9F=8D=83=20add=20sub-entities=20for?= =?UTF-8?q?=20xiaomi.airp.va4=20(#1601)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaomi_miot/core/device_customizes.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 7e294546d..e5dc62710 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1344,6 +1344,17 @@ 'brightness_for_off': 2, 'exclude_miot_services': 'rfid', }, + 'xiaomi.airp.va4': { + 'sensor_properties': 'relative_humidity,air_quality,pm2_5_density,temperature,hcho_density,filter_life_level', + 'switch_properties': 'on,anion,uv,alarm', + 'select_properties': 'air_purifier_favorite.fan_level', + 'number_properties': 'aqi_updata_heartbeat', + 'button_actions': 'reset_filter_life', + 'light_services': 'screen', + 'brightness_for_on': 0, + 'brightness_for_off': 2, + 'exclude_miot_services': 'rfid,custom_service,filter_debug', + }, 'xiaomi.airp.*': { 'exclude_miot_services': 'custom_service', }, @@ -1678,7 +1689,7 @@ }, '*.airpurifier.*': { 'main_miot_services': 'air_purifier', - 'switch_properties': 'air_purifier.on,alarm.alarm', + 'switch_properties': 'air_purifier.on,alarm.alarm,anion,uv', 'sensor_properties': 'relative_humidity,pm2_5_density,temperature,filter_life_level', }, '*.bhf_light.*': { @@ -1854,6 +1865,7 @@ } DEVICE_CUSTOMIZES.update({ + '*.airp.*': DEVICE_CUSTOMIZES.get('*.airpurifier.*') or {}, '*.door.*': DEVICE_CUSTOMIZES.get('*.lock.*') or {}, '*.dryer.*': DEVICE_CUSTOMIZES.get('*.dry.*') or {}, }) From 73225c20280ba727f3f714975a119838609a1a6e Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 27 Mar 2024 22:41:37 +0800 Subject: [PATCH 06/24] =?UTF-8?q?=F0=9F=A7=8A=20improve=20for=20fridge=20(?= =?UTF-8?q?#1426)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 4 ++++ custom_components/xiaomi_miot/sensor.py | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index e5dc62710..9b45734ec 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1763,6 +1763,10 @@ 'select_properties': 'heat_level,motor_control', 'number_properties': 'target_time,target_temperature', }, + '*.fridge.*': { + 'switch_properties': 'on', + 'number_properties': 'target_temperature', + }, '*.heater.*': { 'switch_properties': 'heater.on,horizontal_swing,alarm.alarm,delay.delay', 'number_properties': 'countdown_time,delay_time', diff --git a/custom_components/xiaomi_miot/sensor.py b/custom_components/xiaomi_miot/sensor.py index 5a0609232..de66fdd32 100644 --- a/custom_components/xiaomi_miot/sensor.py +++ b/custom_components/xiaomi_miot/sensor.py @@ -287,7 +287,7 @@ async def async_update_for_main_entity(self): ) self._update_sub_entities( ['on'], - [self._miot_service.name, 'router', 'wifi', 'guest_wifi', 'fridge_chamber'], + [self._miot_service.name, 'router', 'wifi', 'guest_wifi'], domain='switch', ) self._update_sub_entities( @@ -313,11 +313,6 @@ async def async_update_for_main_entity(self): ['bed', 'backrest_control', 'leg_rest_control'], domain='cover', ) - self._update_sub_entities( - ['target_temperature'], - ['fridge_chamber'], - domain='number', - ) @property def device_class(self): From 0981e50c290e19b0bd40f0158129c3b92ff28c7c Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 27 Mar 2024 22:46:11 +0800 Subject: [PATCH 07/24] =?UTF-8?q?=F0=9F=94=8C=20improve=20for=20qmi.plug?= =?UTF-8?q?=20(#1590)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 9b45734ec..c764261f2 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1176,6 +1176,9 @@ 'device_class': 'energy', 'unit_of_measurement': 'kWh', }, + 'qmi.plug.*': { + 'sensor_properties': 'power_consumption', + }, 'qushui.bed.001': { 'chunk_properties': 1, }, From 1b3e9f30674f7dc27a147bb76218c958f538595a Mon Sep 17 00:00:00 2001 From: Alone Date: Wed, 10 Apr 2024 23:49:56 +0800 Subject: [PATCH 08/24] =?UTF-8?q?=F0=9F=94=A5=20improve=20for=20climate=20?= =?UTF-8?q?(#1620)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/climate.py | 2 -- custom_components/xiaomi_miot/core/device_customizes.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/custom_components/xiaomi_miot/climate.py b/custom_components/xiaomi_miot/climate.py index d9f25403b..afdc6fba4 100644 --- a/custom_components/xiaomi_miot/climate.py +++ b/custom_components/xiaomi_miot/climate.py @@ -165,8 +165,6 @@ def __init__(self, config: dict, miot_service: MiotService): self._supported_features |= ClimateEntityFeature.FAN_MODE if self._prop_horizontal_swing or self._prop_vertical_swing: self._supported_features |= ClimateEntityFeature.SWING_MODE - if self._prop_heater and miot_service.name in ['air_conditioner', 'air_condition_outlet']: - self._supported_features |= ClimateEntityFeature.AUX_HEAT self._power_modes = [] if miot_service.get_property('heat_level'): diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index c764261f2..7875ada02 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1678,7 +1678,7 @@ '*.aircondition.*': { 'sensor_properties': 'electricity.electricity', - 'switch_properties': 'air_conditioner.on,alarm.alarm', + 'switch_properties': 'air_conditioner.on,alarm.alarm,heater', 'fan_services': 'air_fresh', }, '*.airer.*': { From c419b81538f1b0874746efd440ae1fa727a336a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Y=C3=A1=C3=B1ez=20Jim=C3=A9nez?= Date: Wed, 10 Apr 2024 17:59:53 +0200 Subject: [PATCH 09/24] =?UTF-8?q?=E2=9B=B2=20add=20sub-entities=20for=20pe?= =?UTF-8?q?t=5Fwaterer.s4=20(#1615)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 7875ada02..555766cfc 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -990,6 +990,12 @@ 'sensor_properties': 'remain_clean_time,fault,filter_left_time,no_water_time', 'select_properties': 'mode', }, + 'mmgg.pet_waterer.s4': { + 'binary_sensor_properties': 'no_water_flag,pump_block_flag', + 'button_actions': 'reset_filter_life,reset_clean_time', + 'sensor_properties': 'remain_clean_time,fault,filter_left_time,no_water_time', + 'select_properties': 'mode', + }, 'mrbond.airer.m53pro': { 'position_reverse': False, 'sensor_properties': 'fault,left_time', From 584971e145eaf560fc20a268691064a4ea0b9658 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 26 Apr 2024 17:36:43 +0800 Subject: [PATCH 10/24] =?UTF-8?q?=F0=9F=94=A7=20fix=20for=20reload=20servi?= =?UTF-8?q?ce=20(#1639)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index 62b93949b..6f3daded6 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -38,6 +38,7 @@ from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.reload import async_integration_yaml_config +from homeassistant.helpers.service import async_register_admin_service import homeassistant.helpers.device_registry as dr import homeassistant.helpers.config_validation as cv @@ -572,7 +573,8 @@ async def _handle_reload_config(service): ] await asyncio.gather(*reload_tasks) - hass.helpers.service.async_register_admin_service( + async_register_admin_service( + hass, DOMAIN, SERVICE_RELOAD, _handle_reload_config, From d241317fb0caf47aa51ec322be937a687be55eaa Mon Sep 17 00:00:00 2001 From: fabiobrolo <91396121+fabiobrolo@users.noreply.github.com> Date: Fri, 26 Apr 2024 06:48:36 -0300 Subject: [PATCH 11/24] =?UTF-8?q?=F0=9F=8C=90=20improve=20pt=5FBR=20transl?= =?UTF-8?q?ation=20(#1632)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaomi_miot/translations/pt-BR.json | 372 +++++++++++++++++- 1 file changed, 363 insertions(+), 9 deletions(-) diff --git a/custom_components/xiaomi_miot/translations/pt-BR.json b/custom_components/xiaomi_miot/translations/pt-BR.json index 5b5de7b94..a335ac78d 100644 --- a/custom_components/xiaomi_miot/translations/pt-BR.json +++ b/custom_components/xiaomi_miot/translations/pt-BR.json @@ -1,6 +1,6 @@ { "config": { - "flow_title": "Xiaomi Miot: {name}", + "flow_title": "Xiaomi Miot Auto", "step": { "user": { "title": "Selecione a forma de integração", @@ -22,6 +22,7 @@ "data": { "username": "ID de conta Xiaomi / Email", "password": "Senha", + "captcha": "Captcha", "server_country": "Região da MiCloud", "conn_mode": "Modo de conexão com o dispositivo", "filter_models": "Filtro de dispositivo via model/home/WiFi (Advanced)" @@ -31,8 +32,10 @@ "title": "Filtro de dispositivos da nuvem", "description": "Você pode incluir ou excluir dispositivos para a integrar só o que quiser. No modo de exclusão, se você não marcar nenhuma opção da lista, equivale a incluir todas as opções.\n{tip}", "data": { - "filter_model": "Filtro de dispositivos", - "model_list": "Lista de dispositivos", + "filter_model": "Filtro de Dispositivos", + "model_list": "Lista de Dispositivos", + "filter_home_id": "Filtro de Casa", + "home_id_list": "Lista de Casa", "filter_ssid": "Filtro por WiFi SSID", "ssid_list": "Lista de WiFi SSID", "filter_bssid": "Filtro WiFi BSSID", @@ -40,16 +43,30 @@ "filter_did": "Filtrar dispositivos", "did_list": "Lista de dispositivos" } + }, + "customizing": { + "title": "Customizando entidades / dispositivos", + "description": "{tip}", + "data": { + "domain": "Selecione o domomínio da entidade", + "entity": "Selecione a entidade", + "model": "Selecione o modelo do dispositivo", + "model_specified": "Modelo do dispositivo especificaco (Opcional)", + "only_main_entity": "Apenas entidades principais (pais)", + "reset_customizes": "Reiniciar para customização padrão", + "bool2selects": "Opções de customização" + } } }, "error": { "cannot_connect": "Falha em conectar o dispositivo", "cannot_login": "Falha no login com a conta xiaomi, verifique a senha. Se está tendo falhas ao fazer o login, faça login em mi.com na mesma rede atual e tente novamente.", "cannot_reach": "Incapaz de accessar a API Xiaomi", - "tzinfo_error": "Acesse: https://github.com/al-one/hass-xiaomi-miot/issues/260", + "tzinfo_error": "Aparentemente há um problema no seu ambiente Hass. Acesse: https://github.com/al-one/hass-xiaomi-miot/issues/260", "none_devices": "Sem dispositivos na conta xiaomi" }, "abort": { + "config_saved": "Configuração guardada! [Customize novamente](/_my_redirect/config_flow_start?domain=xiaomi_miot).\n{tip}\n\nAlgumas opções de customização podem requerir [recarregar a integração](/developer-tools/yaml) para ter efeito.", "already_configured": "O dispositivo já está configurado", "not_xiaomi_miio": "Não é um dispositivo Xiaomi miio/miot." } @@ -71,23 +88,28 @@ "data": { "username": "ID de conta Xiaomi / Email", "password": "Senha", + "captcha": "Captcha", "server_country": "Região da MiCloud", "conn_mode": "Modo de conexão com o dispositivo", - "renew_devices": "Forçar renovar dispositivos" + "renew_devices": "Forçar renovar dispositivos", + "disable_message": "Desabilitar o sensor de notificação Mihome", + "disable_scene_history": "Desabilitar o histórico do sensor de cena" } }, "cloud_filter": { "title": "Filtro de dispositivos da nuvem", "description": "Você pode incluir ou excluir dispositivos para a integrar só o que quiser. No modo de exclusão, se você não marcar nenhuma opção da lista, equivale a incluir todas as opções.\n{tip}", "data": { - "filter_model": "Filtro de dispositivos", - "model_list": "Lista de dispositivos", + "filter_model": "Filtro de Dispositivos", + "model_list": "Lista de Dispositivos", + "filter_home_id": "Filtrar Casa", + "home_id_list": "Lista Casa", "filter_ssid": "Filtro por WiFi SSID", "ssid_list": "Lista de WiFi SSID", "filter_bssid": "Filtro por WiFi BSSID", "bssid_list": "Lista de WiFi BSSID", - "filter_did": "Filtrar dispositivos", - "did_list": "Lista de dispositivos" + "filter_did": "Filtrar Dispositivos", + "did_list": "Lista de Dispositivos" } } }, @@ -97,6 +119,9 @@ "cannot_reach": "Incapaz de accessar a API Xiaomi", "tzinfo_error": "Acesse: https://github.com/al-one/hass-xiaomi-miot/issues/260", "none_devices": "Sem dispositivos na conta xiaomi" + }, + "abort": { + "show_customizes": "[![Adicionar nova integração](https://my.home-assistant.io/badges/config_flow_start.svg)](/_my_redirect/config_flow_start?domain=xiaomi_miot)\n[Adicionar nova integração](/_my_redirect/config_flow_start?domain=xiaomi_miot) para modificar a customização.\n{tip}" } }, "system_health": { @@ -107,5 +132,334 @@ "logged_accounts": "Contas logadas", "total_devices": "Total de dispositivos MiHome" } + }, + "entity": { + "sensor": { + "lock": { + "state": { + "bluetooth": "Bluetooth", + "password": "Senha", + "biological": "Biologico", + "key": "Chave", + "turntable": "Giratória", + "nfc": "NFC", + "one_time_password": "Senha de Única Vez", + "two_step_verification": "Verificação de Dois Passos", + "coercion": "Coerção", + "homekit": "Homekit", + "manual": "Manual", + "automatic": "Automatico" + } + }, + "lock_action": { + "state": { + "outside_unlock": "Desbloquear de fora", + "lock": "Bloquear", + "anti_lock_on": "Habilitar anti-bloqueio", + "anti_lock_off": "Desabilitar anti-bloqueio", + "inside_unlock": "Desbloquear de dentro", + "lock_inside": "Bloquear de dentro", + "child_lock_on": "Habilitar bloqueio por criança", + "child_lock_off": "Desabilitar bloqueio por criança", + "lock_outside": "Bloquear de fora" + } + }, + "door_state": { + "state": { + "open": "Aberto", + "close": "Fechado", + "close_timeout": "Timeout de Fechamento", + "knock": "Batido", + "breaking": "Arrombado", + "stuck": "Travado" + } + } + }, + "climate": { + "air_conditioner": { + "state_attributes": { + "fan_mode": { + "state": { + "auto": "Auto", + "low": "Baixo", + "medium": "Medio", + "middle": "Meio", + "high": "Alto", + "quiet": "Silencioso", + "turbo": "Turbo", + "level1": "Nível 1", + "level2": "Nível 2", + "level3": "Nível 3", + "level4": "Nível 4", + "level5": "Nível 5", + "level6": "Nível 6", + "level7": "Nível 7" + } + }, + "swing_mode": { + "state": { + "off": "Desligado", + "vertical": "Vertical", + "horizontal": "Horizontal", + "both": "Ambos" + } + } + } + } + } + }, + "services": { + "send_command": { + "name": "Enviar comando", + "description": "Enviar comando miio", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "" + }, + "method": { + "name": "Metodo", + "description": "" + }, + "params": { + "name": "Parâmetros", + "description": "" + }, + "throw": { + "name": "Evniar", + "description": "Enviar resultado para uma notificação HA" + } + } + }, + "get_properties": { + "name": "Obter propriedades", + "description": "Obtem as propriedades miot", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "" + }, + "mapping": { + "name": "Mapeamento", + "description": "" + }, + "update_entity": { + "name": "Atualizar entidade", + "description": "" + }, + "throw": { + "name": "Enviar", + "description": "Enviar resultado para uma notificação HA" + } + } + }, + "set_property": { + "name": "Definir propriedade", + "description": "Define a propriedade miot", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "" + }, + "field": { + "name": "Field", + "description": "" + }, + "value": { + "name": "Value", + "description": "" + } + } + }, + "set_miot_property": { + "name": "Definir propriedade miot", + "description": "Define a propriedade miot por siid/piid", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "" + }, + "siid": { + "name": "", + "description": "" + }, + "piid": { + "name": "", + "description": "" + }, + "value": { + "name": "", + "description": "" + } + } + }, + "call_action": { + "name": "Chamar ação", + "description": "Chama uma ação miot", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "" + }, + "siid": { + "name": "", + "description": "" + }, + "aiid": { + "name": "", + "description": "" + }, + "params": { + "name": "", + "description": "" + }, + "throw": { + "name": "Enviar", + "description": "Enviar resultado para uma notificação HA" + } + } + }, + "intelligent_speaker": { + "name": "Caixa de som inteligenter", + "description": "Caixa de som inteligente para XiaoAi", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "ID da Entidade Xiaoai" + }, + "text": { + "name": "Texto", + "description": "" + }, + "execute": { + "name": "Executar", + "description": "" + }, + "silent": { + "name": "Silenciar", + "description": "" + }, + "throw": { + "name": "Enviar", + "description": "Enviar resultado para uma notificação HA" + } + } + }, + "xiaoai_wakeup": { + "name": "Despertar XiaoA", + "description": "Despertar a caixa de som XiaoAi", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "ID da Entidade Xiaoai" + }, + "text": { + "name": "Texto", + "description": "" + } + } + }, + "get_device_data": { + "name": "Obter dados do dispositivo", + "description": "Obtem dados do dispositivo pela cloud", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "" + }, + "type": { + "name": "Tipo", + "description": "" + }, + "key": { + "name": "Chave", + "description": "" + }, + "time_start": { + "name": "Hora de início", + "description": "" + }, + "time_end": { + "name": "Hora de finalização", + "description": "" + }, + "limit": { + "name": "Limite", + "description": "" + }, + "group": { + "name": "Gropo", + "description": "" + } + } + }, + "renew_devices": { + "name": "Renovar dispositivos", + "description": "Renovar dispositivos xiaomi do cache", + "fields": { + "username": { + "name": "Nome de usuário", + "description": "" + } + } + }, + "get_token": { + "name": "Obter token", + "description": "Obtem o token do dispositivo xiaomi", + "fields": { + "name": { + "name": "Nome", + "description": "" + } + } + }, + "get_bindkey": { + "name": "Obter bindkey", + "description": "Obtem o bindkey para dispositivo ble", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "" + }, + "did": { + "name": "DID", + "description": "" + } + } + }, + "request_xiaomi_api": { + "name": "Solicitar API xiaomi", + "description": "Solicita API xiaomi", + "fields": { + "entity_id": { + "name": "ID da Entidade", + "description": "" + }, + "api": { + "name": "API", + "description": "" + }, + "data": { + "name": "Dado", + "description": "" + }, + "method": { + "name": "Metodo", + "description": "" + }, + "crypt": { + "name": "Crypt", + "description": "" + }, + "sid": { + "name": "", + "description": "" + }, + "throw": { + "name": "Enviar", + "description": "Enviar resultado para uma notificação HA" + } + } + } } } From 7e5e064dbb1ec7e6e742018cba433ff4ab7fdb91 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 26 Apr 2024 18:25:57 +0800 Subject: [PATCH 12/24] =?UTF-8?q?=F0=9F=9B=80=20add=20sub-entities=20for?= =?UTF-8?q?=20viomi.waterheater.m1=20(#1457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 555766cfc..3d9153b95 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1320,6 +1320,14 @@ 'viomi.washer.*': { 'exclude_miot_services': 'key_press', }, + 'viomi.waterheater.m1': { + 'sensor_properties': 'water_heater.status,water_level,temperature_tips,' + 'input_water_temp,water_pump_volt,remaining_time', + 'switch_properties': 'on,hot_water_recirculation,heat_preservation,jog_function,pressure_boost.status,' + 'cloud_preheater,in_cloud_timer,reminder,enhanced', + 'select_properties': 'light_off_time,effective,model', + 'number_properties': 'target_temperature,boost_value', + }, 'wise.wifispeaker.x7': { 'switch_properties': 'key_one,key_two,key_three,key_four,key_five,key_six,key_seven,key_eight,key_nine,' From c9e14feb3bb19aad4c4bdcf338f1f40bd6e12ec8 Mon Sep 17 00:00:00 2001 From: Alone Date: Sun, 28 Apr 2024 15:47:28 +0800 Subject: [PATCH 13/24] =?UTF-8?q?=F0=9F=9B=80=20add=20sub-entities=20for?= =?UTF-8?q?=20xiaomi.waterheater.yms2=20(#1457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 3d9153b95..ff90a5843 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1412,6 +1412,14 @@ 'xiaomi.watch.*': { 'sensor_properties': 'current_step_count,current_distance', }, + 'xiaomi.waterheater.yms2': { + 'sensor_properties': 'water_heater.status,water_level,temperature_tips,' + 'input_water_temp,water_pump_volt,remaining_time', + 'switch_properties': 'on,hot_water_recirculation,heat_preservation,jog_function,pressure_boost.status,' + 'cloud_preheater,in_cloud_timer,reminder,enhanced', + 'select_properties': 'light_off_time,effective,model', + 'number_properties': 'target_temperature,boost_value', + }, 'xiaomi.wifispeaker.*': { 'switch_properties': 'sleep_mode,no_disturb', 'button_actions': 'wake_up,play_music,tv_switchon,stop_alarm', From 77846da5c67a204c7feac3d8548e414554aee828 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 12:32:00 +0800 Subject: [PATCH 14/24] =?UTF-8?q?=F0=9F=93=B6=20update=20miot=20local=20de?= =?UTF-8?q?vices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaomi_miot/core/miot_local_devices.py | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/custom_components/xiaomi_miot/core/miot_local_devices.py b/custom_components/xiaomi_miot/core/miot_local_devices.py index 9bad3adca..64c580f61 100644 --- a/custom_components/xiaomi_miot/core/miot_local_devices.py +++ b/custom_components/xiaomi_miot/core/miot_local_devices.py @@ -10,6 +10,7 @@ '090615.gateway.ktvrf', '090615.plug.plus01', '090615.switch.akstft', + '090615.switch.x6ntft', '090615.switch.x6wtft', '1245.airfresh.super2', '1245.airfresh.super3', @@ -17,6 +18,7 @@ '17216.massage.jp3209', '666.curtain.gt01m', 'adp.fitting.adgw', + 'aimore.light.230915', 'aimore.light.cw3201', 'ainice.motion.bt', 'ainice.sensor_occupy.3b', @@ -63,10 +65,12 @@ 'careli.fryer.maf06a', 'careli.fryer.maf07', 'careli.fryer.maf07c', + 'careli.fryer.maf09a', 'careli.fryer.maf10a', 'cddz.plug.pc01w', 'cgllc.airm.cgd1st', 'cgllc.airm.cgdn1', + 'cgllc.airm.cgs2', 'chuangmi.camera.026c02', 'chuangmi.camera.039a01', 'chuangmi.camera.039a04', @@ -89,6 +93,7 @@ 'chunmi.cooker.ztw02', 'chunmi.cooker.zwz02', 'chunmi.health_pot.a1', + 'chunmi.health_pot.cmpa1', 'chunmi.ihcooker.slim', 'chunmi.ihcooker.v2', 'chunmi.juicer.uka1', @@ -185,6 +190,7 @@ 'dooya.curtain.m5', 'dooya.curtain.m7', 'dooya.curtain.x7', + 'dooya.curtain.x7pro', 'dreame.fan.l2146', 'dreame.fan.p2018', 'dreame.light.r2229', @@ -229,9 +235,12 @@ 'dreame.vacuum.r2246', 'dreame.vacuum.r2247', 'dreame.vacuum.r2254', + 'dreame.vacuum.r2257o', 'e11035.airer.t10l', + 'e11035.airer.t10xfh', 'era.diffuser.ws01', 'era.ysj.b65', + 'evecca.wopener.na03ma', 'fawad.airrtc.30011', 'fawad.airrtc.30012', 'fawad.airrtc.40011', @@ -243,13 +252,16 @@ 'fengmi.projector.m045j', 'fengmi.projector.m085j', 'fengmi.projector.m135jp', + 'ftd.light.wfilmp', 'galime.curtain.gp72', 'gerwin.curtain.gm25xm', 'gerwin.curtain.gm35xm', 'giot.light.aise01', + 'giot.tow_w.v1itrw', 'gtop.light.c02', 'gtop.light.fan03', 'hannto.printer.lager', + 'hannto.printer.rmy', 'hanyi.vacuum.m7pro', 'hddz.blanket.zndrt', 'hddz.s_lamp.uvl38w', @@ -263,6 +275,7 @@ 'htcx.alarm.dt210', 'huayi.light.fanwy', 'huayi.light.kin2', + 'huayi.light.wy006', 'hyd.airer.1s', 'hyd.airer.gen', 'hyd.airer.pro', @@ -283,6 +296,8 @@ 'ijai.vacuum.v2', 'ijai.vacuum.v3', 'ijomoo.toilet.zs320', + 'iot.light.socd01', + 'iot.plug.jdls1', 'iot.plug.socn1', 'iot.switch.padw2p', 'iot.switch.padwb1', @@ -304,9 +319,11 @@ 'kadeer.derh.x1701', 'kadeer.fan.l22xh2', 'kejia.airer.krq', + 'kejia.airer.krqpro', 'kejia.airer.mznpro', 'kingee.airer.kelyj5', 'ksmb.treadmill.m1v1', + 'kxf321.mop.mo002', 'leishi.bhf_light.lsyb01', 'leishi.bhf_light.lsyb03', 'leishi.light.eps112', @@ -317,6 +334,7 @@ 'leishi.light.wy0a10', 'leishi.light.wyfa02', 'leishi.light.wyfa03', + 'lemesh.curtain.cura02', 'lemesh.light.wy02', 'lemesh.switch.sw0c01', 'leshi.light.wy0b01', @@ -336,6 +354,7 @@ 'linp.switch.q32', 'linp.switch.q32s', 'linp.switch.q33', + 'linp.switch.s2dw3', 'lipro.light.23x1', 'loock.camera.c1k', 'loock.cateye.v06', @@ -352,6 +371,7 @@ 'lumi.sensor_gas.mcn02', 'lumi.sensor_motion.aq2', 'lumi.sensor_motion.v2', + 'lxzn.switch.cbcsmj', 'mate.airfresh.a1', 'mate.humidifier.cs01', 'miaomiaoce.airm.air01', @@ -362,6 +382,7 @@ 'mibx2.fridge.v1', 'mibx2.washer.v1', 'mibx2.washer.v11', + 'mibx2.washer.v11rm', 'mibx2.washer.v13', 'mibx2.washer.v2', 'mibx2.washer.v3', @@ -377,9 +398,11 @@ 'midjd6.fridge.430', 'midjd6.fridge.4301', 'midjd6.fridge.430b', + 'midjd6.fridge.540', 'midjd6.fridge.610', 'midjd6.fridge.v1', 'midjd8.fridge.400b', + 'midjd8.washer.41', 'midjd8.washer.44', 'mijia.vacuum.b108zb', 'mijia.vacuum.b108zh', @@ -391,6 +414,7 @@ 'minij.washer.v20', 'minjie.light.tdcw02', 'mipin.motion.mc1', + 'mjzm.light.wy0a01', 'mmgg.feeder.fi1', 'mmgg.feeder.inland', 'mmgg.feeder.spec', @@ -407,6 +431,8 @@ 'msj.dishwasher.v1', 'msj.f_washer.m1pro', 'msj.f_washer.m2', + 'mxiang.camera.moc001', + 'mxiang.camera.moc006', 'mxiang.camera.mod11', 'mxiang.camera.mod13', 'myoung.massage.m900', @@ -422,6 +448,7 @@ 'opple.bhf_light.fx88a', 'opple.light.dcfan', 'opple.light.moat', + 'opple.light.tabcol', 'opple.light.tabcw', 'opple.light.tablgt', 'opple.light.yrtd', @@ -436,6 +463,7 @@ 'philips.light.dlight', # 'philips.light.downlight', # miio2miot 'philips.light.pceil', + 'philips.light.pceilb', 'philips.light.sceilm', 'philips.light.sceils', 'philips.light.sread3', @@ -464,18 +492,22 @@ 'qushui.bed.003', 'qushui.bed.007', 'qushui.bed.dt4', + 'qushui.bed.dt7', 'qushui.blanket.mj1', 'rmt.bed.zhsbed', 'roidmi.vacuum.r1b', 'roidmi.vacuum.v60', 'roidmi.vacuum.v62', 'roidmi.vacuum.v66', + 'rotai.magic_touch.sx315', 'rotai.massage.m660p', + 'san.airrtc.8909h', 'san.airrtc.s89h', 'sfl.light.aaas', 'sfl.light.fsl002', 'shhf.light.sfla10', 'shhf.light.slwfc3', + 'shhf.plug.spwc02', 'silen.fryer.sck505', 'skyrc.feeder.fed', 'skyrc.feeder.vdfeed', @@ -495,6 +527,8 @@ 'uvfive.steriliser.tiger', 'viewx.light.101001', 'viomi.aircondition.y1', + 'viomi.aircondition.y112', + 'viomi.aircondition.y113', 'viomi.aircondition.y115', 'viomi.aircondition.y15', 'viomi.aircondition.y64', @@ -517,11 +551,13 @@ 'viomi.dishwasher.v10', 'viomi.dishwasher.v11', 'viomi.dishwasher.v23', + 'viomi.fan.v13', 'viomi.fan.v6', 'viomi.fan.v7', 'viomi.fridge.u35', 'viomi.fridge.u46', 'viomi.fridge.u47', + 'viomi.fridge.u54', 'viomi.heater.v10', 'viomi.heater.v4', 'viomi.heater.v5', @@ -550,6 +586,7 @@ 'viomi.vacuum.v23', 'viomi.vacuum.v35', 'viomi.vacuum.v38', + 'viomi.vacuum.v40', 'viomi.washer.v13', 'viomi.washer.v19', 'viomi.washer.v25', @@ -580,6 +617,7 @@ 'xiaomi.aircondition.c11', 'xiaomi.aircondition.c12', 'xiaomi.aircondition.c13', + 'xiaomi.aircondition.c14', 'xiaomi.aircondition.c15', 'xiaomi.aircondition.c16', 'xiaomi.aircondition.c17', @@ -587,11 +625,13 @@ 'xiaomi.aircondition.c20', 'xiaomi.aircondition.c21', 'xiaomi.aircondition.c22', + 'xiaomi.aircondition.c25', 'xiaomi.aircondition.c32', 'xiaomi.aircondition.c33', 'xiaomi.aircondition.c36', 'xiaomi.aircondition.m16', 'xiaomi.aircondition.m19', + 'xiaomi.aircondition.m3', 'xiaomi.aircondition.m4', 'xiaomi.aircondition.m6', 'xiaomi.aircondition.m9', @@ -621,8 +661,11 @@ 'xiaomi.airp.mp4', 'xiaomi.airp.va2b', 'xiaomi.airp.va4', + 'xiaomi.blanket.mj1', 'xiaomi.blanket.mj2', 'xiaomi.derh.13l', + 'xiaomi.fan.p51', + 'xiaomi.feeder.pi2001', 'xiaomi.heater.ma7', 'xiaomi.heater.ma8', 'xiaomi.humidifier.airmx', @@ -653,12 +696,14 @@ 'xiaomi.vacuum.b112', 'xiaomi.vacuum.b112gl', 'xiaomi.vacuum.c101', + 'xiaomi.vacuum.c101eu', 'xiaomi.vacuum.c102cn', 'xiaomi.vacuum.c103', 'xiaomi.vacuum.c104', 'xiaomi.vacuum.c107', 'xiaomi.waterheater.ym05', 'xiaomi.waterpuri.400f4', + 'xiaomi.waterpuri.lx32', 'xiaomi.waterpuri.lx33', 'xiaomi.waterpuri.q1000', 'xiaomi.wifispeaker.07g', @@ -732,10 +777,12 @@ 'yunmi.kettle.v19', 'yunmi.waterpuri.f1', 'yunmi.waterpuri.f2', + 'yunmi.waterpuri.f3', 'yunmi.waterpuri.f7', 'yunmi.waterpuri.lx14', 'yunmi.waterpuri.lx20', 'yunmi.waterpuri.lx21', + 'yunmi.waterpuri.lx24', 'yunmi.waterpuri.lx27', 'yunmi.waterpuri.lx28', 'yunmi.waterpuri.mg5', @@ -747,6 +794,7 @@ 'yunmi.waterpuri.x10', 'yunmi.ysj.v1', 'yyunyi.wopener.yylt', + 'yywq.toilet.wqzn01', 'zair.switch.zsc02w', 'zdeer.foot_bath.zdz9', 'zemi.curtain.zm25', @@ -766,6 +814,7 @@ 'zhimi.airp.rmb1', 'zhimi.airp.sa4', 'zhimi.airp.ua1', + 'zhimi.airp.ua1a', 'zhimi.airp.va2', 'zhimi.airp.va2a', 'zhimi.airp.vb2a', @@ -802,6 +851,7 @@ 'zhimi.humidifier.ca6', 'zhimi.humidifier.cb1a', 'zhimi.humidifier.va1', + 'zhimi.toilet.pa6', 'zhimi.vacuum.ga1', 'zhimi.vacuum.hd1', 'zhimi.vacuum.ga1', @@ -818,7 +868,9 @@ 'zinguo.motor.mk01', 'zinguo.switch.b3', 'zinguo.switch.b5m', + 'ziwooo.s_lamp.uvc', 'zjaupu.airer.l558', + 'zjdh.curtain.xj001', 'zs1001.mosq.s12pro', 'zxzm.light.j01', ] From 0a7cd4e6ebad86a31e584ed4d0e9588401e771db Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 13:27:35 +0800 Subject: [PATCH 15/24] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20remove=20notifica?= =?UTF-8?q?tion=20for=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 - README_zh.md | 3 - custom_components/xiaomi_miot/__init__.py | 69 ++----------------- custom_components/xiaomi_miot/services.yaml | 30 -------- .../xiaomi_miot/translations/en.json | 20 ------ .../xiaomi_miot/translations/it.json | 20 ------ .../xiaomi_miot/translations/pt-BR.json | 20 ------ .../xiaomi_miot/translations/zh-Hans.json | 15 ---- 8 files changed, 5 insertions(+), 175 deletions(-) diff --git a/README.md b/README.md index 29509955b..aa7f056ef 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,6 @@ data: - siid: 3 piid: 2 update_entity: true # Update to entity state attributes - throw: true # Throw result to HA notifications ``` > With [event](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.got_miot_properties` @@ -283,7 +282,6 @@ data: params: - 18 # piid: 1 - work-mode - '{"selects":[[7,1,0,2,1]]}' # piid: 10 - clean-extend-data - throw: true # throw result to HA notifications ``` > With [event](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.call_miot_action` @@ -296,7 +294,6 @@ data: method: set_power params: - on - throw: true # throw result to HA notifications ``` > With [event](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.send_miio_command` diff --git a/README_zh.md b/README_zh.md index f7b1569bf..3284078f7 100644 --- a/README_zh.md +++ b/README_zh.md @@ -305,7 +305,6 @@ data: - siid: 3 piid: 2 update_entity: true # 更新实体状态属性 - throw: true # 在HA通知中显示结果 ``` > 触发[事件](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.got_miot_properties` @@ -320,7 +319,6 @@ data: params: - 18 # piid: 1 - work-mode - '{"selects":[[7,1,0,2,1]]}' # piid: 10 - clean-extend-data - throw: true # 在HA通知中显示结果 ``` > 触发[事件](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.call_miot_action` @@ -333,7 +331,6 @@ data: method: set_power params: - on - throw: true # 在HA通知中显示结果 ``` > 触发[事件](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.send_miio_command` diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index 6f3daded6..766f81a51 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -97,7 +97,7 @@ { vol.Required('method'): cv.string, vol.Optional('params', default=[]): cv.ensure_list, - vol.Optional('throw', default=False): cv.boolean, + vol.Optional('throw', default=False): cv.boolean, # Deprecated vol.Optional('return_result', default=True): cv.boolean, }, ), @@ -520,10 +520,6 @@ async def async_get_token(call) -> ServiceResponse: cnt += 1 if not lst: lst = [f'Not Found "{nam}" in {cnt} devices.'] - msg = '\n\n'.join(map(lambda vv: f'{vv}', lst)) - persistent_notification.async_create( - hass, msg, 'Miot device', f'{DOMAIN}-debug', - ) return { 'list': lst, } @@ -1009,13 +1005,6 @@ def send_miio_command(self, method, params=None, **kwargs): 'params': params, 'result': result, }) - if kwargs.get('throw'): - persistent_notification.create( - self.hass, - f'{result}', - 'Miio command result', - f'{DOMAIN}-debug', - ) ret = result == self._success_result if kwargs.get('return_result'): return result @@ -1829,13 +1818,6 @@ def get_properties(self, mapping, update_entity=False, throw=False, **kwargs): if attrs and update_entity: self.update_attrs(attrs, update_subs=True) self.async_write_ha_state() - if throw: - persistent_notification.create( - self.hass, - f'{results}', - 'Miot properties', - f'{DOMAIN}-debug', - ) return attrs async def async_get_properties(self, mapping, **kwargs): @@ -1924,13 +1906,6 @@ def set_miot_property(self, siid, piid, value, did=None, **kwargs): elif prop := srv.properties.get(piid): self._state_attrs[prop.full_name] = value self.async_write_ha_state() - if kwargs.get('throw'): - persistent_notification.create( - self.hass, - f'{ret.result}', - 'Set miot property result', - f'{DOMAIN}-debug', - ) return ret async def async_set_miot_property(self, siid, piid, value, did=None, **kwargs): @@ -1996,13 +1971,6 @@ def miot_action(self, siid, aiid, params=None, did=None, **kwargs): self._state_attrs['miot_action_error'] = MiotSpec.spec_error(eno) self.logger.info('%s: Call miot action %s failed: %s', self.name_model, pms, result) self._state_attrs['miot_action_result'] = result - if kwargs.get('throw'): - persistent_notification.create( - self.hass, - f'{result}', - 'Miot action result', - f'{DOMAIN}-debug', - ) return result if ret else ret async def async_miot_action(self, siid, aiid, params=None, did=None, **kwargs): @@ -2170,36 +2138,16 @@ async def async_get_device_data(self, key, did=None, throw=False, **kwargs): mic = self.xiaomi_cloud if not isinstance(mic, MiotCloud): return None - result = await self.hass.async_add_executor_job( - partial(mic.get_user_device_data, did, key, raw=True, **kwargs) - ) - persistent_notification.async_create( - self.hass, - f'{result}', - f'Xiaomi device data: {self.name}', - f'{DOMAIN}-debug', - ) - if throw: - raise Warning(f'Xiaomi device data for {self.name}: {result}') - else: - _LOGGER.debug('%s: Xiaomi device data: %s', self.name_model, result) + result = await self.async_get_user_device_data(did, key, raw=True, **kwargs) + _LOGGER.info('%s: Xiaomi device data: %s', self.name_model, result) return result - async def async_get_bindkey(self, did=None, throw=False): + async def async_get_bindkey(self, did=None): mic = self.xiaomi_cloud if not isinstance(mic, MiotCloud): return None result = await mic.async_get_beaconkey(did or self.miot_did) - persistent_notification.async_create( - self.hass, - f'{result}', - f'Xiaomi device bindkey: {self.name}', - f'{DOMAIN}-debug', - ) - if throw: - raise Warning(f'Xiaomi device bindkey for {self.name}: {result}') - else: - _LOGGER.warning('%s: Xiaomi device bindkey/beaconkey: %s', self.name_model, result) + _LOGGER.info('%s: Xiaomi device bindkey/beaconkey: %s', self.name_model, result) return result async def async_request_xiaomi_api(self, api, data=None, method='POST', crypt=True, **kwargs): @@ -2218,13 +2166,6 @@ async def async_request_xiaomi_api(self, api, data=None, method='POST', crypt=Tr 'data': dat, 'result': result, }) - if kwargs.get('throw'): - persistent_notification.async_create( - self.hass, - f'{result}', - f'Xiaomi Api: {api}', - f'{DOMAIN}-debug', - ) _LOGGER.debug('Xiaomi Api %s: %s', api, result) return result diff --git a/custom_components/xiaomi_miot/services.yaml b/custom_components/xiaomi_miot/services.yaml index c93f51886..d7219ea3d 100644 --- a/custom_components/xiaomi_miot/services.yaml +++ b/custom_components/xiaomi_miot/services.yaml @@ -20,12 +20,6 @@ send_command: required: true selector: object: - throw: - description: Throw result. - default: false - example: false - selector: - boolean: get_properties: description: Get miot properties. @@ -49,12 +43,6 @@ get_properties: example: true selector: boolean: - throw: - description: Throw properties. - default: false - example: true - selector: - boolean: set_property: description: Set miot property. @@ -147,12 +135,6 @@ call_action: example: "['Turn on light', 1]" selector: object: - throw: - description: Throw result. - default: false - example: false - selector: - boolean: intelligent_speaker: description: Play text on Xiaoai speaker / Execute text directive / 小爱TTS及执行语音命令 @@ -183,12 +165,6 @@ intelligent_speaker: example: false selector: boolean: - throw: - description: Throw result. - default: false - example: false - selector: - boolean: xiaoai_wakeup: description: Wake up the Xiaoai speaker / 唤醒小爱音箱 @@ -355,9 +331,3 @@ request_xiaomi_api: value: micoapi - label: i.mi.com value: i.mi.com - throw: - description: Throw result. - default: true - example: true - selector: - boolean: diff --git a/custom_components/xiaomi_miot/translations/en.json b/custom_components/xiaomi_miot/translations/en.json index cb57f7fa5..dd147530c 100644 --- a/custom_components/xiaomi_miot/translations/en.json +++ b/custom_components/xiaomi_miot/translations/en.json @@ -283,10 +283,6 @@ "params": { "name": "Params", "description": "" - }, - "throw": { - "name": "Throw", - "description": "Throw result to HA notifications" } } }, @@ -305,10 +301,6 @@ "update_entity": { "name": "Update entity", "description": "" - }, - "throw": { - "name": "Throw", - "description": "Throw result to HA notifications" } } }, @@ -371,10 +363,6 @@ "params": { "name": "", "description": "" - }, - "throw": { - "name": "Throw", - "description": "Throw result to HA notifications" } } }, @@ -397,10 +385,6 @@ "silent": { "name": "Silent", "description": "" - }, - "throw": { - "name": "Throw", - "description": "Throw result to HA notifications" } } }, @@ -513,10 +497,6 @@ "sid": { "name": "", "description": "" - }, - "throw": { - "name": "Throw", - "description": "Throw result to HA notifications" } } } diff --git a/custom_components/xiaomi_miot/translations/it.json b/custom_components/xiaomi_miot/translations/it.json index c5f44a3f1..c2527c5b9 100644 --- a/custom_components/xiaomi_miot/translations/it.json +++ b/custom_components/xiaomi_miot/translations/it.json @@ -281,10 +281,6 @@ "params": { "name": "Parametro", "description": "" - }, - "throw": { - "name": "Invia", - "description": "Invia il risultato alle notifiche HA" } } }, @@ -303,10 +299,6 @@ "update_entity": { "name": "Update entity", "description": "" - }, - "throw": { - "name": "Invia", - "description": "Invia il risultato alle notifiche HA" } } }, @@ -369,10 +361,6 @@ "params": { "name": "", "description": "" - }, - "throw": { - "name": "Invia", - "description": "Invia il risultato alle notifiche HA" } } }, @@ -395,10 +383,6 @@ "silent": { "name": "Silent", "description": "" - }, - "throw": { - "name": "Invia", - "description": "Invia il risultato alle notifiche HA" } } }, @@ -511,10 +495,6 @@ "sid": { "name": "", "description": "" - }, - "throw": { - "name": "Invia", - "description": "Invia il risultato alle notifiche HA" } } } diff --git a/custom_components/xiaomi_miot/translations/pt-BR.json b/custom_components/xiaomi_miot/translations/pt-BR.json index a335ac78d..0c4761926 100644 --- a/custom_components/xiaomi_miot/translations/pt-BR.json +++ b/custom_components/xiaomi_miot/translations/pt-BR.json @@ -224,10 +224,6 @@ "params": { "name": "Parâmetros", "description": "" - }, - "throw": { - "name": "Evniar", - "description": "Enviar resultado para uma notificação HA" } } }, @@ -246,10 +242,6 @@ "update_entity": { "name": "Atualizar entidade", "description": "" - }, - "throw": { - "name": "Enviar", - "description": "Enviar resultado para uma notificação HA" } } }, @@ -312,10 +304,6 @@ "params": { "name": "", "description": "" - }, - "throw": { - "name": "Enviar", - "description": "Enviar resultado para uma notificação HA" } } }, @@ -338,10 +326,6 @@ "silent": { "name": "Silenciar", "description": "" - }, - "throw": { - "name": "Enviar", - "description": "Enviar resultado para uma notificação HA" } } }, @@ -454,10 +438,6 @@ "sid": { "name": "", "description": "" - }, - "throw": { - "name": "Enviar", - "description": "Enviar resultado para uma notificação HA" } } } diff --git a/custom_components/xiaomi_miot/translations/zh-Hans.json b/custom_components/xiaomi_miot/translations/zh-Hans.json index d40d52ce6..e4ec73cf9 100644 --- a/custom_components/xiaomi_miot/translations/zh-Hans.json +++ b/custom_components/xiaomi_miot/translations/zh-Hans.json @@ -294,9 +294,6 @@ }, "params": { "description": "Miio参数" - }, - "throw": { - "description": "在HA通知中显示结果" } } }, @@ -311,9 +308,6 @@ }, "update_entity": { "description": "更新实体状态属性" - }, - "throw": { - "description": "在HA通知中显示结果" } } }, @@ -362,9 +356,6 @@ }, "params": { "description": "MIoT动作参数" - }, - "throw": { - "description": "在HA通知中显示结果" } } }, @@ -382,9 +373,6 @@ }, "silent": { "description": "静默执行语音指令" - }, - "throw": { - "description": "在HA通知中显示结果" } } }, @@ -480,9 +468,6 @@ }, "sid": { "description": "小米服务ID" - }, - "throw": { - "description": "在HA通知中显示结果" } } } From 7eac09fe4ab3ab00847f5f1601ceb3fc2f7b3148 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 13:29:26 +0800 Subject: [PATCH 16/24] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20remove=20event=20?= =?UTF-8?q?for=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++------- README_zh.md | 12 ++------- custom_components/xiaomi_miot/__init__.py | 31 ----------------------- 3 files changed, 4 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index aa7f056ef..cd57a379a 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,8 @@ This component has added support for configuration reloading (to avoid having to ## Services +> Since the HA support service response has been for some time, this component no longer triggers events starting from v0.7.18. + #### [`xiaomi_miot.set_property`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.set_property) ```yaml service: xiaomi_miot.set_property @@ -270,8 +272,6 @@ data: update_entity: true # Update to entity state attributes ``` -> With [event](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.got_miot_properties` - #### [`xiaomi_miot.call_action`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.call_action) ```yaml service: xiaomi_miot.call_action @@ -284,8 +284,6 @@ data: - '{"selects":[[7,1,0,2,1]]}' # piid: 10 - clean-extend-data ``` -> With [event](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.call_miot_action` - #### [`xiaomi_miot.send_command`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.send_command) ```yaml service: xiaomi_miot.send_command @@ -296,8 +294,6 @@ data: - on ``` -> With [event](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.send_miio_command` - #### [`xiaomi_miot.get_token`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.get_token) ```yaml service: xiaomi_miot.get_token @@ -329,8 +325,6 @@ data: username: 80001234 # Xiaomi Account ID / Email / Phone ``` -> With [event](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.renew_devices` - #### [`xiaomi_miot.request_xiaomi_api`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.request_xiaomi_api) ```yaml service: xiaomi_miot.request_xiaomi_api @@ -344,8 +338,6 @@ data: - model: brand.device.model ``` -> With [event](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.request_xiaomi_api` - > [More services](https://github.com/al-one/hass-xiaomi-miot/blob/master/custom_components/xiaomi_miot/services.yaml) diff --git a/README_zh.md b/README_zh.md index 3284078f7..374b76310 100644 --- a/README_zh.md +++ b/README_zh.md @@ -275,6 +275,8 @@ xiaomi_miot: ## 服务 +> 由于HA支持服务响应已经有一段时间了,本组件自v0.7.18开始不再触发事件。 + #### [`xiaomi_miot.set_property`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.set_property) ```yaml service: xiaomi_miot.set_property @@ -307,8 +309,6 @@ data: update_entity: true # 更新实体状态属性 ``` -> 触发[事件](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.got_miot_properties` - #### [`xiaomi_miot.call_action`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.call_action) ```yaml service: xiaomi_miot.call_action @@ -321,8 +321,6 @@ data: - '{"selects":[[7,1,0,2,1]]}' # piid: 10 - clean-extend-data ``` -> 触发[事件](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.call_miot_action` - #### [`xiaomi_miot.send_command`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.send_command) ```yaml service: xiaomi_miot.send_command @@ -333,8 +331,6 @@ data: - on ``` -> 触发[事件](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.send_miio_command` - #### [`xiaomi_miot.get_token`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.get_token) ```yaml service: xiaomi_miot.get_token @@ -366,8 +362,6 @@ data: username: 80001234 # 小米账号ID/登录邮箱/手机号 ``` -> 触发[事件](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.renew_devices` - #### [`xiaomi_miot.request_xiaomi_api`](https://my.home-assistant.io/redirect/developer_call_service/?service=xiaomi_miot.request_xiaomi_api) ```yaml service: xiaomi_miot.request_xiaomi_api @@ -381,8 +375,6 @@ data: - model: brand.device.model ``` -> 触发[事件](https://my.home-assistant.io/redirect/developer_events/) `xiaomi_miot.request_xiaomi_api` - > 查看[更多服务](https://github.com/al-one/hass-xiaomi-miot/blob/master/custom_components/xiaomi_miot/services.yaml) diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index 766f81a51..ee8eb2902 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -542,11 +542,6 @@ async def async_renew_devices(call): continue dvs = await cld.async_renew_devices() cnt = len(dvs) - hass.bus.async_fire(f'{DOMAIN}.renew_devices', { - CONF_USERNAME: cld.username, - 'user_id': cld.user_id, - 'device_count': cnt, - }) _LOGGER.info('Renew xiaomi devices for %s. Got %s devices.', cld.username, cnt) return True @@ -999,12 +994,6 @@ def send_miio_command(self, method, params=None, **kwargs): except DeviceException as ex: self.logger.error('%s: Send miio command: %s(%s) failed: %s', self.name_model, method, params, ex) return False - self.hass.bus.async_fire(f'{DOMAIN}.send_miio_command', { - ATTR_ENTITY_ID: self.entity_id, - 'method': method, - 'params': params, - 'result': result, - }) ret = result == self._success_result if kwargs.get('return_result'): return result @@ -1807,12 +1796,6 @@ def get_properties(self, mapping, update_entity=False, throw=False, **kwargs): return result = MiotResults(results, mapping) attrs = result.to_attributes(self._state_attrs) - self.hass.bus.async_fire(f'{DOMAIN}.got_miot_properties', { - ATTR_ENTITY_ID: self.entity_id, - 'mapping': mapping, - 'attrs': attrs, - 'result': results, - }) self.logger.info('%s: Get miot properties: %s', self.name_model, results) if attrs and update_entity: @@ -1957,14 +1940,6 @@ def miot_action(self, siid, aiid, params=None, did=None, **kwargs): self.logger.warning('%s: Call miot action %s failed: %s, result: %s', self.name_model, pms, exc, result) ret = eno == self._success_code if ret: - self.hass.bus.async_fire(f'{DOMAIN}.call_miot_action', { - ATTR_ENTITY_ID: self.entity_id, - 'did': did, - 'siid': siid, - 'aiid': aiid, - 'params': params, - 'result': result, - }) self._vars['delay_update'] = dly self.logger.debug('%s: Call miot action %s, result: %s', self.name_model, pms, result) else: @@ -2160,12 +2135,6 @@ async def async_request_xiaomi_api(self, api, data=None, method='POST', crypt=Tr pms = kwargs.pop('params', None) dat = data or pms result = await mic.async_request_api(api, data=dat, method=method, crypt=crypt, **kwargs) - self.hass.bus.async_fire(f'{DOMAIN}.request_xiaomi_api', { - ATTR_ENTITY_ID: self.entity_id, - 'api': api, - 'data': dat, - 'result': result, - }) _LOGGER.debug('Xiaomi Api %s: %s', api, result) return result From ef895809eee5d61b4172244986125f04472e7089 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 13:31:42 +0800 Subject: [PATCH 17/24] =?UTF-8?q?=F0=9F=94=A7=20fix=20call=20in=20unsafe?= =?UTF-8?q?=20thread=20(#1645)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/__init__.py | 8 ++++---- custom_components/xiaomi_miot/button.py | 2 +- custom_components/xiaomi_miot/camera.py | 2 +- custom_components/xiaomi_miot/cover.py | 2 +- custom_components/xiaomi_miot/media_player.py | 2 +- custom_components/xiaomi_miot/number.py | 2 +- custom_components/xiaomi_miot/select.py | 8 ++++---- custom_components/xiaomi_miot/switch.py | 2 +- custom_components/xiaomi_miot/text.py | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index ee8eb2902..096fece2a 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -1800,7 +1800,7 @@ def get_properties(self, mapping, update_entity=False, throw=False, **kwargs): if attrs and update_entity: self.update_attrs(attrs, update_subs=True) - self.async_write_ha_state() + self.schedule_update_ha_state() return attrs async def async_get_properties(self, mapping, **kwargs): @@ -1888,7 +1888,7 @@ def set_miot_property(self, siid, piid, value, did=None, **kwargs): pass elif prop := srv.properties.get(piid): self._state_attrs[prop.full_name] = value - self.async_write_ha_state() + self.schedule_update_ha_state() return ret async def async_set_miot_property(self, siid, piid, value, did=None, **kwargs): @@ -2370,7 +2370,7 @@ async def async_added_to_hass(self): def update_from_parent(self): self.update() if self.platform: - self.async_write_ha_state() + self.schedule_update_ha_state() def update(self, data=None): attrs = self.parent_attributes @@ -2407,7 +2407,7 @@ def update_attrs(self, attrs: dict, update_parent=True): getattr(self._parent, 'update_attrs')(attrs or {}, update_parent=False) if self.hass and self.platform: # don't set state before added to hass - self.async_write_ha_state() + self.schedule_update_ha_state() return self._state_attrs def call_parent(self, method, *args, **kwargs): diff --git a/custom_components/xiaomi_miot/button.py b/custom_components/xiaomi_miot/button.py index 051c5fb9d..80910f12e 100644 --- a/custom_components/xiaomi_miot/button.py +++ b/custom_components/xiaomi_miot/button.py @@ -136,5 +136,5 @@ def press(self): **self._press_kwargs, } if ret := self._press_action(**kws): - self.async_write_ha_state() + self.schedule_update_ha_state() return ret diff --git a/custom_components/xiaomi_miot/camera.py b/custom_components/xiaomi_miot/camera.py index b47f3cd63..8179c5531 100644 --- a/custom_components/xiaomi_miot/camera.py +++ b/custom_components/xiaomi_miot/camera.py @@ -383,7 +383,7 @@ def get_stream_address(self, **kwargs): self._url_expiration = now + 60 * 4.5 if self._prop_stream_address: self._last_url = self._prop_stream_address.from_dict(odt) - self.async_write_ha_state() + self.schedule_update_ha_state() self.async_check_stream_address(self._last_url) if not kwargs.get('scheduled') or self.custom_config('keep_streaming'): self._schedule_stream_refresh() diff --git a/custom_components/xiaomi_miot/cover.py b/custom_components/xiaomi_miot/cover.py index 032cbfcad..fb1e8389c 100644 --- a/custom_components/xiaomi_miot/cover.py +++ b/custom_components/xiaomi_miot/cover.py @@ -414,7 +414,7 @@ async def _time_changed_cover(self, now): self._unsub_listener_cover() self._unsub_listener_cover = None self._set_position = None - self.async_write_ha_state() + self.schedule_update_ha_state() _LOGGER.debug('cover process %s: %s', self.entity_id, { 'position': self._position, 'set_position': self._set_position, diff --git a/custom_components/xiaomi_miot/media_player.py b/custom_components/xiaomi_miot/media_player.py index d42ee2945..4766b7186 100644 --- a/custom_components/xiaomi_miot/media_player.py +++ b/custom_components/xiaomi_miot/media_player.py @@ -818,7 +818,7 @@ def select_source(self, source): if source in self._keycodes: ret = self.press_key(source) self._attr_app_name = source - self.async_write_ha_state() + self.schedule_update_ha_state() return ret if source in self.source_list: return super().select_source(source) diff --git a/custom_components/xiaomi_miot/number.py b/custom_components/xiaomi_miot/number.py index 96dff2c66..f7e860e00 100644 --- a/custom_components/xiaomi_miot/number.py +++ b/custom_components/xiaomi_miot/number.py @@ -122,5 +122,5 @@ def set_native_value(self, value): ret = self.call_parent('call_action', self._miot_action, [val]) if ret: self._attr_native_value = val - self.async_write_ha_state() + self.schedule_update_ha_state() return ret diff --git a/custom_components/xiaomi_miot/select.py b/custom_components/xiaomi_miot/select.py index e0baea43a..f7c760e5d 100644 --- a/custom_components/xiaomi_miot/select.py +++ b/custom_components/xiaomi_miot/select.py @@ -86,7 +86,7 @@ def select_option(self, option): if act: if ret := self.call_action(act): self._attr_current_option = option - self.async_write_ha_state() + self.schedule_update_ha_state() self._attr_current_option = None return ret @@ -153,7 +153,7 @@ def select_option(self, option): ret = self.call_parent('call_action', self._miot_action, pms) if ret: self._attr_current_option = option - self.async_write_ha_state() + self.schedule_update_ha_state() return ret @@ -168,7 +168,7 @@ def __init__(self, parent, attr, option=None): def update(self, data=None): super().update(data) self._attr_current_option = self._attr_state - self.async_write_ha_state() + self.schedule_update_ha_state() def select_option(self, option): """Change the selected option.""" @@ -179,7 +179,7 @@ def select_option(self, option): } if ret := self._select_option(option, **kws): self._attr_current_option = option - self.async_write_ha_state() + self.schedule_update_ha_state() return ret raise NotImplementedError() diff --git a/custom_components/xiaomi_miot/switch.py b/custom_components/xiaomi_miot/switch.py index 0b78dcca5..2ed10b2b4 100644 --- a/custom_components/xiaomi_miot/switch.py +++ b/custom_components/xiaomi_miot/switch.py @@ -219,7 +219,7 @@ def turn_on(self, **kwargs): ret = self.call_parent('call_action', self._miot_action, None if val is None else [val]) if ret: self._state = True - self.async_write_ha_state() + self.schedule_update_ha_state() time.sleep(0.5) self._state = False return ret diff --git a/custom_components/xiaomi_miot/text.py b/custom_components/xiaomi_miot/text.py index 6ff4b58cc..4890b70f4 100644 --- a/custom_components/xiaomi_miot/text.py +++ b/custom_components/xiaomi_miot/text.py @@ -108,7 +108,7 @@ def set_value(self, value): if ret: self._attr_native_value = value - self.async_write_ha_state() + self.schedule_update_ha_state() time.sleep(0.5) self._attr_native_value = '' return ret From 1f2827c20591cdc908d7047dc84d1e4042d364f3 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 13:47:39 +0800 Subject: [PATCH 18/24] =?UTF-8?q?=F0=9F=94=A7=20fix=20for=20call=20action?= =?UTF-8?q?=20(#1642)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index 096fece2a..e35b4d434 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -1922,6 +1922,8 @@ def miot_action(self, siid, aiid, params=None, did=None, **kwargs): mca = self.miot_cloud_action if self.custom_config_bool('auto_cloud') and not self._local_state: mca = self.xiaomi_cloud + elif not self.miot_device: + mca = self.xiaomi_cloud try: if m2m and self._miio2miot.has_setter(siid, aiid=aiid): result = self._miio2miot.call_action(self.miot_device, siid, aiid, params) From a1d7b60e7e983d5b37e2ac12691918442bbddfac Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 14:37:23 +0800 Subject: [PATCH 19/24] =?UTF-8?q?=F0=9F=91=A8=E2=80=8D=F0=9F=8D=B3=20add?= =?UTF-8?q?=20sub-entities=20for=20cykj.hood.jyj22=20(#1630)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaomi_miot/core/device_customizes.py | 14 ++++++++++++++ custom_components/xiaomi_miot/sensor.py | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index ff90a5843..70453b3a7 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -444,6 +444,20 @@ 'main_miot_services': 'switch-2', 'exclude_miot_services': 'setting,wireless_switch', }, + 'cykj.hood.jyj22': { + 'sensor_properties': 'left_stove_level,right_stove_level,left_stove_timer,right_stove_timer,timer_mode', + 'switch_properties': 'prop.2.9,hood_stove_switch,timer_alert_switch,low_power_alert,pose_recog_switch,' + 'start_period_notify,pm_fresh_notify,auto_lighton_start,clean_notify,pm_notify_on', + 'select_properties': 'clean_period', + 'number_properties': 'prop.2.5,off_delay_time,start_period_set,pm_thresold,pm_fresh_time,pm_fresh_valueset,' + 'turn_off_screen', + }, + 'cykj.hood.jyj22:battery': { + 'state_class': '', + }, + 'cykj.hood.jyj22:battery_level': { + 'state_class': '', + }, 'deerma.humidifier.jsq4': { 'exclude_miot_services': None, diff --git a/custom_components/xiaomi_miot/sensor.py b/custom_components/xiaomi_miot/sensor.py index de66fdd32..c9892602f 100644 --- a/custom_components/xiaomi_miot/sensor.py +++ b/custom_components/xiaomi_miot/sensor.py @@ -218,6 +218,8 @@ async def async_added_to_hass(self): cls = self.custom_config('state_class') if cls in STATE_CLASSES: self._attr_state_class = cls + elif cls in ['', False]: + self._attr_state_class = None if uom := self.custom_config('unit_of_measurement'): self._attr_native_unit_of_measurement = uom @@ -465,6 +467,8 @@ async def async_added_to_hass(self): cls = self.custom_config('state_class') if cls in STATE_CLASSES: self._attr_state_class = cls + elif cls in ['', False]: + self._attr_state_class = None if uom := self.custom_config('unit_of_measurement'): self._attr_native_unit_of_measurement = uom From 85e2edfa998e7ecb6ed4c24022f624044a5d3230 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 15:13:53 +0800 Subject: [PATCH 20/24] =?UTF-8?q?=F0=9F=8D=83=20imporve=20pm10=20unit=20fo?= =?UTF-8?q?r=20zhimi.airp=20(#1542)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 70453b3a7..51c7d0481 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1571,7 +1571,7 @@ 'select_properties': 'brightness,temperature_display_unit', 'number_properties': 'favorite_speed,favorite_level', }, - 'zhimi.airp.meb1:pm10-density': { + 'zhimi.airp.meb1:pm10_density': { 'unit_of_measurement': 'µg/m³', }, 'zhimi.airp.sa4': { @@ -1588,7 +1588,7 @@ 'select_properties': 'brightness', 'number_properties': 'air_purifier_favorite.fan_level', }, - 'zhimi.airp.vb4:pm10-density': { + 'zhimi.airp.vb4:pm10_density': { 'unit_of_measurement': 'µg/m³', }, 'zhimi.airpurifier.*': { From 698f33d0a80c5ba8850b5e7f2d65d9016ac23c39 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 15:25:44 +0800 Subject: [PATCH 21/24] =?UTF-8?q?=F0=9F=92=A1=20add=20ambient=20light=20fo?= =?UTF-8?q?r=20yeelink=20ceiling20=20(#1611)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/miio2miot_specs.py | 2 +- custom_components/xiaomi_miot/core/miot_specs_extend.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_miot/core/miio2miot_specs.py b/custom_components/xiaomi_miot/core/miio2miot_specs.py index f965796ae..f8c78260b 100644 --- a/custom_components/xiaomi_miot/core/miio2miot_specs.py +++ b/custom_components/xiaomi_miot/core/miio2miot_specs.py @@ -2175,7 +2175,7 @@ def cbk(prop, params, props, **kwargs): 'yeelink.light.ceiling17': 'yeelink.light.ceiling16', 'yeelink.light.ceiling18': 'yeelink.light.ceiling6', 'yeelink.light.ceiling19': 'yeelink.light.ceiling10', - 'yeelink.light.ceiling20': 'yeelink.light.ceiling6', + 'yeelink.light.ceiling20': 'yeelink.light.ceiling10', 'yeelink.light.ceiling21': { 'extend_model': 'yeelink.light.ceiling22', 'miio_specs': { diff --git a/custom_components/xiaomi_miot/core/miot_specs_extend.json b/custom_components/xiaomi_miot/core/miot_specs_extend.json index 53d0582b0..f80ea46a9 100644 --- a/custom_components/xiaomi_miot/core/miot_specs_extend.json +++ b/custom_components/xiaomi_miot/core/miot_specs_extend.json @@ -1489,7 +1489,7 @@ } ], "yeelink.light.ceiling19": "yeelink.light.ceiling4", - "yeelink.light.ceiling20": "yeelink.light.ceiling1", + "yeelink.light.ceiling20": "yeelink.light.ceiling4", "yeelink.light.ceiling21": "yeelink.light.ceiling1", "yeelink.light.ceiling22": "yeelink.light.ceiling1", "yeelink.light.ceiling23": "yeelink.light.ceiling1", From 5eb1624ac30eafa5bf30a6637e6a1385690832df Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 15:37:44 +0800 Subject: [PATCH 22/24] =?UTF-8?q?=F0=9F=A5=98=20add=20support=20for=20xiao?= =?UTF-8?q?mi.esteamer.mes01=20(#1617)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- README_zh.md | 2 +- custom_components/xiaomi_miot/core/device_customizes.py | 7 +++++++ custom_components/xiaomi_miot/sensor.py | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cd57a379a..1acf1ae96 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ This component has added support for configuration reloading (to avoid having to - 🚰 [water-purifier](https://home.miot-spec.com/s/waterpuri) / [kettle](https://home.miot-spec.com/s/kettle) - ♻️ [air-purifier](https://home.miot-spec.com/s/airpurifier) / [air-fresh](https://home.miot-spec.com/s/airfresh) / [hood](https://home.miot-spec.com/s/hood) - 🌡 [temperature-humidity-sensor](https://home.miot-spec.com/s/sensor_ht) / [submersion-sensor](https://home.miot-spec.com/s/flood) / [smoke-sensor](https://home.miot-spec.com/s/sensor_smoke) -- 🥘 [cooker](https://home.miot-spec.com/s/cooker) / [pressure-cooker](https://home.miot-spec.com/s/pre_cooker) +- 🥘 [cooker](https://home.miot-spec.com/s/cooker) / [pressure-cooker](https://home.miot-spec.com/s/pre_cooker) / [electric-steamer](https://home.miot-spec.com/s/esteamer) - 🍲 [induction-cooker](https://home.miot-spec.com/s/ihcooker) / [oven](https://home.miot-spec.com/s/oven) / [microwave](https://home.miot-spec.com/s/microwave) - 🍗 [air-fryer](https://home.miot-spec.com/s/fryer) / [multifunction-cooking-pot](https://home.miot-spec.com/s/mfcp) - 🍵 [health-pot](https://home.miot-spec.com/s/health_pot) / ☕️ [coffee-machine](https://home.miot-spec.com/s/coffee) diff --git a/README_zh.md b/README_zh.md index 374b76310..f4a7758c8 100644 --- a/README_zh.md +++ b/README_zh.md @@ -237,7 +237,7 @@ xiaomi_miot: - 🚰 [净水器](https://home.miot-spec.com/s/waterpuri) / [饮水机](https://home.miot-spec.com/s/kettle) - ♻️ [空气净化器](https://home.miot-spec.com/s/airpurifier) / [新风机](https://home.miot-spec.com/s/airfresh) / [油烟机](https://home.miot-spec.com/s/hood) - 🌡 [温湿度传感器](https://home.miot-spec.com/s/sensor_ht) / [水侵传感器](https://home.miot-spec.com/s/flood) / [烟雾传感器](https://home.miot-spec.com/s/sensor_smoke) -- 🥘 [电饭煲](https://home.miot-spec.com/s/cooker) / [压力锅](https://home.miot-spec.com/s/pre_cooker) +- 🥘 [电饭煲](https://home.miot-spec.com/s/cooker) / [压力锅](https://home.miot-spec.com/s/pre_cooker) / [电蒸锅](https://home.miot-spec.com/s/esteamer) - 🍲 [电磁炉](https://home.miot-spec.com/s/ihcooker) / [烤箱](https://home.miot-spec.com/s/oven) / [微波炉](https://home.miot-spec.com/s/microwave) - 🍗 [空气炸锅](https://home.miot-spec.com/s/fryer) / [多功能锅](https://home.miot-spec.com/s/mfcp) - 🍵 [养生壶](https://home.miot-spec.com/s/health_pot) / ☕️ [咖啡机](https://home.miot-spec.com/s/coffee) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 51c7d0481..8255eba91 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1403,6 +1403,13 @@ 'button_actions': 'homepage,light', 'text_actions': 'play_text,execute_text_directive', }, + 'xiaomi.esteamer.mes01': { + 'sensor_properties': 'left_time,keep_warm_left_time', + 'switch_properties': 'auto_keep_warm', + 'select_properties': 'mode', + 'number_properties': 'target_temperature,target_time,reservation_left_time,keep_warm_time', + 'button_actions': 'start_cook,pause,cancel_cooking,resume_cook', + }, 'xiaomi.heater.ma8': { 'button_actions': 'toggle', }, diff --git a/custom_components/xiaomi_miot/sensor.py b/custom_components/xiaomi_miot/sensor.py index c9892602f..12651ebd0 100644 --- a/custom_components/xiaomi_miot/sensor.py +++ b/custom_components/xiaomi_miot/sensor.py @@ -109,7 +109,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= 'temperature_humidity_sensor', 'illumination_sensor', 'gas_sensor', 'smoke_sensor', 'router', 'lock', 'door', 'washer', 'printer', 'sleep_monitor', 'bed', 'walking_pad', 'treadmill', 'oven', 'microwave_oven', 'health_pot', 'coffee_machine', 'multifunction_cooking_pot', - 'cooker', 'induction_cooker', 'pressure_cooker', 'air_fryer', 'juicer', + 'cooker', 'induction_cooker', 'pressure_cooker', 'air_fryer', 'juicer', 'electric_steamer', 'water_purifier', 'dishwasher', 'fruit_vegetable_purifier', 'pet_feeder', 'cat_toilet', 'fridge_chamber', 'plant_monitor', 'germicidal_lamp', 'vital_signs', 'sterilizer', 'steriliser', 'table', 'chair', 'dryer', 'clothes_dryer', From 29c69b1aa854552ea8b34cbe87bff725233724f3 Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 30 Apr 2024 16:00:37 +0800 Subject: [PATCH 23/24] =?UTF-8?q?=E2=AC=86=20new=20version=20v0.7.18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/manifest.json b/custom_components/xiaomi_miot/manifest.json index 534be5197..9a5400ae6 100644 --- a/custom_components/xiaomi_miot/manifest.json +++ b/custom_components/xiaomi_miot/manifest.json @@ -17,5 +17,5 @@ "python-miio>=0.5.12", "micloud>=0.5" ], - "version": "0.7.17" + "version": "0.7.18" } From 3238b6f1edaa538093544f4607debb36575373dc Mon Sep 17 00:00:00 2001 From: weiting Date: Sat, 11 May 2024 18:15:34 +0800 Subject: [PATCH 24/24] =?UTF-8?q?=F0=9F=9B=80=20add=20entities=20for=20zim?= =?UTF-8?q?i.waterheater.h01=20(#1657)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/core/device_customizes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 8255eba91..c10763565 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1711,6 +1711,15 @@ 'device_class': 'energy', 'unit_of_measurement': 'kWh', }, + 'zimi.waterheater.h01': { + 'sensor_properties': 'water_heater.status,water_level,temperature_tips,' + 'input_water_temp,water_pump_volt,remaining_time', + 'switch_properties': 'on,hot_water_recirculation,heat_preservation,jog_function,pressure_boost.status,' + 'cloud_preheater,in_cloud_timer,water_trigger,reminder,enhanced', + 'select_properties': 'effective,model', + 'number_properties': 'target_temperature,light_off_time,children_mode_temp,comfort_mode_temp,adult_mode_temp,' + 'kitchen_mode_temp,pet_mode_temp,custom_time,boost_value', + }, 'zinguo.switch.b5m': { 'main_miot_services': 'switch-2', 'sensor_properties': 'temperature',