tangled
alpha
login
or
join now
zzstoatzz.io
/
solux
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
dim all phases - cap brightness at 120
zzstoatzz.io
2 months ago
1d3a1e60
84fc4f7f
+18
-10
2 changed files
expand all
collapse all
unified
split
.env.example
src
solux
controller.py
+7
.env.example
···
0
0
0
0
0
0
0
···
1
+
# prefect cloud credentials (from `prefect profile inspect pond`)
2
+
PREFECT_API_URL=https://api.prefect.cloud/api/accounts/.../workspaces/...
3
+
PREFECT_API_KEY=pnu_...
4
+
5
+
# hue bridge credentials
6
+
HUE_BRIDGE_IP=192.168.0.165
7
+
HUE_BRIDGE_USERNAME=your-username-here
+11
-10
src/solux/controller.py
···
28
29
30
# lighting phases anchored to sun position
0
31
PHASES: list[Phase] = [
32
Phase(
33
name="dawn",
34
get_start=lambda s: s.dawn,
35
-
state=LightState(bri=80, ct=400),
36
),
37
Phase(
38
name="sunrise",
39
get_start=lambda s: s.sunrise,
40
-
state=LightState(bri=180, ct=300),
41
),
42
Phase(
43
name="morning",
44
get_start=lambda s: s.sunrise + timedelta(hours=1),
45
-
state=LightState(bri=254, ct=220),
46
),
47
Phase(
48
name="midday",
49
get_start=lambda s: s.noon,
50
-
state=LightState(bri=254, ct=200),
51
),
52
Phase(
53
name="afternoon",
54
get_start=lambda s: s.noon + timedelta(hours=3),
55
-
state=LightState(bri=230, ct=280),
56
),
57
Phase(
58
name="golden_hour",
59
get_start=lambda s: s.sunset - timedelta(hours=1),
60
-
state=LightState(bri=180, ct=370),
61
),
62
Phase(
63
name="sunset",
64
get_start=lambda s: s.sunset,
65
-
state=LightState(bri=120, ct=420),
66
),
67
Phase(
68
name="dusk",
69
get_start=lambda s: s.dusk,
70
-
state=LightState(bri=80, ct=470),
71
),
72
Phase(
73
name="evening",
74
get_start=lambda s: s.dusk + timedelta(hours=1),
75
-
state=LightState(bri=50, ct=500),
76
),
77
Phase(
78
name="night",
79
get_start=lambda s: s.dusk + timedelta(hours=3),
80
-
state=LightState(bri=25, ct=500),
81
),
82
]
83
···
28
29
30
# lighting phases anchored to sun position
31
+
# brightness capped at 120 - never too bright
32
PHASES: list[Phase] = [
33
Phase(
34
name="dawn",
35
get_start=lambda s: s.dawn,
36
+
state=LightState(bri=40, ct=400),
37
),
38
Phase(
39
name="sunrise",
40
get_start=lambda s: s.sunrise,
41
+
state=LightState(bri=80, ct=300),
42
),
43
Phase(
44
name="morning",
45
get_start=lambda s: s.sunrise + timedelta(hours=1),
46
+
state=LightState(bri=120, ct=220),
47
),
48
Phase(
49
name="midday",
50
get_start=lambda s: s.noon,
51
+
state=LightState(bri=120, ct=200),
52
),
53
Phase(
54
name="afternoon",
55
get_start=lambda s: s.noon + timedelta(hours=3),
56
+
state=LightState(bri=100, ct=280),
57
),
58
Phase(
59
name="golden_hour",
60
get_start=lambda s: s.sunset - timedelta(hours=1),
61
+
state=LightState(bri=80, ct=370),
62
),
63
Phase(
64
name="sunset",
65
get_start=lambda s: s.sunset,
66
+
state=LightState(bri=60, ct=420),
67
),
68
Phase(
69
name="dusk",
70
get_start=lambda s: s.dusk,
71
+
state=LightState(bri=40, ct=470),
72
),
73
Phase(
74
name="evening",
75
get_start=lambda s: s.dusk + timedelta(hours=1),
76
+
state=LightState(bri=30, ct=500),
77
),
78
Phase(
79
name="night",
80
get_start=lambda s: s.dusk + timedelta(hours=3),
81
+
state=LightState(bri=15, ct=500),
82
),
83
]
84