Components Home Assistant "Light”

3 minutes of reading
Proconductor: Home Assistant Community
Availability: included in thepersonale HUB Home Assistant
Category: software
Type: components Home Assistant
Implementation difficulties: dependent on the light platform used

The component "Light” is the founder of the platforms Home Assistant dedicated to the integration of lights, where "lights" means different types of sources luminose, from classic bulbs to LEDs, passing through adjustable or other lights. All, of course, home automation or domotizzate.

The platforms connected to this component they are different, over fifty: they are listed at the component page (right column) at the site of Home Assistant.

Services

The integration of this component provides three basic services:

turn_onTurn on the light o groups of lights.
turn_offTurn off the light or groups of lights.
toggleReverses the state of the light (turns it on if previously off, turns it off if previously on)

"Turn_on" service

If evoked, it turns on the light. Not all integrations support it (see the reference platform).
The attributes supported by the service (but not by all the platforms connected to the component) are:

Service data attributesOptionalDescription
entity_idYupentity specification on which to implement the service
transitionYupnumber of seconds to go from one state to another (increasing / decreasing light)
profilletYupstring indicating the name of one of proavailable basic wires of Home Assistant (relax, energize etc.) or one of the procustom wires defined in the file "light_profiles.csv”Present in the home directory of Home Assistant. THE prowires define the xy and one color coordinates lumiof brilliance.
hs_colorYupa list containing two decimals that rappthey give color and saturation to set the light. The scale is 0-360 for the hue color and 0-100 for saturation.
xy_colorYupa list containing two decimals that rappshow the xy coordinates of the color to be set. Help in defining color can come from this page.
RGB_COLORYupa list containing three integers (range 0-255) rappshowing a RGB color coded. Let it be clear that this value varies only the color, not the color lumibrightness of light.
white_valueYupan integer (range 0-255) that rappresists the lumibrightness to be set on the white LED light.
color_tempYupan integer that rappresists the color temperature of the light emitted by the light, expressed in mired.
kelvinYupalternatively, a value that rappresists the temperature in degrees kelvin.
color_nameYupthe color of the light expressed with an intelligible string. A handy list is available here.
brightnessYupan integer (range 0-255) that rappresists the lumibrightness to be set on the light.
brightness_pctYupalternatively, a value (range 0-100) that rappresists the lumipercentage to be set on the light.
flashYupto indicate the light to flash. The value can be either "long" that "short"
effectYupappan effect like "colorloop" or "random". Dependent on the platform in use. For example the platform "Flux Led / Magic Light”Provides several.

To automatically set a status to a light in terms of color and lumiwhen the light is switched on it is sufficient to create a file "light_profiles.csv"(As anticipated by the service attributeprofillet) in which to set the defaults.

The suffix ".default"Should be added to each entity whether you want to customize (eg light.cucina: light.cucina.default). To define a default for all lights, set group.all_lights.default. Any further specific customization on a light overrides the group default setting.

"Turn_off" service

If summoned, turn off the light. Not all integrations support it (see the reference platform).
The attributes supported by the service are:

Service data attributesOptionalDescription
entity_idYupspecific entity on which to implement the service
transitionYupnumber of seconds to switch from one state to another (increasing / decreasing light).
Attribute available only on some platforms.

"Toggle" service

Reverses the state of the light (turns it on if previously off, turns it off if previously on).
The attributes supported by the service are:

Service data attributesOptionalDescription
entity_idYupspecific entity on which to implement the service
transitionYupnumber of seconds to switch from one state to another (increasing / decreasing light).
Attribute available only on some platforms.

Example of automation

Let's see aautomation for example:

automation:
- id: Auto luce
  alias: Accende una luce in caso di rilevazione di movimento
  trigger:
    - platform: state
      entity_id: binary_sensor.rilevatore
      to: 'on'
  action:
    - service: light.turn_on
      data:
        entity_id: light.salotto
        brightness: 255
        kelvin: 2700


Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.


Please comment below