mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-02-03 23:41:36 +01:00
light conditions
This commit is contained in:
parent
ca792e82e0
commit
1349b93c69
@ -107,6 +107,7 @@ Other notable changes:
|
||||
:ref:`script.is_running <script-is_running_condition>` condition,
|
||||
:ref:`for <for_condition>` condition.
|
||||
- Custom components can now access ESPHome's global variables.
|
||||
- Added ``restore_mode`` for lights and :ref:`light.is_on/off <light-is_on_condition>`.
|
||||
|
||||
Breaking Changes
|
||||
----------------
|
||||
|
@ -296,6 +296,24 @@ Configuration variables:
|
||||
- **white** (*Optional*, :ref:`templatable <config-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 <config-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
|
||||
|
@ -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
|
||||
---------------------------
|
||||
|
@ -377,6 +377,7 @@ All Conditions
|
||||
- :ref:`script.is_running <script-is_running_condition>`
|
||||
- :ref:`sun.is_above_horizon / sun.is_below_horizon <sun-is_above_below_horizon-condition>`
|
||||
- :ref:`text_sensor.state <text_sensor-state_condition>`
|
||||
- :ref:`light.is_on <binary_sensor-is_on_condition>` / :ref:`light.is_off <light-is_off_condition>`
|
||||
|
||||
All Lambda Calls
|
||||
----------------
|
||||
|
Loading…
Reference in New Issue
Block a user