Hi all- I'm new to Hubitat, and I have been struggling to integrate my Legrand RFLC system into the Hubitat universe. I got the RF-RS232 adapter, and another adapter to make RS232 into Telnet, and a little custom programming later I have a driver that actually works! Granted, it doesn't parse data coming from the system, but it will work for what I need it to do.
I'm trying to control a Legrand light with a Lutron Pico. The driver worked for controlling one light
groovy.lang.MissingMethodException: No signature of method: user_driver_Evan_Taliesin_331.telnetStatus() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [send error: Broken pipe (Write failed)] (telnetStatus)
This doesn't mean anything to me, and also means nothing to my programmer-friends. What does this mean?
I have been creating one driver for each Legrand device, and editing the string it sends to the Telnet client.
/**
*
* 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.
*
*/
metadata {
definition (name: "Taliesin", namespace: "Evan", author: "Samir_Genius") {
capability "Initialize"
capability "Telnet"
capability "Switch"
capability "Switch Level"
/*
command "sendMsg", ["String"], int
command "sendLevel", ["Brightness 0-255"]
command "sendDimLevel", ["Brightness 0-255"]
*/
attribute "Telnet", ""
attribute "Switch", ""
}
}
// device commands
def on() {
initialize()
log.debug "Send LNZL"
/*
sendEvent(name: "switch", value: "on")
def msg = "shutdown -h now"
log.debug "Sending msg = ${msg}"
sendEvent(name: "switch", value: "off")
sendHubCommand(new hubitat.device.HubAction("""$msg\r\n""", hubitat.device.Protocol.TELNET))
*/
sendMsg('LNZG 2616')
}
def off() {
initialize()
log.debug "Send OFF"
/*
sendEvent(name: "switch", value: "on")
def msg = "shutdown -h now"
log.debug "Sending msg = ${msg}"
sendEvent(name: "switch", value: "off")
sendHubCommand(new hubitat.device.HubAction("""$msg\r\n""", hubitat.device.Protocol.TELNET))
*/
sendMsg('RAMPG 2616 0')
}
def setLevel(level){
/*
def msg = "${ttsPath}" + '/alexa_remote_control.sh -d "' + "${echoName}" + '" -e vol:' + "${level}"
sendEvent(name: "level", value: level, unit: "%")
sendEvent(name:'mute', value:'false')
state.lastLevel = level
*/
sendMsg(level)
}
// General App Events
def initialize(){
telnetConnect('192.168.1.199', 23, null, null)
log.debug "Opening telnet connection"
}
def parse(String message) {
log.debug "parse: ${message}"
}
def sendMsg(String msg)
{
log.info("Sending telnet msg: " + msg)
return new hubitat.device.HubAction(msg, hubitat.device.Protocol.TELNET)
}
def setLevel(BigDecimal level, BigDecimal fade){
sendMsg("RAMPG 2616 " + (int)(level*2.55) + " " + fade)
}
def setLevel(BigDecimal level){
sendMsg("RAMPG 2616 " + (int)(level*2.55))
}
If I am going about this whole thing wrong, please tell me.
Thanks in advance!