Disable a socket when another device becomes unavailable

I am trying to disable a switch (powering a water pump) while a sensor is unavailable

I modified an Aqara door sensor with a float valve and have a smart outlet that powers a water pump.

I use an automation to keep my live Christmas tree reservoir full but the Aqara sensors (for me) are unstable and often become unavailable. I worry that the float sensor will become unavailable and not turn off the pump

I thought about this automation that would turn off the switch when the sensor becomes unavailable and notify me but wonder if there is a a more fail safe way of doing this.

alias: Christmas Tree Pump Off when Level is Unavailable
description: ''
trigger:
  - device_id: 2ac3364181a145b6c4d591ca2524c565
    domain: zha
    platform: device
    type: device_offline
    subtype: device_offline
condition: []
action:
  - service: switch.turn_off
    target:
      entity_id: switch.christmas_tree_pump
  - service: notify.mobile_app_dad_phone
    data:
      message: Christmas Tree Pump is disabled because Level Sensor is offline
      title: Christmas Tree Pump is Disabled
mode: restart