From ffa07cbede61bdab55e796c0aa6a0606db295b30 Mon Sep 17 00:00:00 2001 From: JZ-SmartThings Date: Fri, 12 May 2017 21:55:35 -0700 Subject: [PATCH] Updating a few enahncements --- .../IRSender5V.ino | 21 ++++++++------- Devices/TVDevice/IRremoteESP8266/IRSender.ino | 5 +--- Devices/TVDevice/TVDevice.groovy | 26 ++++++++++++++++--- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/Devices/TVDevice/IRremoteESP8266-Using5Volts/IRSender5V.ino b/Devices/TVDevice/IRremoteESP8266-Using5Volts/IRSender5V.ino index 9105539..859672c 100644 --- a/Devices/TVDevice/IRremoteESP8266-Using5Volts/IRSender5V.ino +++ b/Devices/TVDevice/IRremoteESP8266-Using5Volts/IRSender5V.ino @@ -1,5 +1,5 @@ /** - * TV Device Sample v1.0.20160806 + * TV Device Sample v1.0.20170512 * Source code can be found here: https://github.com/JZ-SmartThings/SmartThings/blob/master/Devices/TVDevice * Copyright 2016 JZ * @@ -11,10 +11,7 @@ * for the specific language governing permissions and limitations under the License. */ -#include -#include -#include -#include +// CHOOSE WHICH LIBRARY TO USE FOR IR #include //#include @@ -25,15 +22,18 @@ MDNSResponder mdns; ESP8266WebServer server(80); IRsend irsend(D2); -void handleRoot() { - String htmlContent = "ESP8266 IR Remote

ESP8266 IR Remote


"; +//OTHER VARIABLES +String currentIP; - htmlContent += "\n"; +void handleRoot() { + String htmlContent = "ESP8266 IR Remote

ESP8266 IR Remote


"; + htmlContent += currentIP; + htmlContent += "

\n"; for (uint8_t i=0; i -#include -#include -#include +// CHOOSE WHICH LIBRARY TO USE FOR IR //#include #include diff --git a/Devices/TVDevice/TVDevice.groovy b/Devices/TVDevice/TVDevice.groovy index 9e603ab..af5653d 100644 --- a/Devices/TVDevice/TVDevice.groovy +++ b/Devices/TVDevice/TVDevice.groovy @@ -1,5 +1,5 @@ /** - * TVDevice v1.0.20170504 + * TVDevice v1.0.20170505 * * Source code can be found here: https://github.com/JZ-SmartThings/SmartThings/blob/master/Devices/TVDevice/TVDevice.groovy * @@ -97,7 +97,7 @@ metadata { state "default", label: 'MUTE', action: "tvmute", icon: "st.custom.sonos.muted", backgroundColor: "#9966CC", nextState: "trying" state "trying", label: 'TRYING', action: "ResetTiles", icon: "st.custom.sonos.muted", backgroundColor: "#FFAA33" } - controlTile("levelSliderControl", "device.level", "slider", width: 6, height: 1, inactiveLabel: false, range:"(1..4)") { + controlTile("levelSliderControl", "device.level", "slider", width: 6, height: 1, inactiveLabel: false, range:"(0..100)") { state "level", label:'HDMI Input', action:"switch level.setLevel" } @@ -122,8 +122,26 @@ def ResetTiles() { def setLevel(value) { def level=value as int - //log.debug level + "---test" - runCmd("/ir?hdmi=" + level) + def cmd="" as String + log.debug "setLevel >> value: $value" + if (value<25) { + level=0 + cmd="/ir?tv=input" + } else if (value==25 && value<=49) { + level=25 + cmd="/ir?hdmi=" + 1 + } else if (value==50 && value<=74) { + level=50 + cmd="/ir?hdmi=" + 2 + } else if (value==75 && value<=99) { + level=75 + cmd="/ir?hdmi=" + 3 + } else if (value==100) { + level=100 + cmd="/ir?hdmi=" + 4 + } + sendEvent(name: "level", value: level, isStateChange: true) + runCmd(cmd) } def on() {