Skip to content

Add support for color_temp_command_template in MQTT light component#19675

Merged
emontnemery merged 3 commits intohome-assistant:devfrom
dchesterton:dev
Jan 1, 2019
Merged

Add support for color_temp_command_template in MQTT light component#19675
emontnemery merged 3 commits intohome-assistant:devfrom
dchesterton:dev

Conversation

@dchesterton
Copy link
Copy Markdown

@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
Copy Markdown
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!

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),
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Author

Thanks, I've added the abbreviation.

Copy link
Copy Markdown
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/ha-core that referenced this pull request Jan 18, 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