Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

How to pass through "Color_Map" Arg for colorControl? #35

Closed
Dakewlmancoding opened this issue Aug 5, 2020 · 1 comment
Closed

How to pass through "Color_Map" Arg for colorControl? #35

Dakewlmancoding opened this issue Aug 5, 2020 · 1 comment

Comments

@Dakewlmancoding
Copy link

Dakewlmancoding commented Aug 5, 2020

Any idea how to format the color map data type? I've tried the following:

result = await light.command("main", "colorControl", "setColor", ["hue: 50", "saturation: 60"]) assert result == True

result = await light.command("main", "colorControl", "setColor", ["[hue: 50, saturation: 60]"]) assert result == True

and

result = await light.command("main", "colorControl", "setColor", ["hue: 50, saturation: 60"]) assert result == True

All of which have given the error:
pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "C8731E93-C14F-4B9C-A3F3-33567D788575", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "SizeError", "target": "[0].arguments", "message": "[0].arguments must have a size between 1 and 1.", "details": []}, {"code": "UnprocessableEntityError", "target": "[0].arguments.[0]", "message": "invalid COLOR_MAP type", "details": []}]}}

@Dakewlmancoding
Copy link
Author

For anyone else having this issue, here's the answer: Color_Map is a dictionary, as such it need to be passed through like
light.command("main", "colorControl", "setColor", [{"key": "value"}])
where key = the thing you want to manipulate and value = what you want to set the key to.
Here is a list of all the Key/Value pairs (which is also left out of the official documentation, thanks Samsung!)

{"hue": number 1-100}
{"saturation": number 1-100}
{"hex": "#RRGGBB"}
{"level": number} (no idea what this does)
{"switch":"on/off"} (no idea what this does and it's not what you think it does)
(Must ALWAYS include the Hue and Saturation keys)

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

No branches or pull requests

1 participant