ucapi-framework 1.2.3__tar.gz → 1.3.0__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.
Files changed (20) hide show
  1. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/PKG-INFO +2 -2
  2. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/pyproject.toml +2 -2
  3. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/tests/test_driver.py +20 -0
  4. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework/driver.py +31 -0
  5. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework.egg-info/PKG-INFO +2 -2
  6. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework.egg-info/requires.txt +1 -1
  7. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/README.md +0 -0
  8. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/setup.cfg +0 -0
  9. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/tests/test_config.py +0 -0
  10. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/tests/test_device.py +0 -0
  11. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/tests/test_discovery.py +0 -0
  12. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/tests/test_setup.py +0 -0
  13. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework/__init__.py +0 -0
  14. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework/config.py +0 -0
  15. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework/device.py +0 -0
  16. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework/discovery.py +0 -0
  17. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework/setup.py +0 -0
  18. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework.egg-info/SOURCES.txt +0 -0
  19. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework.egg-info/dependency_links.txt +0 -0
  20. {ucapi_framework-1.2.3 → ucapi_framework-1.3.0}/ucapi_framework.egg-info/top_level.txt +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ucapi-framework
3
- Version: 1.2.3
3
+ Version: 1.3.0
4
4
  Summary: ucapi framework that provides core functionality for building integrations.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
7
7
  Requires-Dist: pyee>=9.0.0
8
- Requires-Dist: ucapi>=0.4.0
8
+ Requires-Dist: ucapi>=0.5.0
9
9
  Requires-Dist: aiohttp>=3.9.0
10
10
 
11
11
  [![Tests](https://github.com/jackjpowell/ucapi-framework/actions/workflows/test.yml/badge.svg)](https://github.com/jackjpowell/ucapi-framework/actions/workflows/test.yml)
@@ -1,12 +1,12 @@
1
1
  [project]
2
2
  name = "ucapi-framework"
3
- version = "1.2.3"
3
+ version = "1.3.0"
4
4
  description = "ucapi framework that provides core functionality for building integrations."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
7
7
  dependencies = [
8
8
  "pyee>=9.0.0",
9
- "ucapi>=0.4.0",
9
+ "ucapi>=0.5.0",
10
10
  "aiohttp>=3.9.0",
11
11
  ]
12
12
 
@@ -1958,6 +1958,7 @@ class TestDeviceEventHandlersEntityTypes:
1958
1958
  EntityTypes.SENSOR,
1959
1959
  EntityTypes.SWITCH,
1960
1960
  EntityTypes.IR_EMITTER,
1961
+ EntityTypes.VOICE_ASSISTANT,
1961
1962
  ]:
1962
1963
  mock_entity = MagicMock()
1963
1964
  mock_entity.entity_type = entity_type
@@ -1985,6 +1986,7 @@ class TestDeviceEventHandlersEntityTypes:
1985
1986
  EntityTypes.SENSOR,
1986
1987
  EntityTypes.SWITCH,
1987
1988
  EntityTypes.IR_EMITTER,
1989
+ EntityTypes.VOICE_ASSISTANT,
1988
1990
  ]:
1989
1991
  mock_entity = MagicMock()
1990
1992
  mock_entity.entity_type = entity_type
@@ -2012,6 +2014,7 @@ class TestDeviceEventHandlersEntityTypes:
2012
2014
  EntityTypes.SENSOR,
2013
2015
  EntityTypes.SWITCH,
2014
2016
  EntityTypes.IR_EMITTER,
2017
+ EntityTypes.VOICE_ASSISTANT,
2015
2018
  ]:
2016
2019
  mock_entity = MagicMock()
2017
2020
  mock_entity.entity_type = entity_type
@@ -2200,6 +2203,23 @@ class TestOnDeviceUpdateEntityTypes:
2200
2203
 
2201
2204
  driver.api.configured_entities.update_attributes.assert_called()
2202
2205
 
2206
+ @pytest.mark.asyncio
2207
+ async def test_on_device_update_voice_assistant(self):
2208
+ """Test on_device_update for voice assistant entity."""
2209
+ driver = self._create_driver()
2210
+ config = DeviceConfigForTests("dev1", "Device 1", "192.168.1.1")
2211
+ driver.add_configured_device(config, connect=False)
2212
+
2213
+ mock_entity = MagicMock()
2214
+ mock_entity.entity_type = EntityTypes.VOICE_ASSISTANT
2215
+ driver.api.configured_entities.get = MagicMock(return_value=mock_entity)
2216
+ driver.api.configured_entities.contains = MagicMock(return_value=True)
2217
+ driver.api.configured_entities.update_attributes = MagicMock()
2218
+
2219
+ await driver.on_device_update("dev1", {"state": "on"})
2220
+
2221
+ driver.api.configured_entities.update_attributes.assert_called()
2222
+
2203
2223
  @pytest.mark.asyncio
