I’m don’t entirely understand the technical aspects of @barneyd’s comments but am interested in inclusion of the TCP binding in OH3 and wanted to contribute to the conversation with my use case:
- I use the TCP binding to interface with my alarm system.
- The device is a serial to Ethernet IP adapter and plugs directly into the alarm panel motherboard.
- I use a text item which gets updated by the device and to which I can send commands.
- Through rules I have enabled automatic arming/disarming of the system based on presence including monitoring of PIRs and notifications to my phone when movement is detected (had to implement this to avoid the cat triggering the alarm when he struts around on the dining room table when we aren’t home).
Item:
String ELK_Bridge "Alarm Code [%s]" { tcp=">[192.168.1.4:2101:default]" }
Rule samples:
rule "Arm and Disarm alarm"
when
Item ArmDisarm received command
then
switch ArmDisarm.state {
case ON : ELK_Bridge.sendCommand("8300660A0000E4F?")
case OFF : ELK_Bridge.sendCommand("83005600000E91?")
}
end
and
rule "Update Security"
when
Item ELK_Bridge received update
then
if (ELK_Bridge.state.toString.substring(0,2) == "82"){ //Status Report Data
switch ELK_Bridge.state.toString.substring(8,10) {
case "11" : { //Zone Detector Low Battery
switch ELK_Bridge.state.toString.substring(10,14) {
case "0000" : ELK_Text.postUpdate("Zone Detector Battery Normal")
}
}
case "12" : { //Miscellaneous Alarms
switch ELK_Bridge.state.toString.substring(10,14) {
case "0000" : ELK_Text.postUpdate("No Zones")
case "0100" : ELK_Text.postUpdate("Zone 1")
}
}
case "13" : { //Miscellaneous Alarms
switch ELK_Bridge.state.toString.substring(10,14) {
case "0001" : ELK_Text.postUpdate("Duress Alarm")
case "0002" : ELK_Text.postUpdate("Panic Alarm")
//etc
}
}
case "14" : { //Arming Status
switch ELK_Bridge.state.toString.substring(10,14) {
case "0000" : ELK_Text.postUpdate("Unarmed")
case "0100" : ELK_Text.postUpdate("Area 1 Armed")
//etc
}
}
The tcp.cfg is configured thus:
tcp:addressmask=false
tcp:itemsharedconnections=true
tcp:bindingsharedconnections=true
tcp:directionssharedconnections=true
#tcp:postamble=\r\n
tcp:queue=false
tcp:updatewithresponse=false
tcp:charset=ASCII
#tcp:port=5008
tcp:refreshinterval=250
udp:refreshinterval=250
Just thought I’d add this information as a real-world example in case it is useful if/when someone finds the time and interest to update the binding.