Samsung Hubitat TV Integration (2016 and later)

Can I use your code to integrate with mine. Plan is to add a preference to use SmartThings data that will enable the associated commands. I will integrate to fill-in the capabilities herein,

Dave

Capability Switch is now enabled. The template is switch.

FYI,

I did the below without any virtual devices or buttons (there is a button interface built into the code). The only search was the images for the backgrounds.

2 Likes

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}"])
}

Yep, still lost. So when I add a button to the dash, which button number do I use for volume up?

Same here. How do I tell which button is which? I can select button template, and enter a button number, but without knowing the mapping it is largely a guessing game. Is this documented somewhere that I missed?

Thanks!

The button to command (method) interface is currently documented within the driver (near the bottom) where the button interface is implemented. When I go live, I will create a document.

For Volume and Mute, I currently use dashboard template Music Player. This has volume control, mute, pause/stop (where applicable) and will also (eventually) list the source. Again - beta.

1 Like

Ah, I see that in the code.

So these.

		case 0 : close(); break
		//	===== Physical Remote Commands =====
		case 3 : numericKeyPad(); break
		case 6 : artMode(); break			//	New command.  Toggles art mode
		case 7 : ambientMode(); break
		case 8 : arrowLeft(); break
		case 9 : arrowRight(); break
		case 10: arrowUp(); break
		case 11: arrowDown(); break
		case 12: enter(); break
		case 13: exit(); break
		case 14: home(); break
		case 18: channelUp(); break
		case 19: channelDown(); break
		case 20: guide(); break
		//	===== Direct Access Functions
		case 23: menu(); break			//	Main menu with access to system settings.
		case 24: source(); break		//	Pops up home with cursor at source.  Use left/right/enter to select.
		case 25: info(); break			//	Pops up upper display of currently playing channel
		case 26: channelList(); break	//	Pops up short channel-list.
		case 27: source0(); break		//	Direct to source TV
		case 28: source1(); break		//	Direct to source 1 (one right of TV on menu)
		case 29: source2(); break		//	Direct to source 1 (two right of TV on menu)
		case 30: source3(); break		//	Direct to source 1 (three right of TV on menu)
		case 31: source4(); break		//	Direct to source 1 (ofour right of TV on menu)
		//	===== Other Commands =====
		case 34: previousChannel(); break
		case 35: hdmi(); break			//	Brings up next available source
		case 36: fastBack(); break		//	causes fast forward
		case 37: fastForward(); break	//	causes fast rewind
		case 38: browser(); break		//	Direct to source 1 (ofour right of TV on menu)
		case 39: youTube(); break
		case 40: netflix(); break
		
	}

Hey Dave,

Cause I know very little, please forgive this question... Is it possible to merge drivers from different devices to create one control point? i use Samsung tv's exclusively along with tivo's and sonos speakers... so i have to flip between devices to ay change volume or channels... anyway, just a question and by no means an ask.. not sure if it is even possible...

Combining is explicitly not reasonable done.

TIVO: Do the TIVO devices support HDMI/CEC control from the TV? If so, then the Key commands (VolUp/Down, CHUp/Down, Direction Keys, Enter) should work (even with the physical Samsung Remote. See link: TiVo Support Center

SONOS: Assuming wifi audio interface. The remote functions can not directly control the SONOs devices; however, within Hubitat (speaking SONOS), it is possible to use Rule Machine to set the volume of SONOS base on the Samsung TV Device. I may not have this set up yet - but I can modify in a future version.

Hi Dave, sorry if this has been asked before, but do you have any plans of adding support for the 2015 models? If not, no worries.
Thanks!

Hey Dave, my tivo boxes do not appear to support HDMI-CEC, at least how I have them setup... And my audio is connected via optical line... No biggie... Just thought I'd ask...

Maybe I am misunderstanding the question, but why could you not build a dashboard using all 3 of these devices? You could just use the individual traits you want from each one?

If needed, you could do a virtual button + rule to mute, or any similar situation where you wanted to send simultaneous commands to multiple devices.

Absolutely could - especially with the SONOS device. I don't know if TIVO is supported in HE.

@djgutheinz @neonturbo, I could do that, but I actually like to use HousePanel in place of the HE dashboards.... I do get your point though. And I'm using this for the tivo units... works great.

You can't combine devices on HousePanel? How would you have multiple light switches in a living room, for example? That would seem to be an odd quirk if that is how that app works.

And I am somewhat familiar with that Tivo driver, I have used it in the past.

I do have HousePanel setup with pages for rooms just like I have in the HE dashboard. I guess what you are saying is group those devices together with the attributes i commonly use either on that page or in the dashboard? I'll play around a bit with it.

Yes. Same way you would have any set of devices "grouped" for a lack of better word, in a dashboard.

You do the same "groups" with rooms where you have lots of sensors and switches, correct? I don't see how having a TV and a Tivo is different than a table lamp and ceiling light?

It just requires a lot of buttons or tiles vs the one for a light switch or motion sensor... The tivo driver doesn't have the button function built in, so while I now get the idea for the tv control and even adding volume for the sonos, the tivo is gonna be a bit of a challenge... it works great from the device page, but how do i translate that to a button on the dashboard... anyway, i don't wanna hijack this thread anymore... the tv driver is great and i've wanted this more for being able to turn them off when the family leaves them on... so again, that you @djgutheinz for this!

1 Like

Thanks for this information. I developed an independent link to SmartThings so this driver will stand-alone. It will augment current functions by adding setSource and setChannel plus the attributes inputSource and channel. (Sadly, more was not possible using the ST API). I am targeting tomorrow to release this BETA version.

1 Like

Yes. Being BETA, I reserve the right to change some of the codes (i.e., source1, source2 to HDMI1, HDMI2) with documentation in the release notes at the top of the driver.

1 Like