diff --git a/custom_components/xiaomi_miot/config_flow.py b/custom_components/xiaomi_miot/config_flow.py index f2b5594cd..158de1bd7 100644 --- a/custom_components/xiaomi_miot/config_flow.py +++ b/custom_components/xiaomi_miot/config_flow.py @@ -115,7 +115,9 @@ async def check_miio_device(hass, user_input, errors): return user_input -class BaseFlowHandler(config_entries.ConfigEntryBaseFlow): +class BaseFlowHandler: + hass = None + context = None cloud: MiotCloud = None devices: Optional[list] = None diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index 18b8b97df..81b79f159 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -53,6 +53,8 @@ 'switch_properties': 'radar_switch,count_switch', 'select_properties': 'map_index,traction', 'button_actions': 'reboot', + 'exclude_miot_properties': 'zone_param,target_param,duration_param,time_param,' + 'map_read,map_write,radar_duration', }, 'ainice.sensor_occupy.3b:current_occupied': { 'with_properties': 'has_someone_duration,no_one_duration,total_occupied', @@ -121,6 +123,9 @@ 'babai.curtain.bb82mj': { 'chunk_properties': 1, }, + 'babai.curtain.lsxf83': { + 'chunk_properties': 1, + }, 'babai.curtain.m515e': { 'chunk_properties': 1, }, @@ -391,6 +396,14 @@ 'sensor_attributes': 'power_cost_today,power_cost_month', 'stat_power_cost_key': '11.1', }, + 'cuco.plug.v2eur:power_cost_today': { + **ENERGY_KWH, + 'value_ratio': 0.01, + }, + 'cuco.plug.v2eur:power_cost_month': { + **ENERGY_KWH, + 'value_ratio': 0.01, + }, 'cuco.plug.v3': { 'sensor_attributes': 'power_cost_today,power_cost_month', 'stat_power_cost_key': '11.1', @@ -552,6 +565,9 @@ }, 'dmaker.fan.p33': { 'percentage_property': 'prop.2.6', + 'select_properties': 'motor_control', + 'open_texts': 'LEFT', + 'close_texts': 'RIGHT', }, 'dmaker.fan.p45': { 'percentage_property': 'speed_level', @@ -637,6 +653,10 @@ 'auto_position_reverse': True, 'select_properties': 'speed_control', }, + 'giot.bhf_light.v1ibhw': { + 'switch_properties': 'heating,blow,ventilation,dryer,uv,horizontal_swing,night_light_switch', + 'exclude_miot_properties': 'custom.status,setting,msga,msgb', + }, 'hfjh.fishbowl.v1': { 'light_services': 'light', @@ -677,6 +697,9 @@ 'position_reverse': True, 'cover_position_mapping': {}, }, + 'hyd.airer.znlyj5': { + 'cover_position_mapping': {0: 50, 1: 0, 2: 100}, + }, 'hyd.airer.*': { 'switch_properties': 'uv', 'select_properties': 'mode,dryer', @@ -1171,6 +1194,11 @@ 'cloud_delay_update': 8, 'miot_type': 'urn:miot-spec-v2:device:air-conditioner:0000A004:qdhkl-b23:2', }, + 'qjiang.acpartner.wb20': { + 'sensor_properties': 'switch.temperature', + 'exclude_miot_services': 'air_condition_outlet_matching,matching_action', + 'exclude_miot_properties': 'fault', + }, 'qmi.plug.psv3': { 'sensor_attributes': 'power_cost_today,power_cost_month', 'sensor_properties': 'switch.temperature', @@ -1286,6 +1314,9 @@ 'select_attributes': 'main_state,main_light,night_light,heat,vent,dry,natural_wind,delay_wind', }, + 'smartj.curtain.sjdt82': { + 'chunk_properties': 1, + }, 'smith.blanket.cxma1': { 'sensor_properties': 'fault,temperature', 'select_properties': 'water_level,quilt_dry', @@ -1366,6 +1397,9 @@ 'viomi.washer.*': { 'exclude_miot_services': 'key_press', }, + 'viomi.waterheater.e1': { + 'unreadable_properties': True, # issues/1707 + }, 'viomi.waterheater.m1': { 'sensor_properties': 'water_heater.status,water_level,temperature_tips,' 'input_water_temp,water_pump_volt,remaining_time', @@ -1387,6 +1421,9 @@ 'xiaomi.airc.r34r00': { 'sensor_properties': 'power_consumption', }, + 'xiaomi.airc.r24r00': { + 'sensor_properties': 'power_consumption', + }, 'xiaomi.airc.*:power_consumption': ENERGY_KWH, 'xiaomi.aircondition.m9': { 'exclude_miot_services': 'machine_state,flag_bit,single_smart_scene', @@ -1946,6 +1983,10 @@ 'switch_properties': 'on,auto_keep_warm', 'button_actions': 'start_cook,pause,cancel_cooking', }, + '*.curtain.*': { + 'switch_properties': 'motor_reverse', + 'select_properties': 'mode', + }, '*.desk.*': { 'button_properties': 'motor_control,reset', 'switch_properties': 'on', diff --git a/custom_components/xiaomi_miot/core/miio2miot_specs.py b/custom_components/xiaomi_miot/core/miio2miot_specs.py index 76be35928..e0cc65be5 100644 --- a/custom_components/xiaomi_miot/core/miio2miot_specs.py +++ b/custom_components/xiaomi_miot/core/miio2miot_specs.py @@ -1493,6 +1493,20 @@ def cbk(prop, params, props, **kwargs): 'prop.2.4': {'prop': 'curr_tempe'}, }, }, + 'viomi.hood.c1': { + 'chunk_properties': 1, + 'miio_props': ['run_time', 'link_state', 'stove1_data', 'stove2_data', 'battary_life', 'run_status', 'poweroff_delaytime'], + 'entity_attrs': ['run_time', 'link_state', 'stove1_data', 'stove2_data', 'battary_life', 'run_status', 'poweroff_delaytime'], + 'miio_specs': { + 'prop.2.1': {'prop': 'power_state', 'setter': 'set_power', 'set_template': '{{ [2 if value else 0] }}'}, + 'prop.3.1': {'prop': 'wind_state', 'setter': 'set_wind', 'dict': { + 1: 1, # Low + 16: 2, # High + 4: 3, # Stir-fry + }}, + 'prop.4.1': {'prop': 'light_state', 'setter': 'set_light', 'set_template': '{{ [value|int] }}'}, + }, + }, 'viomi.hood.v1': { 'chunk_properties': 1, 'miio_specs': { diff --git a/custom_components/xiaomi_miot/core/miot_local_devices.py b/custom_components/xiaomi_miot/core/miot_local_devices.py index 62467284f..217226aa0 100644 --- a/custom_components/xiaomi_miot/core/miot_local_devices.py +++ b/custom_components/xiaomi_miot/core/miot_local_devices.py @@ -8,6 +8,7 @@ # '090615.curtain.ykgc82', # -4004 # '090615.curtain.zsdj35', # -4004 # '090615.curtain.zsdj82', # -4004 + '090615.gateway.ac10', '090615.gateway.ktvrf', '090615.plug.plus01', '090615.switch.akstft', @@ -55,6 +56,7 @@ 'babai.wopener.83', 'baomi.airpurifier.450a', 'bean.curtain.bct01', + 'bean.curtain.ctw1', 'beihao.airer.airer3', 'beihao.airer.lyj08', 'bj352.airp.y106cm', @@ -117,6 +119,7 @@ 'chunmi.microwave.n20l02', 'chunmi.oven.kqz1', 'chunmi.oven.s1', + 'chunmi.oven.tsx8', 'chunmi.oven.x02', 'chunmi.pre_cooker.dylg5', 'chunmi.pre_cooker.mini1', @@ -300,6 +303,7 @@ 'hey.switch.x100', 'hfjh.fishbowl.m100', 'hfjh.fishbowl.v2', + 'hith.foot_bath.m1z1', 'hope.switch.w1', 'horow.toilet.s4', 'hsg.fishbowl.hxs01', @@ -329,6 +333,7 @@ 'ijai.vacuum.v3', 'ijomoo.toilet.zs320', 'iot.light.fl02', + 'iot.light.fl04', 'iot.light.socd01', 'iot.plug.jdls1', 'iot.plug.pw6u1', @@ -458,6 +463,7 @@ 'midjd9.fridge.303b', 'midr.camera.bw300', 'midr.camera.bw400g', + 'midr.cateye.ph300', 'mijia.vacuum.b108zb', 'mijia.vacuum.b108zh', 'mijia.vacuum.v1', @@ -516,6 +522,7 @@ 'ows.tow_w.mjj20a', 'ows.tow_w.mjjs1', 'ows.tow_w.mjjxs', + 'ows.tow_w.nexpro', 'pak.light.pak005', 'pak.light.pak01', 'philips.light.aibed', @@ -524,9 +531,10 @@ # 'philips.light.bulb', # issues/254 # 'philips.light.cbulb', # miio2miot 'philips.light.ceil33', - 'philips.light.ceilz', + # 'philips.light.ceilz', # issues/1908 'philips.light.dlight', # 'philips.light.downlight', # miio2miot + # 'philips.light.moonlight', # miio2miot 'philips.light.pceil', 'philips.light.pceilb', 'philips.light.sceilm', @@ -589,6 +597,7 @@ 'skyrc.feeder.vdfeed', 'skyrc.pet_waterer.fres2', 'solove.fan.f5new', + 'suittc.airrtc.m301', 'suittc.airrtc.wk168', 'syi.airer.sy1', 'szdy.airfresh.n80', @@ -738,6 +747,7 @@ 'xiaomi.aircondition.m4', 'xiaomi.aircondition.m6', 'xiaomi.aircondition.m9', + 'xiaomi.aircondition.ma4', 'xiaomi.aircondition.mc1', 'xiaomi.aircondition.mc2', 'xiaomi.aircondition.mc4', @@ -763,6 +773,7 @@ 'xiaomi.airer.1sfun', 'xiaomi.airp.cpa4', 'xiaomi.airp.mp4', + 'xiaomi.airp.mp5', 'xiaomi.airp.va2b', 'xiaomi.airp.va3', 'xiaomi.airp.va4', @@ -772,22 +783,28 @@ 'xiaomi.cooker.cmk7', 'xiaomi.curtain.acn009', 'xiaomi.derh.13l', + 'xiaomi.dishwasher.s2', 'xiaomi.dishwasher.v02', 'xiaomi.fan.p43', 'xiaomi.fan.p51', + 'xiaomi.feeder.iv2001', 'xiaomi.feeder.pi2001', 'xiaomi.fryer.maf07d', 'xiaomi.fryer.maf14', + 'xiaomi.health_pot.p1', 'xiaomi.heater.ma7', 'xiaomi.heater.ma8', 'xiaomi.hood.jyjss2', + 'xiaomi.hood.ymv5', 'xiaomi.humidifier.airmx', 'xiaomi.humidifier.p1200', 'xiaomi.humidifier.p3', 'xiaomi.kettle.mek01', + 'xiaomi.light.ceil04', 'xiaomi.light.cfan', 'xiaomi.light.lamp30', 'xiaomi.light.lamp31', + 'xiaomi.light.lamp32', 'xiaomi.sensor_occupy.p1', 'xiaomi.tv.4kh1', 'xiaomi.tv.8kh1', @@ -825,6 +842,7 @@ 'xiaomi.vacuum.d102ev', 'xiaomi.vacuum.d103cn', 'xiaomi.vacuum.d106gl', + 'xiaomi.waterheater.ym02', 'xiaomi.waterheater.ym05', 'xiaomi.waterheater.yms2', 'xiaomi.waterpuri.400f4', @@ -848,6 +866,7 @@ 'yeelink.bhf_light.v8', 'yeelink.controller.v2', 'yeelink.curtain.ctmt1', + 'yeelink.light.bslamp1', 'yeelink.light.bslamp2', 'yeelink.light.ceil26', # 'yeelink.light.ceil27', # miio2miot @@ -880,7 +899,7 @@ 'yeelink.light.lamp22', 'yeelink.light.lamp27', 'yeelink.light.lamp28', - # 'yeelink.light.mbulb3', #mesh + # 'yeelink.light.mbulb3', # mesh 'yeelink.light.mono6', 'yeelink.light.mono7', 'yeelink.light.mono8', @@ -895,6 +914,7 @@ 'yeelink.ven_fan.vf3', 'yeelink.ven_fan.vf5', 'yh1209.airer.public', + 'yifang.mosq.yx01', 'ykcn.switch.cbcsmj', 'youpon.bhf_light.yb0a01', 'yszh.wopener.bs817', diff --git a/custom_components/xiaomi_miot/core/miot_specs_extend.json b/custom_components/xiaomi_miot/core/miot_specs_extend.json index f80ea46a9..b16e46ad0 100644 --- a/custom_components/xiaomi_miot/core/miot_specs_extend.json +++ b/custom_components/xiaomi_miot/core/miot_specs_extend.json @@ -367,6 +367,28 @@ } ], + "hfjh.fishbowl.m100": [ + { + "iid": 15, + "properties": [ + { + "iid": 2, + "value-list": [ + {"value": 0, "description": "Day"}, + {"value": 1, "description": "Flow"}, + {"value": 2, "description": "Water Grass"}, + {"value": 3, "description": "Color 1"}, + {"value": 4, "description": "Color 2"}, + {"value": 5, "description": "Color 3"}, + {"value": 6, "description": "Color 4"}, + {"value": 7, "description": "Night Light"}, + {"value": 8, "description": "Color 5"} + ] + } + ] + } + ], + "lumi.airer.acn01": [ { "iid": 2, diff --git a/custom_components/xiaomi_miot/core/xiaomi_cloud.py b/custom_components/xiaomi_miot/core/xiaomi_cloud.py index 01e418773..5c01de7a9 100644 --- a/custom_components/xiaomi_miot/core/xiaomi_cloud.py +++ b/custom_components/xiaomi_miot/core/xiaomi_cloud.py @@ -167,7 +167,8 @@ async def async_check_auth(self, notify=False): rdt = await self.async_request_api(api, dat, method='POST') or {} nid = f'xiaomi-miot-auth-warning-{self.user_id}' eno = rdt.get('code', 0) - if eno != 3: + msg = rdt.get('message', '') + if not (eno == 3 or msg == 'auth err'): return True except requests.exceptions.ConnectionError: return None diff --git a/custom_components/xiaomi_miot/manifest.json b/custom_components/xiaomi_miot/manifest.json index 0da26f631..66aa3111f 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.21" + "version": "0.7.22" }