LED brightness

This commit is contained in:
Nikolay Vasilchuk
2021-10-15 13:32:48 +03:00
parent eae44022c4
commit f6eb0983db
4 changed files with 27 additions and 9 deletions

View File

@@ -47,15 +47,13 @@ substitutions:
short_click_time_from: 50ms # Short button click min time
short_click_time_to: 1000ms # Long button click min time
# Led configuration
led_brightness: "0.7"
########### End user configuration ###########
packages:
base: !include domofon_packages/base.yaml
api: !include domofon_packages/api.yaml
#mqtt: !include domofon_packages/mqtt.yaml
number: !include domofon_packages/number.yaml
script: !include domofon_packages/script.yaml
output: !include domofon_packages/output.yaml
switch: !include domofon_packages/switch.yaml

View File

@@ -22,7 +22,7 @@ light:
transition_length: 0ms
- light.turn_on:
id: rgb_led
brightness: $led_brightness
brightness: !lambda "return id(led_brightness).state / 10;"
red: 0%
green: 100%
blue: 0%
@@ -48,7 +48,7 @@ light:
transition_length: 0ms
- light.turn_on:
id: rgb_led
brightness: $led_brightness
brightness: !lambda "return id(led_brightness).state / 10;"
red: 100%
green: 0%
blue: 0%

View File

@@ -0,0 +1,20 @@
number:
- platform: template
name: "${board_name} LED Brightness"
icon: "mdi:led-on"
id: led_brightness
optimistic: true
restore_value: true
initial_value: 7
min_value: 0
max_value: 10
step: 1
set_action:
then:
if:
condition:
light.is_on: rgb_led
then:
light.control:
id: rgb_led
brightness: !lambda "return id(led_brightness).state / 10;"

View File

@@ -103,7 +103,7 @@ script:
- script.execute: led_off
- light.turn_on:
id: rgb_led
brightness: $led_brightness
brightness: !lambda "return id(led_brightness).state / 10;"
red: 0%
green: 0%
blue: 100%
@@ -117,7 +117,7 @@ script:
- script.execute: led_off
- light.turn_on:
id: rgb_led
brightness: $led_brightness
brightness: !lambda "return id(led_brightness).state / 10;"
red: 0%
green: 100%
blue: 0%
@@ -137,7 +137,7 @@ script:
- script.execute: led_off
- light.turn_on:
id: rgb_led
brightness: $led_brightness
brightness: !lambda "return id(led_brightness).state / 10;"
red: 100%
green: 0%
blue: 0%
@@ -149,7 +149,7 @@ script:
- script.execute: led_off
- light.turn_on:
id: rgb_led
brightness: $led_brightness
brightness: !lambda "return id(led_brightness).state / 10;"
red: 0%
green: 70%
blue: 100%