havenlighting 0.2.2__tar.gz → 0.2.3__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. {havenlighting-0.2.2 → havenlighting-0.2.3}/PKG-INFO +1 -1
  2. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/__init__.py +1 -1
  3. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/config.py +7 -1
  4. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/devices/light.py +2 -2
  5. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting.egg-info/PKG-INFO +1 -1
  6. {havenlighting-0.2.2 → havenlighting-0.2.3}/pyproject.toml +1 -1
  7. {havenlighting-0.2.2 → havenlighting-0.2.3}/tests/test_light.py +22 -0
  8. {havenlighting-0.2.2 → havenlighting-0.2.3}/README.md +0 -0
  9. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/client.py +0 -0
  10. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/credentials.py +0 -0
  11. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/devices/location.py +0 -0
  12. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/exceptions.py +0 -0
  13. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/logging.py +0 -0
  14. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting/models.py +0 -0
  15. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting.egg-info/SOURCES.txt +0 -0
  16. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting.egg-info/dependency_links.txt +0 -0
  17. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting.egg-info/requires.txt +0 -0
  18. {havenlighting-0.2.2 → havenlighting-0.2.3}/havenlighting.egg-info/top_level.txt +0 -0
  19. {havenlighting-0.2.2 → havenlighting-0.2.3}/setup.cfg +0 -0
  20. {havenlighting-0.2.2 → havenlighting-0.2.3}/tests/test_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: havenlighting
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Python client for Haven Lighting API
5
5
  Author-email: Mickey Schwab <mickeyschwab@gmail.com>
6
6
  Requires-Python: >=3.10
@@ -3,7 +3,7 @@ from .devices.light import Light
3
3
  from .devices.location import Location
4
4
  from .exceptions import HavenException, AuthenticationError, DeviceError
5
5
 
6
- __version__ = "0.2.1"
6
+ __version__ = "0.2.3"
7
7
  __all__ = [
8
8
  "HavenClient",
9
9
  "Light",
@@ -8,9 +8,15 @@ API_TIMEOUT: Final[int] = 30
8
8
  # Light States
9
9
  LIGHT_STATE: Final[dict] = {
10
10
  "OFF": 1,
11
- "ON": 2
11
+ "ON": 2,
12
+ # Seen live (2026-12-03): ~2s after /Commands/On, once the controller
13
+ # confirms, lightingStatusId moves from 2 to 3 (API `status` still "ON").
14
+ "ON_CONFIRMED": 3,
12
15
  }
13
16
 
17
+ # Every lightingStatusId that means the light is on.
18
+ LIGHT_ON_STATES: Final[frozenset] = frozenset({LIGHT_STATE["ON"], LIGHT_STATE["ON_CONFIRMED"]})
19
+
14
20
  # Default Light Parameters (brightness is 0-10 on Haven's scale)
15
21
  LIGHT_PARAMS: Final[dict] = {
16
22
  "BRIGHTNESS": 10,
@@ -1,7 +1,7 @@
1
1
  from typing import Dict, Any
2
2
  import logging
3
3
  from ..models import LightData
4
- from ..config import LIGHT_STATE, LIGHT_PARAMS
4
+ from ..config import LIGHT_STATE, LIGHT_ON_STATES, LIGHT_PARAMS
5
5
  from ..credentials import Credentials
6
6
  from ..exceptions import ApiError
7
7
 
@@ -33,7 +33,7 @@ class Light:
33
33
 
34
34
  @property
35
35
  def is_on(self) -> bool:
36
- return self._data.status == LIGHT_STATE["ON"]
36
+ return self._data.status in LIGHT_ON_STATES
37
37
 
38
38
  def turn_on(self) -> None:
39
39
  """Turn the light on."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: havenlighting
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Python client for Haven Lighting API
5
5
  Author-email: Mickey Schwab <mickeyschwab@gmail.com>
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "havenlighting"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "Python client for Haven Lighting API"
9
9
  authors = [{name = "Mickey Schwab", email = "mickeyschwab@gmail.com"}]
10
10
  license = {file = "LICENSE"}
@@ -56,3 +56,25 @@ def test_turn_on_command_failure_raises(light):
56
56
  light.turn_on()
57
57
 
58
58
  assert not light.is_on
59
+
60
+
61
+ def _make_light(mocker, **fields):
62
+ data = {"lightId": 456, "name": "Test Light", **fields}
63
+ return Light(mocker.Mock(spec=Credentials), location_id=123, light_id=456, data=data)
64
+
65
+
66
+ def test_controller_confirmed_on_is_on(mocker):
67
+ # Live capture 2026-12-03: ~2s after /Commands/On, once the controller
68
+ # confirms, the API reports lightingStatusId 3 (status "ON"), not 2.
69
+ light = _make_light(mocker, lightingStatusId=3, status="ON")
70
+ assert light.is_on
71
+
72
+
73
+ @pytest.mark.parametrize("status_id,status_text,expected", [
74
+ (1, "OFF", False),
75
+ (2, "ON", True),
76
+ (3, "ON", True),
77
+ ])
78
+ def test_is_on_from_api_status(mocker, status_id, status_text, expected):
79
+ light = _make_light(mocker, lightingStatusId=status_id, status=status_text)
80
+ assert light.is_on is expected
File without changes
File without changes