Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions source/_components/light.mqtt.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Configuration variables:
- **brightness_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract the brightness value.
- **rgb_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract the RGB value.
- **color_temp_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract the color temperature value.
- **color_temp_command_template** (*Optional*): Defines a [template](/topics/templating/) to set the color temperature value.
- **brightness_scale** (*Optional*): Defines the maximum brightness value (i.e. 100%) of the MQTT device (defaults to 255).
- **qos** (*Optional*): The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
- **payload_on** (*Optional*): The payload that represents enabled state. Default is "ON".
Expand Down Expand Up @@ -99,6 +100,31 @@ light:
optimistic: false
```


### {% linkable_title Brightness and color temperature support %}

To enable a light with brightness and color temperature support in your installation, add the following to your `configuration.yaml` file:

```yaml
# Example configuration.yml entry
light:
platform: mqtt
name: "Office light"
state_topic: "office/light/status"
command_topic: "office/light/switch"
brightness_state_topic: 'office/light/brightness'
brightness_command_topic: 'office/light/brightness/set'
color_temp_state_topic: 'office/light/colorTemperature'
color_temp_command_topic: 'office/light/colorTemperature/set'
# To convert from a light with Kelvin to HA-default Mired
color_temp_value_template: '{{ 1000000.0 / value_json }}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Templates must be embedded with {% raw %}...{% endraw %}.

color_temp_command_template: '{{ 1000000.0 / value_json }}'
qos: 0
payload_on: "ON"
payload_off: "OFF"
optimistic: false
```

### {% linkable_title Implementations %}

A basic example using a nodeMCU board (ESP8266) to control its built-in led (on/off) can be found [here](https://github.com/mertenats/open-home-automation/tree/master/ha_mqtt_light). [Here](https://github.com/mertenats/open-home-automation/tree/master/ha_mqtt_rgb_light) is another example to control a RGB led (on/off, brightness and colors).