Index: /L_sPhoneUI.lua
===================================================================
--- /L_sPhoneUI.lua	(revision 1)
+++ /L_sPhoneUI.lua	(revision 3)
@@ -11,5 +11,4 @@
 luup.register_handler("lug_sPhoneRequest_job_status","sPhone_job_status")
 luup.register_handler("lug_sPhoneRequest_camimg","sPhone_camimg")
-luup.register_handler("lug_sPhoneRequest_camstream","sPhone_camstream")
 luup.register_handler("lug_sPhoneRequest_action_js","sPhone_action_js")
 
@@ -257,4 +256,11 @@
 function lug_sPhoneRequest_sensor(lul_device,lul_description,lul_js)
 	local lul_Armed = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Armed",lul_device)
+		lul_Tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",lul_device)
+	
+	if( lul_Tripped~="1") then
+		status_tripped='green'
+	else
+		status_tripped='red'
+	end	
 	
 	if( lul_Armed~="1") then
@@ -267,4 +273,5 @@
 	
 	lul_html_no_js = '<img src="/cmh/iphone_file/icons/security.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />' .. lul_description .. '<br>\n' ..
+		'<a href="data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&time=' .. tostring(os.clock()) .. '"><img src="/cmh/images/' .. status_tripped .. '_circle.gif" alt="" border="0"/></a> ' ..
 		'<a href="data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=1&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/buttons/arm' .. status_arm .. '.gif" alt="" border="0"/></a> ' ..
 		'<a href="data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=0&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/buttons/bypass' .. status_bypass .. '.gif" alt="" border="0"/></a> '
@@ -273,4 +280,5 @@
 	local lul_html_js = '<img src="/cmh/iphone_file/icons/security.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_' .. tostring(lul_device) .. '" />' .. lul_description .. '<br>\n' ..
 		'<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '">' ..
+		'<a href="javascript:void(0);" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&Value=1&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"><img src="/cmh/images/' .. status_tripped .. '_circle.gif" alt="" border="0"/></a> ' ..
 		'<a href="javascript:void(0);" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=1&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"><img src="/cmh/iphone_file/buttons/arm' .. status_arm .. '.gif" alt="" border="0"/></a> ' ..
 		'<a href="javascript:void(0);" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=0&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"><img src="/cmh/iphone_file/buttons/bypass' .. status_bypass .. '.gif" alt="" border="0"/></a> '
@@ -283,4 +291,45 @@
 end
 
+function lug_sPhoneRequest_temp(lul_device,lul_description,lul_js)
+	local lul_Temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",lul_device)
+	
+	if( lul_Temp==nil ) then
+		lul_Temp='N/A'
+	end	
+
+	lul_html_no_js = '<img src="/cmh/iphone_file/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />' .. lul_description .. '<br>\n' ..
+		'Temperature: ' .. lul_Temp ..'&deg;<br/>'
+
+	local lul_html_js = '<img src="/cmh/iphone_file/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_' .. tostring(lul_device) .. '" />' .. lul_description .. '<br>\n' ..
+		'<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '">' ..
+		'Temperature: ' .. lul_Temp ..'&deg;<br/>'
+
+	if( lul_js=='1' ) then
+		return lul_html_js
+	else
+		return lul_html_no_js
+	end			
+end
+
+function lug_sPhoneRequest_bright(lul_device,lul_description,lul_js)
+	local lul_Level = luup.variable_get("urn:micasaverde-com:serviceId:LightSensor1","CurrentLevel",lul_device)
+	
+	if( lul_Level==nil ) then
+		lul_Level='N/A'
+	end	
+
+	lul_html_no_js = '<img src="/cmh/iphone_file/icons/brightness.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />' .. lul_description .. '<br>\n' ..
+		'Light level: ' .. lul_Level ..'<br/>'
+
+	local lul_html_js = '<img src="/cmh/iphone_file/icons/brightness.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_' .. tostring(lul_device) .. '" />' .. lul_description .. '<br>\n' ..
+		'<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '">' ..
+		'Light level: ' .. lul_Level ..'<br/>'
+
+	if( lul_js=='1' ) then
+		return lul_html_js
+	else
+		return lul_html_no_js
+	end			
+end
 
 function lug_sPhoneRequest_thermostat(lul_device,lul_description,lul_js)
@@ -509,5 +558,5 @@
 		'	<tr>' ..
 		'		<td></td>' ..
-		'		<td><img src="/cmh/images/set_deasupra.gif" border="0" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lr_sPhone_action_js&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. tostring(lul_device) .. '&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName=\'+document.getElementById(\'UserCodeName_' .. tostring(lul_device) .. '\').value+\'&newPin=\'+document.getElementById(\'newPin_' .. tostring(lul_device) .. '\').value+\'&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"></td>' ..
+		'		<td><img src="/cmh/images/set_deasupra.gif" border="0" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lr_sPhone_action_js&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. tostring(lul_device) .. '&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName=\'+document.getElementById(\'UserCodeName_' .. tostring(lul_device) .. '\').value+\'&newPin=\'+document.getElementById(\'UserCodeName_' .. tostring(lul_device) .. '\').value+\'&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"></td>' ..
 		'	</tr>' ..				
 		'</table>' ..
