Lučke custom presets
This commit is contained in:
parent
717340a3dd
commit
b46ba4fe84
2 changed files with 50 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue