Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Nov 4, 2024
2 parents e30e53c + 4abc346 commit f446cc5
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 5 deletions.
4 changes: 3 additions & 1 deletion custom_components/xiaomi_miot/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
41 changes: 41 additions & 0 deletions custom_components/xiaomi_miot/core/device_customizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -121,6 +123,9 @@
'babai.curtain.bb82mj': {
'chunk_properties': 1,
},
'babai.curtain.lsxf83': {
'chunk_properties': 1,
},
'babai.curtain.m515e': {
'chunk_properties': 1,
},
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
14 changes: 14 additions & 0 deletions custom_components/xiaomi_miot/core/miio2miot_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
24 changes: 22 additions & 2 deletions custom_components/xiaomi_miot/core/miot_local_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
22 changes: 22 additions & 0 deletions custom_components/xiaomi_miot/core/miot_specs_extend.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion custom_components/xiaomi_miot/core/xiaomi_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_miot/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"python-miio>=0.5.12",
"micloud>=0.5"
],
"version": "0.7.21"
"version": "0.7.22"
}

0 comments on commit f446cc5

Please # to comment.