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

get_scenes gives pydantic ValidationError #42

Closed
RasmusMalver opened this issue Jan 21, 2024 · 5 comments · Fixed by #43
Closed

get_scenes gives pydantic ValidationError #42

RasmusMalver opened this issue Jan 21, 2024 · 5 comments · Fixed by #43

Comments

@RasmusMalver
Copy link

# python3
dirigera_hub.get_scenes()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    dirigera_hub.get_scenes()
  File "~/Gits/IKEA-smart-home/lib/python3.11/site-packages/dirigera/hub/hub.py", line 258, in get_scenes
    return [dict_to_scene(scene, self) for scene in scenes]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/Gits/IKEA-smart-home/lib/python3.11/site-packages/dirigera/hub/hub.py", line 258, in <listcomp>
    return [dict_to_scene(scene, self) for scene in scenes]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/Gits/IKEA-smart-home/lib/python3.11/site-packages/dirigera/devices/scene.py", line 66, in dict_to_scene
    return Scene(dirigeraClient=dirigera_client, **data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/Gits/IKEA-smart-home/lib/python3.11/site-packages/pydantic/main.py", line 164, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Scene
lastUndo
  Field required [type=missing, input_value={'dirigeraClient': <dirig...ndoAllowedDuration': 30}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing

I've tried on MacOS and on Debian, but I run into this, when I try to interact with scenes on my IKEA Dirigera. I've booted everything, deleted all scenes, added them again, but I keep ending here.

@Leggin
Copy link
Owner

Leggin commented Jan 22, 2024

Thank you for reporting this, I will fix it asap and deploy a new version!

@RasmusMalver
Copy link
Author

Thank you for reporting this, I will fix it asap and deploy a new version!

I tried to understand the problem myself, but it was more complex than my skillset could handle 🙂

@RasmusMalver
Copy link
Author

I'm sorry to be a bother, but I get the same error. I've tried making a new venv, and installing from scratch, and I've checked that the committed changes have been made. Do I need to generate a new token from my Dirigera?

dirigera_hub.get_scenes()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    dirigera_hub.get_scenes()
  File "~/Gits/IKEA-2/lib/python3.11/site-packages/dirigera/hub/hub.py", line 257, in get_scenes
    return [dict_to_scene(scene, self) for scene in scenes]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/Gits/IKEA-2/lib/python3.11/site-packages/dirigera/hub/hub.py", line 257, in <listcomp>
    return [dict_to_scene(scene, self) for scene in scenes]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/Gits/IKEA-2/lib/python3.11/site-packages/dirigera/devices/scene.py", line 66, in dict_to_scene
    return Scene(dirigeraClient=dirigera_client, **data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/Gits/IKEA-2/lib/python3.11/site-packages/pydantic/main.py", line 164, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Scene
lastUndo
  Field required [type=missing, input_value={'dirigeraClient': <dirig...ndoAllowedDuration': 30}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing

@Leggin
Copy link
Owner

Leggin commented Jan 22, 2024

I'm sorry I made the wrong fields optional, I will make a corrected version.

@Leggin
Copy link
Owner

Leggin commented Jan 22, 2024

ok please try again with version 1.0.6, it should hopefully work now.

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

Successfully merging a pull request may close this issue.

2 participants