Monoprice Whole Home with Ser2Net not working

Hello,

I just received a Monoprice 6 zone whole home amp. I connected a spare Pi Zero to it with Ser2net however, it is giving me an error. I have the serial port blank and have the ip and port set to what I made ser2net. I know its working because I can control it from telnet. I have attached my debug logs below. It looks like it connects and instantly disconnects. Any help would be appreciated thank you.

2023-08-29 21:05:27.565 [DEBUG] [ternal.handler.MonopriceAudioHandler] - Trying to reconnect...
2023-08-29 21:05:27.567 [DEBUG] [munication.MonopriceAudioIpConnector] - Opening IP connection on IP 192.168.254.232 port 6060
2023-08-29 21:05:29.446 [DEBUG] [munication.MonopriceAudioIpConnector] - IP connection opened
2023-08-29 21:05:29.447 [DEBUG] [unication.MonopriceAudioReaderThread] - Data listener started
2023-08-29 21:05:29.449 [DEBUG] [ternal.handler.MonopriceAudioHandler] - openConnection(): connected
2023-08-29 21:05:29.480 [DEBUG] [ommunication.MonopriceAudioConnector] - Send command ?11
2023-08-29 21:05:29.481 [DEBUG] [ommunication.MonopriceAudioConnector] - Send command ?12
2023-08-29 21:05:29.483 [DEBUG] [ommunication.MonopriceAudioConnector] - Send command ?13
2023-08-29 21:05:29.484 [DEBUG] [ommunication.MonopriceAudioConnector] - Send command ?14
2023-08-29 21:05:29.486 [DEBUG] [ommunication.MonopriceAudioConnector] - Send command ?15
2023-08-29 21:05:29.487 [DEBUG] [ommunication.MonopriceAudioConnector] - Send command ?16
2023-08-29 21:05:29.489 [DEBUG] [munication.MonopriceAudioIpConnector] - Closing IP connection
2023-08-29 21:05:29.491 [DEBUG] [unication.MonopriceAudioReaderThread] - Reading failed: readInput failed: Socket closed
org.openhab.binding.monopriceaudio.internal.MonopriceAudioException: readInput failed: Socket closed
	at org.openhab.binding.monopriceaudio.internal.communication.MonopriceAudioIpConnector.readInput(MonopriceAudioIpConnector.java:127) ~[?:?]
	at org.openhab.binding.monopriceaudio.internal.communication.MonopriceAudioReaderThread.run(MonopriceAudioReaderThread.java:60) ~[?:?]
Caused by: java.net.SocketException: Socket closed
	at sun.nio.ch.NioSocketImpl.endRead(NioSocketImpl.java:253) ~[?:?]
	at sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:332) ~[?:?]
	at sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:355) ~[?:?]
	at sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:808) ~[?:?]
	at java.net.Socket$SocketInputStream.read(Socket.java:976) ~[?:?]
	at java.io.DataInputStream.read(DataInputStream.java:102) ~[?:?]
	at org.openhab.binding.monopriceaudio.internal.communication.MonopriceAudioIpConnector.readInput(MonopriceAudioIpConnector.java:123) ~[?:?]
	... 1 more
2023-08-29 21:05:29.496 [DEBUG] [unication.MonopriceAudioReaderThread] - Data listener stopped
2023-08-29 21:05:29.497 [DEBUG] [munication.MonopriceAudioIpConnector] - IP connection closed
2023-08-29 21:05:29.498 [DEBUG] [ternal.handler.MonopriceAudioHandler] - closeConnection(): disconnected

Thing File:

monopriceaudio:amplifier:a109617349	"Monoprice Amp" [ host="192.168.254.232", port=6060, pollingInterval=15, numZones=6, inputLabel1="Chromecast", inputLabel2="Radio", inputLabel3="CD Player", inputLabel4="Bluetooth Audio", inputLabel5="HTPC", inputLabel6="Phono" ]

ser2net:

connection: &mp_amp
    accepter: tcp,6060
    enable: on
    options:
       kickolduser: true
    connector: serialdev,
              /dev/ttyUSB0,
              9600n81,local

What version of openHAB?

Your ser2net configuration looks incorrect. It should be ‘serialdev’:

Thanks for the reply, that was a typo on my part putting it here. It is in fact serialdev. I am running 4.0.2 Stable. It states COMMUNICATION_ERROR Amplifier not responding to status requests.

Are you able to see the responses from the amp for status queries when connecting via telnet?

I.e. sending the command ?11 followed by the enter key should return a response that looks like this: #>1100010000130809100601.

If not, it is could be that something else is wrong with ser2net, your serial-to-USB adapter is bad or the switches on the back of the amp are set wrong.

Ya i can send commands to it. If i send ?11 i can get #>1100000000200707100100.

I have a similar setup with ser2net running on its own Pi, port 4444

This is the pertinent part of my ser2net .conf file.

#  BANNER:<banner name>:banner
#    This will create a banner, if the banner name is given in the
#    options of a line, that banner will be printed.  This takes the
#    standard "C" \x characters (\r is carraige return, \n is newline,
#    etc.).  It also accepts \d, which prints the device name, \p,
#    which prints the TCP port number, and \s which prints the serial
#    parameters (eg 9600N81).  Banners can span lines if the last
#    character on a line is '\'.  Note that you *must* use \r\n to
#    start a new line.
#
# Note that the same device can be listed multiple times under different
# ports, this allows the same serial port to have both telnet and raw
# protocols.

# The original config file shipped with the upstream sources can be
# found in /usr/share/doc/ser2net/examples

BANNER:banner:\r\nser2net port \p device \d [\s] (Debian GNU/Linux)\r\n\r\n

4444:raw:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT LOCAL
#2001:telnet:600:/dev/ttyS1:9600 8DATABITS NONE 1STOPBIT banner
#3000:telnet:600:/dev/ttyS0:19200 8DATABITS NONE 1STOPBIT banner
#3001:telnet:600:/dev/ttyS1:19200 8DATABITS NONE 1STOPBIT banner

You should check your ser2net configuration.

looking further I think your Acceptor line needs an IP address

Bit of an update. I am certain the ser2net is working fine. I decided to try it on Home Assistant just to test and it worked perfect there. I much prefer Openhab so hopefully I can find a solution so I don’t have to bridge it.

I was able to re-create the issue where a race condition occurs causing the binding to disconnect before the initial status query responses are received. A PR was opened to fix the issue in the next OH release. In the meantime you can use the attached jar (compatible with OH 4.0.x and 3.2.x+) that contains the fixed code.

https://github.com/mlobstein/openhab-addons/releases/download/v2.2.1beta/org.openhab.binding.monopriceaudio-4.1.0-SNAPSHOT.jar

Woohoo that worked, thank you so much. Now to properly wire it up lol.