@@ -529,7 +578,5 @@
 		lul_js = 0;
 	end
-
-	local lul_streaming,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","DirectStreamingURL",tonumber(lul_device))
-
+	
 	local lul_html_no_js = '<div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/images/backButton.gif" border="0"></a> </div>' ..
 		'<div align="center">View camera <br/>' ..
@@ -555,51 +602,4 @@
 		'<br><a href="data_request?id=lr_sPhone_camimg&device=' .. lul_device .. '&js=' .. lul_js .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Refresh</a> '
 
-	if( lul_streaming~=nill and #lul_streaming>1 ) then
-		lul_html_no_js = lul_html_no_js .. '<a href="data_request?id=lr_sPhone_camstream&device=' .. lul_device .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Stream</a>'
-	end
-
-	if( lul_js=='1' ) then
-		return html_header .. lul_html_js .. html_footer
-	else
-		return html_header .. lul_html_no_js .. html_footer
-	end			
-	
-end
-
-function lug_sPhoneRequest_camstream(lul_request,lul_parameters,lul_outputformat)
-	local lul_device = lul_parameters["device"]
-	local lul_js = lul_parameters["js"]
-	if( lul_js==nill or tonumber(lul_js)==0 ) then
-		lul_js = 0;
-	end
-
-	local lul_streaming,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","DirectStreamingURL",tonumber(lul_device))
-	local lul_user,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","Username",tonumber(lul_device))
-	local lul_pass,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","Password",tonumber(lul_device))
-	local lul_ip = luup.devices[tonumber(lul_device)].ip
-
-	local lul_html_no_js = '<div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/images/backButton.gif" border="0"></a> </div>' ..
-		'<div align="center">View camera <br/>' ..
-		'<img src="http://' .. lul_user .. ':' .. lul_pass .. '@' .. lul_ip .. lul_streaming .. '"><br>' ..
-		'<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveUp"><img src="/cmh/images/buupdeasupra.gif" border="0"></a>' ..
-		'<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveDown"><img src="/cmh/images/budowndeasupra.gif" border="0"></a>' ..
-		'<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveLeft"><img src="/cmh/images/buldeasupra.gif" border="0"></a>' ..
-		'<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveRight"><img src="/cmh/images/burdeasupra.gif" border="0"></a>' ..
-		'<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=ZoomIn"><img src="/cmh/images/buplusdeasupra.gif" border="0"></a>' ..
-		'<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=ZoomOut"><img src="/cmh/images/buminusdeasupra.gif" border="0"></a>' ..
-		'<br><a href="data_request?id=lr_sPhone_camimg&device=' .. lul_device .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Still Image</a> '
-	
-	local lul_html_js = '<div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/images/backButton.gif" border="0"></a> </div>' ..
-		'<div align="center">View camera <br/>' ..
-		'<img src="data_request?id=cam_image&Device_Num=' .. lul_device .. '&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&time=' .. tostring(os.clock()) .. '" id="view_' .. tostring(lul_device) .. '"><br>' ..
-		'<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '"><br>' ..
-		'<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveUp\');"><img src="/cmh/images/buupdeasupra.gif" border="0"></a>' ..
-		'<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveDown\');"><img src="/cmh/images/budowndeasupra.gif" border="0"></a>' ..
-		'<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveLeft\');"><img src="/cmh/images/buldeasupra.gif" border="0"></a>' ..
-		'<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveRight\');"><img src="/cmh/images/burdeasupra.gif" border="0"></a>' ..
-		'<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'ZoomIn\');"><img src="/cmh/images/buplusdeasupra.gif" border="0"></a>' ..
-		'<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'ZoomOut\');"><img src="/cmh/images/buminusdeasupra.gif" border="0"></a>' ..
-		'<br><a href="data_request?id=lr_sPhone_camimg&device=' .. lul_device .. '&js=' .. lul_js .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Still Image</a> '
-
 	if( lul_js=='1' ) then
 		return html_header .. lul_html_js .. html_footer
@@ -652,4 +652,8 @@
 			elseif( v.category_num==6 ) then -- DEVICE_CATEGORY_CAMERA
 				lul_html = lul_html .. '<li class="bg">' .. lug_sPhoneRequest_camera(k,v.description,lul_js) .. "</li>\n"
+			elseif( v.category_num==17 ) then -- DEVICE_CATEGORY_TEMPERATURE
+				lul_html = lul_html .. '<li class="bg">' .. lug_sPhoneRequest_temp(k,v.description,lul_js) .. "</li>\n"
+			elseif( v.category_num==18 ) then -- DEVICE_CATEGORY_LIGHT
+				lul_html = lul_html .. '<li class="bg">' .. lug_sPhoneRequest_bright(k,v.description,lul_js) .. "</li>\n"
 			elseif( v.category_num==4 or v.category_num==9) then -- DEVICE_CATEGORY_SENSOR, DEVICE_CATEGORY_REMOTE_CONTROL
 				lul_html = lul_html .. '<li class="bg">' .. lug_sPhoneRequest_sensor(k,v.description,lul_js) .. "</li>\n"