2204
2224
  async def test_on_device_update_unknown_entity_type(self, caplog):
2205
2225
  """Test on_device_update with unknown entity type logs warning."""
@@ -25,6 +25,7 @@ from ucapi import (
25
25
  remote,
26
26
  sensor,
27
27
  switch,
28
+ voice_assistant,
28
29
  )
29
30
 
30
31
  from ucapi_framework.config import BaseConfigManager
@@ -542,6 +543,10 @@ class BaseIntegrationDriver(ABC, Generic[DeviceT, ConfigT]):
542
543
  self.api.configured_entities.update_attributes(
543
544
  entity_id, {remote.Attributes.STATE: state}
544
545
  )
546
+ case EntityTypes.VOICE_ASSISTANT:
547
+ self.api.configured_entities.update_attributes(
548
+ entity_id, {voice_assistant.Attributes.STATE: state}
549
+ )
545
550
 
546
551
  # ========================================================================
547
552
  # Device Lifecycle Management
@@ -782,6 +787,10 @@ class BaseIntegrationDriver(ABC, Generic[DeviceT, ConfigT]):
782
787
  self.api.configured_entities.update_attributes(
783
788
  entity_id, {remote.Attributes.STATE: state}
784
789
  )
790
+ case EntityTypes.VOICE_ASSISTANT:
791
+ self.api.configured_entities.update_attributes(
792
+ entity_id, {voice_assistant.Attributes.STATE: state}
793
+ )
785
794
 
786
795
  async def on_device_disconnected(self, device_id: str) -> None:
787
796
  """
@@ -847,6 +856,13 @@ class BaseIntegrationDriver(ABC, Generic[DeviceT, ConfigT]):
847
856
  entity_id,
848
857
  {remote.Attributes.STATE: media_player.States.UNAVAILABLE},
849
858
  )
859
+ case EntityTypes.VOICE_ASSISTANT:
860
+ self.api.configured_entities.update_attributes(
861
+ entity_id,
862
+ {
863
+ voice_assistant.Attributes.STATE: media_player.States.UNAVAILABLE
864
+ },
865
+ )
850
866
 
851
867
  async def on_device_connection_error(self, device_id: str, message: str) -> None:
852
868
  """
@@ -913,6 +929,13 @@ class BaseIntegrationDriver(ABC, Generic[DeviceT, ConfigT]):
913
929
  entity_id,
914
930
  {remote.Attributes.STATE: media_player.States.UNAVAILABLE},
915
931
  )
932
+ case EntityTypes.VOICE_ASSISTANT:
933
+ self.api.configured_entities.update_attributes(
934
+ entity_id,
935
+ {
936
+ voice_assistant.Attributes.STATE: media_player.States.UNAVAILABLE
937
+ },
938
+ )
916
939
 
917
940
  async def on_device_update(
918
941
  self,
@@ -1086,6 +1109,14 @@ class BaseIntegrationDriver(ABC, Generic[DeviceT, ConfigT]):
1086
1109
  state = self.map_device_state(update[remote.Attributes.STATE.value])
1087
1110
  attributes[remote.Attributes.STATE] = state
1088
1111
 
1112
+ case EntityTypes.VOICE_ASSISTANT:
1113
+ # Voice Assistant entities: STATE
1114
+ if voice_assistant.Attributes.STATE.value in update:
1115
+ state = self.map_device_state(
1116
+ update[voice_assistant.Attributes.STATE.value]
1117
+ )
1118
+ attributes[voice_assistant.Attributes.STATE] = state
1119
+
1089
1120
  case _:
1090
1121
  # Unknown entity type - log warning
1091
1122
  _LOG.warning(
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ucapi-framework
3
- Version: 1.2.3
3
+ Version: 1.3.0
4
4
  Summary: ucapi framework that provides core functionality for building integrations.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
7
7
  Requires-Dist: pyee>=9.0.0
8
- Requires-Dist: ucapi>=0.4.0
8
+ Requires-Dist: ucapi>=0.5.0
9
9
  Requires-Dist: aiohttp>=3.9.0
10
10
 
11
11
  [![Tests](https://github.com/jackjpowell/ucapi-framework/actions/workflows/test.yml/badge.svg)](https://github.com/jackjpowell/ucapi-framework/actions/workflows/test.yml)
@@ -1,3 +1,3 @@
1
1
  pyee>=9.0.0
2
- ucapi>=0.4.0
2
+ ucapi>=0.5.0
3
3
  aiohttp>=3.9.0