Power down a cinema processor with a script

Hi Guys, I’m new to HA and I need find a way to send (via telnet), two commands to power down my cinema processor (Trinnov).

I’ve tried through a simple terminal, telnet session and these two parameters work perfectly. Question how can I put these two instructions on a script that I can later use inside an automation ?

thanks for the help !!
Carlos

Create a Telnet switch:

You can then use this switch in any automation.

FYI you can search core integrations here:

It might look simple but … for a newbie its rather complex. I’ve red that document several times it asks to put that code inside the configuration.yaml.

When I go to settings – Automations and Scenes, select scripts and create new, what shall I put under identity ID and further down in “action type” ?

Here are the parameters I need to pass to the processor;
IP address: 192.168.100.19
Port: 4410
first string: id home_assistant
second string: power_off_SECURED_FHZMCH48FE

Yes that is what you do. Open the file config/configuration.yaml. Type in the configuration. Here are some instructions: https://www.home-assistant.io/getting-started/configuration/

Look at the example:

switch:
  - platform: telnet
    switches:
      projector: # change this to: cinema_processor:
        resource: THE_IP_ADDRESS # your telnet ip address here
        port: 4002 # your port here
        command_on: "PWR ON" # the command you send to turn your switch on
        command_off: "PWR OFF" # the command you send to turn your switch off
        command_state: "PWR?" # The command you send to get the switch state (optional, leave this whole line out if you do not have this command)
        value_template: '{{ value == "PWR=01" }}' # if you do have a command to check the switch state this is how you interperet the reply. If you dont, then leave this line out too. 
        timeout: 0.9 # how long to wait for a reply

Simply change the parts you need to. Make sure to maintain the indentation exactly as it is. It is important in YAML.

You are not ready for that.

You have not made your switch yet.

I think I beguin to understand … first I create the switch at configuration.yaml and only than I can create the script that later will be used by the automations, right ?

The Trinnov needs those two instructions to shutdown, on this telnet example I can only see room for one, can you show me please how to send two instructions using this switch sintaxe ?

Thank you veeeeery much for your help

You can’t send more than one command.

switch:

  • platform: telnet
    switches:
    projector:
    resource: 192.168.100.19
    port: 44100
    command_on: “PWR ON”
    command_off: “power_off_SECURED_FHZMCH48FE”
    command_state: “id home_assistant”
    value_template: ‘{{ value == “PWR=01” }}’
    timeout: 0.9

This is my sintax at configuration.yaml

after restarting the assistant I went to scripts and I still do not know how to create a physical switch in there :frowning:

You have not formatted your post correctly so it is difficult to see if you have done this correctly.

But I doubt it. Pretty sure this isn’t correct:

As you have copied a completely unrelated template.

Nor is this (from what you said earlier):

Look in Developer Tools → States, do you see a switch called switch.projector (you did not change the name as I suggested) in the list?

If so, what is its state?

If not, look in Settings → System → Logs. Any errors related to your switch?

Ok You were right the name should have been altered. Here is the switch current configuration. Maybe I didn’t explain myself right, this is more like a kill switch its not gonna have an “On” position, I wake up the Trinnov using the Wake on Lan protocol. I need this only to power down the Trinnov and for that I need to provide those two instructions. Here is the actual script;

switch:

  • platform: telnet
    switches:
    Trinnov_off:
    resource: 192.168.100.19
    port: 44100
    command_on: “PWR ON”
    command_off: “power_off_SECURED_FHZMCH48FE”
    command_state: “id home_assistant”
    value_template: ‘{{ value == “PWR=01” }}’
    timeout: 0.9

PS the port to connect is in fact 4410

So why have you used 44100?

And you still have not formatted your post correctly.

And you are still using the example value template that will not be relevant to the reply you get.

Sorry Mistyped … the port is 44100 and here is the actual script

switch:

  • platform: telnet
    switches:
    Trinnov_off:
    resource: 192.168.100.19
    port: 44100
    command_on: “id home_assistant”
    command_off: “power_off_SECURED_FHZMCH48FE”

Still don’t know where to put the handshake instruction “id home_assistant” needed to tell the Trinnov the power down instruction is coming next …

And as I said before:

I have to. Otherwise the Trinnov wont accept the powerdown command. I tested all this through a Telnet terminal session and worked only when the handshake string was sent prior to the shutdown command …

Cant I use the handshake string on the on position and on the automation I do an On and next Off to the switch … Do you think it will work ?

One other thing that comes to mind is to create a telnet script with all the instructions inside and some how call the script in automations …

Hi Tom,
I’ve done some progress here. I now have a Button on my Dashboard that triggers the power down of the processor. Works perfectly. Since what I really need is press button ( I only need it to shutdown the unit) I used the same string for On and Off. Regarding sending two instructions at the same string the Telnet command supports that, see code below…

  • platform: telnet
    switches:
    trinnov_power_off:
    resource: 192.168.100.19
    port: 44100
    command_on: ‘id xx; power_off_SECURED_FHZMCH48FE’
    command_off: ‘id xx; power_off_SECURED_FHZMCH48FE’

command_state: “PWR?”

value_template: ‘{{ value == “PWR=01” }}’

timeout: 0.9

Now, the next challenge would be, to add this button to my studio automation. Can you give me a hint on how to accomplish this ?
Thanks

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

you’re right, but not my fault entirely, this editor alters the test format after you press send … Here is a screen shot hope this works…

As you can see, the telnet command accepts multiple strings as long as you separate them. Regarding the insertion of the button inside an automation, can you give me a clue ?
Thanks

No that is worse. How are we supposed to copy and edit text from a screenshot to help you?

I’m out.