pkmnct / homebridge-television-universal-control

This Homebridge plugin enables control of one or more compatible devices using one "Television" in HomeKit.
Apache License 2.0
9 stars 3 forks source link

example configs? #4

Open mentaluproar opened 3 years ago

mentaluproar commented 3 years ago

I'm having trouble getting this to communicate with my LG TV over UART. Are there any example configs? Is there a debug flag to show any responses it gets from the device?

Specifically, I'm getting Incorrectly configured serial command in configuration: [{"commands":["ka 0 01\n"],"device":"/dev/ttyUSB0"}]

pkmnct commented 3 years ago

I do need to get some example configs added to the repository.

As for your posted configuration, it looks like you are passing the serial path instead of the device name to the device key. If you need to specify a path, it should go in the devices key at the root level of the group, under the serial device for which it will control (see the "Sharp" device in the serial array below). You will then use that device's name key when referencing the device for the command.

Here is an example config for a Sharp TV with serial control (without RemoteKey configuration):

{
  "groups": [
    {
      "name": "Sharp Television",
      "devices": {
        "serial": [
          {
            "name": "Sharp",
            "path": "/dev/ttyUSB0",
            "getStatus": {
              "power": {
                "command": "POWR????\r",
                "onResponse": "1",
                "offResponse": "0"
              },
              "input": {
                "command": "IAVD?   \r"
              },
              "mute": {
                "command": "MUTE????\r",
                "onResponse": "0001",
                "offResponse": "0002"
              }
            }
          }
        ]
      },
      "power": {
        "on": {
          "commands": [
            {
              "serial": [
                {
                  "commands": ["POWR1   \r"],
                  "device": "Sharp"
                }
              ]
            }
          ]
        },
        "off": {
          "commands": [
            {
              "serial": [
                {
                  "commands": ["POWR0   \r"],
                  "device": "Sharp"
                }
              ]
            }
          ]
        }
      },
      "speaker": {
        "mute_on": {
          "commands": [
            {
              "serial": [
                {
                  "commands": ["MUTE1   \r"],
                  "device": "Sharp"
                }
              ]
            }
          ]
        },
        "mute_off": {
          "commands": [
            {
              "serial": [
                {
                  "commands": ["MUTE2   \r"],
                  "device": "Sharp"
                }
              ]
            }
          ]
        }
      },
      "inputs": [
        {
          "commands": [
            {
              "serial": [
                {
                  "commands": ["IAVD1   \r"],
                  "device": "Sharp"
                }
              ]
            }
          ],
          "name": "Composite",
          "type": 4,
          "getStatus": {
            "serial": [
              {
                "device": "Sharp",
                "response": "0001"
              }
            ]
          }
        },
        {
          "commands": [
            {
              "serial": [
                {
                  "commands": ["IAVD5   \r"],
                  "device": "Sharp"
                }
              ]
            }
          ],
          "name": "Chromecast",
          "type": 10,
          "getStatus": {
            "serial": [
              {
                "device": "Sharp",
                "response": "0005"
              }
            ]
          }
        }
      ],
      "manufacturer": "Sharp",
      "model": "LC-32SB28UT"
    }
  ],
  "platform": "TelevisionUniversalControl"
}

It does look like I told you the wrong escaped character for a carriage return, my device expects a \r rather than a \n.

You can enable debug mode under the Homebridge Settings (or start homebridge with -D) to get debugging output.

th3dogcow commented 3 years ago

I also have a sharp tv, and this looks like what I have been trying to achieve. However, is it possible to send the serial commands over LAN instead of connecting the TV directly to the Pi?

I know the tv accepts commands via LAN as I have manually tested it via telnet, and it is also how the remote app from sharp works. What would I have to set the path to?

I appreciate your work. Thank you in advance.

pkmnct commented 3 years ago

I also have a sharp tv, and this looks like what I have been trying to achieve. However, is it possible to send the serial commands over LAN instead of connecting the TV directly to the Pi?

I know the tv accepts commands via LAN as I have manually tested it via telnet, and it is also how the remote app from sharp works. What would I have to set the path to?

I appreciate your work. Thank you in advance.

This should be possible, yes, however I do not have a television with such support to test/debug with. I have a separate homebridge plugin, specifically for Sharp TV's, where I started to explore this support. Unfortunately, even with a volunteer to test things, development was not straightforward without the device to test against.

th3dogcow commented 3 years ago

I also have a sharp tv, and this looks like what I have been trying to achieve. However, is it possible to send the serial commands over LAN instead of connecting the TV directly to the Pi?

I know the tv accepts commands via LAN as I have manually tested it via telnet, and it is also how the remote app from sharp works. What would I have to set the path to?

I appreciate your work. Thank you in advance.

This should be possible, yes, however I do not have a television with such support to test/debug with. I have a separate homebridge plugin, specifically for Sharp TV's, where I started to explore this support. Unfortunately, even with a volunteer to test things, development was not straightforward without the device to test against.

Thank you for your kind reply. I understand. I came across the codes for the serial commands online and was manually testing them. They were hit and miss, depending on the model I guess. I did love the idea that you could set a specific value for the volume, whereas using an IR blaster, you can't. That's what I was hoping to achieve.

I know it is a lot to ask but would it be possible for you to point me in the right direction on how to emulate a serial port over LAN? I found something called socat which seemed to be maybe what I needed.

I am not completely code illiterate, merely a decade out of practice haha. If I could help advance your other project I would be interested.