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

Wrong state when turning device on with a color command #21

Closed
alexschwantes opened this issue Apr 21, 2017 · 1 comment
Closed

Wrong state when turning device on with a color command #21

alexschwantes opened this issue Apr 21, 2017 · 1 comment

Comments

@alexschwantes
Copy link
Contributor

When the device is off. if you send just a color command via json/mqtt such as follows, it will turn on the light to the specified color but the state that is returned is OFF, instead of ON. The same happens if you use the IR remote...

SET: { 'color': {'r':0, 'g':255, 'b':0}}
STATE: {"state":"OFF","brightness":145,"white_value":0,"color":{"r":0,"g":255,"b":0}}

Further in this state, you can't turn it off. you first have to send an ON command and then an OFF command to turn the device off. This is due to the checking of m_state variable on lines 57 and 60 of arilux.cpp.

alexschwantes added a commit to alexschwantes/Arilux_AL-LC0X that referenced this issue Apr 21, 2017
* Removing unnecessary checks for state in setState(). Not completely necessary but may help in the future.
* Calling setColor now sets the state to be ON
* Re-ordered the flow of events in loop() so that sending MQTT response (handleCMD()) is done last.
alexschwantes added a commit to alexschwantes/Arilux_AL-LC0X that referenced this issue Apr 21, 2017
Adding two new methods:
* setFadeToColor: sets the end color that the fade will fade to. This is so that the correct state can be sent to MQTT (this is the end state after the fade has completed).
* setFadeColor: Used to fade the color without updating the internal m_color variables that represent the color the fading will change to. This method also includes a similar fix to that in smrtnt#21, so if the color is set with a transition from the off state, it will set the internal state to ON.
@alexschwantes
Copy link
Contributor Author

Sorry, the last commit should have read a fix for #20, not 21.

@smrtnt smrtnt closed this as completed Apr 23, 2017
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