Help to get alexa to trigger a set of IR commands with iTach

Hi.

I am quite new to this and I have got stuck at the coding part of Scripts (I think script is were i will do the code)
I have managed to make 2 remotes in the frontend to try the code and get my itach to send the commands for on/off to 2 of my devices just to see that i works and it does.

However I would like my alexa to be able to trigger these that will be filled with more commands for my entire home like, tv + stereo + etc

From what I understod the alexa can trigger scripts so this is were i intend to insert the code but I can´t seem to figure out how to write the code in order for that to work.

The remote is set upp like below in the bottom.

My question is if anyone here could help and guide me to how this should be written in scripts and how to get alexa to acces and trigger this command for on and off ?

Also if anyone can tell me how to trigger two different itachs in the same script (one have an rf transmitter that will be activated in some scenarios)

*Note
I don´t need to have infomration for current the state on / off because I will also use my system with irule and these are not intergrated with each other.

remote:

  • platform: itach
    name: Living Room
    host: 192.168.2.56
    devices:
    • name: Amplifier
      connaddr: 3
      commands:
      • name: “ON”
        data: “0000 006D 0000 0022 00AC 00AC 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0689”
      • name: “OFF”
        data: “0000 006D 0000 0022 00AC 00AC 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0689”

I can help with the first part. How to call the remote commands in a script (to call your amplifier On IR code):

amplifier_on:
  sequence:
  - service: remote.send_command
    data_template:
      entity_id: remote.amplifier
      command: "ON"
      device: remote.amplifier

I’m not sure how you call a script from alexa. I don’t have one. Someone else may be able to help there.

To trigger two different itachs just add more -service: calls in the script sequence. The good thing about the remote component is it is only defined by the device name (and the redundant but required “entity_id”). You dont need to specify the itach at all. So make sure you have distinct device names across all your itachs!

e.g. these two different devices (lounge_tv and lounge_amp) could be on different itachs:

lounge_macro_goodnight:
  sequence:
  - service: remote.send_command
    data_template:
      entity_id: remote.lounge_tv
      command: "OFF"
      device: remote.lounge_tv
  - service: remote.send_command 
    data_template:
      entity_id: remote.lounge_amp
      command: "OFF"
      device: remote.lounge_amp

Thanks alot for the help !!! just from the look of it it seems like how i would want it to work. Been a busy day but I will definately complete and try it tommorrow :slight_smile:

I tried using the code that you haneded me and inserted these in the scripts.yaml but I keep getting and error that won´t let hass start up.

The error is alsways the same and i can´t figure out what is causing it.
The error is
" mapping values are not allowed in this context at line 13 column 18" wich is directly after data template: in the second script.

Any idea on how to solve this ? :confused:
(also changed the name from amplifier to receiver in config.yaml)

script:
  RECEIVER_ON:
    sequence:
    - service: remote.send_command
      data_template:
        entity_id: remote.RECEIVER
        command: "ON"
        device: 32756745
script:
  RECEIVER_VOLUME_DOWN:
    sequence:
    - service: remote.send_command
        data_template:
        entity_id: remote.RECEIVER
        command: "VOLUME_DOWN"
        device: 32756745
script:      
  RECEIVER_INPUT_TV:
    sequence:
    - service: remote.send_command
        data_template:
        entity_id: remote.RECEIVER
        command: "INPUT_TV"
        device: 32756745
script:
  RECEIVER_ON:
    sequence:
    - service: remote.send_command
      data_template:
        entity_id: remote.RECEIVER
        command: "ON"
        device: 32756745

  RECEIVER_VOLUME_DOWN:
    sequence:
     - service: remote.send_command
       data_template:
         entity_id: remote.RECEIVER
         command: "VOLUME_DOWN"
         device: 32756745
 
  RECEIVER_INPUT_TV:
    sequence:
     - service: remote.send_command
       data_template:
         entity_id: remote.RECEIVER
         command: "INPUT_TV"
         device: 32756745

Watch your indentation, it’s important. Also only one script declaration. The capitalised script names may be confusing later too. HA will change them to lower case, e.g script.receiver_input_tv will be how you call the last one.