Gisle Aune
1 year ago
17 changed files with 666 additions and 363 deletions
-
685frontend/package-lock.json
-
1frontend/src/lib/client/lucifer.ts
-
0frontend/src/lib/components/DeviceIcon.svelte
-
28frontend/src/lib/components/Lamp.svelte
-
103frontend/src/lib/contexts/StateContext.svelte
-
15frontend/src/lib/models/assignment.ts
-
3frontend/src/lib/models/device.ts
-
37frontend/src/lib/models/script.ts
-
10frontend/src/lib/models/uistate.ts
-
26frontend/src/routes/+page.svelte
-
1go.mod
-
2go.sum
-
56services/httpapiv1/service.go
-
4services/hue/bridge.go
-
2services/uistate/data.go
-
4services/uistate/patch.go
-
26services/uistate/service.go
685
frontend/package-lock.json
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,15 @@ |
|||
import type { State } from "./device" |
|||
|
|||
export default interface Assignment { |
|||
id: string |
|||
deviceIds: string[] |
|||
effect: Effect |
|||
variables: Record<string, number> |
|||
} |
|||
|
|||
export type Effect = |
|||
| { manual: State } |
|||
| { gradient: { states: State[], animationMs: number, reverse: boolean, interpolate: boolean } } |
|||
| { pattern: { states: State[], animationMs: number } } |
|||
| { random: { states: State[], animationMs: number, interpolate: boolean } } |
|||
| { vrange: { states: State[], variable: string, min: number, max: number } } |
@ -0,0 +1,37 @@ |
|||
import type { Effect } from "./assignment" |
|||
|
|||
export default interface Script { |
|||
name: string |
|||
lines: ScriptLine[] |
|||
} |
|||
|
|||
export interface ScriptLine { |
|||
if: ScriptLineIf |
|||
assign: ScriptLineAssign |
|||
set: ScriptLineSet |
|||
} |
|||
|
|||
export interface ScriptLineIf { |
|||
condition: ScriptCondition |
|||
then: ScriptLine[] |
|||
else: ScriptLine[] |
|||
} |
|||
|
|||
export interface ScriptCondition { |
|||
scope: string |
|||
key: string |
|||
op: string |
|||
value?: string |
|||
not?: boolean |
|||
} |
|||
|
|||
export interface ScriptLineAssign { |
|||
match: string |
|||
effect: Effect |
|||
} |
|||
|
|||
export interface ScriptLineSet { |
|||
scope: string |
|||
key: string |
|||
value: string |
|||
} |
@ -1,5 +1,15 @@ |
|||
import type Assignment from "./assignment"; |
|||
import type Device from "./device"; |
|||
import type Script from "./script"; |
|||
|
|||
export default interface UIState { |
|||
devices: {[id: string]: Device} |
|||
assignments: {[id: string]: Assignment} |
|||
scripts: {[id: string]: Script} |
|||
} |
|||
|
|||
export interface UIStatePatch { |
|||
device: Partial<Device> & { id: string, delete?: boolean } |
|||
assignment: Partial<Assignment> & { id: string, delete?: boolean } |
|||
script: Partial<Script> & { id: string, delete?: boolean } |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue