Skip to content
This repository was archived by the owner on Feb 19, 2024. It is now read-only.

Commit 2a76dc9

Browse files
author
Zoe
committed
management tweaks
1 parent 13a9bc8 commit 2a76dc9

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

libs/automation-logic/src/services/aggressive-scenes.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ export class AggressiveScenesService {
8989
);
9090
return;
9191
}
92-
await this.matchSwitchToScene(child, expected);
92+
if (child.state !== expected.state) {
93+
await this.matchSwitchToScene(child, expected);
94+
}
9395
});
9496
}
9597
}

libs/automation-logic/src/services/light-manager.service.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from "../includes";
1818
import { CircadianService, ColorLight } from "./circadian.service";
1919

20-
const MAX_DIFFERENCE = 10;
20+
const MAX_DIFFERENCE = 100;
2121
@Injectable()
2222
export class LightMangerService {
2323
constructor(
@@ -112,23 +112,28 @@ export class LightMangerService {
112112
): Promise<boolean> {
113113
const stateTests = {
114114
brightness: entity.attributes.brightness === state.brightness,
115-
color: this.lightInRange(entity),
116115
state: entity.state === state.state,
116+
temperature: this.lightInRange(entity),
117117
};
118118
// ? Find things that don't currently match expectations
119119
const reasons = Object.keys(stateTests).filter(key => !stateTests[key]);
120120
if (is.empty(reasons)) {
121121
return false;
122122
}
123123
this.logger.debug(
124-
{ reasons, state },
125-
`[%s] setting light {temperature}`,
126-
entity.entity_id,
124+
{
125+
from: entity.attributes.color_temp_kelvin,
126+
name: entity.entity_id,
127+
reasons,
128+
state,
129+
to: this.circadian.kelvin,
130+
},
131+
`setting light {temperature}`,
127132
);
128133
await this.call.light.turn_on({
129134
brightness: state.brightness,
130135
entity_id: entity.entity_id,
131-
rgb_color: state.rgb_color,
136+
kelvin: this.circadian.kelvin,
132137
});
133138
return true;
134139
}

libs/automation-logic/src/services/scene-room.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,12 @@ export class SceneRoomService {
278278
new Promise<void>(async done => {
279279
await eachSeries(
280280
Object.keys(lights),
281-
async (id: PICK_ENTITY<"light">) => {
282-
const change = lights[id];
283-
this.eventEmitter.emit(SCENE_SET_ENTITY, id);
281+
async (entity_id: PICK_ENTITY<"light">) => {
282+
const change = lights[entity_id];
283+
this.eventEmitter.emit(SCENE_SET_ENTITY, entity_id);
284284
await this.call.light.turn_on({
285285
brightness: change.brightness,
286-
entity_id: id,
286+
entity_id,
287287
kelvin: change.kelvin,
288288
});
289289
},

0 commit comments

Comments
 (0)