Skip to content

Instantly share code, notes, and snippets.

@a-x-
Last active April 5, 2021 15:40
Show Gist options
  • Save a-x-/c8160a8fcfd95c776c1cbec820e5fdff to your computer and use it in GitHub Desktop.
Save a-x-/c8160a8fcfd95c776c1cbec820e5fdff to your computer and use it in GitHub Desktop.
ir transmitter for samsung tv q9 and sven 5.1 audio; led highlight under couch
esphome:
name: esp_living_couch1
platform: ESP8266
board: d1_mini
wifi:
ssid: "grove"
password: "0My%Secur"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp Irda Led Fallback Hotspot"
password: "KE7ShI8Rwk8b"
captive_portal:
# Enable Home Assistant API
api:
services:
- service: mhz19_calibrate_zero
then:
- mhz19.calibrate_zero: sensor_mhz19
ota:
#
# IR Sound Speaker controller
remote_receiver:
pin:
number: D4
inverted: True
mode: INPUT_PULLUP
dump: all
# tolerance: 25%
# filter: 15us
# idle: 15ms
remote_transmitter:
pin: D5
# Infrared remotes use a 50% carrier signal
carrier_duty_percent: 50%
# binary_sensor:
# - platform: remote_receiver
# name: "Sound Toggle Mute"
# lg:
# data: 0x827DB847
# nbits: 32
switch:
- platform: template
name: living_speakers_toggle_mute
turn_on_action:
remote_transmitter.transmit_pioneer:
rc_code_1: 0x821D
- platform: template
name: living_speakers_setup
turn_on_action:
then:
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x8206 # input
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x8219 # stereo -> 5.1
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x8205 # menu
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x8205 # menu
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x8205 # menu -> Surround volume
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x821E # Up
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x821E # Up
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x821E # Up
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x821E # Up
#
# Couch button
binary_sensor:
- platform: gpio
pin:
number: D1
inverted: yes
mode: INPUT_PULLUP
name: living_couch_btn
filters:
- delayed_on: 50ms
- delayed_off: 50ms
on_click:
- max_length: 400ms
min_length: 50ms
then:
# - homeassistant.service:
# service: media_player.media_play_pause
# data:
# entity_id: media_player.q9
- homeassistant.event:
event: esphome.living_couch_btn_click
- min_length: 500ms # on_hold
max_length: 5000ms
then:
- remote_transmitter.transmit_pioneer:
rc_code_1: 0x821D
on_double_click:
then:
- homeassistant.event:
event: esphome.living_couch_btn_dblclick
# - homeassistant.service:
# service: switch.toggle
# data:
# entity_id: switch.living_toggle_tv
# on_double_click:
# then:
# - homeassistant.service:
# service: media_player.toggle
# data:
# entity_id: media_player.q9
# on_multi_click:
# - timing:
# - ON for at most 0.3s
# - OFF for at most 0.3s
# - ON for at most 0.3s
# - OFF for at least 0.1s
# then:
# - remote_transmitter.transmit_samsung:
# data: 0xE0E06798 # toggle power
# # - homeassistant.service:
# # service: media_player.toggle
# # data:
# # entity_id: media_player.q9
# - timing:
# - ON for at most 0.4s
# - OFF for at least 0.35s
# then:
# - remote_transmitter.transmit_pioneer:
# rc_code_1: 0x821D
output: # relays
- platform: esp8266_pwm #gpio
id: couch_led_mosfet
pin: D2
light: # frontend to relays
- platform: monochromatic #binary
name: living_couch_highlight
output: couch_led_mosfet
#
# CO2 Sensor
uart: # uart0
rx_pin: GPIO3 # IO15, IO13 — 2-й вариант физического UART, по-идее можно и основные юзать: TX—GPIO1, RX—GPIO3
tx_pin: GPIO1
baud_rate: 9600 # Частота MH-Z19B
# logger использует uart0 по умолчанию
# uart1 может использовать только TX (при необходимости туда можно будет перевесить логгер)
# но проводной логгер не особо нужен, поэтому просто отключаем
logger:
# Логируем, но толлько через OTA
baud_rate: 0
sensor:
- platform: mhz19
id: sensor_mhz19
co2:
name: living_couch_co2
temperature:
name: living_couch_internal_temp
update_interval: 30s
# В помещении не нужно калибровать каждые 24 часа,
# потому что не гарантируется нормальное содержание СО2 (400ppm)
automatic_baseline_calibration: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment