Skip to content

Commit

Permalink
Reverse limitlessled color_temp range (#7359)
Browse files Browse the repository at this point in the history
Reverse limitlessled color_temp range
  • Loading branch information
amelchio committed May 3, 2017
1 parent 403a721 commit dbd6f7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/light/limitlessled.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,12 @@ def turn_on(self, transition_time, pipeline, **kwargs):

def _from_hass_temperature(temperature):
"""Convert Home Assistant color temperature units to percentage."""
return (temperature - 154) / 346
return 1 - (temperature - 154) / 346


def _to_hass_temperature(temperature):
"""Convert percentage to Home Assistant color temperature units."""
return int(temperature * 346) + 154
return 500 - int(temperature * 346)


def _from_hass_brightness(brightness):
Expand Down

7 comments on commit dbd6f7e

@Leon99
Copy link

@Leon99 Leon99 commented on dbd6f7e Jul 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change actually made it wrong for me. @amelchio what's your bridge version? The only idea I have is that it depends on the version of the bridge.

@amelchio
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe the wrong behaviour that you see?

@Leon99
Copy link

@Leon99 Leon99 commented on dbd6f7e Jul 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the temperature slider to warm makes it cold and vice versa.

@amelchio
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I guess you'd better file a new issue. Unfortunately I cannot be of any help.

@Leon99
Copy link

@Leon99 Leon99 commented on dbd6f7e Jul 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please let me know what version of the gateway did you use to verify your change?

@amelchio
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was tested on v6 bridges. Please see #7333 and #7359 for the discussion.

@Leon99
Copy link

@Leon99 Leon99 commented on dbd6f7e Jul 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Well, apparently this commit fixed the behaviour with v6 bridges but, at the same time, broke all previous versions, since there is no bridge version check in the function.
I've created a new issue.

Please sign in to comment.