The scenes are defined by the configuration of theHUB and determine the creation of entities called "scene.nome_della_scena"; these entities, associated with the service "scene.turn_on“, Mean that the entities included in them assume the indicated status.
If, for example, we wanted to define a "good night" scene in which all the lights were turned off, it would be possible to do so through a scene in which we would indicate all the entities involved associated with the state "off". Performing "scene.turn_on"Associated with the entity" scenes. Goodnight ", all the lights (indicated) would go out in unison.
The interesting thing is that the scene type entities can be easily exposed to the smart speakers, thus allowing us to execute them through voice commands.
|Nb Starting from the version 0.102.x of Home Assistant a convenient visual editor for defining scenes has been added.|
Let's take an example of a scene:
scene: - name: TV entities: light.artemide: off light.angolo: off light.led_tv: state: true xy_color: [0.33, 0.66] brightness: 200
This scene, called "scene.tv", Causes the lights in the room ("light.artemide" and "light.angolo") Turn off and the light" light.led_tv "turns on: being a RGB light (like the controllers Magic Home, Or Philips HUE, for example), the default color and level are also set lumiof brilliance.
As easy to imagine, it is possible to define how many scenes you want.
|Nb For a limitation proit is not possible to set - in the same scene - multiple states for the same entity. In case it is necessary to do this, it is more advisable to use a sequence through script.|
How to evoke scenes
As anticipated, an excellent field of appThe scene speakers are the smart speakers, but not only.
also the automations di Home Assistant are a scope of applished here very typical: automatically performing a scene in the face of a specific condition (trivially, returning home) is particularly convenient.
To evoke a scene, the syntax in automation is very simple:
automation: alias: "Automazione scena" trigger:  condition:  action: service: scene.turn_on entity_id: scene.nomescena
According to trigger chosen, automation "automation.automazione_scena” provvede to perform the indicated scene (in the example, "scene.nomescena"