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

Add support for color_temp_command_template in MQTT light component #19675

Merged
merged 3 commits into from Jan 1, 2019
Merged

Conversation

dchesterton
Copy link
Contributor

@dchesterton dchesterton commented Dec 31, 2018

Description:

Add support for changing the MQTT color_temp command with the color_temp_command_template config option, in the same way as the existing rgb_command_template config option. This adds support for devices which expect the color_temp to be in Kelvin, such as SmartThings and Hubitat.

Related issue (if applicable): fixes #19673 (among others)

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#8000

Example entry for configuration.yaml (if applicable):

light:
  - platform: mqtt
    color_temp_command_topic: "devices/bulb/color_temp"
    color_temp_command_template: "{{ (1000 / value) | round(0) }}"

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@homeassistant
Copy link
Contributor

Hi @dchesterton,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@@ -207,6 +209,7 @@ def _setup_from_config(self, config):
self._templates = {
CONF_BRIGHTNESS: config.get(CONF_BRIGHTNESS_VALUE_TEMPLATE),
CONF_COLOR_TEMP: config.get(CONF_COLOR_TEMP_VALUE_TEMPLATE),
CONF_COLOR_TEMP_COMMAND_TEMPLATE: config.get(CONF_COLOR_TEMP_COMMAND_TEMPLATE),

Choose a reason for hiding this comment

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

line too long (91 > 79 characters)

@emontnemery
Copy link
Contributor

Please add an abbreviation for the new configuration variable in mqtt/discovery.py

@dchesterton dchesterton requested a review from a team as a code owner December 31, 2018 13:27
@dchesterton
Copy link
Contributor Author

Thanks, I've added the abbreviation.

Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

Looks good.

@emontnemery emontnemery merged commit 61d5b30 into home-assistant:dev Jan 1, 2019
@ghost ghost removed the in progress label Jan 1, 2019
@balloob balloob mentioned this pull request Jan 10, 2019
kellerza pushed a commit to kellerza/home-assistant that referenced this pull request Jan 18, 2019
…ome-assistant#19675)

* Add support for color_temp_command_template in MQTT light component
alandtse pushed a commit to alandtse/home-assistant that referenced this pull request Feb 12, 2019
…ome-assistant#19675)

* Add support for color_temp_command_template in MQTT light component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

color temperature in mqtt_light has fixed range from 153...500.
4 participants