- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
/L_sPhoneUI.lua
r1 r3 11 11 luup.register_handler("lug_sPhoneRequest_job_status","sPhone_job_status") 12 12 luup.register_handler("lug_sPhoneRequest_camimg","sPhone_camimg") 13 luup.register_handler("lug_sPhoneRequest_camstream","sPhone_camstream")14 13 luup.register_handler("lug_sPhoneRequest_action_js","sPhone_action_js") 15 14 … … 257 256 function lug_sPhoneRequest_sensor(lul_device,lul_description,lul_js) 258 257 local lul_Armed = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Armed",lul_device) 258 lul_Tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",lul_device) 259 260 if( lul_Tripped~="1") then 261 status_tripped='green' 262 else 263 status_tripped='red' 264 end 259 265 260 266 if( lul_Armed~="1") then … … 267 273 268 274 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' .. 275 '<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> ' .. 269 276 '<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> ' .. 270 277 '<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 280 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' .. 274 281 '<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '">' .. 282 '<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> ' .. 275 283 '<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> ' .. 276 284 '<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 291 end 284 292 293 function lug_sPhoneRequest_temp(lul_device,lul_description,lul_js) 294 local lul_Temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",lul_device) 295 296 if( lul_Temp==nil ) then 297 lul_Temp='N/A' 298 end 299 300 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' .. 301 'Temperature: ' .. lul_Temp ..'°<br/>' 302 303 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' .. 304 '<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '">' .. 305 'Temperature: ' .. lul_Temp ..'°<br/>' 306 307 if( lul_js=='1' ) then 308 return lul_html_js 309 else 310 return lul_html_no_js 311 end 312 end 313 314 function lug_sPhoneRequest_bright(lul_device,lul_description,lul_js) 315 local lul_Level = luup.variable_get("urn:micasaverde-com:serviceId:LightSensor1","CurrentLevel",lul_device) 316 317 if( lul_Level==nil ) then 318 lul_Level='N/A' 319 end 320 321 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' .. 322 'Light level: ' .. lul_Level ..'<br/>' 323 324 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' .. 325 '<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '">' .. 326 'Light level: ' .. lul_Level ..'<br/>' 327 328 if( lul_js=='1' ) then 329 return lul_html_js 330 else 331 return lul_html_no_js 332 end 333 end 285 334 286 335 function lug_sPhoneRequest_thermostat(lul_device,lul_description,lul_js) … … 509 558 ' <tr>' .. 510 559 ' <td></td>' .. 511 ' <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>' ..560 ' <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>' .. 512 561 ' </tr>' .. 513 562 '</table>' .. … … 529 578 lul_js = 0; 530 579 end 531 532 local lul_streaming,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","DirectStreamingURL",tonumber(lul_device)) 533 580 534 581 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>' .. 535 582 '<div align="center">View camera <br/>' .. … … 555 602 '<br><a href="data_request?id=lr_sPhone_camimg&device=' .. lul_device .. '&js=' .. lul_js .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Refresh</a> ' 556 603 557 if( lul_streaming~=nill and #lul_streaming>1 ) then558 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>'559 end560 561 if( lul_js=='1' ) then562 return html_header .. lul_html_js .. html_footer563 else564 return html_header .. lul_html_no_js .. html_footer565 end566 567 end568 569 function lug_sPhoneRequest_camstream(lul_request,lul_parameters,lul_outputformat)570 local lul_device = lul_parameters["device"]571 local lul_js = lul_parameters["js"]572 if( lul_js==nill or tonumber(lul_js)==0 ) then573 lul_js = 0;574 end575 576 local lul_streaming,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","DirectStreamingURL",tonumber(lul_device))577 local lul_user,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","Username",tonumber(lul_device))578 local lul_pass,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","Password",tonumber(lul_device))579 local lul_ip = luup.devices[tonumber(lul_device)].ip580 581 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>' ..582 '<div align="center">View camera <br/>' ..583 '<img src="http://' .. lul_user .. ':' .. lul_pass .. '@' .. lul_ip .. lul_streaming .. '"><br>' ..584 '<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>' ..585 '<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>' ..586 '<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>' ..587 '<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>' ..588 '<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>' ..589 '<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>' ..590 '<br><a href="data_request?id=lr_sPhone_camimg&device=' .. lul_device .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Still Image</a> '591 592 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>' ..593 '<div align="center">View camera <br/>' ..594 '<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>' ..595 '<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '"><br>' ..596 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveUp\');"><img src="/cmh/images/buupdeasupra.gif" border="0"></a>' ..597 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveDown\');"><img src="/cmh/images/budowndeasupra.gif" border="0"></a>' ..598 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveLeft\');"><img src="/cmh/images/buldeasupra.gif" border="0"></a>' ..599 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveRight\');"><img src="/cmh/images/burdeasupra.gif" border="0"></a>' ..600 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'ZoomIn\');"><img src="/cmh/images/buplusdeasupra.gif" border="0"></a>' ..601 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'ZoomOut\');"><img src="/cmh/images/buminusdeasupra.gif" border="0"></a>' ..602 '<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> '603 604 604 if( lul_js=='1' ) then 605 605 return html_header .. lul_html_js .. html_footer … … 652 652 elseif( v.category_num==6 ) then -- DEVICE_CATEGORY_CAMERA 653 653 lul_html = lul_html .. '<li class="bg">' .. lug_sPhoneRequest_camera(k,v.description,lul_js) .. "</li>\n" 654 elseif( v.category_num==17 ) then -- DEVICE_CATEGORY_TEMPERATURE 655 lul_html = lul_html .. '<li class="bg">' .. lug_sPhoneRequest_temp(k,v.description,lul_js) .. "</li>\n" 656 elseif( v.category_num==18 ) then -- DEVICE_CATEGORY_LIGHT 657 lul_html = lul_html .. '<li class="bg">' .. lug_sPhoneRequest_bright(k,v.description,lul_js) .. "</li>\n" 654 658 elseif( v.category_num==4 or v.category_num==9) then -- DEVICE_CATEGORY_SENSOR, DEVICE_CATEGORY_REMOTE_CONTROL 655 659 lul_html = lul_html .. '<li class="bg">' .. lug_sPhoneRequest_sensor(k,v.description,lul_js) .. "</li>\n"
Note: See TracChangeset
for help on using the changeset viewer.