How to use set_template method in pyresttest

Best Python code snippet using pyresttest_python

miio2miot_specs.py

Source:miio2miot_specs.py Github

copy

Full Screen

1import logging2_LOGGER = logging.getLogger(__name__)3def set_callback_via_param_index(index=0):4 def cbk(prop, params, props, **kwargs):5 if prop in props and len(params) > index:6 props[prop] = params[index]7 _LOGGER.debug('New miio props after setting %s(%s): %s', prop, params, props)8 return cbk9MIIO_TO_MIOT_SPECS = {10 '090615.switch.xswitch01': {11 'without_props': True,12 'ignore_result': True,13 'miio_commands': [14 {15 'method': 'get_prop',16 'params': [0],17 'values': ['power1', 'led'],18 },19 {'method': 'get_prop', 'params': ['switchname1'], 'values': ['name1']},20 ],21 'miio_specs': {22 'prop.2.1': {'prop': 'power1', 'setter': 'SetSwitch1', 'set_template': '{{ [value|int(0)] }}'},23 'prop.2.2': {'prop': 'name1', 'setter': 'SetSwtichname1'},24 },25 },26 '090615.switch.xswitch02': {27 'extend_model': '090615.switch.xswitch01',28 'miio_commands': [29 {30 'method': 'get_prop',31 'params': [0, 0],32 'values': ['power1', 'power2', 'led'],33 },34 {'method': 'get_prop', 'params': ['switchname1'], 'values': ['name1']},35 {'method': 'get_prop', 'params': ['switchname2'], 'values': ['name2']},36 ],37 'miio_specs': {38 'prop.3.1': {'prop': 'power2', 'setter': 'SetSwitch2', 'set_template': '{{ [value|int(0)] }}'},39 'prop.3.2': {'prop': 'name2', 'setter': 'SetSwtichname2'},40 },41 },42 '090615.switch.xswitch03': {43 'extend_model': '090615.switch.xswitch02',44 'miio_commands': [45 {46 'method': 'get_prop',47 'params': [0, 0, 0],48 'values': ['power1', 'power2', 'power3', 'led'],49 },50 {'method': 'get_prop', 'params': ['switchname1'], 'values': ['name1']},51 {'method': 'get_prop', 'params': ['switchname2'], 'values': ['name2']},52 {'method': 'get_prop', 'params': ['switchname3'], 'values': ['name3']},53 ],54 'miio_specs': {55 'prop.4.1': {'prop': 'power3', 'setter': 'SetSwitch3', 'set_template': '{{ [value|int(0)] }}'},56 'prop.4.2': {'prop': 'name3', 'setter': 'SetSwtichname3'},57 },58 },59 'chuangmi.plug.hmi205': {60 'miio_specs': {61 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},62 'prop.2.2': {'prop': 'temperature'},63 },64 },65 'chuangmi.plug.hmi206': 'chuangmi.plug.hmi205',66 'chuangmi.plug.hmi208': {67 'miio_specs': {68 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},69 'prop.3.1': {70 'prop': 'usb_on',71 'setter': True,72 'set_template': '{{ {"method": "set_usb_on" if value else "set_usb_off"} }}',73 },74 'prop.2.2': {'prop': 'temperature'},75 },76 },77 'chuangmi.plug.m1': {78 'extend_model': 'chuangmi.plug.hmi205',79 'miio_specs': {80 'prop.3.1': {'prop': 'wifi_led', 'setter': True, 'format': 'onoff'},81 },82 },83 'chuangmi.plug.m3': 'chuangmi.plug.m1',84 'chuangmi.plug.v1': {85 'miio_specs': {86 'prop.2.1': {87 'prop': 'on',88 'setter': True,89 'set_template': '{{ {"method": "set_on" if value else "set_off"} }}',90 },91 'prop.3.1': {'prop': 'wifi_led', 'setter': True, 'format': 'onoff'},92 },93 },94 'chuangmi.plug.v3': {95 'miio_specs': {96 # must ['on', 'usb_on', 'temperature', 'wifi_led']97 'prop.2.1': {'prop': 'on', 'setter': 'set_power', 'format': 'onoff'},98 'prop.3.1': {99 'prop': 'usb_on',100 'setter': True,101 'set_template': '{{ {"method": "set_usb_on" if value else "set_usb_off"} }}',102 },103 'prop.2.2': {'prop': 'temperature'},104 'prop.4.1': {'prop': 'wifi_led', 'setter': True, 'format': 'onoff'},105 },106 },107 'chunmi.cooker.eh1': {108 # ['status','phase','menu','t_cook','t_left','t_pre','t_kw','taste','temp','rice','favs','akw',109 # 't_start','t_finish','version','setting','code','en_warm','t_congee','t_love','boil']110 # [1 ,0 ,"0001",60 ,3600 ,0 ,0 ,1 ,15 ,0 ,"0009",1 ,111 # 0 ,0 ,13 ,0 ,0 ,15 ,120 ,60 ,0 ]112 'chunk_properties': 1,113 'miio_specs': {114 'prop.2.1': {'prop': 'status', 'template': '{{ 9 if value == "finish" else value }}'},115 'prop.2.2': {'prop': 'temp'},116 'prop.2.3': {'prop': 'akw'},117 'prop.2.101': {'prop': 'menu'},118 'prop.2.102': {'prop': 't_left'},119 'action.2.1': {'setter': 'cancel_cooking'},120 },121 },122 'chunmi.ihcooker.chefnic': {123 'without_props': True,124 'miio_commands': [125 {126 'method': 'get_prop',127 'params': ['all'],128 'values': [129 'func', 'menu', 'action', 'tFunc', 'version', 'custom', 'setStatus', 'play',130 # ['pause', '0100', '0e0b00', '01000', '00050a04', '002497', '01' , '0e00']131 ],132 },133 ],134 'miio_specs': {135 'prop.2.1': {'prop': 'func', 'dict': {136 'running': 1,137 'timing': 2,138 'pause': 3,139 'pause_time': 3,140 'shutdown': 4,141 'waiting': 5,142 'finish': 5,143 }, 'default': 4},144 'prop.2.3': {'prop': 'action', 'template': '{{ (value|string)[4:6]|int(0,16) }}'},145 'prop.2.2': {146 'prop': 'tFunc', # left-time147 'template': '{{ (value|string)[8:10]|int(0,16) * 60 + (value|string)[10:12]|int(0,16) }}',148 },149 'prop.2.4': {150 'prop': 'tFunc', # working-time151 'template': '{{ (value|string)[4:6]|int(0,16) * 60 + (value|string)[6:8]|int(0,16) }}',152 },153 },154 },155 'chunmi.microwave.n23l01': {156 'without_props': True,157 'miio_commands': [158 {159 'method': 'get_prop',160 'params': ['all'],161 'values': [162 'status', 'phase', 'menuid', 'tCook', 'tLeft', 'tPre', 'tPause', 'fire', 'cookPhase',163 'pauseTimeout', 'eCode', 'version', 'customDetails', 'v13', 'orderTime', 'cookCount', 'number',164 # [12 , 0 , "000002", 0 , 0 , 0 , 0 , 6 , 0,165 # "00" , "00" , "0009" , "0000000000000", 0 , 0 , 0 , 0]166 ],167 },168 ],169 'miio_specs': {170 'prop.2.1': {'prop': 'status'},171 'prop.2.2': {'prop': 'tLeft'},172 'action.2.1': {'setter': 'pause_cooking', 'set_template': '{{ ["050201"] }}'},173 },174 },175 'deerma.humidifier._base': {176 'chunk_properties': 1,177 'miio_specs': {178 'prop.2.1': {'prop': 'OnOff_State', 'setter': 'Set_OnOff', 'set_template': '{{ [value|int] }}'},179 'prop.3.1': {'prop': 'Humidity_Value'},180 'prop.3.2': {'prop': 'TemperatureValue'},181 'prop.4.1': {'prop': 'TipSound_State', 'setter': 'SetTipSound_Status', 'set_template': '{{ [value|int] }}'},182 'prop.5.1': {'prop': 'Led_State', 'setter': 'SetLedState', 'set_template': '{{ [value|int] }}'},183 'prop.2.101': {'prop': 'HumiSet_Value', 'setter': 'Set_HumiValue'},184 'prop.2.102': {'prop': 'waterstatus'},185 'prop.2.103': {'prop': 'watertankstatus'},186 },187 },188 'deerma.humidifier.jsq': {189 'extend_model': 'deerma.humidifier._base',190 'miio_specs': {191 'prop.4.1': {'prop': 'Led_State', 'setter': 'SetLedState', 'set_template': '{{ [value|int] }}'},192 'prop.5.1': {'prop': 'TipSound_State', 'setter': 'SetTipSound_Status', 'set_template': '{{ [value|int] }}'},193 'prop.2.104': {'prop': 'Humidifier_Gear', 'setter': 'Set_HumidifierGears'},194 },195 },196 'deerma.humidifier.jsq1': {197 'extend_model': 'deerma.humidifier._base',198 'miio_specs': {199 'prop.2.2': {'prop': 'Humidifier_Gear', 'setter': 'Set_HumidifierGears'},200 },201 },202 'deerma.humidifier.mjjsq': {203 'extend_model': 'deerma.humidifier.jsq1',204 'miio_specs': {205 'prop.3.3': {'prop': 'HumiSet_Value', 'setter': 'Set_HumiValue'},206 },207 },208 'fawad.airrtc.fwd20011': {209 # ["real_fan_speed","fan_mode","Wind_Out","hot_switch_status","power_status","work_mode","fan_speed",210 # "temperature_current","temperature_set","timers_info","timers_enable","low_temp_protect_enable",211 # "screen_lock_enable","heat_type"]212 # [3 ,1 ,0 ,0 ,0 ,3 ,0 ,213 # 12.61004447937011 ,30 ,[[0,0,0,0,0]],false ,false ,214 # false ,2]215 'chunk_properties': 1,216 'miio_specs': {217 'prop.2.1': {'prop': 'power_status', 'setter': True, 'set_template': '{{ [value|int] }}'},218 'prop.2.2': {'prop': 'work_mode', 'setter': True, 'dict': {219 1: 2,220 2: 1,221 3: 3,222 }, 'default': 1},223 'prop.2.3': {'prop': 'temperature_set', 'setter': True, 'set_template': '{{ [value|int] }}'},224 'prop.3.1': {'prop': 'fan_speed', 'setter': True, 'dict': {225 0: 3,226 1: 2,227 2: 1,228 3: 0,229 }, 'default': 0},230 'prop.4.1': {'prop': 'temperature_current'},231 },232 },233 'hfjh.fishbowl.v1': {234 # ["Equipment_Status","feed_num","feed_switch","feed_time","feed_time_week","heater_switch",235 # "led_board_brightness","led_board_color","led_board_model","led_board_speed","led_board_stream",236 # "led_board_sun","pump_switch","pump_value","water_tds","water_temp","water_temp_value"]237 # [true,17,false,"00:00","",false,0,16753920,1,24,0,16771985,true,36,243,25,26]238 'miio_specs': {239 'prop.2.1': {'prop': 'Equipment_Status'},240 'prop.2.4': {'prop': 'feed_num'},241 'prop.2.3': {'prop': 'feed_switch'},242 'prop.9.1': {'prop': 'feed_time'},243 'prop.9.2': {'prop': 'feed_time_week'},244 'prop.2.6': {'prop': 'heater_switch'},245 'prop.3.1': {'prop': 'led_board_brightness'},246 'prop.3.2': {'prop': 'led_board_color'},247 'prop.3.3': {'prop': 'led_board_model'},248 'prop.3.4': {'prop': 'led_board_speed'},249 'prop.3.5': {'prop': 'led_board_stream'},250 'prop.3.6': {'prop': 'led_board_sun'},251 'prop.2.2': {'prop': 'pump_switch'},252 'prop.2.5': {'prop': 'pump_value'},253 'prop.4.1': {'prop': 'water_tds'},254 'prop.2.7': {'prop': 'water_temp'},255 'prop.2.8': {'prop': 'water_temp_value'},256 },257 },258 'isa.camera.hlc6': {259 # ["light","motion_record","flip","watermark","sdcard_status","power","night_mode","rect","max_client"]260 # ["on" ,"on" ,"off" ,"on" ,0 ,"on" ,"0" ,"on" ,0]261 'miio_specs': {262 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'}, # restart_device []263 'prop.2.2': {'prop': 'flip', 'template': "{{ 0 if value in ['off'] else 180 }}"},264 'prop.2.3': {'prop': 'night_mode'},265 'prop.2.4': {'prop': 'watermark', 'format': 'onoff'},266 'prop.2.5': {'prop': 'motion_record', 'dict': {267 'stop': 1,268 'off': 2,269 'on': 3,270 }, 'default': 1},271 },272 },273 'ksmb.walkingpad.v1': {274 # https://github.com/al-one/hass-xiaomi-miot/issues/261#issuecomment-1001213758275 # ['mode:2', 'time:0', 'sp:0.0', 'dist:0', 'cal:0', 'step:0']276 'without_props': True,277 'miio_commands': [278 {279 'method': 'get_prop',280 'params': ['all'],281 'values': ['mode', 'time', 'speed', 'dist', 'calorie', 'step'],282 },283 {284 'method': 'get_prop',285 'params': ['auto'],286 'values': ['auto'],287 'delay': 2,288 },289 {290 'method': 'get_prop',291 'params': ['state'],292 'values': ['state'],293 'delay': 2,294 },295 ],296 'miio_specs': {297 'prop.2.1': {298 'prop': 'mode', # switch299 'setter': True,300 'template': '{{ (value|string).split(":")[1]|default(2)|int != 2 }}',301 'set_template': '{{ [1 if value else 2] }}',302 },303 'prop.2.2': {'prop': 'auto', 'setter': True, 'template': '{{ value|int(0) }}'},304 'prop.2.3': {'prop': 'state', 'template': '{{ 1 if value == "run" else 0 }}'},305 'prop.2.4': {306 'prop': 'speed',307 'setter': True,308 'template': '{{ (value|string).split(":")[1]|default(0)|round(1) }}',309 'set_template': '{{ [value|round(1)|string] }}',310 },311 'prop.2.5': {'prop': 'dist', 'template': '{{ (value|string).split(":")[1]|default(0)|int }}'},312 'prop.2.6': {'prop': 'time', 'template': '{{ (value|string).split(":")[1]|default(0)|int }}'},313 'prop.2.7': {'prop': 'step', 'template': '{{ (value|string).split(":")[1]|default(0)|int }}'},314 'prop.2.8': {'prop': 'calorie', 'template': '{{ (value|string).split(":")[1]|default(0)|int }}'},315 },316 },317 'lumi.acpartner.mcn02': {318 # ['power', 'mode', 'tar_temp', 'fan_level', 'ver_swing', 'load_power']319 # ['on', 'dry', 16, 'small_fan', 'off', 84.0]320 'miio_specs': {321 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},322 'prop.2.2': {'prop': 'mode', 'setter': True, 'dict': {323 'auto': 0,324 'cool': 1,325 'dry': 2,326 'heat': 3,327 'wind': 4,328 }, 'default': 0},329 'prop.2.3': {'prop': 'tar_temp', 'setter': True},330 'prop.3.1': {'prop': 'fan_level', 'setter': True, 'dict': {331 'auto_fan': 0,332 'small_fan': 1,333 'medium_fan': 2,334 'large_fan': 3,335 }, 'default': 0},336 'prop.3.2': {'prop': 'ver_swing', 'setter': True, 'format': 'onoff'},337 },338 },339 'lumi.acpartner.v1': {340 'without_props': True,341 'miio_commands': [342 {343 'method': 'get_model_and_state',344 'template': 'lumi_acpartner_miio_status',345 },346 ],347 'miio_specs': {348 'prop.2.1': {'prop': 'power'},349 'prop.2.2': {'prop': 'mode'},350 'prop.2.3': {'prop': 'target_temperature'},351 'prop.3.1': {'prop': 'fan_level'},352 'prop.3.2': {'prop': 'vertical_swing'},353 },354 },355 'lumi.acpartner.v2': 'lumi.acpartner.v1',356 'lumi.acpartner.v3': 'lumi.acpartner.v1',357 'lumi.airer.acn01': {358 # ["lumi.0","light","airer_state","en_night_tip_light","level",359 # "limit_configured","limit_locked","run_time","dry_remaining_time","dry_status"]360 # [ "off" ,"stop" ,1 ,0 ,361 # 1 ,0 ,27 ,0 ,"off"]362 'without_props': True,363 'miio_commands': [364 {365 'method': 'get_device_prop',366 'params': [367 'lumi.0', 'light', 'airer_state', 'en_night_tip_light', 'level', 'limit_configured',368 'limit_locked', 'run_time', 'dry_remaining_time', 'dry_status',369 ],370 'values': [371 'light', 'airer_state', 'en_night_tip_light', 'level', 'limit_configured',372 'limit_locked', 'run_time', 'dry_remaining_time', 'dry_status',373 ],374 },375 ],376 'miio_specs': {377 'prop.2.1': {'prop': 'motor', 'setter': 'toggle_device', 'dict': {378 'up': 0,379 'down': 1,380 'stop': 2,381 }},382 'prop.2.2': {'prop': 'level', 'setter': True},383 'prop.2.3': {'prop': 'airer_state', 'dict': {384 'down': 1,385 'up': 2,386 'stop': 3,387 }, 'default': 3},388 'prop.2.4': {389 'prop': 'dry_status',390 'format': 'onoff',391 'setter': 'control_device',392 'set_template': '{{ ["start_hotdry",90] if value else ["stop_hotdry",0] }}',393 },394 'prop.2.101': {395 'prop': 'dry_status',396 'dict': {397 'off': 0,398 'hotdry': 1,399 'winddry': 2,400 },401 'setter': 'control_device',402 'set_template': '{{ '403 '["start_hotdry",90] if value == 1 else '404 '["start_winddry",90] if value == 2 else '405 '["stop_hotdry",0] if "hotdry" in props.dry_status else '406 '["stop_winddry",0] }}',407 },408 'prop.2.5': {'prop': 'dry_remaining_time'},409 'prop.3.1': {'prop': 'light', 'setter': 'toggle_light', 'format': 'onoff'},410 },411 },412 'mijia.camera.v3': {413 'miio_specs': {414 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},415 'prop.2.2': {'prop': 'flip', 'template': "{{ 0 if value in ['off'] else 180 }}"},416 'prop.2.3': {'prop': 'night_mode'},417 'prop.2.5': {'prop': 'band_nearby'},418 'prop.2.7': {'prop': 'watermark', 'format': 'onoff'},419 'prop.2.8': {'prop': 'motion_record', 'dict': {420 'off': 1,421 'on': 2,422 }, 'default': 1},423 },424 },425 'minij.washer.v5': {426 # ["state","process","cycle","time_remain","child_lock","lock","dry_set","dirty_type"]427 # ["off","option:load,prewash,wash,rinse,spin;processing:invalid","dailywash","0069","off","unlock","none","none"]428 'miio_specs': {429 'prop.2.1': {430 'prop': 'state',431 'format': 'onoff',432 'setter': 'set_power',433 'template': '{{ value != "off" }}',434 },435 'prop.2.2': {'prop': 'state', 'setter': True, 'dict': {436 'off': 1,437 'standby': 2,438 'run': 3,439 'delay': 4,440 'pause': 5,441 'fault': 6,442 'eoc': 7,443 }},444 'prop.2.3': {'prop': 'cycle', 'setter': True, 'dict': {445 'dailywash': 1, # mode446 'quick': 2,447 'delicate': 3,448 'down': 4,449 'heavy': 5,450 'userdefine': 6,451 'rinse': 7,452 'spin': 8,453 'cotton': 9,454 'synthetic': 10,455 'shirt': 11,456 'boiling': 12,457 'wool': 13,458 'drumclean': 14,459 'babycare': 15,460 'intensive': 16,461 'jacket': 17,462 'washdry': 18,463 'underwear': 19,464 'dry': 20,465 'dryairwash': 21,466 'washdryquick': 22,467 }, 'default': 1},468 'prop.2.4': {'prop': 'time_remain', 'setter': True},469 'prop.2.5': {470 'prop': 'speed',471 'setter': True,472 'template': '{{ value | regex_replace("rpm","") | int }}',473 'set_template': '{{ [value ~ "rpm"] }}',474 },475 'prop.2.6': {476 'prop': 'temp',477 'setter': True,478 'template': '{{ value | int(0) }}',479 'set_template': '{{ [value | string if value else "cool"] }}',480 },481 'prop.2.7': {'prop': 'water_level', 'setter': True, 'dict': {482 'high': 1,483 'middle': 2,484 'low': 3,485 }, 'default': 3},486 'prop.2.8': {487 'prop': 'rinse_time',488 'setter': True,489 'template': '{{ value | int(0) }}',490 'set_template': '{{ [value | string] }}',491 },492 'prop.2.9': {'prop': 'dry_set', 'setter': True, 'dict': {493 'moist': 1,494 'normal': 2,495 'extra': 3,496 'none': 4,497 }, 'default': 4},498 'prop.3.1': {'prop': 'child_lock', 'setter': True},499 'prop.4.1': {'prop': 'volume', 'setter': True},500 },501 },502 'minij.washer.v14': {503 'extend_model': 'minij.washer.v5',504 'chunk_properties': 1,505 },506 'opple.light.fanlight': {507 # ["LightPower","Brightness","ColorTemperature","Scenes","FanPower","Speed",508 # "SmartBtn","SmartVal","Gear","Temperature","Circular","CountdownTime","CountdownAct"]509 # [true ,100 ,3000 ,"GUEST" ,false ,42 ,510 # false ,26 ,"NONE",15 ,false ,0 ,false]511 'miio_specs': {512 'prop.2.1': {'prop': 'LightPower', 'setter': 'SetLightPower'},513 'prop.2.2': {'prop': 'Scenes', 'setter': 'SetScenes', 'dict': {514 'GUEST': 1,515 'TV': 2,516 'PLAY': 3,517 'NIGHT': 4,518 }, 'default': 1},519 'prop.2.3': {'prop': 'Brightness', 'setter': 'SetBrightness'},520 'prop.2.4': {'prop': 'ColorTemperature', 'setter': 'SetColorTemperature'},521 'prop.3.1': {'prop': 'FanPower', 'setter': 'SetFanPower'},522 'prop.3.2': {'prop': 'Speed', 'setter': 'SetSpeed'},523 'prop.3.3': {'prop': 'Gear', 'setter': 'SetGear', 'dict': {524 'NONE': 1,525 'LOW': 2,526 'MID': 3,527 'HIGH': 4,528 }, 'default': 1},529 },530 },531 'philips.light.bulb': {532 'miio_specs': {533 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},534 'prop.2.2': {'prop': 'bright', 'setter': True},535 'prop.2.3': {'prop': 'snm', 'setter': 'apply_fixed_scene', 'dict': {536 1: 1,537 2: 3,538 3: 4,539 4: 2,540 }, 'default': 1},541 'prop.2.4': {542 'prop': 'cct',543 'setter': True,544 'template': '{{ ((max - min) * value / 100 + min) | round }}',545 'set_template': '{% set num = ((value - min) / (max - min) * 100) | round %}'546 '{{ [num if num > 0 else 1] }}',547 },548 },549 },550 'philips.light.cbulb': {551 'extend_model': 'philips.light.bulb',552 'miio_specs': {553 'prop.2.3': {'prop': 'cid', 'setter': True},554 'prop.2.5': {'prop': 'snm', 'setter': 'apply_fixed_scene'},555 'prop.2.6': {'prop': 'cid', 'template': '{{ 2 if val == 360 else 1 }}'},556 },557 },558 'philips.light.downlight': {559 'miio_specs': {560 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},561 'prop.2.2': {'prop': 'bright', 'setter': True},562 'prop.2.3': {563 'prop': 'cct',564 'setter': True,565 'template': '{{ ((max - min) * value / 100 + min) | round }}',566 'set_template': '{% set num = ((value - min) / (max - min) * 100) | round %}'567 '{{ [num if num > 0 else 1] }}',568 },569 'prop.2.4': {'prop': 'snm', 'setter': 'apply_fixed_scene'},570 },571 },572 'philips.light.moonlight': {573 'extend_model': 'philips.light.bulb',574 'miio_specs': {575 'prop.2.1': {'prop': 'pow', 'setter': 'set_power', 'format': 'onoff'},576 'prop.2.2': {'prop': 'bri', 'setter': 'set_bright'},577 'prop.2.3': {'prop': 'rgb', 'setter': True, 'format': 'rgb'},578 'prop.2.5': {579 'prop': 'snm',580 'setter': True,581 'template': '{{ 1 if value == 6 else 0 }}',582 'set_template': '{{ {"method": "go_night"} '583 'if value == 1 else '584 '{"method": "apply_fixed_scene","params": [5]} }}',585 },586 'prop.2.6': {'prop': 'sta', 'template': '{{ 2 if value == 0 else 1 }}'},587 },588 },589 'rockrobo.vacuum.v1': {590 'extend_model': 'roborock.vacuum.t6',591 'miio_specs': {592 'prop.3.2': {'prop': 'charging', 'template': '{{ 1 if props.state in [8] else 2 }}'},593 },594 },595 'roborock.vacuum.t6': {596 'without_props': True,597 'miio_commands': [598 {599 'method': 'get_status',600 'template': '{{ results.0 | default({}) }}',601 },602 {603 'method': 'get_consumable',604 'template': '{{ results.0 | default({}) }}',605 },606 ],607 'miio_specs': {608 'prop.2.1': {'prop': 'state', 'dict': {609 1: 2, # Starting610 2: 7, # Charger disconnected611 3: 1, # Idle612 4: 6, # Remote control active613 5: 2, # Cleaning614 6: 5, # Returning home615 7: 6, # Manual mode616 8: 3, # Charging617 9: 7, # Charging problem618 10: 4, # Paused619 11: 2, # Spot cleaning620 12: 7, # Error621 13: 7, # Shutting down622 15: 1, # Docking623 16: 6, # Going to target624 17: 2, # Zoned cleaning625 18: 2, # Segment cleaning626 }, 'default': 1},627 'prop.2.2': {'prop': 'fan_power'},628 'prop.3.1': {'prop': 'battery'},629 },630 },631 'shuii.humidifier.jsq002': {632 'without_props': True,633 'miio_commands': [634 {635 'method': 'get_props',636 'values': [637 'power', 'gear', 'humidity', 'ledLevel', 'temperature', 'waterLevel',638 'heat', 'beaPower', 'childLock', 'targetTemp', 'targetHumidity',639 ],640 },641 ],642 'miio_specs': {643 'prop.2.1': {644 'prop': 'power',645 'setter': 'on_off',646 'template': '{{ value == 1 and props.waterLevel not in [0,6] }}',647 'set_template': '{{ [value|int] }}',648 },649 'prop.2.2': {'prop': 'gear', 'setter': True},650 'prop.2.3': {'prop': 'heat', 'setter': 'warm_on', 'set_template': '{{ [value|int] }}'},651 'prop.2.4': {'prop': 'targetHumidity', 'setter': 'set_humidity'},652 'prop.2.5': {'prop': 'waterLevel'},653 'prop.2.6': {'prop': 'targetTemp', 'setter': 'set_temp'},654 'prop.3.1': {'prop': 'humidity'},655 'prop.3.2': {'prop': 'temperature'},656 'prop.4.1': {'prop': 'ledLevel', 'setter': 'set_led'},657 'prop.5.1': {'prop': 'beaPower', 'setter': 'buzzer_on', 'set_template': '{{ [value|int] }}'},658 'prop.6.1': {'prop': 'childLock', 'setter': 'set_lock', 'set_template': '{{ [value|int] }}'},659 },660 },661 'skyrc.pet_waterer.fre1': {662 'without_props': True,663 'miio_commands': [664 {665 'method': 'get_prop',666 'values': ['bright_value', 'filter', 'on', 'pump', 'var5', 'water_type', 'power'],667 },668 ],669 'miio_specs': {670 'prop.2.1': {'prop': 'power', 'setter': True, 'set_template': "{{ [1 if value else 0] }}"},671 'prop.3.1': {'prop': 'bright_value', 'setter': True, 'set_template': "{{ [1 if value else 0] }}"},672 'prop.4.1': {'prop': 'filter'}, # set_filter_alarm [0]673 },674 },675 'tinymu.toiletlid.v1': {676 'without_props': True,677 'miio_commands': [678 {679 'method': 'get_prop',680 'params': ['work_state', 'filter_use_time', 'filter_use_flux'],681 'values': ['work_state', 'filter_use_time', 'filter_use_flux'],682 },683 {684 'method': 'get_aled_v_of_uid',685 'params': [''],686 'values': ['ambient_light'],687 },688 ],689 'miio_specs': {690 'prop.2.1': {'prop': 'filter_use_time'},691 'prop.2.2': {'prop': 'filter_use_flux'},692 'prop.3.1': {'prop': None, 'setter': 'seat_heat', 'format': 'onoff'},693 'prop.3.2': {'prop': None, 'setter': 'deodorant', 'format': 'onoff'},694 'prop.3.101': {'prop': 'work_state', 'template': '{{ (value|int(1) - 1) // 16 }}'},695 'prop.3.102': {'prop': 'work_state', 'template': '{{ value|int(0) not in [1,97] }}'},696 'prop.3.103': {697 'prop': 'ambient_light',698 'setter': 'set_aled_v_of_uid',699 'template': '{{ value | int }}',700 'set_template': '{{ ["", value | string] }}',701 },702 },703 },704 'viomi.fridge.p1': {705 # ["Mode","RCSetTemp","FCSetTemp","RCSet","Error","IndoorTemp","SmartCool","SmartFreeze"]706 # ["none",8 ,-15 ,"on" ,0 ,10 ,"off" ,"off"]707 'chunk_properties': 1,708 'miio_specs': {709 'prop.2.1': {'prop': 'Mode', 'setter': 'setMode', 'dict': {710 'holiday': 1,711 'none': 2,712 }, 'default': 2},713 'prop.3.1': {'prop': 'RCSetTemp'},714 'prop.3.2': {'prop': 'RCSetTemp', 'setter': 'setRCSetTemp'},715 'prop.4.1': {'prop': 'FCSetTemp'},716 'prop.4.2': {'prop': 'FCSetTemp', 'setter': 'setFCSetTemp'},717 'prop.3.3': {'prop': 'RCSet', 'setter': 'setRCSet', 'format': 'onoff'},718 },719 },720 'viomi.vacuum.v7': {721 'miio_props': [722 'run_state', 'mode', 'err_state', 'battary_life', 'box_type', 'mop_type', 's_time', 's_area',723 'suction_grade', 'water_grade', 'remember_map', 'has_map', 'is_mop', 'has_newmap',724 ],725 'miio_specs': {726 'prop.2.1': {'prop': 'suction_grade', 'dict': {727 0: 0, # Silent728 1: 1, # Standard729 2: 1, # Medium730 3: 2, # Turbo731 }, 'default': 1},732 'prop.2.2': {'prop': 'run_state', 'dict': {733 0: 1, # IdleNotDocked734 1: 1, # Idle735 2: 3, # Idle2736 3: 4, # Cleaning737 4: 5, # Returning738 5: 6, # Docked739 6: 8, # VacuumingAndMopping740 7: 7, # Mopping741 }, 'default': 1},742 'prop.3.1': {'prop': 'battary_life'},743 'action.2.1': {'setter': 'set_mode_withroom', 'set_template': '{{ [0,1,0] }}'}, # start-sweep744 'action.2.2': {'setter': 'set_mode', 'set_template': '{{ [0] }}'}, # stop-sweeping745 'action.2.3': {'setter': 'set_mode_withroom', 'set_template': '{{ [1,1,0] }}'}, # start-sweep-mop746 'action.2.4': {'setter': 'set_mode_withroom', 'set_template': '{{ [3,1,0] }}'}, # start-mop747 'action.2.5': {'setter': 'set_mode_withroom', 'set_template': '{{ [0,3,0] }}'}, # pause-sweeping748 'action.3.1': {'setter': 'set_charge', 'set_template': '{{ [1] }}'}, # start-charge749 'prop.200.201': {'prop': 'main_brush_life'},750 'prop.200.202': {'prop': 'side_brush_life'},751 'prop.200.203': {'prop': 'hypa_life'},752 'prop.200.204': {'prop': 'mop_life'},753 },754 },755 'viomi.vacuum.v8': {756 'extend_model': 'viomi.vacuum.v7',757 'without_props': True,758 'miio_commands': [759 {760 'method': 'get_prop',761 'params': [762 'sw_info', 'run_state', 'mode', 'err_state', 'battary_life', 'box_type', 'mop_type', 's_time',763 's_area', 'suction_grade', 'water_grade', 'remember_map', 'has_map', 'is_mop', 'has_newmap',764 ],765 'values': True,766 },767 {768 'method': 'get_consumables',769 'template': '{%- set c0 = results[0] | default(0) | int(0) %}'770 '{%- set c1 = results[1] | default(0) | int(0) %}'771 '{%- set c2 = results[2] | default(0) | int(0) %}'772 '{%- set c3 = results[3] | default(0) | int(0) %}'773 '{{ {'774 '"main_brush_hours": c0,'775 '"side_brush_hours": c1,'776 '"hypa_hours": c2,'777 '"mop_hours": c3,'778 '"main_brush_life": [100 - c0 / 360 * 100, 0] | max | round,'779 '"side_brush_life": [100 - c1 / 180 * 100, 0] | max | round,'780 '"hypa_life": [100 - c2 / 180 * 100, 0] | max | round,'781 '"mop_life": [100 - c3 / 180 * 100, 0] | max | round,'782 '} }}',783 },784 ],785 'miio_specs': {786 'prop.2.1': {'prop': 'run_state', 'dict': {787 0: 1, # IdleNotDocked788 1: 1, # Idle789 2: 3, # Idle2790 3: 4, # Cleaning791 4: 5, # Returning792 5: 6, # Docked793 6: 8, # VacuumingAndMopping794 7: 7, # Mopping795 }, 'default': 1},796 'prop.2.2': {'prop': 'suction_grade'},797 'prop.3.1': {'prop': 'battary_life'},798 },799 },800 'viomi.waterheater.e1': {801 'chunk_properties': 1,802 'miio_specs': {803 'prop.2.1': {'prop': 'targetTemp', 'setter': 'set_temp', 'set_template': '{{ [value|int] }}'},804 'prop.2.2': {'prop': 'waterTemp'},805 'prop.2.3': {'prop': 'washStatus'},806 'prop.2.4': {807 'prop': 'washStatus',808 'setter': 'set_power',809 'template': '{{ value != 0 }}',810 'set_template': '{{ [value|int(1)] }}',811 },812 'prop.2.5': {'prop': 'hotWater'}, # water-level813 'prop.2.6': {'prop': 'modeType', 'setter': 'set_mode'},814 },815 },816 'viomi.waterheater.u1': {817 'miio_specs': {818 'prop.2.2': {'prop': 'targetTemp', 'setter': 'set_temp', 'set_template': '{{ [value|int] }}'},819 'prop.2.3': {'prop': 'waterTemp'},820 'prop.2.5': {'prop': 'washStatus'},821 'prop.2.6': {822 'prop': 'washStatus',823 'setter': 'set_power',824 'template': '{{ value != 0 }}',825 'set_template': '{{ [value|int(1)] }}',826 },827 'prop.2.103': {'prop': 'velocity'},828 },829 },830 'viomi.waterheater.u8': {831 # ["washStatus","velocity","waterTemp","targetTemp","errStatus","preHeatTime1","preHeatTime2","isPreHeatNow"]832 # [2 , 4 , 44 , 44 , 0 , "0-6-10" , "0-16-22" , 0]833 'miio_specs': {834 'prop.2.1': {'prop': 'targetTemp', 'setter': 'set_temp', 'set_template': '{{ [value|int] }}'},835 'prop.2.2': {'prop': 'waterTemp'},836 'prop.2.3': {'prop': 'washStatus'},837 'prop.2.4': { # viomi.waterheater.u12838 'prop': 'washStatus',839 'setter': 'set_power',840 'template': '{{ value != 0 }}',841 'set_template': '{{ [value|int(1)] }}',842 },843 'prop.2.5': {844 'prop': 'washStatus',845 'setter': 'set_power',846 'template': '{{ value != 0 }}',847 'set_template': '{{ [value|int(1)] }}',848 },849 'prop.2.102': {'prop': 'targetTemp', 'setter': 'set_temp', 'dict': {850 99: 0, # Custom851 39: 1, # Children852 40: 2, # Comfortable853 42: 3, # Old Man854 36: 4, # Kitchen855 }, 'default': 0},856 'prop.2.103': {'prop': 'velocity'},857 'prop.200.201': {858 'prop': 'isPreHeatNow',859 'setter': 'set_preheat_now',860 'template': '{{ value != 0 }}',861 'set_template': '{{ [value|int(1)] }}',862 },863 },864 },865 'viomi.waterheater.u12': 'viomi.waterheater.u8',866 'xjx.toilet.pro': {867 'miio_specs': {868 'prop.2.1': {'prop': 'seating'},869 },870 },871 'xjx.toilet.relax': {872 'extend_model': 'xjx.toilet.pro',873 'miio_specs': {874 'prop.2.1': {'prop': 'seating'},875 'prop.2.2': {'prop': 'status_bubbleshield', 'setter': 'set_bubble', 'set_template': '{{ [value|int] }}'},876 'prop.3.1': {'prop': 'status_seatheat', 'setter': 'work_seatheat', 'set_template': '{{ [value|int] }}'},877 'prop.3.2': {'prop': 'seat_temp', 'setter': 'set_seat_temp'},878 'prop.4.1': {'prop': 'status_led', 'setter': 'work_night_led', 'set_template': '{{ [value|int] }}'},879 },880 },881 'yeelink.bhf_light.v2': {882 'miio_specs': {883 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},884 'prop.2.2': {'prop': 'bright', 'setter': True, 'set_template': '{{ [value,"smooth",500] }}'},885 'prop.3.1': {'prop': 'bh_mode', 'dict': {886 'bh_off': 1, # stop_bath_heater887 'warmwind': 2,888 'venting': 3,889 'drying': 4,890 'coolwind': 5,891 }, 'default': 1},892 'prop.4.1': {893 'prop': 'fan_speed_idx',894 'setter': 'set_gears_idx',895 'template': 'yeelink_bhf_light_v2_fan_levels',896 'set_template': '{{ [value - 1] }}',897 },898 },899 },900 'yeelink.bhf_light.v5': {901 'miio_template': 'yeelink_bhf_light_v5_miio_props',902 'miio_specs': {903 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},904 'prop.2.2': {905 'prop': 'light_mode',906 'template': '{{ 2 if value == "nightlight" else 1 }}',907 },908 'prop.2.3': {'prop': 'bright', 'setter': True, 'set_template': '{{ [value,"smooth",500] }}'},909 'prop.3.1': {910 'prop': 'bh_mode',911 'setter': True,912 'template': '{{ '913 '3 if "fastdefog" in value else '914 '4 if "fastwarm" in value else '915 '1 if "drying" in value else '916 '2 if "defog" in value else '917 '8 if "venting" in value else '918 '7 if "coolwind" in value else '919 '6 if "warmwind" in value else '920 '5 if "bh_off" in value else '921 '0 }}',922 'set_template': '{{ '923 '["drying"] if value == 1 else '924 '["defog"] if value == 2 else '925 '["fastdefog"] if value == 3 else '926 '["fastwarm"] if value == 4 else '927 '["warmwind", 2] if value == 6 else '928 '["coolwind", 3] if value == 7 else '929 '["venting", 3] if value == 8 else '930 '["windoff"] if "coolwind" in props.bh_mode else '931 '["windoff"] if "warmwind" in props.bh_mode else '932 '["ventingoff"] if "venting" in props.bh_mode else '933 '["bh_off", 0] }}',934 'set_callback': set_callback_via_param_index(0),935 },936 'prop.3.2': {937 'prop': 'bh_mode', 'setter': True,938 'template': '{{ "warm" in value }}',939 'set_template': '{{ ["warmwind" if value else "windoff"] }}',940 },941 'prop.3.3': {942 'prop': 'bh_mode', 'setter': True,943 'template': '{{ "coolwind" in value }}',944 'set_template': '{{ ["coolwind" if value else "windoff"] }}',945 },946 'prop.3.4': {947 'prop': 'bh_mode', 'setter': True,948 'template': '{{ "venting" in value }}',949 'set_template': '{{ ["venting" if value else "ventingoff"] }}',950 },951 'prop.3.5': {'prop': 'aim_temp', 'setter': 'set_temp'},952 'prop.3.6': {'prop': 'temperature'},953 'prop.3.101': {954 'prop': 'fan_speed_idx',955 'setter': 'set_bh_mode',956 'template': 'yeelink_bhf_light_v5_fan_levels',957 'set_template': '{{ ['958 'props.bh_mode,'959 '1 if value <= 1 else '960 '3 if "coolwind" in props.bh_mode else '961 '3 if "venting" in props.bh_mode else '962 '2] }}',963 },964 'prop.3.111': {965 'prop': 'warmwind_gear',966 'setter': 'set_bh_mode',967 'set_template': '{{ ["warmwind" if value else "windoff", value] }}',968 },969 'prop.3.112': {970 'prop': 'coolwind_gear',971 'setter': 'set_bh_mode',972 'set_template': '{{ ["coolwind" if value else "windoff", value] }}',973 },974 'prop.3.113': {975 'prop': 'venting_gear',976 'setter': 'set_bh_mode',977 'set_template': '{{ ["venting" if value else "ventingoff", value] }}',978 },979 'action.3.1': {'setter': 'bh_mode', 'set_template': '{{ ["bh_off", 0] }}'},980 },981 },982 'yeelink.bhf_light.v6': {983 'miio_specs': {984 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},985 'prop.2.2': {986 'prop': 'light_mode',987 'setter': True,988 'template': '{{ 2 if value == "nightlight" else 1 }}',989 'set_template': '{{ {'990 '"method":"set_ps",'991 '"params":"on" if value == 2 else "off",'992 '} }}',993 },994 'prop.2.3': {'prop': 'bright', 'setter': True, 'set_template': '{{ [value,"smooth",500] }}'},995 'prop.3.1': {996 'prop': 'bh_mode',997 'setter': True,998 'template': '{{ '999 '7 if "fastdefog" in value else '1000 '6 if "fastwarm" in value else '1001 '1 if "coolwind" in value else '1002 '2 if "warmwind" in value else '1003 '3 if "venting" in value else '1004 '4 if "drying" in value else '1005 '5 if "defog" in value else '1006 '0 }}',1007 'set_template': '{{ '1008 '["coolwind", 3] if value == 1 else '1009 '["warmwind", 2] if value == 2 else '1010 '["venting", 3] if value == 3 else '1011 '["drying"] if value == 4 else '1012 '["defog"] if value == 5 else '1013 '["fastwarm"] if value == 6 else '1014 '["fastdefog"] if value == 7 else '1015 '["windoff"] if "coolwind" in props.bh_mode else '1016 '["windoff"] if "warmwind" in props.bh_mode else '1017 '["ventingoff"] if "venting" in props.bh_mode else '1018 '["bh_off", 0] }}',1019 'set_callback': set_callback_via_param_index(0),1020 },1021 'prop.3.2': {'prop': 'aim_temp', 'setter': 'set_temp'},1022 'prop.3.3': {'prop': 'temperature'},1023 'prop.3.101': {1024 'prop': 'fan_speed_idx',1025 'setter': 'set_bh_mode',1026 'template': 'yeelink_bhf_light_v5_fan_levels',1027 'set_template': '{{ ['1028 'props.bh_mode,'1029 '1 if value <= 1 else '1030 '3 if "coolwind" in props.bh_mode else '1031 '3 if "venting" in props.bh_mode else '1032 '2] }}',1033 },1034 'prop.3.111': {1035 'prop': 'warmwind_gear',1036 'setter': 'set_bh_mode',1037 'set_template': '{{ ["warmwind" if value else "windoff", value] }}',1038 },1039 'prop.3.112': {1040 'prop': 'coolwind_gear',1041 'setter': 'set_bh_mode',1042 'set_template': '{{ ["coolwind" if value else "windoff", value] }}',1043 },1044 'prop.3.113': {1045 'prop': 'venting_gear',1046 'setter': 'set_bh_mode',1047 'set_template': '{{ ["venting" if value else "ventingoff", value] }}',1048 },1049 'action.3.1': {'setter': 'bh_mode', 'set_template': '{{ ["bh_off", 0] }}'},1050 },1051 },1052 'yeelink.light.bslamp1': {1053 'extend_model': 'yeelink.light.color1',1054 'miio_specs': {1055 'prop.2.6': {'prop': 'sat'},1056 },1057 },1058 'yeelink.light.bslamp2': {1059 'extend_model': 'yeelink.light.color2',1060 'miio_specs': {1061 'prop.2.6': {'prop': 'sat'},1062 },1063 },1064 'yeelink.light.bslamp3': {1065 'extend_model': 'yeelink.light.color2',1066 'miio_specs': {1067 'prop.2.4': {'prop': 'color_mode'},1068 'prop.2.5': {'prop': 'rgb', 'setter': True},1069 },1070 },1071 'yeelink.light.color1': {1072 'extend_model': 'yeelink.light.color2',1073 'miio_specs': {1074 'prop.2.3': {'prop': 'rgb', 'setter': True},1075 'prop.2.4': {'prop': 'ct', 'setter': 'set_ct_abx', 'set_template': "{{ [value,'smooth',500] }}"},1076 'prop.2.101': {'prop': 'nl_br', 'setter': True},1077 'prop.200.201': {'prop': 'delayoff'},1078 },1079 },1080 'yeelink.light.color2': {1081 'miio_specs': {1082 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1083 'prop.2.2': {'prop': 'bright', 'setter': True},1084 'prop.2.3': {'prop': 'ct', 'setter': 'set_ct_abx', 'set_template': "{{ [value,'smooth',500] }}"},1085 'prop.2.4': {'prop': 'rgb', 'setter': True},1086 'prop.2.5': {'prop': 'color_mode'},1087 },1088 },1089 'yeelink.light.color3': 'yeelink.light.color2',1090 'yeelink.light.color4': 'yeelink.light.color2',1091 'yeelink.light.color5': 'yeelink.light.color2',1092 'yeelink.light.ceiling1': {1093 'extend_model': 'yeelink.light.ceiling2',1094 'miio_specs': {1095 'prop.2.4': {'prop': 'ct', 'setter': 'set_ct_abx', 'set_template': "{{ [value,'smooth',500] }}"},1096 },1097 },1098 'yeelink.light.ceiling2': {1099 'miio_specs': {1100 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1101 'prop.2.2': {'prop': 'bright', 'setter': True},1102 'prop.2.3': {1103 'prop': 'nl_br',1104 'setter': 'set_ps',1105 'template': '{{ 2 if value|int else 1 }}',1106 'set_template': "{{ ['nightlight','on' if value == 2 else 'off'] }}",1107 },1108 },1109 },1110 'yeelink.light.ceiling3': 'yeelink.light.ceiling1',1111 'yeelink.light.ceiling4': 'yeelink.light.ceiling1',1112 'yeelink.light.ceiling5': {1113 'extend_model': 'yeelink.light.ceiling1',1114 'miio_specs': {1115 'prop.2.5': {'prop': 'smart_switch'}, # set_ps ['cfg_smart_switch', '1']1116 },1117 },1118 'yeelink.light.ceiling6': {1119 'extend_model': 'yeelink.mirror.bm1',1120 'miio_specs': {1121 'prop.2.4': {1122 'prop': 'nl_br',1123 'setter': 'set_ps',1124 'template': '{{ 2 if value|int else 1 }}',1125 'set_template': "{{ ['nightlight','on' if value == 2 else 'off'] }}",1126 },1127 },1128 },1129 'yeelink.light.ceiling7': 'yeelink.light.ceiling6',1130 'yeelink.light.ceiling8': 'yeelink.light.ceiling6',1131 'yeelink.light.ceiling9': 'yeelink.light.ceiling6',1132 'yeelink.light.ceiling10': 'yeelink.light.ceiling6',1133 'yeelink.light.ceiling11': 'yeelink.light.ceiling6',1134 'yeelink.light.ceiling12': 'yeelink.light.ceiling6',1135 'yeelink.light.ceiling13': 'yeelink.light.ceiling6',1136 'yeelink.light.ceiling14': 'yeelink.light.ceiling6',1137 'yeelink.light.ceiling15': 'yeelink.light.ceiling6',1138 'yeelink.light.ceiling16': {1139 'extend_model': 'yeelink.light.ceiling2',1140 'miio_specs': {1141 'prop.2.3': {'prop': 'ct', 'setter': 'set_ct_abx', 'set_template': "{{ [value,'smooth',500] }}"},1142 },1143 },1144 'yeelink.light.ceiling17': 'yeelink.light.ceiling16',1145 'yeelink.light.ceiling18': 'yeelink.light.ceiling6',1146 'yeelink.light.ceiling19': 'yeelink.light.ceiling6',1147 'yeelink.light.ceiling20': 'yeelink.light.ceiling6',1148 'yeelink.light.ceiling21': {1149 'extend_model': 'yeelink.light.ceiling6',1150 'miio_specs': {1151 'prop.2.4': {1152 'prop': 'nl_br',1153 'setter': 'set_ps',1154 'template': '{{ 1 if value|int else 0 }}',1155 'set_template': "{{ ['nightlight','on' if value == 1 else 'off'] }}",1156 },1157 'prop.2.5': {'prop': 'smart_switch'},1158 },1159 },1160 'yeelink.light.ceiling22': 'yeelink.light.ceiling21',1161 'yeelink.light.ceiling23': 'yeelink.light.ceiling21',1162 'yeelink.light.ceiling24': 'yeelink.light.ceiling16',1163 'yeelink.light.lamp2': 'yeelink.light.ceiling16',1164 'yeelink.light.lamp3': {1165 'miio_specs': {1166 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1167 'prop.2.2': {'prop': 'bright', 'setter': True},1168 },1169 },1170 'yeelink.light.lamp4': {1171 'extend_model': 'yeelink.light.ceiling6',1172 'miio_specs': {1173 'prop.2.4': {'prop': None},1174 },1175 },1176 'yeelink.light.lamp5': 'yeelink.light.lamp3',1177 'yeelink.light.lamp7': 'yeelink.light.ceiling16',1178 'yeelink.light.lamp9': 'yeelink.light.ceiling6',1179 'yeelink.light.lamp10': 'yeelink.light.bslamp3',1180 'yeelink.light.mono1': {1181 'miio_specs': {1182 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1183 'prop.2.2': {'prop': 'bright', 'setter': True},1184 'prop.3.1': {'prop': 'color_mode', 'setter': True},1185 },1186 },1187 'yeelink.light.panel1': 'yeelink.light.ceiling2',1188 'yeelink.light.panel3': 'yeelink.light.ceiling2',1189 'yeelink.light.strip1': 'yeelink.light.color1',1190 'yeelink.light.strip2': {1191 'miio_specs': {1192 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1193 'prop.2.2': {'prop': 'bright', 'setter': True},1194 'prop.2.3': {'prop': 'rgb', 'setter': True},1195 },1196 },1197 'yeelink.light.strip4': 'yeelink.light.ceiling16',1198 'yeelink.light.strip6': 'yeelink.light.strip2',1199 'yeelink.light.strip8': 'yeelink.light.strip2',1200 'yeelink.ven_fan.vf1': {1201 'miio_specs': {1202 'prop.2.1': {1203 'prop': 'bh_mode',1204 'setter': True,1205 'template': "{{ value in ['coolwind'] }}",1206 'set_template': "{{ ['coolwind' if value else 'bh_off'] }}",1207 },1208 'prop.2.2': {'prop': 'gears', 'setter': 'set_gears_idx', 'dict': {1209 0: 1, # Low1210 1: 2, # High1211 }, 'default': 1},1212 'prop.2.3': {1213 'prop': 'swing_action',1214 'setter': 'set_swing',1215 'template': "{{ value in ['swing'] }}",1216 'set_template': "{{ ['swing' if value else 'stop'] }}",1217 },1218 },1219 },1220 'yeelink.mirror.bm1': {1221 'miio_specs': {1222 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1223 'prop.2.2': {'prop': 'bright', 'setter': True},1224 'prop.2.3': {'prop': 'ct', 'setter': 'set_ct_abx', 'set_template': "{{ [value,'smooth',500] }}"},1225 },1226 },1227 'yeelink.ven_fan.vf3': {1228 'extend_model': 'yeelink.ven_fan.vf5',1229 'miio_specs': {1230 'prop.2.3': {1231 'prop': 'swing_action',1232 'setter': 'set_swing',1233 'template': "{{ value in ['swing'] }}",1234 'set_template': "{{ ['swing' if value else 'stop'] }}",1235 },1236 },1237 },1238 'yeelink.ven_fan.vf5': {1239 'miio_specs': {1240 'prop.2.1': {1241 'prop': 'bh_mode',1242 'setter': True,1243 'template': "{{ value in ['coolwind'] }}",1244 'set_template': "{{ ['coolwind' if value else 'bh_off'] }}",1245 },1246 'prop.2.2': {'prop': 'gears', 'setter': 'set_gears_idx', 'dict': {1247 0: 1, # Low1248 1: 2, # High1249 }, 'default': 1},1250 'prop.2.4': {'prop': 'delayoff'},1251 'prop.3.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1252 'prop.3.2': {1253 'prop': 'nl_br',1254 'setter': 'set_ps',1255 'template': '{{ 2 if value|int else 1 }}',1256 'set_template': "{{ ['nightlight','on' if value == 2 else 'off'] }}",1257 },1258 'prop.3.3': {'prop': 'bright', 'setter': True},1259 },1260 },1261 'zhimi.airmonitor.v1': {1262 'miio_specs': {1263 'prop.2.1': {'prop': 'aqi'},1264 'prop.3.1': {'prop': 'battery'},1265 'prop.3.2': {'prop': 'usb_state', 'dict': {1266 'on': 1, # Charging1267 'off': 2, # Not Charging1268 }, 'default': 2},1269 'prop.4.1': {'prop': 'time_state', 'setter': True, 'format': 'onoff'},1270 },1271 },1272 'zhimi.airfresh.va2': {1273 'miio_props': ['average_aqi', 'motor1_speed', 'use_time'],1274 'entity_attrs': ['motor1_speed', 'use_time'],1275 'miio_specs': {1276 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1277 'prop.2.2': {'prop': 'mode', 'setter': True, 'dict': {1278 'auto': 0,1279 'silent': 1,1280 'interval': 2,1281 'low': 3,1282 'medium': 4,1283 'strong': 5,1284 }, 'default': 0},1285 'prop.3.1': {'prop': 'humidity'},1286 'prop.3.2': {'prop': 'aqi'},1287 'prop.3.3': {'prop': 'temp_dec'},1288 'prop.3.4': {'prop': 'co2'},1289 'prop.4.1': {'prop': 'f1_hour_used'},1290 'prop.5.1': {'prop': 'child_lock', 'setter': True, 'format': 'onoff'},1291 'prop.6.1': {'prop': 'buzzer', 'setter': True, 'format': 'onoff'},1292 'prop.7.1': {'prop': 'led_level', 'setter': True},1293 },1294 },1295 'zhimi.airfresh.va4': {1296 'extend_model': 'zhimi.airfresh.va2',1297 'miio_specs': {1298 'prop.2.3': {'prop': 'mode', 'setter': True, 'dict': {1299 'interval': 0,1300 'silent': 1,1301 'low': 2,1302 'medium': 3,1303 'strong': 4,1304 'auto': 5,1305 }, 'default': 5},1306 'prop.2.4': {'prop': 'ptc_state', 'setter': True, 'format': 'onoff'},1307 'prop.3.3': {'prop': 'temp_dec', 'template': '{{ value|default(0,true)/10.0 }}'},1308 },1309 },1310 'zhimi.airpurifier._base': {1311 'miio_props': ['motor1_speed', 'motor2_speed', 'purify_volume'],1312 'entity_attrs': ['aqi', 'motor1_speed', 'motor2_speed', 'purify_volume'],1313 'miio_specs': {1314 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1315 'prop.2.2': {'prop': 'mode', 'setter': True, 'dict': {1316 'auto': 0,1317 'silent': 1,1318 'low': 1,1319 'medium': 2,1320 'strong': 3,1321 'high': 3,1322 }, 'default': 0},1323 'prop.3.1': {'prop': 'aqi'},1324 'prop.4.1': {'prop': 'filter1_life'},1325 'prop.5.1': {'prop': 'led', 'setter': True, 'format': 'onoff'},1326 'prop.6.1': {'prop': 'buzzer', 'setter': True, 'format': 'onoff'},1327 },1328 },1329 'zhimi.airpurifier.m1': {1330 'extend_model': 'zhimi.airpurifier.v3',1331 'miio_specs': {1332 'prop.2.2': {'prop': 'mode', 'setter': True, 'dict': {1333 'auto': 0,1334 'silent': 1,1335 'favorite': 2,1336 }, 'default': 0},1337 'prop.3.1': {'prop': 'humidity'},1338 'prop.3.2': {'prop': 'aqi'},1339 'prop.3.3': {'prop': 'temp_dec', 'template': '{{ value|default(0,true)/10.0 }}'},1340 'prop.4.2': {'prop': 'f1_hour_used'},1341 'prop.5.2': {'prop': 'led_b', 'setter': True},1342 'prop.8.1': {'prop': 'favorite_level', 'setter': True},1343 },1344 },1345 'zhimi.airpurifier.m2': 'zhimi.airpurifier.m1',1346 'zhimi.airpurifier.ma2': 'zhimi.airpurifier.v6',1347 'zhimi.airpurifier.mc1': {1348 'extend_model': 'zhimi.airpurifier.v6',1349 'miio_specs': {1350 'prop.4.2': {1351 'prop': 'f1_hour_used',1352 'template': '{{ value/(props.filter1_life|default(0,true)/100)-value }}',1353 },1354 },1355 },1356 'zhimi.airpurifier.mc2': 'zhimi.airpurifier.mc1',1357 'zhimi.airpurifier.sa2': {1358 'extend_model': 'zhimi.airpurifier._base',1359 'miio_specs': {1360 'prop.2.2': {'prop': 'mode', 'setter': True, 'dict': {1361 'auto': 0,1362 'silent': 1,1363 'favorite': 2,1364 'low': 3,1365 'medium': 4,1366 'high': 5,1367 'strong': 5,1368 }, 'default': 0},1369 'prop.2.3': {'prop': 'mode', 'setter': True, 'dict': {1370 'auto': 0,1371 'silent': 1,1372 'favorite': 2,1373 'idle': 3,1374 }, 'default': 3},1375 'prop.3.1': {'prop': 'humidity'},1376 'prop.3.2': {'prop': 'aqi'},1377 'prop.3.3': {'prop': 'temp_dec', 'template': '{{ value|default(0,true)/10.0 }}'},1378 'prop.4.2': {'prop': 'f1_hour_used'},1379 'prop.5.1': {'prop': 'filter2_life'},1380 'prop.5.2': {'prop': 'f2_hour_used'},1381 'prop.6.1': {'prop': 'led', 'setter': True, 'format': 'onoff'},1382 'prop.6.2': {'prop': 'led_b', 'setter': True},1383 'prop.7.1': {'prop': 'buzzer', 'setter': True, 'format': 'onoff'},1384 'prop.8.1': {'prop': 'child_lock', 'setter': True, 'format': 'onoff'},1385 'prop.9.1': {'prop': 'favorite_level', 'setter': True},1386 },1387 },1388 'zhimi.airpurifier.v1': {1389 'extend_model': 'zhimi.airpurifier._base',1390 'miio_specs': {1391 'prop.2.3': {'prop': 'mode', 'setter': True, 'dict': {1392 'auto': 0,1393 'silent': 1, # Sleep1394 'strong': 2,1395 'idle': 3,1396 }, 'default': 0},1397 'prop.5.2': {1398 'prop': 'led_b',1399 'setter': True,1400 'dict': {1401 0: 15, # Bright1402 1: 10, # Dim1403 2: 5, # Off1404 },1405 'default': 0,1406 'set_template': '{{ ['1407 '0 if value > 10 else '1408 '1 if value > 5 else '1409 '2] }}',1410 },1411 },1412 },1413 'zhimi.airpurifier.v2': {1414 'extend_model': 'zhimi.airpurifier._base',1415 'miio_specs': {1416 'prop.4.2': {1417 'prop': 'f1_hour_used',1418 'template': '{{ value/(props.filter1_life|default(0,true)/100)-value }}',1419 },1420 'prop.7.1': {'prop': 'child_lock', 'setter': True, 'format': 'onoff'},1421 },1422 },1423 'zhimi.airpurifier.v3': {1424 'extend_model': 'zhimi.airpurifier.v2',1425 'miio_specs': {1426 'prop.2.3': {'prop': 'mode', 'setter': True, 'dict': {1427 'auto': 0,1428 'silent': 1,1429 'strong': 2,1430 'high': 2,1431 'idle': 3,1432 }, 'default': 3},1433 },1434 },1435 'zhimi.airpurifier.v5': 'zhimi.airpurifier.v2',1436 'zhimi.airpurifier.v6': {1437 'extend_model': 'zhimi.airpurifier.m1',1438 'miio_specs': {1439 'prop.2.3': {'prop': 'mode', 'setter': True, 'dict': {1440 'auto': 0,1441 'silent': 1,1442 'favorite': 2,1443 }, 'default': 0},1444 },1445 },1446 'zhimi.airpurifier.v7': {1447 'extend_model': 'zhimi.airpurifier.m1',1448 'miio_specs': {1449 'prop.5.1': {'prop': 'child_lock', 'setter': True, 'format': 'onoff'},1450 'prop.7.1': {'prop': 'led', 'setter': True, 'format': 'onoff'},1451 },1452 },1453 'zhimi.fan.sa1': {1454 # https://github.com/rytilahti/python-miio/blob/9bc6b65ce846707db7e83d403dd2c71d4e6bfa31/miio/fan.py#L321-L3221455 'chunk_properties': 1,1456 'miio_specs': {1457 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1458 'prop.2.2': {1459 'prop': 'speed_level',1460 'setter': True,1461 'template': '{% set lvl = props.natural_level|default(value,true)|int(0) %}'1462 '{{ '1463 'lvl if max == 100 else '1464 '1 if lvl <= 25 else '1465 '2 if lvl <= 50 else '1466 '3 if lvl <= 75 else '1467 '4 }}',1468 'set_template': '{% set nlv = props.natural_level|default(0)|int(0) %}'1469 '{{ {'1470 '"method": "set_natural_level" if nlv else "set_speed_level",'1471 '"params": [value|int(0) * (1 if max == 100 else 25)],'1472 '} }}',1473 },1474 'prop.2.3': {'prop': 'angle_enable', 'setter': True, 'format': 'onoff'},1475 'prop.2.4': {'prop': 'angle', 'setter': True},1476 'prop.2.5': {1477 'prop': 'natural_level',1478 'setter': True,1479 'template': '{{ 1 if value|int(0) > 0 else 2 }}',1480 'set_template': '{{ [value|int(0) * 25] }}',1481 },1482 'prop.3.1': {'prop': 'child_lock', 'setter': True, 'format': 'onoff'},1483 },1484 },1485 'zhimi.fan.v2': {1486 'extend_model': 'zhimi.fan.sa1',1487 'chunk_properties': 15,1488 'miio_specs': {1489 'prop.2.5': {1490 'prop': 'natural_level',1491 'setter': True,1492 'template': '{{ 1 if value|int(0) > 0 else 0 }}',1493 'set_template': '{{ [value|int(0) * 25] }}',1494 },1495 'prop.4.1': {'prop': 'battery'},1496 'prop.4.2': {'prop': 'bat_charge', 'template': '{{ 2 if value == "complete" else 1 }}'},1497 },1498 },1499 'zhimi.fan.v3': 'zhimi.fan.v2',1500 'zhimi.fan.za1': 'zhimi.fan.sa1',1501 'zhimi.fan.za3': {1502 'extend_model': 'zhimi.fan.sa1',1503 'miio_specs': {1504 'prop.2.5': {1505 'prop': 'natural_level',1506 'setter': True,1507 'template': '{{ 1 if value|int(0) > 0 else 0 }}',1508 'set_template': '{{ [value|int(0) * 25] }}',1509 },1510 'prop.4.1': {1511 'prop': 'buzzer',1512 'setter': True,1513 'template': '{{ value|int(0) > 0 }}',1514 'set_template': '{{ [1 if value else 0] }}',1515 },1516 'prop.5.1': {1517 'prop': 'led_b',1518 'setter': True,1519 'template': '{{ value|int(0) > 0 }}',1520 'set_template': '{{ [1 if value else 0] }}',1521 },1522 },1523 },1524 'zhimi.fan.za4': 'zhimi.fan.za3',1525 'zhimi.humidifier.ca1': {1526 'extend_model': 'zhimi.humidifier.v1',1527 # https://github.com/rytilahti/python-miio/blob/9bc6b65ce846707db7e83d403dd2c71d4e6bfa31/miio/airhumidifier.py#L297-L3021528 'chunk_properties': 1,1529 'miio_specs': {1530 'prop.2.3': {'prop': 'depth'},1531 },1532 },1533 'zhimi.humidifier.cb1': {1534 'extend_model': 'zhimi.humidifier.ca1',1535 'miio_specs': {1536 'prop.3.2': {'prop': 'temperature'},1537 },1538 },1539 'zhimi.humidifier.cb2': 'zhimi.humidifier.cb1',1540 'zhimi.humidifier.v1': {1541 'miio_specs': {1542 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1543 'prop.2.2': {'prop': 'mode', 'setter': True, 'dict': {1544 'auto': 0,1545 'silent': 1,1546 'medium': 2,1547 'high': 3,1548 'strong': 3,1549 }, 'default': 0},1550 'prop.3.1': {'prop': 'humidity'},1551 'prop.3.2': {'prop': 'temp_dec', 'template': '{{ value / 10.0 }}'},1552 'prop.4.1': {'prop': 'buzzer', 'setter': True, 'format': 'onoff'},1553 'prop.5.1': {'prop': 'child_lock', 'setter': True, 'format': 'onoff'},1554 },1555 },1556 'zimi.powerstrip.v2': {1557 'miio_props': ['current', 'mode', 'power_price'],1558 'miio_specs': {1559 'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},1560 'prop.2.2': {'prop': 'temperature'},1561 'prop.3.1': {'prop': 'power_consume_rate'},1562 'prop.4.1': {'prop': 'wifi_led'},1563 },1564 },...

Full Screen

Full Screen

create_entry_operations.py

Source:create_entry_operations.py Github

copy

Full Screen

...85 :type: SetEdoc86 """87 self._set_edoc = set_edoc88 @property89 def set_template(self):90 """Gets the set_template of this CreateEntryOperations. # noqa: E50191 :return: The set_template of this CreateEntryOperations. # noqa: E50192 :rtype: SetTemplate93 """94 return self._set_template95 @set_template.setter96 def set_template(self, set_template):97 """Sets the set_template of this CreateEntryOperations.98 :param set_template: The set_template of this CreateEntryOperations. # noqa: E50199 :type: SetTemplate100 """101 self._set_template = set_template102 @property103 def set_fields(self):104 """Gets the set_fields of this CreateEntryOperations. # noqa: E501105 :return: The set_fields of this CreateEntryOperations. # noqa: E501106 :rtype: SetFields107 """108 return self._set_fields109 @set_fields.setter110 def set_fields(self, set_fields):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyresttest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful