keepcalculator

06 Numbers and Powers

Home Assistant Brightness 0 Success Fix

Card No. 06·10369 · Updated · Standard formula, shown below

When a Home Assistant automation sends a brightness value of 0 to a smart light and the service call reports success, the light is being turned off, not set to a dim level. This happens because brightness 0 is interpreted by most light platforms as a command to power off, and Home Assistant’s service response only confirms the command was accepted, not that the light reached a specific state.

Why Brightness 0 Means Off

In the Home Assistant ecosystem, brightness is typically represented as an integer between 0 and 255. The value 0 is reserved as the off state for most light integrations, including those for Philips Hue, LIFX, and many Zigbee devices. When you call light.turn_on with brightness: 0, the integration translates that to a power-off command rather than a dimming command. This behavior follows the design of the underlying protocols: a light with zero brightness is indistinguishable from an off light, so the device firmware treats it as off.

Home Assistant’s service call returns success: true because the command was valid and accepted by the integration. The service response does not verify the final state of the light; it only confirms that the request was processed without error. This is a common point of confusion because users expect a success message to mean the light is now at the requested brightness, but it actually means the command was sent.

How Home Assistant Handles Brightness

Brightness in Home Assistant is a percentage or a raw value depending on the integration. The light.turn_on service accepts brightness as a number between 0 and 255 for most platforms. Some integrations use a float between 0 and 1, but the frontend and YAML typically normalize to the 0-255 scale. The brightness_pct attribute is also available for percentages, but it is converted internally.

When you send brightness: 0, the integration may either set the light to off or ignore the value and keep the current state. The exact behavior depends on the device and its firmware. For example, a Hue bulb will turn off, while some Wi-Fi bulbs may simply ignore the command and remain on. This inconsistency is why you should never use 0 as a dimming value.

Common Scenarios and Misconceptions

A frequent mistake is using a slider that sends 0 as the minimum value. If your UI slider ranges from 0 to 255, dragging it all the way down sends 0, which turns the light off instead of dimming to minimum. Another scenario is an automation that calculates brightness based on time of day and accidentally produces 0 for late night. The automation runs, reports success, but the light goes off, which may be unexpected if you intended a very dim night light.

Another misconception is that brightness: 0 is the same as brightness: 1. In practice, 1 is the lowest non-zero brightness, and it is still on. If you want a light to be as dim as possible, use 1, not 0. Also, some integrations treat brightness: 0 as an invalid value and ignore it, so the light stays at its previous brightness, which can be even more confusing.

How to Fix It in Automations

To avoid sending brightness 0, always use a minimum value of 1 in your automations and scripts. If you are using a template, clamp the value with max(1, your_value). For example, if you want a night light that dims to 1% brightness, use brightness_pct: 1 instead of brightness_pct: 0. If you intend to turn the light off, use light.turn_off explicitly, which is clearer and avoids ambiguity.

If you are using a UI slider, set the min to 1 in your configuration. For a Lovelace entity card, you can customize the slider range with slider: min: 1 max: 255. For a blueprint or a script, always validate that the brightness value is at least 1 before sending.

When Brightness 0 Might Be Intentional

There are cases where sending brightness 0 is a deliberate way to turn off a light. Some integrations, like MQTT-based lights, may only support a single brightness command and use 0 to indicate off. In those cases, the behavior is consistent and you can rely on it. However, it is still better to use the dedicated turn_off service for clarity and portability.

Also, some advanced users use brightness 0 as a way to temporarily disable a light without losing its color or other settings. When you turn it on again, the previous brightness is restored. This can be useful for scenes, but it is not the default behavior for all devices.

Alternatives to Brightness 0

If you need a light to be extremely dim, consider using a low brightness value like 1 or 2, or use a transition to fade to off slowly. For example, light.turn_on with brightness: 1 and transition: 5 will fade to the lowest setting over 5 seconds, which can be more pleasing than an abrupt off. If you want a light to be off but still respond to motion sensors, you can use a separate binary sensor or a group.

Another alternative is to use a scene that sets the light to off, then on with a low brightness. This can be done with a single scene that includes state: off and brightness: 1 for when it turns on. But remember, the scene will turn the light on, so it is not a true off state.

Frequently Asked Questions

Why does my light turn off when I set brightness to 0 in Home Assistant?

Because brightness 0 is interpreted as the off state by most light integrations. The device firmware treats zero brightness as power off, so the light turns off. Home Assistant reports success because the command was valid, but the result is off, not a dim light.

How can I set a light to its minimum dim level without turning it off?

Use a brightness value of 1 (or 1% if using brightness_pct). This is the lowest non-zero value and will keep the light on. Avoid using 0 for dimming.

Does Home Assistant have a way to know if the light actually turned on?

Yes, you can check the light’s state attribute after the service call. Use light.get_state or a template to read the state attribute, which will be ‘on’ or ‘off’. The service response itself does not include the final state.

Why does my automation report success but the light doesn’t change?

This can happen if the brightness value is 0 and the device ignores it, or if the light is unreachable. The service call only confirms the command was sent, not that it was executed. Check the device’s availability and the actual state.

Can I use brightness 0 to turn off a light in a scene?

Yes, but it’s not recommended. Using light.turn_off is clearer and works across all integrations. Some devices may not respond to brightness 0, so a scene might not turn the light off reliably.

Is there a way to make brightness 0 not turn off the light?

No, that is defined by the device firmware and integration. You cannot override it in Home Assistant. Always use a minimum value of 1 for dimming.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →