Changes in trunk/L_VistaAlarmPanel1.lua [82:83]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/L_VistaAlarmPanel1.lua
r82 r83 8 8 9 9 -- Constants 10 local VERSION = " 2.45"10 local VERSION = "3.89" 11 11 12 12 local NUM_PARTITIONS = 1 -- Number of partitions. … … 51 51 } 52 52 53 local FILE = " " --"/tmp/havsc"53 local FILE = "/etc/cmh-ludl/havsc" 54 54 55 55 -- Globals … … 866 866 return processRELEXPMessages(data) 867 867 elseif (data:sub(1,1) == "!") then 868 local overNetwork = luup.variable_get(SID.PANEL, "overNetwork", lul_device) or "" 869 if overNetwork == "0" then 870 -- Ignore messages starting with '!'. 871 return true 872 end 868 -- Ignore messages starting with '!'. 869 return true 873 870 end 874 871 … … 1140 1137 1141 1138 luup.variable_set(SID.PANEL, "PluginVersion", VERSION, lul_device) 1142 local overNetwork = luup.variable_get(SID.PANEL, "overNetwork", lul_device) or "" 1143 if overNetwork == "" then 1144 luup.variable_set(SID.PANEL, "overNetwork", "0", lul_device) 1145 else 1146 if overNetwork == 0 then 1147 FILE = "/etc/cmh-ludl/havsc" 1148 else 1149 FILE = "/tmp/havsc" 1150 -- IP based serial port code 1151 -- Copyright (C) 2009-2011 Deborah Pickett 1152 -- Adapted From: http://code.mios.com/trac/mios_caddxnx584/browser/trunk/L_CaddxNX584Security.lua 1153 local ioDevice = luup.variable_get("urn:micasaverde-com:serviceId:HaDevice1", "IODevice", lul_device) 1154 local useSocket = false 1155 if (ioDevice == nil or ioDevice == "") then 1156 useSocket = true 1157 end 1158 if (useSocket) then 1159 local ip = luup.devices[lul_device].ip 1160 local ipv4, tcpport = ip:match("(%d+%.%d+%.%d+%.%d+):(%d+)") 1161 if (ipv4 ~= nil and tcpport ~= nil) then 1162 luup.log(string.format("(VistaAlarmPanel::main) Opening socket to %s port %s", ipv4, tcpport)) 1163 luup.io.open(lul_device, ipv4, tcpport) 1164 else 1165 luup.log("(VistaAlarmPanel::main) No serial device specified; exiting") 1166 return false, "(VistaAlarmPanel::main) No serial device specified. Please configure the plugin.", 1167 string.format("%s[%d]", luup.devices[lul_device].description, lul_device) 1168 end 1169 else 1170 luup.log("(VistaAlarmPanel::main) Opening serial port") 1171 end 1172 -- End IP based serial port code 1173 end 1174 end 1175 1139 1140 -- IP based serial port code 1141 -- Copyright (C) 2009-2011 Deborah Pickett 1142 -- Adapted From: http://code.mios.com/trac/mios_caddxnx584/browser/trunk/L_CaddxNX584Security.lua 1143 local ioDevice = luup.variable_get("urn:micasaverde-com:serviceId:HaDevice1", "IODevice", lul_device) 1144 local useSocket = false 1145 if (ioDevice == nil or ioDevice == "") then 1146 luup.log("(VistaAlarmPanel::main) No IO device specified; going to check for IP based config") 1147 useSocket = true 1148 end 1149 if (useSocket) then 1150 local ip = luup.devices[lul_device].ip 1151 luup.log("(VistaAlarmPanel::main) Configured ip address: " .. ip) 1152 local ipv4, tcpport = ip:match("(%d+%.%d+%.%d+%.%d+):(%d+)") 1153 if (ipv4 ~= nil and tcpport ~= nil) then 1154 luup.log(string.format("(VistaAlarmPanel::main) Opening socket to %s port %s", ipv4, tcpport)) 1155 luup.io.open(lul_device, ipv4, tcpport) 1156 else 1157 luup.log("(VistaAlarmPanel::main) No serial device specified; exiting") 1158 return false, "(VistaAlarmPanel::main) No serial device specified. Please configure the plugin.", 1159 string.format("%s[%d]", luup.devices[lul_device].description, lul_device) 1160 end 1161 else 1162 luup.log("(VistaAlarmPanel::main) Opening serial port") 1163 end 1164 -- End IP based serial port code 1165 1176 1166 getDebugMode() 1177 1167 … … 1235 1225 -- Start the timer that checks the connection status. 1236 1226 luup.call_delay("checkConnection", CHECK_CONNECTION_DELAY, "") 1237 luup.set_failure(0, lul_device) 1227 1228 if (luup.version_major >= 7) then 1229 luup.set_failure(0, lul_device) 1230 end 1231 1238 1232 log("(VistaAlarmPanel::main) SUCCESS: Startup successful.") 1239 1233 return true, "Startup successful.", "Vista Alarm Panel"
Note: See TracChangeset
for help on using the changeset viewer.