Add garage lights.
This commit is contained in:
73
_data/gar-light-1.yaml
Normal file
73
_data/gar-light-1.yaml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
substitutions:
|
||||||
|
device_name: gar-light-1
|
||||||
|
dn: "gar-light-1"
|
||||||
|
sn: gl1
|
||||||
|
friendly_name: Garage Light 1
|
||||||
|
ps_pin: GPIO27
|
||||||
|
dimmer_pin: GPIO14
|
||||||
|
warm_pin: GPIO12
|
||||||
|
cool_pin: GPIO13
|
||||||
|
pwmfreq: 2000Hz
|
||||||
|
|
||||||
|
<<: !include .common.yaml
|
||||||
|
<<: !include .wifi-oss.yaml
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: ${dn}
|
||||||
|
platform: ESP32
|
||||||
|
board: esp32doit-devkit-v1
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: ledc
|
||||||
|
pin: ${dimmer_pin}
|
||||||
|
id: dimmer_output_id
|
||||||
|
frequency: ${pwmfreq}
|
||||||
|
- platform: gpio
|
||||||
|
id: ps_id
|
||||||
|
pin:
|
||||||
|
number: ${ps_pin}
|
||||||
|
inverted: false
|
||||||
|
- platform: gpio
|
||||||
|
id: warm_id
|
||||||
|
pin:
|
||||||
|
number: ${warm_pin}
|
||||||
|
inverted: true
|
||||||
|
- platform: gpio
|
||||||
|
id: cool_id
|
||||||
|
pin:
|
||||||
|
number: ${cool_pin}
|
||||||
|
inverted: true
|
||||||
|
- platform: template
|
||||||
|
id: color_output_id
|
||||||
|
type: float
|
||||||
|
write_action:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return ((state >= 0) && (state < 0.33));
|
||||||
|
then:
|
||||||
|
- output.turn_on: warm_id
|
||||||
|
- output.turn_off: cool_id
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return ((state >= 0.33) && (state < 0.66));
|
||||||
|
then:
|
||||||
|
- output.turn_on: warm_id
|
||||||
|
- output.turn_on: cool_id
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return ((state >= 0.66) && (state <= 1));
|
||||||
|
then:
|
||||||
|
- output.turn_off: warm_id
|
||||||
|
- output.turn_on: cool_id
|
||||||
|
light:
|
||||||
|
- platform: color_temperature
|
||||||
|
name: ${friendly_name}
|
||||||
|
brightness: dimmer_output_id
|
||||||
|
color_temperature: color_output_id
|
||||||
|
cold_white_color_temperature: 5000 K
|
||||||
|
warm_white_color_temperature: 3000 K
|
||||||
|
restore_mode: RESTORE_DEFAULT_ON
|
||||||
|
on_turn_on:
|
||||||
|
- output.turn_on: ps_id
|
||||||
|
on_turn_off:
|
||||||
|
- output.turn_off: ps_id
|
||||||
73
_data/gar-light-2.yaml
Normal file
73
_data/gar-light-2.yaml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
substitutions:
|
||||||
|
device_name: gar-light-2
|
||||||
|
dn: "gar-light-2"
|
||||||
|
sn: gl2
|
||||||
|
friendly_name: Garage Light 2
|
||||||
|
ps_pin: GPIO27
|
||||||
|
dimmer_pin: GPIO14
|
||||||
|
warm_pin: GPIO12
|
||||||
|
cool_pin: GPIO13
|
||||||
|
pwmfreq: 2000Hz
|
||||||
|
|
||||||
|
<<: !include .common.yaml
|
||||||
|
<<: !include .wifi-oss.yaml
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: ${dn}
|
||||||
|
platform: ESP32
|
||||||
|
board: esp32doit-devkit-v1
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: ledc
|
||||||
|
pin: ${dimmer_pin}
|
||||||
|
id: dimmer_output_id
|
||||||
|
frequency: ${pwmfreq}
|
||||||
|
- platform: gpio
|
||||||
|
id: ps_id
|
||||||
|
pin:
|
||||||
|
number: ${ps_pin}
|
||||||
|
inverted: false
|
||||||
|
- platform: gpio
|
||||||
|
id: warm_id
|
||||||
|
pin:
|
||||||
|
number: ${warm_pin}
|
||||||
|
inverted: true
|
||||||
|
- platform: gpio
|
||||||
|
id: cool_id
|
||||||
|
pin:
|
||||||
|
number: ${cool_pin}
|
||||||
|
inverted: true
|
||||||
|
- platform: template
|
||||||
|
id: color_output_id
|
||||||
|
type: float
|
||||||
|
write_action:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return ((state >= 0) && (state < 0.33));
|
||||||
|
then:
|
||||||
|
- output.turn_on: warm_id
|
||||||
|
- output.turn_off: cool_id
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return ((state >= 0.33) && (state < 0.66));
|
||||||
|
then:
|
||||||
|
- output.turn_on: warm_id
|
||||||
|
- output.turn_on: cool_id
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return ((state >= 0.66) && (state <= 1));
|
||||||
|
then:
|
||||||
|
- output.turn_off: warm_id
|
||||||
|
- output.turn_on: cool_id
|
||||||
|
light:
|
||||||
|
- platform: color_temperature
|
||||||
|
name: ${friendly_name}
|
||||||
|
brightness: dimmer_output_id
|
||||||
|
color_temperature: color_output_id
|
||||||
|
cold_white_color_temperature: 5000 K
|
||||||
|
warm_white_color_temperature: 3000 K
|
||||||
|
restore_mode: RESTORE_DEFAULT_ON
|
||||||
|
on_turn_on:
|
||||||
|
- output.turn_on: ps_id
|
||||||
|
on_turn_off:
|
||||||
|
- output.turn_off: ps_id
|
||||||
Reference in New Issue
Block a user