Seeed Xiao IR Mate dashboard - multiple buttons

This is the first time that I’ve tried to create a dashboard and I’m a little unclear about the best way to make a set of buttons in the dashboard that will send various signals using a Xiao IR Mate. For example: I’d like one button that will turn on my TV, a second that will increase the volume, and a third that will decrease the volume. Basically emulating a simple remote control.

All three different IR signals are stored as signal[0-3], but I don’t see a way to send those different signals using the dashboard to create a button.
My instinct is that I should create an automation for each button and then trigger them on the respective button press.

Is there a better way to accomplish my goal? This is the first time I’ve played with either HA dashboards or IR devices, so I’m out of my depth.

You don’t need a separate automation for each button. A button card can call a script or service directly with its tap action, so each button can send its own signal index for power, volume up and volume down. It’s a simpler set-up and keeps everything on the dashboard itself.

Is there a way to configure the button to do 2 things by itself? (selecting a signal to send from the Seeed Mate, then sending that signal)? I’ve tried to set it up like that in the UI but it appears that I can only do one or another.

I ended up trying to set up a script (below) but I can’t figure out how to test which button I’ve pressed in the dashboard.

sequence:

  • choose:
    • conditions:
      • condition: trigger
        id: ‘’
        sequence:
      • action: select.select_option
        metadata: {}
        target:
        entity_id: select.xiao_smart_ir_mate_183f58_signal_select
        data:
        option: Signal3
      • action: button.press
        metadata: {}
        target:
        entity_id: button.xiao_smart_ir_mate_183f58_send
        data: {}
    • conditions:
      • condition: trigger
        id: ‘’
        sequence:
      • action: select.select_option
        metadata: {}
        target:
        device_id: 2f84790a9fb2638dc34ce5bc02e409fa
        data:
        option: Signal4
      • action: button.press
        metadata: {}
        target:
        entity_id: button.xiao_smart_ir_mate_183f58_send
        data: {}
        alias: TV Remote
        description: ‘’

Have you considered HAIR? It’s in HACS/Marketplace.

Please follow the Community Questions Guideline #11 by properly formatting any shared code or configuration.

Beside the fact that they have '' in the id value, scripts don’t have triggers, so those Trigger conditions are not valid in 2 ways.


First things first, are you using the stock firmware on the IR Mate or is it flashed with custom firmware? Based on the entities used in the script, I would guess you are, but let us know otherwise. If you are unsure, take a screenshot of it’s device dashboard and we may be able to tell from the entities that are shown.

Before you get too deep into setting up scripts and automations for the device, you may want to consider flashing it with different firmware. The stock firmware is quite limited and does not include the ESPHome Infrared component which would allow the device to work as a proxy for HA.

There are a number of different ESPHome configs available for this device. The previously-linked HAIR integration has two available on its repo. If you want to get the most out of the device, I would highly recommend you use the full version of the firmware and install HAIR on you HA instance.


If you decide to stick with the stock firmware.

Please be specific. Are you asking about a dashboard button in HA or the device’s buttons (the device has a physical button as well as a capacitive sensor that acts like a button)? Based on the script, my guess would be a dashboard button, but let us know if that’s not the case. If it is a dashboard button, it would help us help you if you share the card configuration.


Dashboard cards that support multiple card actions like tap and hold can be pointed at a single script to produce different outcomes by passing values to the script. In the following version of your script I’ve used the variable type:

alias: TV Remote
description: ''
sequence:
  choose:
    - conditions:
        - condition: template
          id: "{{ type == 'tap' }}"
      sequence:
        - action: select.select_option
          metadata: {}
          target:
            entity_id: select.xiao_smart_ir_mate_183f58_signal_select
          data:
          option: Signal3
        - action: button.press
          metadata: {}
          target:
            entity_id: button.xiao_smart_ir_mate_183f58_send
          data: {}
    - conditions:
        - condition: template
          id: "{{ type == 'hold' }}"
      sequence:
        - action: select.select_option
          metadata: {}
          target:
            device_id: 2f84790a9fb2638dc34ce5bc02e409fa
          data:
          option: Signal4
        - action: button.press
          metadata: {}
          target:
            entity_id: button.xiao_smart_ir_mate_183f58_send
          data: {}

An example Button card configuration would be as follows:

type: button
name: TV Remote
show_name: true
tap_action:
  action: perform-action
  perform_action: script.tv_remote
  data:
    type: tap
  target: {}
hold_action:
  action: perform-action
  perform_action: script.tv_remote
  data:
    type: hold
  target: {}

Yes, I’m using the stock firmware because all I want to do is send these ~10 signals to my TV so I assumed that it would be the most straight forward. I also don’t trust the marketplace so I’m cautious about installing from it.

When I say “button”, I’m referring to a button in the HA dashboard. I’ve included the yaml below for the dashboard that I’ve created but what I’m looking for is a HA dashboard that has a way to turn on/off the tv, increase the volume, and decrease the volume; if this isn’t the right way to do it then I’m open to something else.

views:
  - type: sections
    sections:
      - type: grid
        cards:
          - type: heading
            heading: Volume
            heading_style: title
          - show_name: true
            show_icon: true
            type: button
            grid_options:
              columns: 12
              rows: 4
            name: Volume Up
            tap_action:
              action: perform-action
              perform_action: script.turn_on
              target:
                entity_id: script.tv_remote
              data: {}
          - show_name: true
            show_icon: true
            type: button
            name: Volume Down
            tap_action:
              action: perform-action
              perform_action: script.turn_on
              target:
                entity_id: script.tv_remote
              data: {}
            grid_options:
              columns: 12
              rows: 4
      - type: grid
        cards:
          - type: heading
            heading: Channel
            heading_style: title

If you are using discrete button cards for each desired action, then the tap actions each need to pass an identifier to the script they are calling.

For example:

...
            tap_action:
              action: perform-action
              perform_action: script.turn_on
              target:
                entity_id: script.tv_remote
              data:
                variables: 
                  type: volume_up
... 
# Make sure each button calls the script and 
# provides the correct type value for its desired function

Then the script can use a Choose action with options for each type:

alias: TV Remote
description: ''
sequence:
  - alias: Select the command to be sent
    choose:
      - conditions:
          - condition: template
            value_template: "{{ type == 'volume_up' }}"
        sequence:
          - action: select.select_option
            metadata: {}
            target:
              entity_id: select.xiao_smart_ir_mate_183f58_signal_select
            data:
              option: #### Whatever Signal ID increases the volume
      - conditions:
          - condition: template
            value_template: "{{ type == 'volume_down' }}"
        sequence:
          - action: select.select_option
            metadata: {}
            target:
              device_id: 2f84790a9fb2638dc34ce5bc02e409fa
            data:
              option: #### Whatever Signal decreases the volume
       #### Add the options for the rest of the commands
  - alias: Now that the command has been selected, send it
    action: button.press
    metadata: {}
    target:
      entity_id: button.xiao_smart_ir_mate_183f58_send
    data: {}

Thank you, I understand what’s going on. I’ve got the script set up the way I want but when I try to save it I get the error " Message malformed: not a valid option at ‘sequence[0].choose[0].conditions[0].id’" which reads
id: "{{ type == 'volume_up' }}"

Did I screw something up typing it?

Nope, that screw up is all mine. :man_facepalming:

It should be value_template: "{{ type == 'volume_up' }}"

Sorry for adding stress to your day… I’ve fixed the config in the post above.