Set HEV cycle state
The Set HEV cycle state action controls the HEV LEDs on a LIFX Clean bulb. Starting a cycle, also called a Clean cycle, switches the HEV LEDs on for a set time and then returns the bulb to its previous state. Stopping a cycle ends it early.
Only LIFX Clean bulbs have HEV LEDs. If you target a bulb without them, Home Assistant returns an error and nothing changes on that bulb.
Using this action from the user interface
If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.
To start or stop a Clean cycle from an automation or a script:
- Go to Settings > Automations & scenes.
- Open an existing automation or script, or select Create automation > Create new automation.
- If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
- In the Then do section, select Add action.
- From the search box, search for and select Set HEV cycle state.
- Select what you want to control. Under By target (see Targets), pick the area your LIFX Clean bulbs are in (like your bathroom or kitchen). You can also select a floor, a device, a specific entity, or a label.
- Turn Enable on to start a Clean cycle, or off to stop one. Optional: set Duration to control how long the cycle runs.
- Select Save.
Options in the UI
Using this action in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this action as lifx.set_hev_cycle_state. A basic example looks like this:
action: lifx.set_hev_cycle_state
target:
entity_id: light.bathroom
data:
power: true
duration: 3600
This starts a one-hour Clean cycle on the bathroom bulb.
Options in YAML
Targets of the action
This action requires a target. The target is the object of the action. You can point the action at a single entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more], a device, an area, a floor, or a label, and Home Assistant will run the action on every matching light entity behind that target.
-
Entity: one specific light entity, such as
light.living_room. - Device: every light entity that belongs to a device.
- Area: every light entity in a room or area.
- Floor: every light entity on a floor.
- Label: every light entity that shares a label.
You can also select different target types in one action. For example, you can add a specific entity and an area as targets in the same action to run the action on both of them at once.
Good to know
- Only LIFX Clean bulbs have HEV LEDs. Targeting any other LIFX bulb returns the error “does not have HEV LEDs”.
- If you leave Duration out, Home Assistant asks the bulb to run for the duration configured on the bulb itself. Home Assistant does not apply a duration of its own, even though the field suggests 7200 seconds (two hours) when you open it in the UI.
- Duration is sent to the bulb as whole seconds, so a value with decimals is rounded.
- Home Assistant creates a Clean cycle entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] for every bulb that has HEV LEDs. It tells you whether a cycle is currently running, which is handy as a condition so you don’t start a second cycle or stop one that was never running.
- The Clean cycle entity is refreshed every 10 seconds to keep network traffic low, so it may take a moment to catch up after you start or stop a cycle.
- Stopping a cycle returns the bulb to the color and brightness it had before the cycle started. To set it to something else instead, follow up with the Set state action.
- This action only works on lights provided by the LIFX integration. Other lights in the target are left alone, and if you name a light that is not a LIFX light, Home Assistant logs a warning instead of returning an error.
Try it yourself
Ready to test this? Open Settings > Tools > Actions, search for this action, fill in the fields, and select Perform action. You see what happens on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] without writing a line of YAML.
More examples
Real scenarios where this action shows up in automations and scripts. Copy any example and adapt it to your setup. In the visual editor, select the UI options listed in the example or paste the YAML code.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the visual automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: run a Clean cycle overnight
Start a one-hour Clean cycle in the bathroom at 2:00 AM, when nobody is likely to be in the room.
- Trigger: Time: 02:00
-
Action: Set HEV cycle state
-
Target: Bathroom light (
light.bathroom)
-
Target: Bathroom light (
alias: "Run a Clean cycle overnight"
triggers:
- trigger: time
at: "02:00:00"
actions:
- action: lifx.set_hev_cycle_state
target:
entity_id: light.bathroom
data:
power: true
duration: 3600
Automation: stop the Clean cycle when someone walks in
If a motion sensor detects someone in the bathroom while a Clean cycle is running, stop the cycle straight away. The Clean cycle entity is used as a condition so the automation only acts when a cycle is actually running.
- Trigger: State: motion detected in the bathroom
- Condition: The bathroom Clean cycle is running
-
Action: Set HEV cycle state
-
Target: Bathroom light (
light.bathroom)
-
Target: Bathroom light (
alias: "Stop the Clean cycle when someone walks in"
triggers:
- trigger: state
entity_id: binary_sensor.bathroom_motion
to: "on"
conditions:
- condition: state
entity_id: binary_sensor.bathroom_clean_cycle
state: "on"
actions:
- action: lifx.set_hev_cycle_state
target:
entity_id: light.bathroom
data:
power: false
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.
Related actions
Explore related actions:
-
Set state: Change the color, brightness, and power of a LIFX light in a single step.
-
Pulse effect: Run a flash effect on LIFX lights by changing to a color and back.