Last active
September 14, 2025 16:35
-
-
Save almirus/d789e6a3f3c2f4f7ba7c4c6cd8e55ae8 to your computer and use it in GitHub Desktop.
xiaomi_b108gl_clean_room
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Xiaomi Vacuum - Уборка по комнатам (авто-заполнение) | |
| description: > | |
| Выбирает пылесос, автоматически жмёт его info-кнопку, | |
| парсит список комнат и заполняет input_select. | |
| При выборе комнаты запускает уборку с указанными параметрами. | |
| domain: automation | |
| input: | |
| vacuum_entity: | |
| name: Пылесос | |
| description: Выберите ваш пылесос | |
| selector: | |
| entity: | |
| domain: vacuum | |
| room_select: | |
| name: Селектор комнат | |
| description: input_select для списка комнат | |
| selector: | |
| entity: | |
| domain: input_select | |
| fan_level: | |
| name: Fan Level | |
| description: Мощность всасывания | |
| default: 2 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 4 | |
| step: 1 | |
| water_level: | |
| name: Water Level | |
| description: Уровень подачи воды | |
| default: 1 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 3 | |
| step: 1 | |
| clean_mode: | |
| name: Clean Mode | |
| description: Режим уборки | |
| default: 1 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 2 | |
| step: 1 | |
| clean_times: | |
| name: Clean Times | |
| description: Количество проходов | |
| default: 1 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 3 | |
| step: 1 | |
| mop_mode: | |
| name: Mop Mode | |
| description: Мытьё полов | |
| default: false | |
| selector: | |
| boolean: | |
| mode: single | |
| variables: | |
| vacuum: !input vacuum_entity | |
| room_select: !input room_select | |
| fan_level: !input fan_level | |
| water_level: !input water_level | |
| clean_mode: !input clean_mode | |
| clean_times: !input clean_times | |
| mop_mode: !input mop_mode | |
| # Автоматически формируем кнопку info на основе имени пылесоса | |
| info_button: > | |
| {{ "button." + vacuum.split(".")[1].replace("robot_cleaner", "info") }} | |
| trigger: | |
| # Заполняем список при загрузке HA и при изменении состояния пылесоса | |
| - platform: homeassistant | |
| event: start | |
| - platform: state | |
| entity_id: !input vacuum_entity | |
| # Запускаем уборку при выборе комнаты | |
| - platform: state | |
| entity_id: !input room_select | |
| action: | |
| - choose: | |
| # 1. Если это запуск или обновление пылесоса → обновляем список комнат | |
| - conditions: "{{ trigger.platform in ['homeassistant', 'state'] and trigger.entity_id != room_select }}" | |
| sequence: | |
| - service: button.press | |
| target: | |
| entity_id: "{{ info_button }}" | |
| - delay: "00:00:02" | |
| - variables: | |
| room_info: "{{ state_attr(vacuum, 'vacuum_extend.room_info') }}" | |
| rooms: > | |
| {% set res = [] %} | |
| {% if room_info is mapping and room_info.room_attrs|count > 1 %} | |
| {% for r in room_info.room_attrs[1:] %} | |
| {% set res = res + [ r[1] ] %} | |
| {% endfor %} | |
| {% endif %} | |
| {{ res }} | |
| - service: input_select.set_options | |
| target: | |
| entity_id: "{{ room_select }}" | |
| data: | |
| options: "{{ rooms }}" | |
| # 2. Если выбрана комната → запускаем уборку | |
| - conditions: "{{ trigger.entity_id == room_select }}" | |
| sequence: | |
| - variables: | |
| room_info: "{{ state_attr(vacuum, 'vacuum_extend.room_info') }}" | |
| selected_room: "{{ states(room_select) }}" | |
| room_id: > | |
| {% if room_info is mapping and room_info.room_attrs|length > 1 %} | |
| {% for r in room_info.room_attrs[1:] %} | |
| {% if r[1] == states(room_select) %} | |
| {{ r[0] }} | |
| {% endif %} | |
| {% endfor %} | |
| {% endif %} | |
| - service: xiaomi_miot.call_action | |
| data: | |
| entity_id: "{{ vacuum }}" | |
| siid: 2 | |
| aiid: 10 | |
| params: | |
| - > | |
| { | |
| "room_attrs":[ | |
| { | |
| "id": {{ room_id }}, | |
| "room_name": "{{ selected_room }}", | |
| "fan_level": {{ fan_level }}, | |
| "water_level": {{ water_level }}, | |
| "clean_mode": {{ clean_mode }}, | |
| "clean_times": {{ clean_times }}, | |
| "mop_mode": {{ 1 if mop_mode else 0 }}, | |
| "on": true | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment