Created
December 1, 2016 09:28
-
-
Save baloo247/96b3c9cbadc1a35c357524c9a335836d to your computer and use it in GitHub Desktop.
Celcus HDMI 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Celcus TV Smartthings Integration, Currently testing on: CEL-48UHDSB-16/1 | |
* | |
* | |
* | |
* 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. | |
* | |
* Based on Ed Anuff and Jamie Yates Code | |
* | |
* Based on Jamie Yates's example: | |
* https://gist.github.com/jamieyates79/fd49d23c1dac1add951ec8ba5f0ff8ae | |
* | |
* Please make sure the TV is on when you set up the device. | |
* | |
* | |
*/ | |
metadata { | |
definition (name: "Ceclus TV HDMI4", namespace: "BBirdy", author: "Bal Birdy") { | |
capability "Switch" | |
command "netflix" | |
} | |
simulator { | |
status "on": "on/off: 1" | |
status "off": "on/off: 0" | |
} | |
tiles(scale:2) { | |
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) { | |
state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff" | |
state "on", label: 'ON', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821" | |
} | |
main "switch" | |
details(["switch"]) | |
} | |
preferences { | |
input name: "ipadd", type: "string", required: true, title: "TV IP Address", displayDuringSetup: true | |
input name: "tv_port", type: "number", range: "0..9999", required: true, title: "TV Port Usually: 4660", displayDuringSetup: true | |
input name: "smartapp_port", type: "number", range: "0..99999", required: true, title: "Smartapp Port Usually: 56789", displayDuringSetup: true | |
} | |
} | |
def on() { | |
def source = new physicalgraph.device.HubAction( | |
method: "POST", | |
path: "/apps/vr/browserseturl", | |
body: ("""<?xml version="1.0" ?><remote><key code="1056"/></remote>"""), | |
headers: ["Content-Type":"text/plain"+" ; "+"charset=ISO-8859-1",Host:"${ipadd}:${smartapp_port}"] | |
) | |
log.debug result.toString() | |
sendHubCommand(source); | |
def hdmi4 = new physicalgraph.device.HubAction( | |
method: "POST", | |
path: "/apps/vr/browserseturl", | |
body: ("""<?xml version="1.0" ?><remote><key code="1006"/></remote>"""), | |
headers: ["Content-Type":"text/plain"+" ; "+"charset=ISO-8859-1",Host:"${ipadd}:${smartapp_port}"] | |
) | |
log.debug result.toString() | |
sendHubCommand(hdmi4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment