Skip to content

Instantly share code, notes, and snippets.

@tillbaks
Last active August 21, 2022 13:28
Show Gist options
  • Save tillbaks/4ece10575ce017e0ba68e725361472ab to your computer and use it in GitHub Desktop.
Save tillbaks/4ece10575ce017e0ba68e725361472ab to your computer and use it in GitHub Desktop.
Home Assistant Config for IR receivers (SMSL Q5 Pro example)
control_smsl_q5_pro:
alias: Control SMSL Q5 Pro
mode: queued
icon: mdi:remote
max: 10
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''volume'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command: down
num_repeats: 62
target:
entity_id: remote.rm4c_mini_remote
- delay:
hours: 0
minutes: 0
seconds: 18
milliseconds: 0
- service: remote.send_command
data:
entity_id: remote.rm4c_mini_remote
device: SMSL Q5 Pro
command: up
num_repeats: '{{ level - 1 | int }}'
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: input_number.set_value
target:
entity_id: input_number.stereo_volume
data:
value: '{{ level | int }}'
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''treble'' }}'
sequence:
- service: remote.send_command
data:
entity_id: remote.rm4c_mini_remote
device: SMSL Q5 Pro
command: tone
num_repeats: 2
- service: remote.send_command
data:
entity_id: remote.rm4c_mini_remote
device: SMSL Q5 Pro
command: down
num_repeats: 20
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: remote.send_command
data:
entity_id: remote.rm4c_mini_remote
device: SMSL Q5 Pro
command: up
num_repeats: '{{ level + 9 | int }}'
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: remote.send_command
data:
device: SMSL Q5 Pro
command: tone
target:
entity_id: remote.rm4c_mini_remote
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: input_number.set_value
target:
entity_id: input_number.stereo_treble
data:
value: '{{ level | int }}'
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''bass'' }}'
sequence:
- service: remote.send_command
data:
entity_id: remote.rm4c_mini_remote
device: SMSL Q5 Pro
command: tone
- service: remote.send_command
data:
entity_id: remote.rm4c_mini_remote
device: SMSL Q5 Pro
command: down
num_repeats: 20
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: remote.send_command
data:
entity_id: remote.rm4c_mini_remote
device: SMSL Q5 Pro
command: up
num_repeats: '{{ level + 9 | int }}'
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: remote.send_command
data:
device: SMSL Q5 Pro
command: tone
num_repeats: 2
target:
entity_id: remote.rm4c_mini_remote
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: input_number.set_value
target:
entity_id: input_number.stereo_bass
data:
value: '{{ level | int }}'
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''volume-up'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command: up
target:
entity_id: remote.rm4c_mini_remote
- service: input_number.increment
target:
entity_id: input_number.stereo_volume
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''volume-down'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command: down
target:
entity_id: remote.rm4c_mini_remote
- service: input_number.decrement
target:
entity_id: input_number.stereo_volume
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''bass-up'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command:
- tone
- up
- tone
- tone
target:
entity_id: remote.rm4c_mini_remote
- service: input_number.increment
target:
entity_id: input_number.stereo_bass
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''bass-down'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command:
- tone
- down
- tone
- tone
target:
entity_id: remote.rm4c_mini_remote
- service: input_number.decrement
target:
entity_id: input_number.stereo_bass
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''treble-up'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command:
- tone
- tone
- up
- tone
target:
entity_id: remote.rm4c_mini_remote
- service: input_number.increment
target:
entity_id: input_number.stereo_treble
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''treble-down'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command:
- tone
- tone
- down
- tone
target:
entity_id: remote.rm4c_mini_remote
- service: input_number.decrement
target:
entity_id: input_number.stereo_treble
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''eq-next'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command:
- eq
- eq
- tone
target:
entity_id: remote.rm4c_mini_remote
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''source-next'' }}'
sequence:
- service: remote.send_command
data:
device: SMSL Q5 Pro
command: source
target:
entity_id: remote.rm4c_mini_remote
default: []
Some Home Assistant Helpers which are used in the script:
Name: Stereo Volume
Entity ID: input_number.stereo_volume
Minimum: 1
Maximum: 60
Step Size: 1
Name: Stereo Bass
Entity ID: input_number.stereo_bass
Minimum: -9
Maximum: 9
Step Size: 1
Name: Stereo Treble
Entity ID: input_number.stereo_treble
Minimum: -9
Maximum: 9
Step Size: 1
learn_remote_smsl_q5_pro:
alias: Learn Remote - SMSL Q5 Pro
mode: single
icon: mdi:remote
sequence:
- service: remote.learn_command
data:
entity_id: remote.rm4c_mini_remote
device: SMSL Q5 Pro
command:
- power
- up
- down
- eq
- tone
- source
- mute
type: vertical-stack
cards:
- type: grid
columns: 4
cards:
- type: gauge
entity: input_number.stereo_volume
min: 0
max: 100
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: volume-down
target: {}
icon: mdi:volume-low
show_name: false
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: volume-up
target: {}
icon: mdi:volume-high
show_name: false
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: volume
level: 2
target: {}
icon: mdi:undo-variant
show_name: false
- type: gauge
entity: input_number.stereo_bass
min: -9
max: 9
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: bass-down
target: {}
icon: mdi:volume-minus
show_name: false
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: bass-up
target: {}
icon: mdi:volume-plus
show_name: false
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: bass
level: 0
target: {}
icon: mdi:undo-variant
show_name: false
- type: gauge
entity: input_number.stereo_treble
min: -9
max: 9
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: treble-down
target: {}
icon: mdi:volume-minus
show_name: false
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: treble-up
target: {}
icon: mdi:volume-plus
show_name: false
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: treble
level: 7
target: {}
icon: mdi:undo-variant
show_name: false
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: source-next
target: {}
icon: mdi:video-input-svideo
name: Next Input
- type: button
tap_action:
action: call-service
service: script.control_smsl_q5_pro
service_data:
action: eq-next
target: {}
icon: mdi:volume-vibrate
name: Next EQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment