Index: trunk/S_VistaAlarmPanel1.xml
===================================================================
--- trunk/S_VistaAlarmPanel1.xml	(revision 77)
+++ trunk/S_VistaAlarmPanel1.xml	(revision 83)
@@ -8,53 +8,53 @@
 		<stateVariable>
 			<name>PluginVersion</name>
-			<datatype>string</datatype>
+			<dataType>string</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>DebugMode</name>
-			<datatype>boolean</datatype>
+			<dataType>boolean</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>NumPartitions</name>
-			<datatype>ui1</datatype>
+			<dataType>ui1</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>KeypadAddresses</name>
-			<datatype>string</datatype>
+			<dataType>string</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>ChimeMode</name>
-			<datatype>boolean</datatype>
+			<dataType>boolean</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>ConnectionDown</name>
-			<datatype>boolean</datatype>
+			<dataType>boolean</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>Zones</name>
-			<datatype>string</datatype>
+			<dataType>string</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>SecureStore</name>
-			<datatype>boolean</datatype>
+			<dataType>boolean</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>TTL</name>
-			<datatype>ui2</datatype>
+			<dataType>ui2</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>AlarmZone</name>
-			<datatype>ui1</datatype>
+			<dataType>ui1</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>CheckConnectionTimer</name>
-			<datatype>ui2</datatype>
+			<dataType>ui2</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>VirtualZones</name>
-			<datatype>string</datatype>
+			<dataType>string</dataType>
 		</stateVariable>
 		<stateVariable>
 			<name>DisableSendStar</name>
-			<datatype>boolean</datatype>
+			<dataType>boolean</dataType>
 		</stateVariable>
 	</serviceStateTable>
Index: trunk/L_VistaAlarmPanel1.lua
===================================================================
--- trunk/L_VistaAlarmPanel1.lua	(revision 77)
+++ trunk/L_VistaAlarmPanel1.lua	(revision 83)
@@ -8,5 +8,5 @@
 
 -- Constants
-local VERSION = "2.45"
+local VERSION = "3.89"
 
 local NUM_PARTITIONS = 1 -- Number of partitions.
@@ -500,5 +500,5 @@
 		table.insertSet(g_faultedZones, zone)
 	end
-
+	
 	debug("(VistaAlarmPanel::addFaultedZone) Set zone #"..zone.." to tripped.")
 end
@@ -512,7 +512,7 @@
 
 	table.removeItem(g_faultedZones, zone)
-
+	
 	luup.variable_set(SID.SECURITY_SENSOR, "Tripped", "0", g_zones[zone].device)
-
+	
 	debug("(VistaAlarmPanel::removeFaultedZone) Set zone #"..zone.." to not tripped.")
 end
@@ -537,5 +537,5 @@
 		return true
 	end
-
+	
 	partNo = tonumber(partNo, 10)
 
@@ -743,5 +743,5 @@
 			if (faulted) then
 				addFaultedZone(k)
-			else
+			else 
 				removeFaultedZone(k)
 			end
@@ -753,5 +753,5 @@
 -- Process "!RFX" messages
 --
--- Example messages:
+-- Example messages: 
 -- !RFX:0180036,80
 --
