Created
March 29, 2024 15:40
-
-
Save mogery/7682bf8cffa03ccd77449055015bae1c to your computer and use it in GitHub Desktop.
ESPHome configuration for controlling an EGLO GIRON ceiling lamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remote_transmitter: | |
pin: GPIO12 # change to your IR LED pin | |
carrier_duty_percent: 50% | |
output: | |
- platform: template | |
id: ceiling_light_brightness | |
type: float | |
write_action: | |
then: | |
- if: | |
condition: | |
light.is_on: ceiling_light | |
then: | |
- remote_transmitter.transmit_samsung: | |
data: !lambda |- | |
int brightness = (int)round(state * 7.0); | |
int temperature = (int)round((id(ceiling_light).current_values.get_color_temperature() - 200.0) / 133.333344 * 7.0); | |
// ESP_LOGD("giron_ir", "Brightness: %i, Temperature: %i", brightness, temperature); | |
int base = 0b00111010110000000000000000000000; | |
int addr = ((0b0101 + brightness) << 4) + 0b1111 + temperature; | |
addr = ((addr & 0xF0) >> 4) | ((addr & 0x0F) << 4); | |
addr = ((addr & 0xCC) >> 2) | ((addr & 0x33) << 2); | |
addr = ((addr & 0xAA) >> 1) | ((addr & 0x55) << 1); | |
brightness = (brightness & 0b010) | ((brightness & 0b100) >> 2) | ((brightness & 0b001) << 2); | |
temperature = (temperature & 0b010) | ((temperature & 0b100) >> 2) | ((temperature & 0b001) << 2); | |
int cmd = base | (brightness << 17) | (temperature << 13) | addr; | |
// ESP_LOGD("giron_ir", "Command: %#010X", cmd); | |
return cmd; | |
else: | |
- remote_transmitter.transmit_samsung: | |
data: 0x8ACE0023 | |
- platform: template | |
id: ceiling_light_temperature | |
type: float | |
write_action: | |
then: # This is just a dummy output. Changing the temperature is handled by ceiling_light_brightness | |
light: | |
- platform: color_temperature | |
name: Ceiling Light | |
id: ceiling_light | |
brightness: ceiling_light_brightness | |
color_temperature: ceiling_light_temperature | |
default_transition_length: 0s | |
warm_white_color_temperature: 3000 K | |
cold_white_color_temperature: 5000 K |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment