set actor power added to api

This commit is contained in:
avollkopf 2023-03-04 15:03:21 +01:00
parent 6d5fd493df
commit 2c978400b9
2 changed files with 34 additions and 1 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.1.3"
__version__ = "4.1.4"
__codename__ = "Groundhog Day"

View file

@ -250,4 +250,37 @@ class ActorHttpEndpoints():
#print(data)
await self.controller.call_action(actor_id, data.get("action"), data.get("parameter"))
return web.Response(status=204)
@request_mapping(path="/{id}/set_power", method="POST", auth_required=auth)
async def http_set_power(self, request) -> web.Response:
"""
---
description: Set actor power
tags:
- Actor
parameters:
- name: "id"
in: "path"
description: "Actor ID"
required: true
type: "integer"
format: "int64"
- in: body
name: body
description: Set Power
required: true
schema:
type: object
properties:
temp:
type: integer
responses:
"204":
description: successful operation
"""
id = request.match_info['id']
data = await request.json()
await self.controller.set_power(id,data.get("power"))
return web.Response(status=204)