@@ -759,13 +759,13 @@
 	-- break the incoming message into sections (I wish Lua had real regex handling :(
 	local sections = {data:match('^!RFX:(%d%d%d%d%d%d%d),(%x%x)$')}
-
+	
 	if (not sections or #sections == 0) then
 		log ("(VistaAlarmPanel::processRFXMessage) Invalid RFX message received: " .. data)
 		return false
 	end
-
+	
 	local serial = sections[1]
 	local rawDeviceData = tonumber(sections[2], 16)
-
+		
 	-- decode raw device data
 	local flags = {}
@@ -780,5 +780,5 @@
 	loop[4] = bit.band(rawDeviceData, 0x40) > 0
 	loop[1] = bit.band(rawDeviceData, 0x80) > 0
-
+		
 	if (DEBUG_MODE) then
 		local message = "(VistaAlarmPanel::processExMessage) Decoded RFX message: serial = " .. serial
@@ -787,5 +787,5 @@
 		end
 		for k, v in pairs(flags) do
-			message = message .. ", flags." .. k .. " = " .. tostring(v)
+			message = message .. ", flags." .. k .. " = " .. tostring(v)			
 		end
 		debug (message)
@@ -799,10 +799,10 @@
 		return true
 	end
-
+		
 	-- update Zone tripped statuses
 	for i = 1, 4 do
 		updateZoneByAddress(serial, i, loop[i])
 	end
-
+	
 	return true
 end
@@ -828,11 +828,11 @@
 
 	debug("(VistaAlarmPanel::processExMessage) Decoded " .. sections[1] ..
-		" message: address = " .. address  .. ", channel = " .. channel ..
+		" message: address = " .. address  .. ", channel = " .. channel .. 
 		", faulted = " .. tostring(faulted) .. ", supervision = " .. tostring(supervision))
-
+			
 	if (not supervision) then
 		updateZoneByAddress(address, channel, faulted)
 	end
-
+	
 	return true
 end
@@ -845,5 +845,5 @@
 	luup.sleep(SLEEP_MS)
 end
-
+		
 function processIncoming (data)
 
@@ -947,7 +947,7 @@
 		", lul_value_old = " .. (lul_value_old or "nil") ..
 		", lul_value_new = " .. (lul_value_new or "nil"))
-
+		
 	local securitySensor = g_securitySensors[tonumber(lul_device)]
-
+	
 	if (securitySensor and lul_value_new == "0" or lul_value_new == "1") then
 		sendVirtualZoneStatus (securitySensor.zone, lul_value_new)
@@ -1037,5 +1037,5 @@
 		debug("(VistaAlarmPanel::appendPartitions) Appending partition #"..i..".")
 		local parameters = SID.PANEL..",KeypadAddresses="
-		luup.chdev.append(lug_device, rootPtr, "vista_partition_"..i, "Ademco Vista Partition "..i, "urn:schemas-micasaverde-com:device:AlarmPartition:2", "D_VistaAlarmPartition1.xml", "", parameters, false)
+		luup.chdev.append(lug_device, rootPtr, "vista_partition_"..i, "Ademco Vista Partition "..i, "urn:schemas-micasaverde-com:device:VistaAlarmPartition:2", "D_VistaAlarmPartition1.xml", "", parameters, false)
 	end
 end
@@ -1055,5 +1055,5 @@
 		end
 		g_zones[zoneNo] = {
-			address = zoneAddress, -- keep address as string because RF serial # "0000012" != address "12"
+			address = zoneAddress, -- keep address as string because RF serial # "0000012" != address "12" 
 			channel = tonumber(zoneChannel, 10),
 			type = zoneType
@@ -1134,8 +1134,34 @@
 function vistaStartup (lul_device)
 	log("Honeywell Ademco Vista Alarm Panel Plugin version "..VERSION)
-
 	lug_device = lul_device
+	
 	luup.variable_set(SID.PANEL, "PluginVersion", VERSION, lul_device)
 
+  -- IP based serial port code
+  -- Copyright (C) 2009-2011 Deborah Pickett
+  -- Adapted From: http://code.mios.com/trac/mios_caddxnx584/browser/trunk/L_CaddxNX584Security.lua
+  local ioDevice = luup.variable_get("urn:micasaverde-com:serviceId:HaDevice1", "IODevice", lul_device)
+  local useSocket = false
+  if (ioDevice == nil or ioDevice == "") then
+    luup.log("(VistaAlarmPanel::main) No IO device specified; going to check for IP based config")  
+    useSocket = true
+  end
+  if (useSocket) then
+    local ip = luup.devices[lul_device].ip
+    luup.log("(VistaAlarmPanel::main) Configured ip address: " .. ip)  
+    local ipv4, tcpport = ip:match("(%d+%.%d+%.%d+%.%d+):(%d+)")
+    if (ipv4 ~= nil and tcpport ~= nil) then
+      luup.log(string.format("(VistaAlarmPanel::main) Opening socket to %s port %s", ipv4, tcpport))
+      luup.io.open(lul_device, ipv4, tcpport)
+    else
+      luup.log("(VistaAlarmPanel::main) No serial device specified; exiting")
+      return false, "(VistaAlarmPanel::main) No serial device specified. Please configure the plugin.",
+        string.format("%s[%d]", luup.devices[lul_device].description, lul_device)
+    end
+  else
+    luup.log("(VistaAlarmPanel::main) Opening serial port")
+  end
+  -- End IP based serial port code
+  
 	getDebugMode()
 
@@ -1190,5 +1216,5 @@
 	-- Initialize virtual zones
 	initVirtualZones()
-
+	
 	-- Start the TTL timer.
 	ttlCountdownTimer()
@@ -1199,4 +1225,8 @@
 	-- Start the timer that checks the connection status.
 	luup.call_delay("checkConnection", CHECK_CONNECTION_DELAY, "")
+	
+	if (luup.version_major >= 7) then
+		luup.set_failure(0, lul_device)
+  end
 
 	log("(VistaAlarmPanel::main) SUCCESS: Startup successful.")
