IP Control of Amp - Looking for solutions

Anyone ? could use some guidance.

This thread might provide you some direction.

@gassgs Using telnet on my laptop, I was able to connect to the amp and do some basic stuff. However, it seems that, to do anything with telnet on hubitat, I need to build a driver ? I have zero groovy programming experience and not sure how i will be able to do this. I was hoping that it was a functionality built into RM, and I can use if and else statements to interact via telnet with the amp.

What are my options here? Is it possible to use RM to do this at all? I'd like to do the following:

  1. At 6 am , check if the amp is on, if not, turn it on and switch input source to #1
  2. At 6.30 am switch to input source #4
  3. At 8 am, power off amp
  4. Send connection reset every 2 minutes to keep connection alive

There are telnet codes above for each of the above items. Seems pretty simple to require writing drivers for.

Rule machine could send commands via http get or post. Does the amp support that?

The documentation above ( posted by @gassgs ) says:

The Röst can be controlled through a TCP/IP connection on port 50001.

Not sure if this implies http post /get capability? It does say I can test it with telnet.

Threw together a simple Telnet driver you might be able use to test with:

Driver Code
 /*

 */


@SuppressWarnings('unused')
static String version() {return "0.0.0"}

metadata {
    definition (
        name: "Telnet Test", 
        namespace: "thebearmay", 
        author: "Jean P. May, Jr.",
        importUrl:"https://raw.githubusercontent.com/thebearmay/hubitat/main/xxxx.groovy"
    ) {
        
        capability "Telnet"

        command "connectTelnet"
        command "disconnectTelnet"

    }   
}

preferences {

    input(name: "ipAddr", type: "string", title:"IP Address", required: true)
    input(name: "portNum", type: "number", title: "Port Number", required: true)
}

@SuppressWarnings('unused')
def installed() {

}
void updateAttr(String aKey, aValue, String aUnit = ""){
    sendEvent(name:aKey, value:aValue, unit:aUnit)
}

def connectTelnet(){
    try{
        telnetConnect([termChars:[10]], ipAddr, (int)portNum, null, null)
    } catch (ex) {
        updateAttr("error", ex)
    }
}

def disconnectTelnet() {
    telnetClose()
}

def sendMsg(message) {
    sendHubCommand(new hubitat.device.HubAction("""$message\r\n""", hubitat.device.Protocol.TELNET))
}

def parse(message) {
    updateAttr("parsedMessage", message)
}

def telnetStatus(message){
        updateAttr("statusMessage", message)
}

Messages returned are not retained by the driver, but will display on the device page. Enter the IP address and port number, click on connect, and then type the command (-p 1, -p 0, etc) in the Send Message box and click it to send. Click disconnect when done.

2 Likes

@thebearmay this is great! thanks for helping out. going to test asap. How do you advise I setup the amp in hubitat? As a virtual device? A switch ?

Well if this allows you send it commands and it responds, it would be a simple matter of expanding upon it to make it a specific driver for the amp, i.e. encapsulating the amp commands with a driver equivalent that could be exposed to RM, etc.

Clear as mud. As I said, no groovy programming experience, so not sure what you just said. My question was, how do i setup the device on hubitat before applying the above driver code to it? as a virtual device and what type of device? Or am I looking at this all wrong?

LOL, this gets installed as a device driver (copy code to the Driver's Code area, go to Devices and create a virtual device with it as the device type). Then, if it allows you to connect and send commands (I'd try the on/off -p 1 and -p 0) and it responds, I can quickly adapt it to be the device driver for you.

brb!

1 Like

@thebearmay it works!! I was able to turn the amp on and off using -p.1 and -p.0 . The other codes didn't work ,

  1. -1.1 to switch to balanced input
  2. -1.4 to switch to coaxial input
  3. -p.? to check power state
  4. -p.? to check current source

try
-p ?
-v 50
-m 1
-m 0
-i 4
-i 1

no dot in between? i.e -p ? instead of -p.?

I'd try it as a space instead of a dot

nope - doesnt work. but seems the ones with dots are working now! sorry! not sure but wasnt working before. So i can confirm the following works now:

-p.1
-p.0
-i.4
-i.1
-v.50
-m.1
-m.0

1 Like

It may be responding and I'm just not catching it right, how about the mute and volume commands.

Edit. Dots not spaces noted..

updated my responses above. mute and volume working ok

Excellent. I can make this work for you then. Give me a little bit and I should have something for you to play with.

I can't thank you enough - let me buy you a beer!

ps: What about reseting the telnet connection to keep it alive ? The doc above says:

Sending -r.3 every 2 minutes, will ensure that
the connection is reset in the event of a controller
power reboot; allowing the controller to reconnect.