diff --git a/controller/lucke/luckeControl.py b/controller/lucke/luckeControl.py index 01a46da..60fece0 100644 --- a/controller/lucke/luckeControl.py +++ b/controller/lucke/luckeControl.py @@ -31,6 +31,14 @@ async def setLight(client, lightNum, intensity: int): else: print("setLight error:", resp.status, await resp.text()) +async def saveScene(client, sceneNum): + endpoint = url + f"/rest/v2/fri-fkkt/lecture-halls/{roomId}/scenes/{sceneNum}/save" + async with aiohttp.request("GET", endpoint, headers={"Authorization": "Bearer " + lucke_bearer_token}) as resp: + if resp.status == 204: + pass + else: + print("saveScene error:", resp.status, await resp.text()) + async def task_luckeCommand(controlClient): await controlClient.subscribe(f"{room}/lucke/#") @@ -42,6 +50,11 @@ async def task_luckeCommand(controlClient): print("Received: " + str(mesg.topic) + " payload: [" + sceneNum + "]") await sendSceneRequest(controlClient, sceneNum) + elif mesg.topic.matches(f"{room}/lucke/preset/save"): + sceneNum = mesg.payload.decode() + print("Received: " + str(mesg.topic) + " payload: [" + sceneNum + "]") + await saveScene(controlClient, sceneNum) + elif mesg.topic.matches(f"{room}/lucke/set/+"): lightNum = mesg.topic.value.rsplit("/", maxsplit=1)[-1] try: diff --git a/frontend/src/components/pages/LightingPage.vue b/frontend/src/components/pages/LightingPage.vue index 1bd86aa..1d439af 100644 --- a/frontend/src/components/pages/LightingPage.vue +++ b/frontend/src/components/pages/LightingPage.vue @@ -86,6 +86,9 @@ function publishMQTTMsg(topic: string, msg: string) { const publishPrefix = ref(props.room + '/') +// TODO: unhardcode +const showCustom = true; + // TODO: un-hard-code this const lights = [ { @@ -129,24 +132,40 @@ const lights = [