Skip to content

Instantly share code, notes, and snippets.

@Steve-Tech
Created June 7, 2025 08:36
Show Gist options
  • Save Steve-Tech/87d28a3679fa31fb7b0f3bbaf01b8c52 to your computer and use it in GitHub Desktop.
Save Steve-Tech/87d28a3679fa31fb7b0f3bbaf01b8c52 to your computer and use it in GitHub Desktop.
ESPHome Casablanca IR (SM5021BL) Light & Fan Remote Config
# ESPHome Casablanca IR Light & Fan Remote Config
# These remotes use the SM5021BL IC, the values are calculated as per the datasheet.
# Add this to an existing config and change GPIO0 to whatever pin you have chosen to use.
remote_transmitter:
pin: GPIO0
carrier_duty_percent: 50%
output:
- platform: template
id: light1
type: binary
write_action:
- delay: 0s
- platform: template
id: fan1
type: float
write_action:
- delay: 0s
light:
- platform: binary
name: "Bedroom Light"
output: light1
on_turn_on:
- repeat:
count: 4
then:
- remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: [1125, -375, 1125, -375, 375, -1125, 1125, -375, 1125, -375, 375, -1125, 1125, -375, 375, -1125, 375, -1125, 375, -1125, 375, -1125, 375, -1125]
- delay: 9ms
on_turn_off:
- repeat:
count: 4
then:
- remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: [1125, -375, 1125, -375, 375, -1125, 1125, -375, 1125, -375, 375, -1125, 375, -1125, 1125, -375, 375, -1125, 375, -1125, 375, -1125, 375, -1125]
- delay: 9ms
fan:
- platform: speed
name: "Bedroom Fan"
id: fan
output: fan1
speed_count: 3
on_turn_off:
- repeat:
count: 4
then:
- remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: [1125, -375, 1125, -375, 375, -1125, 1125, -375, 1125, -375, 375, -1125, 375, -1125, 375, -1125, 375, -1125, 375, -1125, 375, -1125, 1125, -375]
- delay: 9ms
on_speed_set:
- if:
condition:
lambda: 'return id(fan).speed == 1;'
then:
- repeat:
count: 4
then:
- remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: [1125, -375, 1125, -375, 375, -1125, 1125, -375, 1125, -375, 375, -1125, 375, -1125, 375, -1125, 1125, -375, 375, -1125, 375, -1125, 375, -1125]
- delay: 9ms
- if:
condition:
lambda: 'return id(fan).speed == 2;'
then:
- repeat:
count: 4
then:
- remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: [1125, -375, 1125, -375, 375, -1125, 1125, -375, 1125, -375, 375, -1125, 375, -1125, 375, -1125, 375, -1125, 1125, -375, 375, -1125, 375, -1125]
- delay: 9ms
- if:
condition:
lambda: 'return id(fan).speed == 3;'
then:
- repeat:
count: 4
then:
- remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: [1125, -375, 1125, -375, 375, -1125, 1125, -375, 1125, -375, 375, -1125, 375, -1125, 375, -1125, 375, -1125, 375, -1125, 1125, -375, 375, -1125]
- delay: 9ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment