Code by Scott שאול בן ישוע
Verified Commit f141cbb3 authored by Sha'ul ben Yeshua's avatar Sha'ul ben Yeshua 🎗
Browse files

New sample telnet driver

parent 8d5cd79c
Pipeline #208 passed with stage
in 3 seconds
......@@ -18,7 +18,13 @@
*/
metadata {
definition (name: "Send Telnet Command", namespace: "sgrayban", author: "Scott Grayban")
definition (
name: "Send Telnet Command",
namespace: "sgrayban",
author: "Scott Grayban",
importUrl: "http://sgrayban.borgnet.online:8081/hubitat-public-repo/Send%20Telnet%20Command.groovy"
)
{
capability "Initialize"
capability "Telnet"
......@@ -50,6 +56,7 @@ def installed(){
def updated(){
log.info "Preferences updated"
runIn(5,sendEvent(name: "switch", value: "off"))
}
def on() {
......@@ -59,7 +66,7 @@ def on() {
def msg = "sudo reboot"
if (logEnable) log.info "Sending msg = ${msg}"
sendHubCommand(new hubitat.device.HubAction("""$msg\r\n""", hubitat.device.Protocol.TELNET))
runIn(2,sendEvent(name: "switch", value: "off"))
runIn(5,sendEvent(name: "switch", value: "off"))
}
def reboot(){
on()
......@@ -83,3 +90,4 @@ def telnetStatus(String status){
sendEvent(name: "Telnet", value: "Connected")
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment