Skip to content

Instantly share code, notes, and snippets.

@daemonp
Created May 22, 2021 10:21
Show Gist options
  • Save daemonp/7828bc14db3b264913eefdc571162e4b to your computer and use it in GitHub Desktop.
Save daemonp/7828bc14db3b264913eefdc571162e4b to your computer and use it in GitHub Desktop.
substitutions:
device_name: mcintosh
friendly_name: "McIntosh C2500"
timezone: "Europe/London"
main_icon: "amp"
activity_threshold: "5" # Threshold (number) that the device will change from `Idle` to `Active` if power is greater than or equal to
esphome:
name: ${device_name}
platform: ESP8266
board: d1_mini
includes:
- readline.h
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: ${friendly_name}_AP
logger:
level: VERBOSE #makes uart stream available in esphome logstream
baud_rate: 0 #disable logging over uart
hardware_uart: UART1
captive_portal:
api: # Enable Home Assistant API
reboot_timeout: 300s
ota:
web_server: # Enable Web server.
port: 80
time: # Sync time with Home Assistant.
- platform: homeassistant
id: homeassistant_time
timezone: ${timezone}
uart:
baud_rate: 115200
id: uart_bus
tx_pin: D3
rx_pin: D4
text_sensor:
- platform: custom
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(uart_bus));
App.register_component(my_custom_sensor);
return {my_custom_sensor};
text_sensors:
id: "uart_readline"
switch:
- platform: template
name: 'McIntosh Power'
icon: "mdi:radio"
id: power
lambda: |-
if (id(uart_readline).state == "(PON Z1)") {
return true;
} else if(id(uart_readline).state == "(POF Z1)") {
return false;
} else {
return {};
}
turn_on_action:
- uart.write: "(PON Z1)\r\n"
- delay: 1s
- uart.write: "(PON Z1)\r\n"
turn_off_action:
- uart.write: "(SYO)\r\n"
- platform: template
name: 'McIntosh Mute'
icon: "mdi:radio"
id: mute
lambda: |-
if (id(uart_readline).state == "(MUT Z1 1)") {
return true;
} else if(id(uart_readline).state == "(MUT Z1 0)") {
return false;
} else {
return {};
}
turn_on_action:
- uart.write: "(MUT Z1 1)\r\n"
turn_off_action:
- uart.write: "(MUT Z1 0)\r\n"
- platform: uart
icon: "mdi:radio"
name: "Query"
data: "(QRY)\r\n"
interval:
- interval: 300s
then:
- uart.write: "\r(QRY)\r\n"
# MA6700/MAC6700 RS232 CONTROL PROTOCOL
# This is basically the same for all the McIntosh integrated and 2 channel preamps that have RS232 control
# The RS232 protocol is built into the unit.
# If the programmer types in (HLP) from a RS232 terminal program, the complete protocol will be transferred and can then be printed.
# This holds true for all the integrated amps, C2500, C48 & C50
# The C2500 has the following RS232 parameters
# Baud rate : 115.2k by default – user selectable from setup menu
# Parity : None
# Stop Bits : 1
# Flow Control : None
# Every command begins with a ‘(‘ character and ends with ‘)’ character. Carriage returns are not necessary and not used to parse any part of the protocol. However, they may be sent by the control system and they are sent by the C2500 only for the purpose of clearer more readable display when a terminal program is used to monitor the traffic.
# Syntax: (COMMAND ZONE PARAMETER1 PARAMETER2 PARAMETERn)
# CONTROL MESSAGE:
# MESSAGE COMMAND ZONE PARAMETERS EXAMPLE REPLY
# RS232 Control CTL N/A 1=ON,0=OFF (CTL 1) CTL
# Power On PON Z1 N/A (PON Z1) PON
# NOTE: If the Unit is in Standby - Send Power On twice with @100MS Delay
# between them. This will wake the unit from low power sleep.
# Power Off POF Z1 N/A (POF Z1) POF
# System Off SYO N/A N/A (SYO) POF
# Volume Up VUP Z1 N/A (VUP Z1) VST
# Volume Up VUP Z1 1-9 Step Size (VUP Z1 5) VST
# Volume Down VDN Z1 N/A (VDN Z1) VST
# Volume Down VDN Z1 1-9 Step Size (VDN Z1 5) VST
# Volume Set VST Z1 0 - 100 (VST Z1 30) VST
# Mute MUT Z1 1=Muted,0=unMuted (MUT Z1 1) MUT
# Output 1 OP1 Z1 1 = ON, 0 = Off (OP1 Z1 1) OP1
# Output 2 OP2 Z1 1 = ON, 0 = Off (OP2 Z1 1) OP2
# Input Up INU Z1 N/A (INU Z1) INP
# Input Down IND Z1 N/A (IND Z1) INP
# Input Select INP Z1 1 - 9 (INP Z1 1) INP
# MC-1,MM-2,CD1-3,CD2-4,DVD-5,AUX-6,SERVER-7,D2A-8,TUNER_AM-9,TUNER_FM-10
# Trim Up TRU Z1 Trim Sel 0 - 10 (TRU Z1 0) TRS
# OFF-0,BALANCE-1,BASS-2,TREBEL-3,LEVEL-4,BYPASS-6,MONO-7,PHONO-8,DISPLAY-9,
# INFO-10,METER-11,TUNER-12,RADIOTEXT-13,TUNEMODE-14
# Trim Down TRD Z1 Trim Sel 0 - 12 (TRD Z1 0) TRS
# OFF-0,BALANCE-1,BASS-2,TREBEL-3,LEVEL-4,BYPASS-6,MONO-7,PHONO-8,DISPLAY-9,
# INFO-10,METER-11,TUNER-12,RADIOTEXT-13,TUNEMODE-14
# USB Audio TPC Z1 0 - 6 (TPC Z1 0) TPC
# PLAY - 0, STOP - 1, PAUSE - 2, NEXT - 3, BACK - 4, REV - 5, FF - 6
# IR Converter CNV N/A 1=ON,0=OFF (CNV 1) CNV
# RS232 to IR KEY Z1 IR Hex Code (KEY Z1 5F) KEY
# Preset Select PSS Z1 Preset(1-20) (PSS Z1 20) TNQ
# Seek Up SKU Z1 N/A (SKU Z1) TNQ
# Seek Down SKD Z1 N/A (SKD Z1) TNQ
# AM Select AMS Z1 N/A (AMS Z1) TNQ
# FM Select FMS Z1 N/A (FMS Z1) TNQ
# Tuner Query TNQ Z1 N/A (TNQ Z1) TNQ
# Tune Up TUP Z1 N/A (TUP Z1) TNQ
# Tune Down TDN Z1 N/A (TDN Z1) TNQ
# Tune Direct TDR Z1 AM=0, 1430 (TDR Z1 0 1430 1) TNQ
# FM=1, 1057 (TDR Z1 1 1057 1) TNQ
# HD Sub (1-3)
# Signal Strength SIG Z1 1=ON,0=OFF (SIG Z1 1) TSS
# System Query QRY N/A N/A (QRY) See Below
# REPLY STATUS MESSAGE:
# MESSAGE COMMAND ZONE PARAMETERS EXAMPLE
# IR to RS232 IRC Z1 IR Hex Code (IRC Z1 10)
# Volume Status VST Z1 %Volume (VST Z1 100)
# Mute Status MUT Z1 1=Mute, 0=unMute (MUT Z1 1)
# Input Selected INP Z1 1 - 9 (INP Z1 1)
# MC-1,MM-2,CD1-3,CD2-4,DVD-5,AUX-6,SERVER-7,D2A-8,TUNER_AM-9,TUNER_FM-10
# TrimStatus TRS Z1 P1: Selected Trim (TRS Z1 1 +10)
# P2: Trim Value
# OFF-0,BALANCE-1,BASS-2,TREBEL-3,LEVEL-4,BYPASS-6,MONO-7,PHONO-8,DISPLAY-9,
# INFO-10,METER-11,TUNER-12,RADIOTEXT-13,TUNEMODE-14
# Artist TAR Z1 1: Chan Number (TAR Z1 60 10 Pink Floyd)
# 2: String Length
# 3: Artist
# Song Title TTT Z1 1: Chan Number (TTT Z1 60 5 Money)
# 2: String Length
# 3: Song Title
# Tuner Query TNQ Z1 1: Preset(1-20) (TNQ Z1 15 1057 FM HD1)
# 2: Chan Number
# 3: Band
# 4: M/ST/HDn
# Genre (HD) THG Z1 1: Chan Number (THG Z1 1057 3 POP)
# 2: String Length
# 3: Genre
# Signal Strenth TSS Z1 1: Signal(0-3) (TSS Z1 3)
# ERROR MESSAGE:
# MESSAGE COMMAND EXAMPLE COMMENTS
# Command Error ERR 1 (ERR 1) Unrecognized Command
# Zone Error ERR 2 (ERR 2) Use Only Z1
# Parameter Error ERR 3 (ERR 3) Format or value in error
# Req Blocked Error ERR 4 (ERR 4) Trim or Setup Mode is Active
# Zone Off Error ERR 5 (ERR 5) Requested Zone must first be on
# Input Error ERR 6 (ERR 6) Wrong Input Selected for request
# Band Error ERR 7 (ERR 7) Band must be select before acted upon
# Preset Error ERR 8 (ERR 8) Preset number out of range
# Preset Not Set ERR 9 (ERR 9) Preset number not set
# (HLP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment