ESPHome-Devices/core/device_tuya_dimmer.yaml

61 lines
1.7 KiB
YAML
Raw Normal View History

esphome:
<<: !include esphome.yaml
includes:
- ../custom/tuya_light_plus.h
on_boot:
priority: -100
then:
- script.execute: startup
<<: !include ../components/logger/logger_none.yaml
<<: !include wifi_api_ota.yaml
binary_sensor:
- !include ../components/binary_sensor/status.yaml
light:
# We need this dummy light to get the base tuya_light code to get pulled in to the build folder
- platform: "tuya"
id: dummy_light
switch_datapoint: 255
- platform: custom
lambda: |-
TuyaLight = new TuyaLightPlus();
TuyaLight->set_switch_id(1);
TuyaLight->set_dimmer_id(2);
TuyaLight->set_min_value(0);
TuyaLight->set_max_value(1000);
TuyaLight->set_tuya_parent(tuya_tuya);
TuyaLight->set_day_night_sensor("sensor.day_night");
TuyaLight->set_day_default_brightness(${day_brightness});
TuyaLight->set_night_default_brightness(${night_brightness});
TuyaLight->set_day_auto_off_minutes(${day_auto_off_minutes});
TuyaLight->set_night_auto_off_minutes(${night_auto_off_minutes});
TuyaLight->set_api_server(api_apiserver);
TuyaLight->set_linked_lights("${linked_lights}");
TuyaLight->set_double_tap_on_stays_on(${double_tap_on_stays_on});
App.register_component(TuyaLight);
return {TuyaLight};
lights:
- id: tuya_light
name: ${device_name}
gamma_correct: 1.0
default_transition_length: 0s
sensor:
- !include ../components/sensor/uptime.yaml
- !include ../components/sensor/wifi.yaml
switch:
- !include ../components/switch/restart.yaml
text_sensor:
- !include ../components/text_sensor/version.yaml
- !include ../components/text_sensor/wifi.yaml
tuya:
uart:
- !include ../components/uart/tuya.yaml