File: scenario.py

package info (click to toggle)
python-boschshcpy 0.2.92-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 268 kB
  • sloc: python: 3,343; makefile: 4; sh: 4
file content (29 lines) | stat: -rw-r--r-- 689 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from .api import SHCAPI


class SHCScenario:
    def __init__(self, api: SHCAPI, raw_scenario):
        self._api = api
        self._raw_scenario = raw_scenario

    @property
    def id(self):
        return self._raw_scenario["id"]

    @property
    def icon_id(self):
        return self._raw_scenario["iconId"]

    @property
    def name(self):
        return self._raw_scenario["name"]

    def trigger(self):
        return self._api._post_api_or_fail(
            f"{self._api._api_root}/scenarios/{self.id}/triggers", ""
        )

    def summary(self):
        print(f"scenario: {self.id}")
        print(f"  Name   : {self.name}")
        print(f"  Icon Id: {self.icon_id}")