To make use of all the things I've learned, I want to integrate my receiver control into Home Assistant. I already have a lot of ESP01 modules running esphome for measuring temperature and humidity. esphome is extremely convenient, especially if you want to integrate it into Home Assistant.
It's is also capable of generating RC5 codes. So I tried that first: hook up and LED via Transistor. Increasing the volume worked like a charm.
- remote_transmitter.transmit_rc5: address: 0x10 command: 0x10
The only problem I have now, is that all libraries for sending RC5 codes modulate them with the IR carrier frequency. Which makes a lot of sense. But my signal does not need to be modulated, because it goes in via wire. Luckily, there is a function to transmit "raw" signals (it's just the timing on and off in ns). The default carrier frequency is even 0Hz. Very nice. Using IrScrutinizer I generated the four raw codes for vol+, vol-, standby, and on/AUX, put them in my esphome YAML file:
esphome:
name: music-control
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
id: musik_anlage
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
ota:
password: "xxxxxxxxxxxxxxxx"
wifi:
ssid: "WIFI-so-fly"
password: "wouldntyouliketoknow"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "music-control Fallback Hotspot"
password: "nope"
captive_portal:
remote_transmitter:
pin: GPIO3
carrier_duty_percent: 100%
# Individual switches
switch:
- platform: template
name: "Musikanlage lauter"
#RC5 Device/Address 16 (0x10), Command 16 (0x10)
turn_on_action:
remote_transmitter.transmit_raw:
code: [+888, -888, +888, -888, +888, -888, +1776, -888, +888, -888, +888, -888, +888, -888, +888, -1776, +1776, -888, +888, -888, +888, -888, +888]
- platform: template
name: "Musikanlage leiser"
#RC5 Device/Address 16 (0x10), Command 17 (0x10)
turn_on_action:
remote_transmitter.transmit_raw:
code: [+889, -889, +889, -889, +889, -889, +1778, -889, +889, -889, +889, -889, +889, -889, +889, -1778, +1778, -889, +889, -889, +889, -1778, +889]
- platform: template
name: "Musikanlage an"
#actually the command for changing the source to AUX/TV
#RC5 Device/Address 0 (0x00), Command 63 (0x3F)
turn_on_action:
remote_transmitter.transmit_raw:
code: [+889, -889, +889, -889, +1778, -889, +889, -889, +889, -889, +889, -889, +889, -1778, +889, -889, +889, -889, +889, -889, +889, -889, +889, -889, +889]
- platform: template
name: "Musikanlage standby"
#actually the command for the tuner to go to standby
#RC5 Device/Address 17 (0x11), Command 12 (0x0C)
turn_on_action:
remote_transmitter.transmit_raw:
code: [+889, -889, +889, -889, +889, -889, +1778, -889, +889, -889, +889, -1778, +1778, -889, +889, -1778, +889, -889, +1778, -889, +889]
I connected the pin via a 10k Resistor, and it works! Now I can control everything via HA:
All that's left to do, is make a nice board, a case, nice wiring and possibly add some more logic, to keep track of the receiver state and possibly turn it off, when nobody's home.
- Send commands with ESP01 (esphome) via IR LED (triggered in Home assistant) ✅
- Send commands with ESP01 (esphome) via wire (triggered in Home assistant) ✅
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.