Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"sunset" in smart-scene #406

Open
hendriksen-mark opened this issue Sep 12, 2024 · 2 comments
Open

"sunset" in smart-scene #406

hendriksen-mark opened this issue Sep 12, 2024 · 2 comments

Comments

@hendriksen-mark
Copy link

if smart-scene start_time kind is sunset aiohue give a error.
if i change line 61 of aiohue/v2/models/smart_scene.py to time: TimeslotStartTimeTime | None = None the error is gone.

{
    "errors": [],
    "data": [
        {
            "metadata": {
                "image": {
                    "rid": "eb014820-a902-4652-8ca7-6e29c03b87a1",
                    "rtype": "public_image"
                },
                "name": "Natuurlijk licht"
            },
            "id": "f287474f-4134-48bd-8c19-c74ed5a7d479",
            "id_v1": "/smart_scene/1",
            "group": {
                "rid": "46332c14-1c72-5fe3-b817-9621e535a68b",
                "rtype": "room"
            },
            "type": "smart_scene",
            "week_timeslots": [
                {
                    "timeslots": [
                        {
                            "start_time": {
                                "kind": "time",
                                "time": {
                                    "hour": 7,
                                    "minute": 0,
                                    "second": 0
                                }
                            },
                            "target": {
                                "rid": "43b3b7c2-eb23-4e72-9628-20d73507d7bc",
                                "rtype": "scene"
                            }
                        },
                        {
                            "start_time": {
                                "kind": "time",
                                "time": {
                                    "hour": 10,
                                    "minute": 0,
                                    "second": 0
                                }
                            },
                            "target": {
                                "rid": "f2ab39ae-2f6c-4d78-a67e-08e08b2bad16",
                                "rtype": "scene"
                            }
                        },
                        {
                            "start_time": {
                                "kind": "sunset"
                            },
                            "target": {
                                "rid": "66d4471f-6b1a-4151-a38c-f421d07e2b13",
                                "rtype": "scene"
                            }
                        },
                        {
                            "start_time": {
                                "kind": "time",
                                "time": {
                                    "hour": 20,
                                    "minute": 0,
                                    "second": 0
                                }
                            },
                            "target": {
                                "rid": "b1fb3678-aa27-4da0-8baf-10b42f46d820",
                                "rtype": "scene"
                            }
                        },
                        {
                            "start_time": {
                                "kind": "time",
                                "time": {
                                    "hour": 22,
                                    "minute": 0,
                                    "second": 0
                                }
                            },
                            "target": {
                                "rid": "0e098d29-2ccd-4043-8de4-30412637cd25",
                                "rtype": "scene"
                            }
                        },
                        {
                            "start_time": {
                                "kind": "time",
                                "time": {
                                    "hour": 0,
                                    "minute": 0,
                                    "second": 0
                                }
                            },
                            "target": {
                                "rid": "d564f1fd-cb53-4de6-90ad-96502a044377",
                                "rtype": "scene"
                            }
                        }
                    ],
                    "recurrence": [
                        "sunday",
                        "monday",
                        "tuesday",
                        "wednesday",
                        "thursday",
                        "friday",
                        "saturday"
                    ]
                }
            ],
            "transition_duration": 60000,
            "state": "inactive",
            "active_timeslot": {
                "timeslot_id": 1,
                "weekday": "thursday"
            }
        }
    ]
}
2024-09-12 11:31:56.356 ERROR (MainThread) [aiohue.v2[192.168.1.25].smart_scene] Unable to parse resource, please report this to the authors of aiohue.
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 200, in _handle_event
    cur_item = self._items[item_id] = dataclass_from_dict(
                                      ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 244, in dataclass_from_dict
    field.name: _parse_value(
                ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 153, in _parse_value
    return origin(
           ^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 154, in <genexpr>
    _parse_value(name, subvalue, get_args(value_type)[0])
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 149, in _parse_value
    return dataclass_from_dict(value_type, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 244, in dataclass_from_dict
    field.name: _parse_value(
                ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 153, in _parse_value
    return origin(
           ^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 154, in <genexpr>
    _parse_value(name, subvalue, get_args(value_type)[0])
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 149, in _parse_value
    return dataclass_from_dict(value_type, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 244, in dataclass_from_dict
    field.name: _parse_value(
                ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 149, in _parse_value
    return dataclass_from_dict(value_type, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 244, in dataclass_from_dict
    field.name: _parse_value(
                ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 202, in _parse_value
    raise KeyError(f"`{name}` of type `{value_type}` is required.")
KeyError: "`TimeslotStartTime.time` of type `<class 'aiohue.v2.models.smart_scene.TimeslotStartTimeTime'>` is required."
@marcelveldt
Copy link
Collaborator

Is TimeslotStartTimeTime supposed to be optional or mandatory according to the api spec ?

@hendriksen-mark
Copy link
Author

It time or sunset.Screenshot_20241126-213930_Chrome.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants