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

Creating scene with trigger does not match any of the allowed types #73

Closed
slajob opened this issue Apr 24, 2024 · 2 comments
Closed

Creating scene with trigger does not match any of the allowed types #73

slajob opened this issue Apr 24, 2024 · 2 comments

Comments

@slajob
Copy link
Contributor

slajob commented Apr 24, 2024

I tried to create a empty scene and it works well when triggers and actions are empty. But I can't create a scene with assigned trigger.
Using this code:

trigger = Trigger(id="b55c75ec-829c-4623-a167-0b537569c9e2_1", type="device",triggered_at=datetime.now(), disabled=False)
action = Action(id="b55c75ec-829c-4623-a167-0b537569c9e2_1", type="device", disabled=False)
dirigera_hub.create_scene(info=Info(name="ha_dir-pla_test_test1_test2", icon=Icon.SCENES_CLEAN_SPARKLES), triggers=[trigger], actions=[action])

I getting error:

Traceback (most recent call last):
  File "/Users/slajob/git/dirigera_local/shortcut-somrig.py", line 24, in <module>
    dirigera_hub.create_scene(info=Info(name="ha_dir-pla_test_test1_test2", icon=Icon.SCENES_CLEAN_SPARKLES), triggers=[trigger], actions=[action])
  File "/Users/slajob/git/dirigera_local/venv/lib/python3.9/site-packages/dirigera/hub/hub.py", line 421, in create_scene
    response_dict = self.post(
  File "/Users/slajob/git/dirigera_local/venv/lib/python3.9/site-packages/dirigera/hub/hub.py", line 132, in post
    response.raise_for_status()
  File "/Users/slajob/git/dirigera_local/venv/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://192.168.0.73:8443/v1/scenes/
{"error":"Error","message":"\"triggers[0]\" does not match any of the allowed types"}

Have you ever tried creating scene with trigger assigned?

@bjorncs
Copy link
Contributor

bjorncs commented Apr 24, 2024

@Leggin @slajob I managed to create a scene with a controller trigger in #74.

@Leggin
Copy link
Owner

Leggin commented Apr 26, 2024

Thanks you two!

@Leggin Leggin closed this as completed Apr 26, 2024
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

3 participants