mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-09 18:36:51 +00:00
Remove blank lines
This commit is contained in:
parent
bbddfc14a7
commit
973cefc427
@ -55,11 +55,9 @@ Configuration variables:
|
|||||||
|
|
||||||
Here's an example of `input_number` being used as a trigger in an automation.
|
Here's an example of `input_number` being used as a trigger in an automation.
|
||||||
|
|
||||||
```yaml
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
|
```yaml
|
||||||
# Example configuration.yaml entry using 'input_number' as a trigger in an automation
|
# Example configuration.yaml entry using 'input_number' as a trigger in an automation
|
||||||
|
|
||||||
# Define input_number
|
|
||||||
input_number:
|
input_number:
|
||||||
bedroom_brightness:
|
bedroom_brightness:
|
||||||
name: Brightness
|
name: Brightness
|
||||||
@ -67,8 +65,6 @@ input_number:
|
|||||||
min: 0
|
min: 0
|
||||||
max: 254
|
max: 254
|
||||||
step: 1
|
step: 1
|
||||||
|
|
||||||
# Automation.
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Bedroom Light - Adjust Brightness
|
- alias: Bedroom Light - Adjust Brightness
|
||||||
trigger:
|
trigger:
|
||||||
@ -76,20 +72,19 @@ automation:
|
|||||||
entity_id: input_number.bedroom_brightness
|
entity_id: input_number.bedroom_brightness
|
||||||
action:
|
action:
|
||||||
- service: light.turn_on
|
- service: light.turn_on
|
||||||
# Note the use of 'data_template:' below rather than the normal 'data:' if you weren't using an input variable
|
# Note the use of 'data_template:' below rather than the normal 'data:' if you weren't using an input variable
|
||||||
data_template:
|
data_template:
|
||||||
entity_id: light.bedroom
|
entity_id: light.bedroom
|
||||||
brightness: '{{ trigger.to_state.state | int }}'
|
brightness: '{{ trigger.to_state.state | int }}'
|
||||||
{% endraw %}
|
|
||||||
```
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
Another code example using `input_number`, this time being used in an action in an automation.
|
Another code example using `input_number`, this time being used in an action in an automation.
|
||||||
|
|
||||||
```yaml
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
|
```yaml
|
||||||
# Example configuration.yaml entry using 'input_number' in an action in an automation
|
# Example configuration.yaml entry using 'input_number' in an action in an automation
|
||||||
|
|
||||||
# Define 'input_select'
|
|
||||||
input_select:
|
input_select:
|
||||||
scene_bedroom:
|
scene_bedroom:
|
||||||
name: Scene
|
name: Scene
|
||||||
@ -101,8 +96,6 @@ input_select:
|
|||||||
- Relax
|
- Relax
|
||||||
- 'OFF'
|
- 'OFF'
|
||||||
initial: 'Select'
|
initial: 'Select'
|
||||||
|
|
||||||
# Define input_number
|
|
||||||
input_number:
|
input_number:
|
||||||
bedroom_brightness:
|
bedroom_brightness:
|
||||||
name: Brightness
|
name: Brightness
|
||||||
@ -110,8 +103,6 @@ input_number:
|
|||||||
min: 0
|
min: 0
|
||||||
max: 254
|
max: 254
|
||||||
step: 1
|
step: 1
|
||||||
|
|
||||||
# Automation.
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Bedroom Light - Custom
|
- alias: Bedroom Light - Custom
|
||||||
trigger:
|
trigger:
|
||||||
@ -120,21 +111,18 @@ automation:
|
|||||||
to: CUSTOM
|
to: CUSTOM
|
||||||
action:
|
action:
|
||||||
- service: light.turn_on
|
- service: light.turn_on
|
||||||
# Again, note the use of 'data_template:' rather than the normal 'data:' if you weren't using an input variable.
|
# Again, note the use of 'data_template:' rather than the normal 'data:' if you weren't using an input variable.
|
||||||
data_template:
|
data_template:
|
||||||
entity_id: light.bedroom
|
entity_id: light.bedroom
|
||||||
brightness: '{{ states.input_number.bedroom_brightness.state | int }}'
|
brightness: '{{ states.input_number.bedroom_brightness.state | int }}'
|
||||||
{% endraw %}
|
|
||||||
```
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
Example of `input_number` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation.
|
Example of `input_number` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation.
|
||||||
|
|
||||||
```yaml
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
|
```yaml
|
||||||
# Example configuration.yaml entry using 'input_number' in an action in an automation
|
# Example configuration.yaml entry using 'input_number' in an action in an automation
|
||||||
|
|
||||||
# Define input_number
|
|
||||||
input_number:
|
input_number:
|
||||||
target_temp:
|
target_temp:
|
||||||
name: Target Heater Temperature Slider
|
name: Target Heater Temperature Slider
|
||||||
@ -143,31 +131,29 @@ input_number:
|
|||||||
step: 1
|
step: 1
|
||||||
unit_of_measurement: step
|
unit_of_measurement: step
|
||||||
icon: mdi:target
|
icon: mdi:target
|
||||||
|
|
||||||
# Automation.
|
|
||||||
# This automation script runs when a value is received via MQTT on retained topic: setTemperature
|
# This automation script runs when a value is received via MQTT on retained topic: setTemperature
|
||||||
# It sets the value slider on the GUI. This slides also had its own automation when the value is changed.
|
# It sets the value slider on the GUI. This slides also had its own automation when the value is changed.
|
||||||
- alias: Set temp slider
|
automation:
|
||||||
trigger:
|
- alias: Set temp slider
|
||||||
platform: mqtt
|
trigger:
|
||||||
topic: "setTemperature"
|
platform: mqtt
|
||||||
action:
|
|
||||||
service: input_number.set_value
|
|
||||||
data_template:
|
|
||||||
entity_id: input_number.target_temp
|
|
||||||
value: '{{ trigger.payload}}'
|
|
||||||
|
|
||||||
# This automation script runs when the target temperature slider is moved.
|
|
||||||
# It publishes its value to the same MQTT topic it is also subscribed to.
|
|
||||||
- alias: Temp slider moved
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: input_number.target_temp
|
|
||||||
action:
|
|
||||||
service: mqtt.publish
|
|
||||||
data_template:
|
|
||||||
topic: "setTemperature"
|
topic: "setTemperature"
|
||||||
retain: true
|
action:
|
||||||
payload: '{{ states.input_number.target_temp.state | int }}'
|
service: input_number.set_value
|
||||||
{% endraw %}
|
data_template:
|
||||||
|
entity_id: input_number.target_temp
|
||||||
|
value: '{{ trigger.payload}}'
|
||||||
|
# This automation script runs when the target temperature slider is moved.
|
||||||
|
# It publishes its value to the same MQTT topic it is also subscribed to.
|
||||||
|
- alias: Temp slider moved
|
||||||
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: input_number.target_temp
|
||||||
|
action:
|
||||||
|
service: mqtt.publish
|
||||||
|
data_template:
|
||||||
|
topic: "setTemperature"
|
||||||
|
retain: true
|
||||||
|
payload: '{{ states.input_number.target_temp.state | int }}'
|
||||||
```
|
```
|
||||||
|
{% endraw %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user