Skip to main content.

When many people think about our WiFi IR products they are mainly focused on the IR Emitter for use as a way to control items such as dehumidifiers, air conditioners, and blinds. The IR receiver in the kit is often thought of as just a way to record IR codes. The IR receiver, however, can be used in production automations. For example, one of our customers requested that we dim the lights based on a key press of their existing Verizon FiOS remote control. This way, when the customer started a show with the remote, they could use the exact same remote to also turn down the lights. The WiFi IR Receiver is a perfect product to accomplish this automation using esphomeyaml

Turn Off Lights Based on IR Button Press

First we need the esphomeyaml code to capture the IR buttom press and send it to home assistant as a binary I/O. In this particular example we use the widgets button on the FiOS remote. This button is basically harmless in any state of the DVR so it can be easily overloaded as the light trigger.


esphomeyaml:
  name: ir_sensor_1
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: 'XXXX'
  password: 'XXXXX'

mqtt:
  broker: '192.168.1.160'
  username: 'mosquitto'
  password: 'XXXXX'

# Enable logging
logger:

ota:
  password: 'XXXX'

remote_receiver:
  pin: D7
  filter: 20us
  idle: 20ms
  buffer_size: 4068
  dump: all
  
binary_sensor:
  - platform: remote_receiver
    name: "FIOS_Widgets"
    raw: [-8949, 4409, -583, 4382, -538, 4403, -535, 2181, -509, 2207, -534, 2181, -535, 2180, -510, 4432, -510, 2205, -510, 2210, -505, 2207, -509, 2206, -510, 2205, -539, 4403, -510, 2205, -536, 2180, -510, 4431, -562 ]
   
   

Next we need an automation that responds to the IR button press and controls the lights.

- id: 'fios_bytton_to_lights'
  alias: fios_button_to_lights
  trigger:
  - entity_id: binary_sensor.fios_widgets
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      brightness_pct: on
      entity_id: light.living_room
    service: light.turn_off