When I said I created a custom driver, I was referring to a HubConnect Custom Driver. So it doesn't query the ST API or do anything like that. It just enables some capabilities to look for in the ST device. As such, it won't actually be helpful to you. I've pasted it below though.
/*
* Copyright 2019-2020 Steve White, Retail Media Concepts LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*
*/
def getDriverVersion() {[platform: "Universal", major: 2, minor: 0, build: 0]}
metadata
{
definition(name: "HubConnect TV", namespace: "shackrat", author: "Steve White", importUrl: "https://raw.githubusercontent.com/HubitatCommunity/HubConnect/master/UniversalDrivers/HubConnect-AVR.groovy")
{
capability "Switch"
capability "Refresh"
capability "Actuator"
capability "Telnet"
capability "Initialize"
capability "AudioVolume"
attribute "inputSource", "string"
attribute "tvChannelName", "string"
attribute "soundMode", "string"
attribute "version", "string"
command "setInputSource", [[name:"MediaSource", type: "STRING", description: "Media Source" ]]
command "setTvChannel", [[name:"channel", type: "STRING", description: "Application ID" ]]
command "channelUp"
command "channelDown"
command "sync"
}
}
/*
installed
Doesn't do much other than call initialize().
*/
def installed()
{
initialize()
}
/*
updated
Doesn't do much other than call initialize().
*/
def updated()
{
initialize()
}
/*
initialize
Doesn't do much other than call refresh().
*/
def initialize()
{
refresh()
}
/*
uninstalled
Reports to the remote that this device is being uninstalled.
*/
def uninstalled()
{
// Report
parent?.sendDeviceEvent(device.deviceNetworkId, "uninstalled")
}
/*
parse
In a virtual world this should never be called.
*/
def parse(String description)
{
log.trace "Msg: Description is $description"
}
/*
setVolume
Does what it says.
*/
def setVolume(value)
{
parent.sendDeviceEvent(device.deviceNetworkId, "setVolume", [value])
}
/*
editCurrentInputName
Does what it says.
*/
def editCurrentInputName(value)
{
parent.sendDeviceEvent(device.deviceNetworkId, "editCurrentInputName", [value])
}
/*
setInputSource
Does what it says.
*/
def setInputSource(value)
{
parent.sendDeviceEvent(device.deviceNetworkId, "setInputSource", [value])
}
/*
setTvChannel
Does what it says.
*/
def setTvChannel(value)
{
parent.sendDeviceEvent(device.deviceNetworkId, "setTvChannel", [value])
}
/*
ChannelUp
Does what it says.
*/
def channelUp(value)
{
parent.sendDeviceEvent(device.deviceNetworkId, "channelUp")
}
/*
ChannelDown
Does what it says.
*/
def channelDown(value)
{
parent.sendDeviceEvent(device.deviceNetworkId, "channelDown")
}
/*
mute
Mutes the device.
*/
def mute()
{
// The server will update on/off status
parent.sendDeviceEvent(device.deviceNetworkId, "mute")
}
/*
unmute
Unmutes the device.
*/
def unmute()
{
// The server will update on/off status
parent.sendDeviceEvent(device.deviceNetworkId, "unmute")
}
/*
on
Turns the device on.
*/
def on()
{
// The server will update on/off status
parent.sendDeviceEvent(device.deviceNetworkId, "on")
}
/*
off
Turns the device off.
*/
def off()
{
// The server will update on/off status
parent.sendDeviceEvent(device.deviceNetworkId, "off")
}
/*
volumeUp
volumeUp on the device.
*/
def volumeUp()
{
// The server will update status
parent.sendDeviceEvent(device.deviceNetworkId, "volumeUp")
}
/*
volumeDown
volumeDown on the device.
*/
def volumeDown()
{
// The server will update status
parent.sendDeviceEvent(device.deviceNetworkId, "volumeDown")
}
/*
refresh
Refreshes the device by requesting an update from the client hub.
*/
def refresh()
{
// The server will update status
parent.sendDeviceEvent(device.deviceNetworkId, "refresh")
}
/*
sync
Synchronizes the device details with the parent.
*/
def sync()
{
// The server will respond with updated status and details
parent.syncDevice(device.deviceNetworkId, "switch")
parent.syncDevice(device.deviceNetworkId, "inputSource")
parent.syncDevice(device.deviceNetworkId, "tvChannelName")
sendEvent([name: "version", value: "v${driverVersion.major}.${driverVersion.minor}.${driverVersion.build}"])
}