diff --git a/changelog/v1.13.0.rst b/changelog/v1.13.0.rst index 6560eca7a..fd6fdc07d 100644 --- a/changelog/v1.13.0.rst +++ b/changelog/v1.13.0.rst @@ -107,6 +107,7 @@ Other notable changes: :ref:`script.is_running ` condition, :ref:`for ` condition. - Custom components can now access ESPHome's global variables. +- Added ``restore_mode`` for lights and :ref:`light.is_on/off `. Breaking Changes ---------------- diff --git a/components/light/index.rst b/components/light/index.rst index c2f8e950e..3d339f89f 100644 --- a/components/light/index.rst +++ b/components/light/index.rst @@ -296,6 +296,24 @@ Configuration variables: - **white** (*Optional*, :ref:`templatable `, percentage): The value to set the white channel to. +.. _light-is_on_condition: +.. _light-is_off_condition: + +``light.is_on`` / ``light.is_off`` Condition +******************************************** + +This :ref:`Condition ` checks if the given light is ON or OFF. OFF means +that the light is completely OFF, and ON means that the light is emitting at least a bit of light. + +.. code-block:: yaml + + # In some trigger: + on_...: + if: + condition: + # Same syntax for is_off + light.is_on: my_light + .. _light-effects: Light Effects diff --git a/cookbook/mirabella-genio-bulb.rst b/cookbook/mirabella-genio-bulb.rst index 65d50d7a1..9a0e64edf 100644 --- a/cookbook/mirabella-genio-bulb.rst +++ b/cookbook/mirabella-genio-bulb.rst @@ -125,12 +125,6 @@ variable ``output_component1``. platform: ESP8266 board: esp01_1m - # Ensure the light turns on by default if the physical switch is actuated. - on_boot: - priority: 100 # Highest priority, ensures light turns on without delay. - then: - - light.turn_on: light - wifi: ssid: 'WIFI' password: 'WIFIPASS' @@ -147,6 +141,9 @@ variable ``output_component1``. id: light output: output_component1 + # Ensure the light turns on by default if the physical switch is actuated. + restore_mode: ALWAYS_ON + output: - platform: esp8266_pwm id: output_component1 @@ -162,12 +159,6 @@ variable ``output_component1``. platform: ESP8266 board: esp01_1m - # Ensure the light turns on by default if the physical switch is actuated. - on_boot: - priority: 100 # Highest priority, ensures light turns on without delay. - then: - - light.turn_on: light - wifi: ssid: 'WIFI' password: 'WIFIPASS' @@ -195,6 +186,9 @@ variable ``output_component1``. cold_white_color_temperature: 6500 K warm_white_color_temperature: 2700 K + # Ensure the light turns on by default if the physical switch is actuated. + restore_mode: ALWAYS_ON + 3.3 RGBW Color Bulbs ******************** @@ -205,12 +199,6 @@ variable ``output_component1``. platform: ESP8266 board: esp01_1m - # Ensure the light turns on by default if the physical switch is actuated. - on_boot: - priority: 100 # Highest priority, ensures light turns on without delay. - then: - - light.turn_on: light - wifi: ssid: 'WIFI' password: 'WIFIPASS' @@ -244,6 +232,9 @@ variable ``output_component1``. blue: output_blue white: output_white + # Ensure the light turns on by default if the physical switch is actuated. + restore_mode: ALWAYS_ON + 4. Adding to Home Assistant --------------------------- diff --git a/guides/automations.rst b/guides/automations.rst index b1a087de9..ed0317933 100644 --- a/guides/automations.rst +++ b/guides/automations.rst @@ -377,6 +377,7 @@ All Conditions - :ref:`script.is_running ` - :ref:`sun.is_above_horizon / sun.is_below_horizon ` - :ref:`text_sensor.state ` +- :ref:`light.is_on ` / :ref:`light.is_off ` All Lambda Calls ----------------