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

Pass RGB parameters to color bulb? #345

Open
jbrepogmailcom opened this issue Jun 5, 2020 · 2 comments · May be fixed by #404
Open

Pass RGB parameters to color bulb? #345

jbrepogmailcom opened this issue Jun 5, 2020 · 2 comments · May be fixed by #404

Comments

@jbrepogmailcom
Copy link

Hello, is this possible with hass-cli? I can start a scene that I previously defined in Smart Life, but that way it only allows to set one predefined color. I would like to set various colors by hass-cli.

(IFTTT used to do that, at least for basic colors red, blue, orange, yellow, white, green... But is not integrated with Smart Life anymore)

Thanks, Jan

@bpsib
Copy link

bpsib commented Sep 2, 2020

Can someone explain how to do this? I have tried hass-cli service call homeassistant.toggle --arguments entity_id=light.055667caab5065b --arguments rgb_color="[0, 0, 255]" but get error: ValueError: dictionary update sequence element #1 has length 1; 2 is required

@bpsib
Copy link

bpsib commented Sep 9, 2020

So I have given up on this and made my own solution using the REST API and curl. I have made my own script for changing the color and have the token saved in a file called hatoken. Replace localhost with your IP/domain if necessary.

curl -X POST -H "Authorization: Bearer $(cat ~/hatoken)"  \
-H "Content-Type: application/json" -d '{"entity_id": "'"$1"'", "rgb_color": ['$2', '$3', '$4']}'  \
http://localhost:8123/api/services/light/turn_on

Example:
./lightrgb.sh light.mylightid 0 0 255
Sets the light to blue.

P.S. Smart Life is back on IFTTT but using it to set the color is very temperamental. Sometimes it works but other times it just goes on the set color for a split second then reverts back. A very annoying bug with IFTTT.

@FOLLGAD FOLLGAD linked a pull request Mar 12, 2023 that will close this issue
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