Vacuum and alarm

Hi all,

I have a vacuum (rockobo s50 with valetudo re on it) and an alarm system managed by HA.

I’ve setup an automation to change alarm type when vacuum starts cleaning the house:

- alias: Cambia tipo allarme da away a home se R2D2 è in funzione

  initial_state: 'on'

  trigger:

    - platform: state

      entity_id: vacuum.rockrobo

      to: 'cleaning'

  condition:

    - condition: state

      entity_id: alarm_control_panel.home_alarm

      state: 'armed_away'

  action:

    - service: alarm_control_panel.alarm_disarm

      data: {"entity_id":"alarm_control_panel.home_alarm"}

    - delay: 02:00

    - service: alarm_control_panel.alarm_arm_home

      data: {"entity_id":"alarm_control_panel.home_alarm"}

Now I would like an automation to restore alarm previous state after vacuum is back to docking station.

How can I use a previous state?

Create an input boolean to check if the alarm was armed_away.

input_boolean:
  vacuum_disarmed_away_alarm:
      name: Vacuum Disarmed Away Home Alarm

In the actions for the automation you already have, add:

 - service: input_boolean.turn_on
   entity_id: input_boolean.vacuum_disarmed_away_alarm

Then use something like this (consider adding another condition which checks that you’re still away incase you arrived home while the vacuum is running):

- alias: Set Home Alarm to Away when Vacuum Docks
  trigger:
    - platform: state
      entity_id: vacuum.rockrobo
      to: "docked"
  condition:
    - condition: state
      entity_id: input_boolean.vacuum_disarmed_away_alarm
      state: 'on'
  action:
    - service: alarm_control_panel.alarm_arm_away
      entity_id: alarm_control_panel.home_alarm
    - service: input_boolean.turn_off
      entity_id: input_boolean.vacuum_disarmed_away_alarm

Just curious, what alarm panel are you using?
Is it safe to disarm the alarm? It might look easier, but imho is definitely not the best option…

Actually it turns from armed away (triggered by internal motion sensor) to home (triggere by door/windows sensor). It’s a compromise to have the house cleaned and “almost” safe.

thank you! I’ll give it a try and let you know!