diff --git a/packages/vacuum/vacuum.yaml b/packages/vacuum/vacuum.yaml index 55143c8..fceab87 100644 --- a/packages/vacuum/vacuum.yaml +++ b/packages/vacuum/vacuum.yaml @@ -167,6 +167,52 @@ script: topic: valetudo/furbot/MapSegmentationCapability/clean/set payload: '{"segment_ids": ["2"], "iterations": 2}' + # Vacuum Selected Segments + furbot_clean_segments: + alias: "Furbot: Clean Selected Rooms" + sequence: + - choose: + # Pause the robot if it is currently cleaning + - conditions: + - condition: template + value_template: "{{ states('vacuum.valetudo_furbot') == 'cleaning' }}" + sequence: + - service: mqtt.publish + data: + topic: valetudo/furbot/BasicControlCapability/operation/set + payload: 'pause' + + # Resume the robot if it is paused + - conditions: + - condition: template + value_template: "{{ states('vacuum.valetudo_furbot') == 'paused' }}" + sequence: + - service: mqtt.publish + data: + topic: valetudo/furbot/BasicControlCapability/operation/set + payload: 'start' + + # Start a new cleaning if it is docked + default: + - if: + - condition: template + value_template: "{{ is_state('group.furbot_segments', 'off') }}" + then: + - service: mqtt.publish + data: + topic: valetudo/furbot/BasicControlCapability/operation/set + payload: 'start' + else: + - service: mqtt.publish + data: + topic: valetudo/furbot/MapSegmentationCapability/clean/set + payload: >- + { + 'segment_ids': {{ expand('group.furbot_segments') | + selectattr('state','eq','on') | + map(attribute='attributes.segment_id') | list | to_json }} + } + # ----------------------------------------------------------------------------- # Vacuum Automations automation: @@ -187,3 +233,14 @@ automation: - service: input_text.reload target: entity_id: input_text.furbot_last_fan_speed + + # Reset the Cleaning Segments when cleaning is complete + - alias: "Furbot: Reset Rooms" + trigger: + - platform: state + entity_id: vacuum.valetudo_furbot + to: docked + action: + - service: homeassistant.turn_off + target: + entity_id: group.furbot_segments