๐ก Rooms
Rooms offer a method to coordinate multiple entities together. This is primarily accomplished through the generation of scenes and other related entities, then using those to coordinate other entities.
๐ Room Detailsโ
For the most part, rooms are intended to manage themselves and there are no directly required interactions for the object itself.
Property | Type | Description |
---|---|---|
scene | string | The current scene of the room. Can be assigned to as shorthand the same service call |
currentSceneDefinition | object | The definition of the current scene, detailing light and sensor settings. |
currentSceneEntity | sensor entity | The virtual sensor entity representing the current scene in the room. |
sceneId | helper | A function to get the Home Assistant entity ID of a specified scene. |
๐ Exampleโ
Create rooms, with the ability to coordinate sets of entities together in scenes.
import { CronExpression, TServiceParams } from "@digital-alchemy/core";
export function ExampleRoom({
automation,
scheduler,
hass,
context,
}: TServiceParams) {
// generate a room with scenes, sensors, etc
const room = automation.room({
context,
name: "Example",
scenes: {
high: {
definition: {
"light.ceiling_fan": { brightness: 255, state: "on" },
},
friendly_name: "High",
},
off: {
definition: {
"light.ceiling_fan": { state: "off" },
},
friendly_name: "Off",
},
},
});
// easy bindings for setting scene
scheduler.cron({
exec: () => (room.scene = "high"),
schedule: CronExpression.EVERY_DAY_AT_8AM,
});
// or set it through the service
scheduler.cron({
exec: async () => await hass.call.scene.turn_on({
entity_id: "scene.example_off"
}),
schedule: CronExpression.EVERY_DAY_AT_8PM,
});
return room;
}
Aggressive Scenesโ
๐ Descriptionโ
Aggressive scenes are a service to assist rooms, and don't have a lot of use to external applications. It is best interacted with via config properties.
โ๏ธ Configurationโ
Disable globally with AGGRESSIVE_SCENES switch
Set up a room with scenes that can be set, but with the aggressive
export function Example({ automation }: TServiceParams) {
automation.room({
context,
name: "Kitchen",
scenes: {
high: {
aggressive: false,
definition: {
"switch.bar_light": { state: "on" },
"switch.dining_room_light": { state: "on" },
"switch.kitchen_light": { state: "on" },
},
friendly_name: "High",
},
off: {
aggressive: false,
definition: {
"switch.bar_light": { state: "off" },
"switch.dining_room_light": { state: "off" },
"switch.kitchen_light": { state: "off" },
},
friendly_name: "Off",
},
},
});
}
Light Managerโ
The light manager is an internal utility, intended to support rooms as they manipulate lights.
๐ก Circadian Mode Lightsโ
If lights aren't flagged as being in a particular color, then the light manager will work to manage the lights in circadian mode. As the target changes, the lights will have their current target temperature changed.
This is intended to work as a continual process, updating a set number of entities at once at a constant rate.
๐ Design noteโ
Warning: The default values are tight already. Lower is not better.
A non-obvious effect of decreasing the diff threshold is increased light.turn_on
calls. By increasing the rate at which these happen, you will experience more situations where a turn_off
command as a result of a scene set (or similar) will conflict with the turn_on
used to change the temperature.