ucapi 0.5.0__tar.gz → 0.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ucapi-0.5.0 → ucapi-0.5.2}/CHANGELOG.md +12 -0
- {ucapi-0.5.0/ucapi.egg-info → ucapi-0.5.2}/PKG-INFO +1 -1
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/hello_integration.py +1 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/remote.py +1 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/setup_flow.py +1 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/__init__.py +1 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/_version.py +3 -3
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/api.py +4 -3
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/entity.py +11 -0
- ucapi-0.5.2/ucapi/ir_emitter.py +93 -0
- ucapi-0.5.2/ucapi/select.py +88 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/sensor.py +38 -3
- {ucapi-0.5.0 → ucapi-0.5.2/ucapi.egg-info}/PKG-INFO +1 -1
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi.egg-info/SOURCES.txt +2 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/CONTRIBUTING.md +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/LICENSE +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/README.md +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/docs/code_guidelines.md +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/docs/setup.md +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/README.md +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/hello_integration.json +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/remote.json +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/remote_ui_page.json +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/setup_flow.json +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/voice.json +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/examples/voice.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/pyproject.toml +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/requirements.txt +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/scripts/compile_protos.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/setup.cfg +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/test-requirements.txt +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/tests/test_api.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/tests/test_voice_assistant.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/api_definitions.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/button.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/climate.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/cover.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/entities.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/light.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/media_player.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/proto/__init__.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/proto/ucr_integration_voice.proto +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/proto/ucr_integration_voice_pb2.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/proto/ucr_integration_voice_pb2.pyi +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/remote.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/switch.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/ui.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/voice_assistant.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi/voice_stream.py +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi.egg-info/dependency_links.txt +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi.egg-info/requires.txt +0 -0
- {ucapi-0.5.0 → ucapi-0.5.2}/ucapi.egg-info/top_level.txt +0 -0
|
@@ -11,6 +11,18 @@ _Changes in the next release_
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## v0.5.2 - 2026-01-30
|
|
15
|
+
### Added
|
|
16
|
+
- Add Select Entity support by @JackJPowell ([#44](https://github.com/unfoldedcircle/integration-python-library/pull/44)).
|
|
17
|
+
- Add IR Emitter Entity support by @JackJPowell ([#45](https://github.com/unfoldedcircle/integration-python-library/pull/45)).
|
|
18
|
+
|
|
19
|
+
## v0.5.1 - 2025-12-19
|
|
20
|
+
### Added
|
|
21
|
+
- Add binary sensor device class and common entity states enum ([#40](https://github.com/unfoldedcircle/integration-python-library/pull/40)).
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Optional event loop argument in IntegrationAPI constructor ([#41](https://github.com/unfoldedcircle/integration-python-library/pull/41)).
|
|
25
|
+
|
|
14
26
|
## v0.5.0 - 2025-12-17
|
|
15
27
|
### Breaking Changes
|
|
16
28
|
- Enhance entity command handler with WS client connection parameter in `CommandHandler` callback and `Entity.command`
|
|
@@ -44,6 +44,7 @@ from .cover import Cover # noqa: F401
|
|
|
44
44
|
from .light import Light # noqa: F401
|
|
45
45
|
from .media_player import MediaPlayer # noqa: F401
|
|
46
46
|
from .remote import Remote # noqa: F401
|
|
47
|
+
from .select import Select # noqa: F401
|
|
47
48
|
from .sensor import Sensor # noqa: F401
|
|
48
49
|
from .switch import Switch # noqa: F401
|
|
49
50
|
from .voice_assistant import VoiceAssistant # noqa: F401
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.5.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 5,
|
|
31
|
+
__version__ = version = '0.5.2'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 5, 2)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g08c18e023'
|
|
@@ -75,13 +75,14 @@ class IntegrationAPI:
|
|
|
75
75
|
|
|
76
76
|
DEFAULT_VOICE_SESSION_TIMEOUT_S: int = 30
|
|
77
77
|
|
|
78
|
-
def __init__(self, loop: AbstractEventLoop):
|
|
78
|
+
def __init__(self, loop: AbstractEventLoop | None = None):
|
|
79
79
|
"""
|
|
80
80
|
Create an integration driver API instance.
|
|
81
81
|
|
|
82
|
-
:param loop: event loop
|
|
82
|
+
:param loop: optional event loop. The currently running event loop is used if
|
|
83
|
+
not provided.
|
|
83
84
|
"""
|
|
84
|
-
self._loop = loop
|
|
85
|
+
self._loop = loop if loop else asyncio.get_event_loop()
|
|
85
86
|
self._events = AsyncIOEventEmitter(self._loop)
|
|
86
87
|
|
|
87
88
|
self._setup_handler: uc.SetupHandler | None = None
|
|
@@ -25,12 +25,23 @@ class EntityTypes(str, Enum):
|
|
|
25
25
|
LIGHT = "light"
|
|
26
26
|
MEDIA_PLAYER = "media_player"
|
|
27
27
|
REMOTE = "remote"
|
|
28
|
+
SELECT = "select"
|
|
28
29
|
SENSOR = "sensor"
|
|
29
30
|
SWITCH = "switch"
|
|
30
31
|
IR_EMITTER = "ir_emitter"
|
|
31
32
|
VOICE_ASSISTANT = "voice_assistant"
|
|
32
33
|
|
|
33
34
|
|
|
35
|
+
class CommonStates(str, Enum):
|
|
36
|
+
"""Common entity states available in all entities."""
|
|
37
|
+
|
|
38
|
+
UNAVAILABLE = "UNAVAILABLE"
|
|
39
|
+
"""The entity is currently not available.
|
|
40
|
+
The UI will render the entity as inactive until the entity becomes active again."""
|
|
41
|
+
UNKNOWN = "UNKNOWN"
|
|
42
|
+
"""The entity is available but the current state is unknown."""
|
|
43
|
+
|
|
44
|
+
|
|
34
45
|
class Entity:
|
|
35
46
|
"""
|
|
36
47
|
Entity base class.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""
|
|
2
|
+
IR Emitter entity definitions.
|
|
3
|
+
|
|
4
|
+
:copyright: (c) 2023 by Unfolded Circle ApS.
|
|
5
|
+
:license: MPL-2.0, see LICENSE for more details.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from enum import Enum
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from .api_definitions import CommandHandler
|
|
12
|
+
from .entity import Entity, EntityTypes
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class States(str, Enum):
|
|
16
|
+
"""IR Emitter entity states."""
|
|
17
|
+
|
|
18
|
+
UNAVAILABLE = "UNAVAILABLE"
|
|
19
|
+
UNKNOWN = "UNKNOWN"
|
|
20
|
+
ON = "ON"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Features(str, Enum):
|
|
24
|
+
"""IR Emitter entity features."""
|
|
25
|
+
|
|
26
|
+
SEND_IR = "send_ir"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Attributes(str, Enum):
|
|
30
|
+
"""IR Emitter entity attributes."""
|
|
31
|
+
|
|
32
|
+
STATE = "state"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Commands(str, Enum):
|
|
36
|
+
"""IR Emitter entity commands."""
|
|
37
|
+
|
|
38
|
+
SEND_IR = "send_ir"
|
|
39
|
+
STOP_IR = "stop_ir"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class DeviceClasses(str, Enum):
|
|
43
|
+
"""IR Emitter entity device classes."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Options(str, Enum):
|
|
47
|
+
"""IR Emitter entity options."""
|
|
48
|
+
|
|
49
|
+
PORTS = "ports"
|
|
50
|
+
IR_FORMATS = "ir_formats"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class IREmitter(Entity):
|
|
54
|
+
"""
|
|
55
|
+
IR Emitter entity class.
|
|
56
|
+
|
|
57
|
+
See https://github.com/unfoldedcircle/core-api/blob/main/doc/entities/entity_ir_emitter.md
|
|
58
|
+
for more information.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
# pylint: disable=R0917
|
|
62
|
+
def __init__(
|
|
63
|
+
self,
|
|
64
|
+
identifier: str,
|
|
65
|
+
name: str | dict[str, str],
|
|
66
|
+
features: list[Features],
|
|
67
|
+
attributes: dict[str, Any],
|
|
68
|
+
*,
|
|
69
|
+
options: dict[str, Any] | None = None,
|
|
70
|
+
area: str | None = None,
|
|
71
|
+
cmd_handler: CommandHandler = None,
|
|
72
|
+
):
|
|
73
|
+
"""
|
|
74
|
+
Create IR Emitter instance.
|
|
75
|
+
|
|
76
|
+
:param identifier: entity identifier
|
|
77
|
+
:param name: friendly name
|
|
78
|
+
:param features: IR Emitter features
|
|
79
|
+
:param attributes: IR Emitter attributes
|
|
80
|
+
:param options: IR Emitter options
|
|
81
|
+
:param area: optional area
|
|
82
|
+
:param cmd_handler: handler for entity commands
|
|
83
|
+
"""
|
|
84
|
+
super().__init__(
|
|
85
|
+
identifier,
|
|
86
|
+
name,
|
|
87
|
+
EntityTypes.IR_EMITTER,
|
|
88
|
+
features,
|
|
89
|
+
attributes,
|
|
90
|
+
options=options,
|
|
91
|
+
area=area,
|
|
92
|
+
cmd_handler=cmd_handler,
|
|
93
|
+
)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Switch entity definitions.
|
|
3
|
+
|
|
4
|
+
:copyright: (c) 2023 by Unfolded Circle ApS.
|
|
5
|
+
:license: MPL-2.0, see LICENSE for more details.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from enum import Enum
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from .api_definitions import CommandHandler
|
|
12
|
+
from .entity import Entity, EntityTypes
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class States(str, Enum):
|
|
16
|
+
"""Select entity states."""
|
|
17
|
+
|
|
18
|
+
UNAVAILABLE = "UNAVAILABLE"
|
|
19
|
+
UNKNOWN = "UNKNOWN"
|
|
20
|
+
ON = "ON"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Features(str, Enum):
|
|
24
|
+
"""Select entity features."""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Attributes(str, Enum):
|
|
28
|
+
"""Select entity attributes."""
|
|
29
|
+
|
|
30
|
+
STATE = "state"
|
|
31
|
+
CURRENT_OPTION = "current_option"
|
|
32
|
+
OPTIONS = "options"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Commands(str, Enum):
|
|
36
|
+
"""Select entity commands."""
|
|
37
|
+
|
|
38
|
+
SELECT_OPTION = "select_option"
|
|
39
|
+
SELECT_FIRST = "select_first"
|
|
40
|
+
SELECT_LAST = "select_last"
|
|
41
|
+
SELECT_NEXT = "select_next"
|
|
42
|
+
SELECT_PREVIOUS = "select_previous"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class DeviceClasses(str, Enum):
|
|
46
|
+
"""Select entity device classes."""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class Options(str, Enum):
|
|
50
|
+
"""Select entity options."""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class Select(Entity):
|
|
54
|
+
"""
|
|
55
|
+
Select entity class.
|
|
56
|
+
|
|
57
|
+
See https://github.com/unfoldedcircle/core-api/blob/main/doc/entities/entity_select.md
|
|
58
|
+
for more information.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
# pylint: disable=R0917
|
|
62
|
+
def __init__(
|
|
63
|
+
self,
|
|
64
|
+
identifier: str,
|
|
65
|
+
name: str | dict[str, str],
|
|
66
|
+
attributes: dict[str, Any],
|
|
67
|
+
*,
|
|
68
|
+
area: str | None = None,
|
|
69
|
+
cmd_handler: CommandHandler = None,
|
|
70
|
+
):
|
|
71
|
+
"""
|
|
72
|
+
Create select-entity instance.
|
|
73
|
+
|
|
74
|
+
:param identifier: entity identifier
|
|
75
|
+
:param name: friendly name
|
|
76
|
+
:param attributes: select attributes
|
|
77
|
+
:param area: optional area
|
|
78
|
+
:param cmd_handler: handler for entity commands
|
|
79
|
+
"""
|
|
80
|
+
super().__init__(
|
|
81
|
+
identifier,
|
|
82
|
+
name,
|
|
83
|
+
EntityTypes.SELECT,
|
|
84
|
+
[],
|
|
85
|
+
attributes,
|
|
86
|
+
area=area,
|
|
87
|
+
cmd_handler=cmd_handler,
|
|
88
|
+
)
|
|
@@ -15,8 +15,12 @@ class States(str, Enum):
|
|
|
15
15
|
"""Sensor entity states."""
|
|
16
16
|
|
|
17
17
|
UNAVAILABLE = "UNAVAILABLE"
|
|
18
|
+
"""The sensor is currently not available.
|
|
19
|
+
The UI will render the sensor as inactive until the sensor becomes active again."""
|
|
18
20
|
UNKNOWN = "UNKNOWN"
|
|
21
|
+
"""The sensor is available but the current state is unknown."""
|
|
19
22
|
ON = "ON"
|
|
23
|
+
"""The sensor is available and providing measurements."""
|
|
20
24
|
|
|
21
25
|
|
|
22
26
|
class Features(str, Enum):
|
|
@@ -27,8 +31,11 @@ class Attributes(str, Enum):
|
|
|
27
31
|
"""Sensor entity attributes."""
|
|
28
32
|
|
|
29
33
|
STATE = "state"
|
|
34
|
+
"""Optional state of the sensor."""
|
|
30
35
|
VALUE = "value"
|
|
36
|
+
"""The native measurement value of the sensor."""
|
|
31
37
|
UNIT = "unit"
|
|
38
|
+
"""Optional unit of the ``value`` if no default unit is set."""
|
|
32
39
|
|
|
33
40
|
|
|
34
41
|
class Commands(str, Enum):
|
|
@@ -36,33 +43,61 @@ class Commands(str, Enum):
|
|
|
36
43
|
|
|
37
44
|
|
|
38
45
|
class DeviceClasses(str, Enum):
|
|
39
|
-
"""Sensor entity device classes.
|
|
46
|
+
"""Sensor entity device classes.
|
|
47
|
+
|
|
48
|
+
See https://unfoldedcircle.github.io/core-api/entities/entity_sensor.html
|
|
49
|
+
for more information about binary sensors.
|
|
50
|
+
"""
|
|
40
51
|
|
|
41
52
|
CUSTOM = "custom"
|
|
53
|
+
"""Generic sensor with custom unit"""
|
|
42
54
|
BATTERY = "battery"
|
|
55
|
+
"""Battery charge in %"""
|
|
43
56
|
CURRENT = "current"
|
|
57
|
+
"""Electrical current in ampere"""
|
|
44
58
|
ENERGY = "energy"
|
|
59
|
+
"""Energy in kilowatt-hour"""
|
|
45
60
|
HUMIDITY = "humidity"
|
|
61
|
+
"""Humidity in %"""
|
|
46
62
|
POWER = "power"
|
|
63
|
+
"""Power in watt or kilowatt"""
|
|
47
64
|
TEMPERATURE = "temperature"
|
|
48
65
|
VOLTAGE = "voltage"
|
|
66
|
+
"""Voltage in volt"""
|
|
67
|
+
BINARY = "binary"
|
|
68
|
+
"""Binary sensor.
|
|
69
|
+
The binary specific device class is stored in the ``unit`` attribute."""
|
|
49
70
|
|
|
50
71
|
|
|
51
72
|
class Options(str, Enum):
|
|
52
73
|
"""Sensor entity options."""
|
|
53
74
|
|
|
54
75
|
CUSTOM_UNIT = "custom_unit"
|
|
76
|
+
"""Unit label for a custom sensor if device_class is not specified or to override
|
|
77
|
+
a default unit."""
|
|
55
78
|
NATIVE_UNIT = "native_unit"
|
|
79
|
+
"""The sensor's native unit of measurement to perform automatic conversion.
|
|
80
|
+
Applicable to device classes: ``temperature``."""
|
|
56
81
|
DECIMALS = "decimals"
|
|
82
|
+
"""Number of decimal places to show in the UI if the sensor provides the measurement
|
|
83
|
+
as a number. Not applicable to string values."""
|
|
57
84
|
MIN_VALUE = "min_value"
|
|
85
|
+
"""Not yet supported.
|
|
86
|
+
|
|
87
|
+
Optional minimum value of the sensor output. This can be used in the UI for graphs
|
|
88
|
+
or gauges."""
|
|
58
89
|
MAX_VALUE = "max_value"
|
|
90
|
+
"""Not yet supported.
|
|
91
|
+
|
|
92
|
+
Optional maximum value of the sensor output. This can be used in the UI for graphs
|
|
93
|
+
or gauges."""
|
|
59
94
|
|
|
60
95
|
|
|
61
96
|
class Sensor(Entity):
|
|
62
97
|
"""
|
|
63
98
|
Sensor entity class.
|
|
64
99
|
|
|
65
|
-
See https://github.
|
|
100
|
+
See https://unfoldedcircle.github.io/core-api/entities/entity_sensor.html
|
|
66
101
|
for more information.
|
|
67
102
|
"""
|
|
68
103
|
|
|
@@ -78,7 +113,7 @@ class Sensor(Entity):
|
|
|
78
113
|
area: str | None = None,
|
|
79
114
|
):
|
|
80
115
|
"""
|
|
81
|
-
Create sensor-entity instance.
|
|
116
|
+
Create a sensor-entity instance.
|
|
82
117
|
|
|
83
118
|
:param identifier: entity identifier
|
|
84
119
|
:param name: friendly name
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|