Dyson Vacuum Charger – Auto On/Off
This automation automatically turns off a smart plug if the power consumption drops below 3 W, and turns it back on after a set time interval, with checks happening every minute.
I created this automation to prevent the vacuum’s battery from being damaged by staying on the charger in the dock indefinitely.
How It Works
- Every minute, the automation checks conditions.
- If the plug is ON and the current consumption < 3 W:
- The plug is turned OFF.
- The current time is stored in
input_datetime.dyson_charger_off_time
. - A notification is created to confirm it turned off.
- If the plug is OFF and a certain amount of time has passed since it was last turned off, the plug is turned ON again, and a notification is created to confirm it turned on.
By default, the code below uses 9 days (777,600 seconds) as the interval. To truly make it 4 hours, replace 777600
with 14400
(4 × 3600).
Required Helper
Create an [Input Datetime][1] helper to store the timestamp of when the plug was last turned off:
- Go to Settings → Devices & Services → Helpers → Create Helper.
- Choose Date and/or time.
- Name it (for example) “Dyson Charger Off Time”.
- Select Store time (or Store date/time, either works).
- Make sure it has the Entity ID:
input_datetime.dyson_charger_off_time
.
Automation YAML
alias: Dyson Vacuum Charger - Auto On/Off
description: >
Automatically turns off the smart plug if the power consumption is < 3 W,
and turns it back on after a specific delay. Runs every minute.
trigger:
- platform: time_pattern
minutes: "/1" # Check every minute
action:
- choose:
# 1) If plug is ON and consumption < 3W -> Turn OFF
- conditions:
- condition: state
entity_id: switch.smart_plug
state: "on"
- condition: template
value_template: >-
{{ states('sensor.smart_plug_current_consumption') | float(999) < 3 }}
sequence:
- service: switch.turn_off
target:
entity_id: switch.smart_plug
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.dyson_charger_off_time
data:
timestamp: "{{ now().timestamp() }}"
- service: persistent_notification.create
data:
title: Dyson Vacuum - Off
message: "Outlet turned off due to consumption < 3 W."
# 2) If plug is OFF and X seconds (default 777,600s = 9 days) have passed -> Turn ON
- conditions:
- condition: state
entity_id: switch.smart_plug
state: "off"
- condition: template
value_template: >-
{{
state_attr('input_datetime.dyson_charger_off_time', 'timestamp') | default(0) | int > 0
and
as_timestamp(now()) - (
state_attr('input_datetime.dyson_charger_off_time', 'timestamp') | int
) > 777600
}}
sequence:
- service: switch.turn_on
target:
entity_id: switch.smart_plug
- service: persistent_notification.create
data:
title: Dyson Vacuum - On
message: "Outlet turned on after the defined delay."
default: []
mode: single