Index: /D_RFIDTransmitter.json
===================================================================
--- /D_RFIDTransmitter.json	(revision 1)
+++ /D_RFIDTransmitter.json	(revision 3)
@@ -29,6 +29,17 @@
             "Position": "0",
             "TabType": "flash",
+			"ControlGroup":[
+				{
+					"id":"1",
+					"isSingle":"1"
+				},
+				{
+					"id":"2",
+					"isSingle":"1"
+				}
+			],
             "Control": [
                 {
+					"ControlGroup":"1",
                     "ControlType": "button",
                     "Label": {
@@ -57,4 +68,5 @@
                 },
                 {
+					"ControlGroup":"2",
                     "ControlType": "button",
                     "Label": {
@@ -167,5 +179,5 @@
     "eventList": {
         "event_1": {
-            "label": "Home\/Away",
+            "label": "Home or Away",
             "serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
             "argumentList": {
@@ -179,5 +191,5 @@
                     "name": "Tripped",
                     "comparisson": "=",
-                    "prefix": "Home or Away",
+                    "prefix": "Home or Away?",
                     "suffix": "" 
                 } 
@@ -185,5 +197,5 @@
         },
         "event_2": {
-            "label": "Armed Home\/Away,
+            "label": "Armed Home or Away",
             "serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
             "serviceStateTable": {
@@ -202,9 +214,21 @@
                     "name": "Tripped",
                     "comparisson": "=",
-                    "prefix": "Home or Away",
+                    "prefix": "Home or Away?",
                     "suffix": " " 
                 } 
             } 
-        } 
+        },
+        "event_3": {
+            "label": "Battery level goes below",
+            "serviceId": "urn:micasaverde-com:serviceId:HaDevice1",
+            "argumentList": {
+                "argument_1": {
+                    "dataType": "i4",
+                    "name": "BatteryLevel",
+                    "comparisson": "<",
+                    "suffix": "%" 
+                } 
+            } 
+        }
     },
     "DeviceType": "urn:schemas-micasaverde-com:device:MotionSensor:1",
Index: /I_ActiveRFID.xml
===================================================================
--- /I_ActiveRFID.xml	(revision 1)
+++ /I_ActiveRFID.xml	(revision 3)
@@ -10,10 +10,8 @@
     <functions>
         function RFIDStartup(lul_device)
+			RFID_RecDev = lul_device
 			RFID_Tag_Index = {}
 			RFID_Buffer_Index = {}
-			RFID_Expire = {}
-			RFID_Buffers = {}
-			RFID_Data = {}
-			RFID_Data[lul_device] = ""
+			RFID_Data = ""
             luup.log("Running I_ActiveRFID.xml")
 			local txCount = luup.variable_get("urn:ActiveRFID:serviceId:ActiveRFID1","Transmitters",lul_device)
@@ -23,6 +21,6 @@
 				expireTime = luup.variable_get("urn:ActiveRFID:serviceId:ActiveRFID1","Expire Time",lul_device)
 			end
-			RFID_Expire[lul_device] = expireTime .. "s"
-			RFID_Buffers[lul_device] = (math.floor((expireTime - 1)/(2.5))+1)
+			RFID_Expire = expireTime .. "s"
+			RFID_Buffers = (math.floor((expireTime)/(2.5))+1)
 			if (txCount == nil) then
 				luup.variable_set("urn:ActiveRFID:serviceId:ActiveRFID1","Transmitters",0,lul_device)
@@ -42,15 +40,14 @@
 								luup.variable_set("urn:ActiveRFID:serviceId:RFIDTransmitter1","TagID","Enter 4-digit ID",k)
 							else
-								local RecTagID = lul_device .. TagID
-								local RecTagBuffer
-								RFID_Tag_Index[RecTagID] = k
-								for i=1,RFID_Buffers[lul_device] do
-									RecTagBuffer = RecTagID .. "," .. i
-									RFID_Buffer_Index[RecTagBuffer] = 0
+								local TagBuffer
+								RFID_Tag_Index[TagID] = k
+								for i=1,RFID_Buffers do
+									TagBuffer = TagID .. i
+									RFID_Buffer_Index[TagBuffer] = 0
 								end
 								if (TrippedStatus == "1") then
-									luup.call_timer("verifyBuffer", 1, RFID_Expire[lul_device],"",RecTagID)
+									luup.call_timer("verifyBuffer", 1, RFID_Expire,"",TagID)
 								end
-								luup.log("RFID Transmitter " .. TagID .. ", Receiver " .. lul_device .. " indexed at " .. RecTagID .. ".")
+								luup.log("RFID Transmitter " .. TagID .. ", Receiver " .. lul_device .. " indexed.")
 							end
 							if (TrippedStatus == nil) then
@@ -63,38 +60,34 @@
 			luup.log("ActiveRFID startup complete")
 		end
-		function setBuffer(rectagid)
-			local RecTagBuffer
-			local RecTagDev = RFID_Tag_Index[rectagid]
-			local TagID = string.sub(rectagid,-4)
-			local RecDev = tonumber(string.sub(rectagid,0,-5))
-			local TrippedStatus = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",RecTagDev)
+		function setBuffer(tagid)
+			local TagBuffer
+			local TagDev = RFID_Tag_Index[tagid]
+			local TrippedStatus = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",TagDev)
 			if (TrippedStatus == "0") then
-				luup.log("RFID Tag " .. TagID .. ", Device " .. RecTagDev .. " tripped.")
-				luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped","1",RecTagDev)
+				luup.log("RFID Tag " .. tagid .. ", Device " .. TagDev .. " tripped.")
+				luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped","1",TagDev)
 			end
-			for i=1,RFID_Buffers[RecDev] do
-				RecTagBuffer = rectagid .. "," .. i
-				if (RFID_Buffer_Index[RecTagBuffer] == 0) then
-					RFID_Buffer_Index[RecTagBuffer] = 1
-					luup.call_timer("resetBuffer", 1, RFID_Expire[RecDev],"",RecTagBuffer)
+			for i=1,RFID_Buffers do
+				TagBuffer = tagid .. i
+				if (RFID_Buffer_Index[TagBuffer] == 0) then
+					RFID_Buffer_Index[TagBuffer] = 1
+					luup.call_timer("resetBuffer", 1, RFID_Expire,"",TagBuffer)
 					break
 				end
 			end
 		end
-		function resetBuffer(rectagbuffer)
-			local RecTagID = string.sub(rectagbuffer,1,(string.find(rectagbuffer,",")-1))
-			RFID_Buffer_Index[rectagbuffer] = 0
-			verifyBuffer(RecTagID)			
+		function resetBuffer(tagbuffer)
+			local TagID = string.sub(tagbuffer,1,4)
+			RFID_Buffer_Index[tagbuffer] = 0
+			verifyBuffer(TagID)			
 		end
-		function verifyBuffer(rectagid)
-			local RecTagBuffer
+		function verifyBuffer(tagid)
+			local TagBuffer
 			local TagVerified = "0"
-			local RecTagDev = RFID_Tag_Index[rectagid]
-			local TagID = string.sub(rectagid,-4)
-			local RecDev = tonumber(string.sub(rectagid,0,-5))
-			local TrippedStatus = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",RecTagDev)
-			for i=1,RFID_Buffers[RecDev] do
-				RecTagBuffer = rectagid .. "," .. i
-				if (RFID_Buffer_Index[RecTagBuffer] == 1) then
+			local TagDev = RFID_Tag_Index[tagid]
+			local TrippedStatus = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",TagDev)
+			for i=1,RFID_Buffers do
+				TagBuffer = tagid .. i
+				if (RFID_Buffer_Index[TagBuffer] == 1) then
 					TagVerified = "1"
 					break
@@ -102,23 +95,22 @@
 			end
 			if (TrippedStatus == "1" and TagVerified == "0") then
-				luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped","0",RecTagDev)
-				luup.log("RFID Tag " .. TagID .. ", Device " .. RecTagDev .. " untripped.")
+				luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped","0",TagDev)
+				luup.log("RFID Tag " .. tagid .. ", Device " .. TagDev .. " untripped.")
 			end
 		end
-		function handle_incoming(serdata,recdevice)
+		function handle_incoming(serdata)
 			if (serdata == " ") then
-				local TagID = string.sub(RFID_Data[recdevice],1,4)
-				local RFIDStrength = string.sub(RFID_Data[recdevice],5,7)
+				local TagID = string.sub(RFID_Data,1,4)
+				local RFIDStrength = string.sub(RFID_Data,5,7)
 				RFIDStrength = tonumber(RFIDStrength)
-				local RecTagID = recdevice .. TagID
-				local TAGDEV = RFID_Tag_Index[RecTagID]
-				if (TAGDEV == nil) then
-					luup.log("RFID tag " .. TagID .. " found by receiver " .. recdevice .. ", but not assigned to a device.")
+				local TagDev = RFID_Tag_Index[TagID]
+				if (TagDev == nil) then
+					luup.log("RFID tag " .. TagID .. " found by receiver " .. RFID_RecDev .. ", but not assigned to a device.")
 				else
-					setBuffer(RecTagID)
+					setBuffer(TagID)
 				end
-				RFID_Data[recdevice] = ""
+				RFID_Data = ""
 			else
-				RFID_Data[recdevice] = RFID_Data[recdevice] .. serdata
+				RFID_Data = RFID_Data .. serdata
 			end
 		end
@@ -126,6 +118,6 @@
     <incoming>
         <lua>
-			handle_incoming(lul_data,lul_device)
-        </lua>
+			handle_incoming(lul_data)
+		</lua>
     </incoming>
     <startup>RFIDStartup</startup>
