Changes in / [20:30]


Ignore:
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • /L_sPhoneUI.lua

    r20 r30  
    55        return 
    66    end 
     7     
     8    sPh_LAYOUT_PFX = 'https://download1.mios.com/L_sPhoneUI_layout' 
     9    g_is_remote = 0 
    710 
    811    function string:template(variables) 
    9         return (self:gsub('%%{(.-)}%%', function (key) return tostring(variables[key] or '') end)) 
     12        return (self:gsub('{%%(.-)%%}', function (key) return tostring(variables[key] or _G[key] or '') end)) 
     13    end 
     14     
     15    function flag(v) 
     16        if( v==nil or tonumber(v)==0 ) then 
     17            return '0' 
     18        end 
     19        return '1' 
    1020    end 
    1121 
     
    1828    luup.register_handler("lug_sPhoneRequest_action_js","sPhone_action_js") 
    1929 
    20     luup.log (("L_sPhoneUI running version: %{version_branch}%.%{version_major}%.%{version_minor}%"):template(luup)) 
    21  
    22     local html_header = [[ 
     30    luup.log (("L_sPhoneUI running version: {%version_branch%}.{%version_major%}.{%version_minor%}"):template(luup)) 
     31 
     32    local html_header = ([[ 
    2333<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    2434<html xmlns="http://www.w3.org/1999/xhtml"> 
     
    2737        <meta http-equiv="pragma" content="nocache"/> 
    2838        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/> 
    29         <script src="/port_3480/L_sPhoneUI_layout/js/mobile.js" language="javascript"></script> 
    30         <link rel="stylesheet" href="/port_3480/L_sPhoneUI_layout/css/iui.css" type="text/css" /> 
     39        <script src="{%sPh_LAYOUT_PFX%}/js/mobile.js" language="javascript"></script> 
     40        <link rel="stylesheet" href="{%sPh_LAYOUT_PFX%}/css/iui.css" type="text/css" /> 
    3141    </head> 
    32     <body onLoad="js_prepare_urls();"> 
    33 ]] 
     42    <body onLoad="js_prepare_urls();set_layout_prefix('{%sPh_LAYOUT_PFX%}');"> 
     43]]):template ({}) 
    3444 
    3545    local html_footer=[[ 
     
    3747</html>]] 
    3848 
    39     function list_devices (lul_room, out) 
     49    function list_devices (lul_room, out, lul_js) 
    4050     
    4151        local grouphead_inserted = false 
     
    4858                end 
    4959                 
    50                 if( v.category_num==2 ) then -- DEVICE_CATEGORY_DIMMABLE_LIGHT 
     60                if( v.category_num==2 or v.category_num==8 ) then -- DEVICE_CATEGORY_DIMMABLE_LIGHT 
    5161                    table.insert (out, '<li class="bg">' .. lug_sPhoneRequest_light(k,v.description,lul_js) .. "</li>\n") 
    5262                elseif( v.category_num==5 ) then -- DEVICE_CATEGORY_HVAC 
     
    5868                elseif( v.category_num==17 ) then -- DEVICE_CATEGORY_TEMPERATURE 
    5969                    table.insert (out, '<li class="bg">' .. lug_sPhoneRequest_temp(k,v.description,lul_js) .. "</li>\n") 
     70                elseif( v.category_num==16 ) then -- DEVICE_CATEGORY_HUMIDITY 
     71                    table.insert (out, '<li class="bg">' .. lug_sPhoneRequest_humid(k,v.description,lul_js) .. "</li>\n") 
    6072                elseif( v.category_num==18 ) then -- DEVICE_CATEGORY_LIGHT 
    6173                    table.insert (out, '<li class="bg">' .. lug_sPhoneRequest_bright(k,v.description,lul_js) .. "</li>\n") 
     
    7082 
    7183    function lug_sPhoneRequest(lul_request,lul_parameters,lul_outputformat) 
     84        local lul_js = flag(lul_parameters.js) 
     85        g_is_remote = flag (lul_parameters.r) 
     86--      if( lul_js==nil or tonumber(lul_js)==0 ) then 
     87--          lul_js = 0 
     88--      end 
     89        luup.log("lul_js = " .. lul_js) 
    7290        local out = {html_header, [[ 
    7391        <div id="toolbar" class="toolbar"><!--logout_btn--></div> 
     
    8199                if not scene_grouphead_inserted then 
    82100                    table.insert (out, '<li class="group">Scenes</li>') 
     101                    scene_grouphead_inserted = true 
    83102                end 
    84                 -- lul_html = lul_html .. '<li class="bg"><a href="data_request?id=lr_sPhone_action&remote=' .. v.remote .. '&page=' .. v.page .. '&room=' .. 0 .. '&device=0&service=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=' .. tostring(k) .. '&time=' .. tostring(os.clock()) .. '"><img src="/port_3480/L_sPhoneUI_layout/buttons/go.gif" alt="" width="36" height="36" border="0" align="absmiddle" class="icon"/></a> ' .. v.description .. '</li>\n' 
    85103                table.insert (out, ([[ 
    86104                    <li class="bg"> 
    87                         <a href="data_request?id=lr_sPhone_action&remote=%{remote}%&page=%{page}%&room=%{room}%&device=0&service=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=%{scene_num}%&time=%{time}%"> 
    88                             <img src="/port_3480/L_sPhoneUI_layout/buttons/go.gif" alt="" width="36" height="36" border="0" align="absmiddle" class="icon"/> 
     105                        <a href="data_request?id=lr_sPhone_action&remote={%remote%}&page={%page%}&room={%room%}&device=0&service=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum={%scene_num%}&time={%time%}"> 
     106                            <img src="{%sPh_LAYOUT_PFX%}/buttons/go.gif" alt="" width="36" height="36" border="0" align="absmiddle" class="icon"/> 
    89107                        </a> 
    90                         %{description}% 
     108                        {%description%} 
    91109                    </li> 
    92110                ]]):template { 
     
    101119        end 
    102120 
    103         -- lul_html = lul_html .. '<li class="group">My Home</li>' 
    104121        if next(luup.rooms) ~= nil then 
    105122            table.insert (out, '<li class="group">My Home</li>') 
     
    107124 
    108125        for k,v in pairs(luup.rooms) do 
    109             -- lul_html = lul_html.. '<li><a class="pic" href="data_request?id=lr_sPhone_room&room=' .. tostring(k) .. '&time=' .. tostring(os.clock()) .. '">' .. v .. '</a></li>\r\n' 
    110126            table.insert (out, ([[ 
    111                 <li><a class="pic" href="data_request?id=lr_sPhone_room&room=%{room}%&time=%{time}%"> 
    112                     %{room_name}% 
     127                <li><a class="pic" href="data_request?id=lr_sPhone_room&room={%room%}&time={%time%}"> 
     128                    {%room_name%} 
    113129                </a></li> 
    114130            ]]):template { 
     
    119135        end 
    120136         
    121         list_devices (0, out) 
     137        list_devices (0, out, lul_js) 
    122138         
    123         -- lul_html = lul_html .. '</ul>' 
    124139        table.insert (out, '</ul>') 
    125140        table.insert (out, html_footer) 
    126141 
    127         -- lul_html = html_header .. lul_html .. html_footer 
    128142        return table.concat (out),"text/html" 
    129143    end 
     
    139153 
    140154        if( lul_remote~=nil and tonumber(lul_remote)>0 ) then 
    141             html_header_action = [[ 
     155            html_header_action = ([[ 
    142156<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    143157<html xmlns="http://www.w3.org/1999/xhtml"> 
     
    146160    <meta http-equiv="pragma" content="nocache"/> 
    147161    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/> 
    148     <meta http-equiv="refresh" content="0;url=\/port_3480/luvd/PK_Remote_' .. lul_remote .. '_' .. lul_page .. '.html" /> 
    149     <script src="/port_3480/L_sPhoneUI_layout/js/mobile.js" language="javascript"></script> 
    150     <link rel="stylesheet" href="/port_3480/L_sPhoneUI_layout/css/iui.css" type="text/css" /> 
     162    <meta http-equiv="refresh" content="0;url="/port_3480/luvd/PK_Remote_{%lul_remote%}_{%lul_page%}.html" /> 
     163    <script src="{%sPh_LAYOUT_PFX%}/js/mobile.js" language="javascript"></script> 
     164    <link rel="stylesheet" href="{%sPh_LAYOUT_PFX%}/css/iui.css" type="text/css" /> 
    151165</head> 
    152166<body onLoad="js_prepare_urls();"> 
    153 ]] 
     167            ]]):template { 
     168                lul_remote = lul_remote, 
     169                lul_page, 
     170            } 
    154171        else 
    155172            html_header_action = html_header 
     
    161178            return (html_header .. [[ 
    162179                <div> 
    163                     <img src="/port_3480/L_sPhoneUI_layout/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     180                    <img src="{%sPh_LAYOUT_PFX%}/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    164181                    Internal Error: Missing arguments 
    165182                </div> 
     
    174191            return (html_header .. [[ 
    175192                <div> 
    176                     <img src="/port_3480/L_sPhoneUI_layout/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     193                    <img src="{%sPh_LAYOUT_PFX%}/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    177194                    Internal Error: Invalid Device 
    178195                </div> 
     
    196213        local lul_resultcode,lul_resultstring,lul_job,lul_returnarguments = luup.call_action(lul_service,lul_action,lul_arguments,tonumber(lul_device)) 
    197214 
    198         luup.log (("lug_sPhoneRequest_action: device: %{device}% action: %{action}% service %{service}% returned: %{resultcode}% str %{resultstring}% job %{job}%"):template { 
     215        luup.log (("lug_sPhoneRequest_action: device: {%device%} action: {%action%} service {%service%} returned: {%resultcode%} str {%resultstring%} job {%job%}"):template { 
    199216            device = lul_device, 
    200217            action = lul_action, 
     
    207224        if( lul_resultcode~=0 ) then 
    208225            return ([[ 
    209                 %{html_header}% 
     226                {%html_header%} 
    210227                <div> 
    211                     <img src="/port_3480/L_sPhoneUI_layout/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    212                     Error: %{lul_resultcode}%: %{lul_resultstring}%<br> 
    213                     <a href="data_request?id=lr_sPhone_room&room=%{room_num}%&time=%{time}%">OK - back</a><br> 
     228                    <img src="{%sPh_LAYOUT_PFX%}/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     229                    Error: {%lul_resultcode%}: {%lul_resultstring%}<br> 
     230                    <a href="data_request?id=lr_sPhone_room&room={%room_num%}&time={%time%}">OK - back</a><br> 
    214231                </div> 
    215                 %{html_footer}% 
     232                {%html_footer%} 
    216233            ]]):template { 
    217                 html_header, 
    218                 html_footer, 
     234                html_header = html_header, 
     235                html_footer = html_footer, 
    219236                lul_resultcode = lul_resultcode, 
    220237                lul_resultstring = lul_resultstring, 
     
    226243        if ( lul_job==0 ) then 
    227244            return ([[ 
    228                 %{html_header_action}% 
     245                {%html_header_action%} 
    229246                <div id="toolbar" class="toolbar"> 
    230                     <a href="data_request?id=lr_sPhone_room&room=%{room}%&time=%{time}%"> 
    231                         <img src="/port_3480/L_sPhoneUI_layout/images/backButton.gif" border="0"> 
     247                    <a href="data_request?id=lr_sPhone_room&room={%room%}&time={%time%}"> 
     248                        <img src="{%sPh_LAYOUT_PFX%}/images/backButton.gif" border="0"> 
    232249                    </a> 
    233250                </div> 
    234251                <div> 
    235                     <img src="/port_3480/L_sPhoneUI_layout/buttons/ok.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     252                    <img src="{%sPh_LAYOUT_PFX%}/buttons/ok.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    236253                    Command executed OK<br> 
    237254                </div> 
    238                 %{html_footer}% 
     255                {%html_footer%} 
    239256            ]]):template { 
    240257                html_header_action = html_header_action, 
     
    246263 
    247264        return ([[ 
    248             %{html_header_action}% 
     265            {%html_header_action%} 
    249266            <div id="toolbar" class="toolbar"> 
    250                 <a href="data_request?id=lr_sPhone_room&room=%{room}%&time=%{time}%"> 
    251                     <img src="/port_3480/L_sPhoneUI_layout/images/backButton.gif" border="0"> 
     267                <a href="data_request?id=lr_sPhone_room&room={%room%}&time={%time%}"> 
     268                    <img src="{%sPh_LAYOUT_PFX%}/images/backButton.gif" border="0"> 
    252269                </a> 
    253270            </div> 
    254271            <div> 
    255                 <img src="/port_3480/L_sPhoneUI_layout/buttons/wait.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     272                <img src="{%sPh_LAYOUT_PFX%}/buttons/wait.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    256273                Running command now...<br> 
    257                 <a href="data_request?id=lr_sPhone_job&device=%{device}%&room=%{room}%&job=%{job}%&time=%{time}%"> 
     274                <a href="data_request?id=lr_sPhone_job&device={%device%}&room={%room%}&job={%job%}&time={%time%}"> 
    258275                    Check the status 
    259276                </a> 
    260277            </div> 
    261             %{html_footer}% 
     278            {%html_footer%} 
    262279        ]]):template { 
    263280            html_header_action = html_header_action, 
     
    272289    function lug_sPhoneRequest_camera(lul_device,lul_description,lul_js) 
    273290        return ([[ 
    274             <img src="/port_3480/L_sPhoneUI_layout/icons/camera.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/> 
    275                 %{description}% <br> 
    276             <a href="data_request?id=lr_sPhone_camimg&device=%{device}%&time=%{time}%&js=%{js}%"> 
    277                 <img src="/port_3480/L_sPhoneUI_layout/buttons/view.gif" alt="" border="0"/> 
     291            <img src="{%sPh_LAYOUT_PFX%}/icons/camera.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/> 
     292                {%description%} <br> 
     293            <a href="data_request?id=lr_sPhone_camimg&device={%device%}&time={%time%}&js={%js%}&r={%g_is_remote%}"> 
     294                <img src="{%sPh_LAYOUT_PFX%}/buttons/view.gif" alt="" border="0"/> 
    278295            </a> 
    279296        ]]):template { 
     
    297314        if( lul_job_status==nil ) then 
    298315            lul_text = [[ 
    299                 <img src="/port_3480/L_sPhoneUI_layout/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     316                <img src="{%sPh_LAYOUT_PFX%}/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    300317                No information on command.<br> 
    301318                Command history is only kept for 30 seconds. 
     
    303320        elseif( lul_job_status==0 or lul_job_status==1 or lul_job_status==5 ) then 
    304321            lul_text = ([[ 
    305                 <img src="/port_3480/L_sPhoneUI_layout/buttons/wait.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     322                <img src="{%sPh_LAYOUT_PFX%}/buttons/wait.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    306323                Command is still running...<br> 
    307                 <a href="data_request?id=lr_sPhone_job&device=%{device}%&room=%{room}%&job=%{job}%&time=%{time}%">Refresh</a>' 
     324                <a href="data_request?id=lr_sPhone_job&device={%device%}&room={%room%}&job={%job%}&time={%time%}">Refresh</a>' 
    308325            ]]):template { 
    309326                device = lul_device, 
     
    314331        elseif( lul_job_status==2 or lul_job_status==3 ) then 
    315332            lul_text = [[ 
    316                 <img src="/port_3480/L_sPhoneUI_layout/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     333                <img src="{%sPh_LAYOUT_PFX%}/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    317334                Failed to run command 
    318335            ]] 
    319336        elseif( lul_job_status==4 ) then 
    320337            lul_text = [[ 
    321                 <img src="/port_3480/L_sPhoneUI_layout/buttons/ok.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     338                <img src="{%sPh_LAYOUT_PFX%}/buttons/ok.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    322339                Command completed ok 
    323340            ]] 
    324341        else 
    325342            lul_text = [[ 
    326                 <img src="/port_3480/L_sPhoneUI_layout/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
     343                <img src="{%sPh_LAYOUT_PFX%}/buttons/eror.gif" alt="" border="0" class="icon" align="absmiddle"/> 
    327344                Unknown status:]] .. tostring(lul_job_status) 
    328345        end 
    329346 
    330347        return ([[ 
    331             %{html_header}% 
     348            {%html_header%} 
    332349            <div id="toolbar" class="toolbar"> 
    333                 <a href="data_request?id=lr_sPhone_room&room=%{room}%&time=%{time}%"> 
    334                     <img src="/port_3480/L_sPhoneUI_layout/images/backButton.gif" border="0"> 
     350                <a href="data_request?id=lr_sPhone_room&room={%room%}&time={%time%}"> 
     351                    <img src="{%sPh_LAYOUT_PFX%}/images/backButton.gif" border="0"> 
    335352                </a> 
    336353            </div> 
    337354            <div> 
    338                 %{text}% 
     355                {%text%} 
    339356            </div> 
    340             %{html_footer}% 
     357            {%html_footer%} 
    341358        ]]):template { 
    342359            html_header = html_header, 
     
    370387        if( lul_js=='1' ) then 
    371388            return ([[ 
    372                 <img src="/port_3480/L_sPhoneUI_layout/icons/dimmable.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/>%{description}%<br/> 
    373                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{device}%"> 
    374                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/off%{status_0}%.gif" alt="" border="0"/></a> 
    375                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=25&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/25%{status_25}%.gif" alt="" border="0"/></a> 
    376                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=50&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/50%{status_50}%.gif" alt="" border="0"/></a> 
    377                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=75&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/75%{status_75}%.gif" alt="" border="0"/></a> 
    378                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/on%{status_100}%.gif" alt="" border="0"/></a> (%{level}%) 
    379             ]]):template (tmpl_params) 
    380         else 
    381             return ([[ 
    382                 <img src="/port_3480/L_sPhoneUI_layout/icons/dimmable.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/>%{description}%<br/> 
    383                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{device}%"> 
    384                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/off%{status_0}%.gif" alt="" border="0"/></a> 
    385                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=25&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/25%{status_25}%.gif" alt="" border="0"/></a> 
    386                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=50&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/50%{status_50}%.gif" alt="" border="0"/></a> 
    387                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=75&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/75%{status_75}%.gif" alt="" border="0"/></a> 
    388                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room_num}%&device=%{device}%&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/on%{status_100}%.gif" alt="" border="0"/></a> (%{level}%) 
     389                <img src="{%sPh_LAYOUT_PFX%}/icons/dimmable.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/>{%description%}<br/> 
     390                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%device%}"> 
     391                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/off{%status_0%}.gif" alt="" border="0"/></a> 
     392                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=25&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/25{%status_25%}.gif" alt="" border="0"/></a> 
     393                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=50&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/50{%status_50%}.gif" alt="" border="0"/></a> 
     394                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=75&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/75{%status_75%}.gif" alt="" border="0"/></a> 
     395                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/on{%status_100%}.gif" alt="" border="0"/></a> ({%level%}) 
     396            ]]):template (tmpl_params) 
     397        else 
     398            return ([[<img src="{%sPh_LAYOUT_PFX%}/icons/dimmable.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/>{%description%}<br/> 
     399                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/off{%status_0%}.gif" alt="" border="0"/></a> 
     400                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=25&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/25{%status_25%}.gif" alt="" border="0"/></a> 
     401                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=50&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/50{%status_50%}.gif" alt="" border="0"/></a> 
     402                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=75&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/75{%status_75%}.gif" alt="" border="0"/></a> 
     403                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/on{%status_100%}.gif" alt="" border="0"/></a> 
    389404            ]]):template (tmpl_params) 
    390405        end 
     
    405420        if( lul_js=='1' ) then 
    406421            return ([[ 
    407                 <img src="/port_3480/L_sPhoneUI_layout/icons/switch.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_%{device}%" />%{description}%<br> 
    408                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{lul_device}%"> 
    409                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/off%{status_0}%.gif" alt="" border="0"/></a> 
    410                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/on%{status_100}%.gif" alt="" border="0"/></a> 
    411             ]]):template (tmpl_params) 
    412         else 
    413             return ([[ 
    414                 <img src="/port_3480/L_sPhoneUI_layout/icons/switch.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />%{description}%<br> 
    415                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/off%{status_0}%.gif" alt="" border="0"/></a> 
    416                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/on%{status_100}%.gif" alt="" border="0"/></a> 
     422                <img src="{%sPh_LAYOUT_PFX%}/icons/switch.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_{%device%}" />{%description%}<br> 
     423                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%lul_device%}"> 
     424                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/off{%status_0%}.gif" alt="" border="0"/></a> 
     425                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/on{%status_100%}.gif" alt="" border="0"/></a> 
     426            ]]):template (tmpl_params) 
     427        else 
     428            return ([[ 
     429                <img src="{%sPh_LAYOUT_PFX%}/icons/switch.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />{%description%}<br> 
     430                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/off{%status_0%}.gif" alt="" border="0"/></a> 
     431                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/on{%status_100%}.gif" alt="" border="0"/></a> 
    417432            ]]):template (tmpl_params) 
    418433        end 
     
    444459        if( lul_js=='1' ) then 
    445460            return ([[ 
    446                 <img src="/port_3480/L_sPhoneUI_layout/icons/security.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_%{device}%" />%{description}%<br> 
    447                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{lul_device}%"> 
    448                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lu_variableset&DeviceNum=%{device}%&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&Value=1&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/images/%{status_tripped}%_circle.gif" alt="" border="0"/></a> 
    449                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lu_variableset&DeviceNum=%{device}%&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=1&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/arm%{status_arm}%.gif" alt="" border="0"/></a> 
    450                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lu_variableset&DeviceNum=%{device}%&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=0&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/bypass%{status_bypass}%.gif" alt="" border="0"/></a> 
    451                 %{temp}% 
    452             ]]):template (tmpl_params) 
    453         else 
    454             return ([[ 
    455                 <img src="/port_3480/L_sPhoneUI_layout/icons/security.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />%{description}%<br> 
    456                 <a href="data_request?id=lu_variableset&DeviceNum=%{device}%&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/images/%{status_tripped}%_circle.gif" alt="" border="0"/></a> 
    457                 <a href="data_request?id=lu_variableset&DeviceNum=%{device}%&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=1&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/arm%{status_arm}%.gif" alt="" border="0"/></a> 
    458                 <a href="data_request?id=lu_variableset&DeviceNum=%{device}%&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=0&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/bypass%{status_bypass}%.gif" alt="" border="0"/></a> 
    459                 %{temp}% 
     461                <img src="{%sPh_LAYOUT_PFX%}/icons/security.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_{%device%}" />{%description%}<br> 
     462                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%lul_device%}"> 
     463                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lu_variableset&DeviceNum={%device%}&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&Value=1&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/images/{%status_tripped%}_circle.gif" alt="" border="0"/></a> 
     464                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lu_variableset&DeviceNum={%device%}&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=1&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/arm{%status_arm%}.gif" alt="" border="0"/></a> 
     465                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lu_variableset&DeviceNum={%device%}&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=0&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/bypass{%status_bypass%}.gif" alt="" border="0"/></a> 
     466                {%temp%} 
     467            ]]):template (tmpl_params) 
     468        else 
     469            return ([[ 
     470                <img src="{%sPh_LAYOUT_PFX%}/icons/security.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />{%description%}<br> 
     471                <a href="data_request?id=lu_variableset&DeviceNum={%device%}&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/images/{%status_tripped%}_circle.gif" alt="" border="0"/></a> 
     472                <a href="data_request?id=lu_variableset&DeviceNum={%device%}&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=1&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/arm{%status_arm%}.gif" alt="" border="0"/></a> 
     473                <a href="data_request?id=lu_variableset&DeviceNum={%device%}&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=0&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/bypass{%status_bypass%}.gif" alt="" border="0"/></a> 
     474                {%temp%} 
    460475            ]]):template (tmpl_params) 
    461476        end 
     
    472487        if( lul_js=='1' ) then 
    473488            return ([[ 
    474                 <img src="/port_3480/L_sPhoneUI_layout/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_%{device}%" />%{description}%<br> 
    475                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{device}%"> 
    476                 Temperature: %{temp}%&deg;<br/> 
    477             ]]):template (tmpl_params) 
    478         else 
    479             return ([[ 
    480                 <img src="/port_3480/L_sPhoneUI_layout/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />%{description}%<br> 
    481                 Temperature: %{temp}%&deg;<br/> 
     489                <img src="{%sPh_LAYOUT_PFX%}/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_{%device%}" />{%description%}<br> 
     490                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%device%}"> 
     491                Temperature: {%temp%}&deg;<br/> 
     492            ]]):template (tmpl_params) 
     493        else 
     494            return ([[ 
     495                <img src="{%sPh_LAYOUT_PFX%}/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />{%description%}<br> 
     496                Temperature: {%temp%}&deg;<br/> 
     497            ]]):template (tmpl_params) 
     498        end 
     499    end 
     500     
     501    function lug_sPhoneRequest_humid(lul_device, lul_description, lul_js) 
     502        local lul_humid = luup.variable_get ('urn:micasaverde-com:serviceId:HumiditySensor1', 'CurrentLevel', lul_device) 
     503        local tmpl_params = { 
     504            device = lul_device, 
     505            description = lul_description, 
     506            humid = lul_humid or 'N/A', 
     507        } 
     508         
     509        if (lul_js=='1') then 
     510            return ([[ 
     511                <img src="{%sPh_LAYOUT_PFX%}/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_{%device%}" />{%description%}<br> 
     512                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%device%}"> 
     513                Humidity: {%humid%}%<br/> 
     514            ]]):template (tmpl_params) 
     515        else 
     516            return ([[ 
     517                <img src="{%sPh_LAYOUT_PFX%}/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />{%description%}<br> 
     518                Humidity: {%humid%}%<br/> 
    482519            ]]):template (tmpl_params) 
    483520        end 
     
    494531        if( lul_js=='1' ) then 
    495532            return ([[ 
    496                 <img src="/port_3480/L_sPhoneUI_layout/icons/brightness.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_%{device}%" />%{description}%<br> 
    497                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{device}%"> 
    498                 Light level: %{level}%<br/> 
     533                <img src="{%sPh_LAYOUT_PFX%}/icons/brightness.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_{%device%}" />{%description%}<br> 
     534                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%device%}"> 
     535                Light level: {%level%}%<br/> 
    499536            ]]):template(tmpl_params) 
    500537        else 
    501538            return ([[ 
    502                 <img src="/port_3480/L_sPhoneUI_layout/icons/brightness.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />%{description}%<br> 
    503                 Light level: %{lul_Level}%<br/> 
     539                <img src="{%sPh_LAYOUT_PFX%}/icons/brightness.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />{%description%}<br> 
     540                Light level: {%level%}%<br/> 
    504541            ]]):template(tmpl_params) 
    505542        end 
     
    529566        if( lul_js=='1' ) then 
    530567            return ([[ 
    531                 <img src="/port_3480/L_sPhoneUI_layout/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/>%{description}%<br> 
    532                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{device}%"> 
    533                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=Off&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/off%{status_off}%.gif" alt="" border="0"/></a> 
    534                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=CoolOn&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/cool%{status_cool}%.gif" alt="" border="0"/></a> 
    535                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=HeatOn&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/heat%{status_heat}%.gif" alt="" border="0"/></a> 
    536                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=AutoChangeOver&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/auto%{status_auto}%.gif" alt="" border="0"/></a> <br/> 
    537                 Fan: <a href="javascript:void(0);" onClick="set_device_icon('%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_FanOperatingMode1&action=SetMode&NewMode=Auto&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/auto%{status_fan_auto}%.gif" alt="" border="0"/></a> 
    538                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_FanOperatingMode1&action=SetMode&NewMode=ContinuousOn&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/on%{status_fan_on}%.gif" alt="" border="0"/></a><br/> 
     568                <img src="{%sPh_LAYOUT_PFX%}/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/>{%description%}<br> 
     569                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%device%}"> 
     570                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=Off&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/off{%status_off%}.gif" alt="" border="0"/></a> 
     571                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=CoolOn&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/cool{%status_cool%}.gif" alt="" border="0"/></a> 
     572                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=HeatOn&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/heat{%status_heat%}.gif" alt="" border="0"/></a> 
     573                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=AutoChangeOver&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/auto{%status_auto%}.gif" alt="" border="0"/></a> <br/> 
     574                Fan: <a href="javascript:void(0);" onClick="set_device_icon('{%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_FanOperatingMode1&action=SetMode&NewMode=Auto&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/auto{%status_fan_auto%}.gif" alt="" border="0"/></a> 
     575                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_FanOperatingMode1&action=SetMode&NewMode=ContinuousOn&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/on{%status_fan_on%}.gif" alt="" border="0"/></a><br/> 
    539576                <table cellpadding="2" cellspacing="0"> 
    540577                    <tr> 
    541578                        <td>Heat: </td> 
    542                         <td><input type="text" name="NewCurrentSetpoint" id="NewCurrentSetpoint_Heat_%{device}%" value="" size="3"></td> 
    543                         <td><img src="/port_3480/L_sPhoneUI_layout/images/set_deasupra.gif" border="0" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:TemperatureSetpoint1_Heat&action=SetCurrentSetpoint&NewCurrentSetpoint='+document.getElementById('NewCurrentSetpoint_Heat_%{device}%').value+'&time=%{time}%',%{device}%);" border="0"></td> 
     579                        <td><input type="text" name="NewCurrentSetpoint" id="NewCurrentSetpoint_Heat_{%device%}" value="" size="3"></td> 
     580                        <td><img src="{%sPh_LAYOUT_PFX%}/images/set_deasupra.gif" border="0" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:TemperatureSetpoint1_Heat&action=SetCurrentSetpoint&NewCurrentSetpoint='+document.getElementById('NewCurrentSetpoint_Heat_{%device%}').value+'&time={%time%}',{%device%});" border="0"></td> 
    544581                    </tr> 
    545582 
    546583                    <tr> 
    547584                        <td>Cool: </td> 
    548                         <td><input type="text" name="NewCurrentSetpoint" id="NewCurrentSetpoint_Cool_%{device}%" value="" size="3"></td> 
    549                         <td><img src="/port_3480/L_sPhoneUI_layout/images/set_deasupra.gif" border="0" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:TemperatureSetpoint1_Cool&action=SetCurrentSetpoint&NewCurrentSetpoint='+document.getElementById('NewCurrentSetpoint_Cool_%{device}%').value+'&time=%{time}%',%{device}%);" border="0"></td> 
     585                        <td><input type="text" name="NewCurrentSetpoint" id="NewCurrentSetpoint_Cool_{%device%}" value="" size="3"></td> 
     586                        <td><img src="{%sPh_LAYOUT_PFX%}/images/set_deasupra.gif" border="0" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:TemperatureSetpoint1_Cool&action=SetCurrentSetpoint&NewCurrentSetpoint='+document.getElementById('NewCurrentSetpoint_Cool_{%device%}').value+'&time={%time%}',{%device%});" border="0"></td> 
    550587                    </tr> 
    551588                </table> 
    552                 Current temperature: %{temp}%&deg;<br/> 
    553                 Set point heat: %{setPointHeat}%&deg;<br/> 
    554                 Set point cool: %{setPointCool}%&deg; 
    555             ]]):template (tmpl_params) 
    556         else 
    557             return ([[ 
    558                 <img src="/port_3480/L_sPhoneUI_layout/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/>%{description}%<br> 
    559                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=Off&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/off%{status_off}%.gif" alt="" border="0"/></a> 
    560                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=CoolOn&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/cool%{status_cool}%.gif" alt="" border="0"/></a> 
    561                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=HeatOn&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/heat%{status_heat}%.gif" alt="" border="0"/></a> 
    562                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=AutoChangeOver&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/auto%{status_auto}%.gif" alt="" border="0"/></a> <br/> 
    563                 Fan: <a href="\data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_FanOperatingMode1&action=SetMode&NewMode=Auto&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/auto%{status_fan_auto}%.gif" alt="" border="0"/></a> 
    564                 <a href="\data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:upnp-org:serviceId:HVAC_FanOperatingMode1&action=SetMode&NewMode=ContinuousOn&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/buttons/on%{status_fan_on}%.gif" alt="" border="0"/></a><br/> 
     589                Current temperature: {%temp%}&deg;<br/> 
     590                Set point heat: {%setPointHeat%}&deg;<br/> 
     591                Set point cool: {%setPointCool%}&deg; 
     592            ]]):template (tmpl_params) 
     593        else 
     594            return ([[ 
     595                <img src="{%sPh_LAYOUT_PFX%}/icons/thermostat.gif" alt="" width="44" height="43" align="absmiddle" class="icon"/>{%description%}<br> 
     596                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=Off&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/off{%status_off%}.gif" alt="" border="0"/></a> 
     597                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=CoolOn&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/cool{%status_cool%}.gif" alt="" border="0"/></a> 
     598                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=HeatOn&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/heat{%status_heat%}.gif" alt="" border="0"/></a> 
     599                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget&NewModeTarget=AutoChangeOver&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/auto{%status_auto%}.gif" alt="" border="0"/></a> <br/> 
     600                Fan: <a href="\data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_FanOperatingMode1&action=SetMode&NewMode=Auto&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/auto{%status_fan_auto%}.gif" alt="" border="0"/></a> 
     601                <a href="\data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:upnp-org:serviceId:HVAC_FanOperatingMode1&action=SetMode&NewMode=ContinuousOn&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/on{%status_fan_on%}.gif" alt="" border="0"/></a><br/> 
    565602                <table cellpadding="2" cellspacing="0"> 
    566603                <form action="\data_request" method="get"> 
    567604                <input type="hidden" name="id" value="lr_sPhone_action"> 
    568                 <input type="hidden" name="room" value="%{room}%"> 
    569                 <input type="hidden" name="device" value="%{device}%"> 
     605                <input type="hidden" name="room" value="{%room%}"> 
     606                <input type="hidden" name="device" value="{%device%}"> 
    570607                <input type="hidden" name="service" value="urn:upnp-org:serviceId:TemperatureSetpoint1_Heat"> 
    571608                <input type="hidden" name="action" value="SetCurrentSetpoint"> 
    572                 <input type="hidden" name="time" value="%{time}%"> 
     609                <input type="hidden" name="time" value="{%time%}"> 
    573610                    <tr> 
    574611                        <td>Heat: </td> 
    575612                        <td><input type="text" name="NewCurrentSetpoint" value="" size="3"></td> 
    576                         <td><input type="image" src="/port_3480/L_sPhoneUI_layout/images/set_deasupra.gif" border="0"></td> 
     613                        <td><input type="image" src="{%sPh_LAYOUT_PFX%}/images/set_deasupra.gif" border="0"></td> 
    577614                    </tr> 
    578615                </form> 
    579616                <form action="\data_request" method="get"> 
    580617                <input type="hidden" name="id" value="lr_sPhone_action"> 
    581                 <input type="hidden" name="room" value="%{room}%"> 
    582                 <input type="hidden" name="device" value="%{device}%"> 
     618                <input type="hidden" name="room" value="{%room%}"> 
     619                <input type="hidden" name="device" value="{%device%}"> 
    583620                <input type="hidden" name="service" value="urn:upnp-org:serviceId:TemperatureSetpoint1_Cool"> 
    584621                <input type="hidden" name="action" value="SetCurrentSetpoint"> 
    585                 <input type="hidden" name="time" value="%{time}%"> 
     622                <input type="hidden" name="time" value="{%time%}"> 
    586623 
    587624                    <tr> 
    588625                        <td>Cool: </td> 
    589626                        <td><input type="text" name="NewCurrentSetpoint" value="" size="3"></td> 
    590                         <td><input type="image" src="/port_3480/L_sPhoneUI_layout/images/set_deasupra.gif" border="0"></td> 
     627                        <td><input type="image" src="{%sPh_LAYOUT_PFX%}/images/set_deasupra.gif" border="0"></td> 
    591628                    </tr> 
    592629                </form> 
    593630                </table> 
    594                 Current temperature: %{temp}%&deg;<br/> 
    595                 Set point heat: %{setPointHeat}%&deg;<br/> 
    596                 Set point cool: %{setPointCool}%&deg;' 
     631                Current temperature: {%temp%}&deg;<br/> 
     632                Set point heat: {%setPointHeat%}&deg;<br/> 
     633                Set point cool: {%setPointCool%}&deg;' 
    597634            ]]):template (tmpl_params) 
    598635        end 
     
    623660                    table.insert (o, ([[ 
    624661                        <tr> 
    625                             <td>%{part_5}%</td> 
    626                             <td><a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:DoorLock1&action=ClearPin&UserCode=%{part_1}%&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/images/remove_deasupra.gif" border="0"></a></td> 
     662                            <td>{%part_5%}</td> 
     663                            <td><a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:DoorLock1&action=ClearPin&UserCode={%part_1%}&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/images/remove_deasupra.gif" border="0"></a></td> 
    627664                        </tr> 
    628665                        ]]):template (tmpl_params)) 
     
    634671 
    635672 
    636         if( lul_js=='1' ) then 
    637             return ([[ 
    638                 %{description}%<br> 
    639                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{device}%"> 
    640                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=0&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/unlock%{status_unlock}%.gif" alt="" border="0"/></a> 
    641                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=1&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/lock%{status_lock}%.gif" alt="" border="0"/></a> 
     673        if( lul_js == '1') then 
     674            return ([[ 
     675                {%description%}<br> 
     676                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%device%}"> 
     677                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=0&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/unlock{%status_unlock%}.gif" alt="" border="0"/></a> 
     678                <a href="javascript:void(0);" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=1&time={%time%}',{%device%})"><img src="{%sPh_LAYOUT_PFX%}/buttons/lock{%status_lock%}.gif" alt="" border="0"/></a> 
    642679                <form action="data_request" method="get"> 
    643680                <input type="hidden" name="id" value="lr_sPhone_action"> 
    644                 <input type="hidden" name="room" value="%{room}%"> 
    645                 <input type="hidden" name="device" value="%{device}%"> 
     681                <input type="hidden" name="room" value="{%room%}"> 
     682                <input type="hidden" name="device" value="{%device%}"> 
    646683                <input type="hidden" name="service" value="urn:micasaverde-com:serviceId:DoorLock1"> 
    647684                <input type="hidden" name="action" value="SetPin"> 
    648                 <input type="hidden" name="time" value="%{time}%"> 
     685                <input type="hidden" name="time" value="{%time%}"> 
    649686                <table cellpadding="2" cellspacing="0"> 
    650687                    <tr> 
    651688                        <td>New code:</td> 
    652                         <td><input type="text" name="UserCodeName" id="UserCodeName_%{device}%" value="" size="8"></td> 
     689                        <td><input type="text" name="UserCodeName" id="UserCodeName_{%device%}" value="" size="8"></td> 
    653690                    </tr> 
    654691                    <tr> 
    655692                        <td>PIN code:</td> 
    656                         <td><input type="text" name="newPin" id="newPin_%{device}%" value="" size="8"></td> 
     693                        <td><input type="text" name="newPin" id="newPin_{%device%}" value="" size="8"></td> 
    657694                    </tr> 
    658695                    <tr> 
    659696                        <td></td> 
    660                         <td><img src="/port_3480/L_sPhoneUI_layout/images/set_deasupra.gif" border="0" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName='+document.getElementById('UserCodeName_%{device}%').value+'&newPin='+document.getElementById('UserCodeName_%{device}%').value+'&time=%{time}%',%{device}%)"></td> 
     697                        <td><img src="{%sPh_LAYOUT_PFX%}/images/set_deasupra.gif" border="0" onClick="set_device_icon({%device%},1);send_command('data_request?id=lr_sPhone_action_js&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName='+document.getElementById('UserCodeName_{%device%}').value+'&newPin='+document.getElementById('UserCodeName_{%device%}').value+'&time={%time%}',{%device%})"></td> 
    661698                    </tr> 
    662699                </table> 
    663700                </form> 
    664                 %{existing_codes}% 
    665             ]]):template (tmpl_params) 
    666         else 
    667             return ([[ 
    668                 %{description}%<br> 
    669                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{device}%"> 
    670                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=0&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/unlock%{status_unlock}%.gif" alt="" border="0"/></a> 
    671                 <a href="javascript:void(0);" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=1&time=%{time}%',%{device}%)"><img src="/port_3480/L_sPhoneUI_layout/buttons/lock%{status_lock}%.gif" alt="" border="0"/></a> 
     701                {%existing_codes%} 
     702            ]]):template (tmpl_params) 
     703        else 
     704            return ([[ 
     705                {%lul_description%}<br> 
     706                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=0&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/unlock{%status_unlock%}.gif" alt="" border="0"/></a> 
     707                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=1&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/buttons/lock{%status%}.gif" alt="" border="0"/></a> 
    672708                <form action="data_request" method="get"> 
    673                 <input type="hidden" name="id" value="lr_sPhone_action"> 
    674                 <input type="hidden" name="room" value="%{room}%"> 
    675                 <input type="hidden" name="device" value="%{device}%"> 
    676                 <input type="hidden" name="service" value="urn:micasaverde-com:serviceId:DoorLock1"> 
    677                 <input type="hidden" name="action" value="SetPin"> 
    678                 <input type="hidden" name="time" value="%{time}%"> 
    679                 <table cellpadding="2" cellspacing="0"> 
    680                     <tr> 
    681                         <td>New code:</td> 
    682                         <td><input type="text" name="UserCodeName" id="UserCodeName_%{device}%" value="" size="8"></td> 
    683                     </tr> 
    684                     <tr> 
    685                         <td>PIN code:</td> 
    686                         <td><input type="text" name="newPin" id="newPin_%{device}%" value="" size="8"></td> 
    687                     </tr> 
    688                     <tr> 
    689                         <td></td> 
    690                         <td><img src="/port_3480/L_sPhoneUI_layout/images/set_deasupra.gif" border="0" onClick="set_device_icon(%{device}%,1);send_command('data_request?id=lr_sPhone_action_js&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName='+document.getElementById('UserCodeName_%{device}%').value+'&newPin='+document.getElementById('UserCodeName_%{device}%').value+'&time=%{time}%',%{device}%)"></td> 
    691                     </tr> 
    692                 </table> 
     709                    <input type="hidden" name="id" value="lr_sPhone_action"> 
     710                    <input type="hidden" name="room" value="{%room%}"> 
     711                    <input type="hidden" name="device" value="{%device%}"> 
     712                    <input type="hidden" name="service" value="urn:micasaverde-com:serviceId:DoorLock1"> 
     713                    <input type="hidden" name="action" value="SetPin"> 
     714                    <input type="hidden" name="time" value="{%time%}"> 
     715                    <table cellpadding="2" cellspacing="0"> 
     716                        <tr> 
     717                            <td>New code:</td> 
     718                            <td><input type="text" name="UserCodeName" value="" size="4"></td> 
     719                        </tr> 
     720                        <tr> 
     721                            <td>4 digit code:</td> 
     722                            <td><input type="text" name="newPin" value="" size="4"></td> 
     723                        </tr> 
     724                        <tr> 
     725                            <td></td> 
     726                            <td><input type="image" src="{%sPh_LAYOUT_PFX%}/images/set_deasupra.gif" border="0"></td> 
     727                        </tr> 
     728                    </table> 
    693729                </form> 
    694                 %{existing_codes}% 
     730                {%existing_codes%} 
    695731            ]]):template (tmpl_params) 
    696732        end 
     
    699735    function lug_sPhoneRequest_camimg(lul_request,lul_parameters,lul_outputformat) 
    700736        local lul_device = lul_parameters.device 
     737 
    701738        local tmpl_params = { 
    702739            header = html_header, 
     
    706743            time = os.clock(), 
    707744        } 
    708         local lul_js = lul_parameters.js 
    709         if( lul_js==nil or tonumber(lul_js)==0 ) then 
    710             lul_js = 0; 
    711         end 
     745        local lul_js = flag(lul_parameters.js) 
    712746        tmpl_params.js = lul_js 
     747        g_is_remote = flag (lul_parameters.r) 
     748         
     749        local streamingurl = luup.variable_get ('urn:micasaverde-com:serviceId:Camera1', 'DirectStreamingURL', lul_device) 
     750        if streamingurl and g_is_remote=='1' then 
     751            streamingurl = string.format('data_request?id=lu_camera_port&DeviceNum=%d', lul_device) 
     752        end 
     753        tmpl_params.url = streamingurl or ("data_request?id=cam_image&Device_Num={%device%}&room={%room%}&time={%time%}"):template(tmpl_params) 
     754         
    713755 
    714756        if( lul_js=='1' ) then 
    715757            return ([[ 
    716                 %{header}% 
    717                 <div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room=%{room}%&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/images/backButton.gif" border="0"></a> </div> 
     758                {%header%} 
     759                <div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room={%room%}&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/images/backButton.gif" border="0"></a> </div> 
    718760                <div align="center">View camera <br/> 
    719                 <img src="data_request?id=cam_image&Device_Num=%{device}%&room=%{room}%&time=%{time}%" id="view_%{device}%"><br> 
    720                 <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="action_icon_%{device}%"><br> 
    721                 <a href="javascript:void(0)" onClick="sp_move_camera(%{device}%,'MoveUp');"><img src="/port_3480/L_sPhoneUI_layout/images/buupdeasupra.gif" border="0"></a> 
    722                 <a href="javascript:void(0)" onClick="sp_move_camera(%{device}%,'MoveDown');"><img src="/port_3480/L_sPhoneUI_layout/images/budowndeasupra.gif" border="0"></a> 
    723                 <a href="javascript:void(0)" onClick="sp_move_camera(%{device}%,'MoveLeft');"><img src="/port_3480/L_sPhoneUI_layout/images/buldeasupra.gif" border="0"></a> 
    724                 <a href="javascript:void(0)" onClick="sp_move_camera(%{device}%,'MoveRight');"><img src="/port_3480/L_sPhoneUI_layout/images/burdeasupra.gif" border="0"></a> 
    725                 <a href="javascript:void(0)" onClick="sp_move_camera(%{device}%,'ZoomIn');"><img src="/port_3480/L_sPhoneUI_layout/images/buplusdeasupra.gif" border="0"></a> 
    726                 <a href="javascript:void(0)" onClick="sp_move_camera(%{device}%,'ZoomOut');"><img src="/port_3480/L_sPhoneUI_layout/images/buminusdeasupra.gif" border="0"></a> 
    727                 <br><a href="data_request?id=lr_sPhone_camimg&device=%{device}%&js=%{js}%&time=%{time}%&js=%{js}%">Refresh</a> 
    728                 %{footer}% 
    729             ]]):template (tmpl_params) 
    730         else 
    731             return ([[ 
    732                 <div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room=%{room}%&time=%{time}%"><img src="/port_3480/L_sPhoneUI_layout/images/backButton.gif" border="0"></a> </div> 
     761                <img src="{%url%}" id="view_{%device%}"><br> 
     762                <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="action_icon_{%device%}"><br> 
     763                <a href="javascript:void(0)" onClick="sp_move_camera({%device%},'MoveUp');"><img src="{%sPh_LAYOUT_PFX%}/images/buupdeasupra.gif" border="0"></a> 
     764                <a href="javascript:void(0)" onClick="sp_move_camera({%device%},'MoveDown');"><img src="{%sPh_LAYOUT_PFX%}/images/budowndeasupra.gif" border="0"></a> 
     765                <a href="javascript:void(0)" onClick="sp_move_camera({%device%},'MoveLeft');"><img src="{%sPh_LAYOUT_PFX%}/images/buldeasupra.gif" border="0"></a> 
     766                <a href="javascript:void(0)" onClick="sp_move_camera({%device%},'MoveRight');"><img src="{%sPh_LAYOUT_PFX%}/images/burdeasupra.gif" border="0"></a> 
     767                <a href="javascript:void(0)" onClick="sp_move_camera({%device%},'ZoomIn');"><img src="{%sPh_LAYOUT_PFX%}/images/buplusdeasupra.gif" border="0"></a> 
     768                <a href="javascript:void(0)" onClick="sp_move_camera({%device%},'ZoomOut');"><img src="{%sPh_LAYOUT_PFX%}/images/buminusdeasupra.gif" border="0"></a> 
     769                <br><a href="data_request?id=lr_sPhone_camimg&device={%device%}&js={%js%}&time={%time%}&r={%g_is_remote%}">Refresh</a> 
     770                {%footer%} 
     771            ]]):template (tmpl_params) 
     772        else 
     773            return ([[ 
     774                <div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room={%room%}&time={%time%}"><img src="{%sPh_LAYOUT_PFX%}/images/backButton.gif" border="0"></a> </div> 
    733775                <div align="center">View camera <br/> 
    734                 <img src="data_request?id=cam_image&Device_Num=%{device}%&room=%{room}%&time=%{time}%"><br> 
    735                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveUp"><img src="/port_3480/L_sPhoneUI_layout/images/buupdeasupra.gif" border="0"></a> 
    736                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveDown"><img src="/port_3480/L_sPhoneUI_layout/images/budowndeasupra.gif" border="0"></a> 
    737                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveLeft"><img src="/port_3480/L_sPhoneUI_layout/images/buldeasupra.gif" border="0"></a> 
    738                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveRight"><img src="/port_3480/L_sPhoneUI_layout/images/burdeasupra.gif" border="0"></a> 
    739                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=ZoomIn"><img src="/port_3480/L_sPhoneUI_layout/images/buplusdeasupra.gif" border="0"></a> 
    740                 <a href="data_request?id=lr_sPhone_action&room=%{room}%&device=%{device}%&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=ZoomOut"><img src="/port_3480/L_sPhoneUI_layout/images/buminusdeasupra.gif" border="0"></a> 
    741                 <br><a href="data_request?id=lr_sPhone_camimg&device=%{device}%&time=%{time}%&js=%{js}%">Refresh</a> 
     776                <img src="{%url%}"><br> 
     777                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveUp"><img src="{%sPh_LAYOUT_PFX%}/images/buupdeasupra.gif" border="0"></a> 
     778                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveDown"><img src="{%sPh_LAYOUT_PFX%}/images/budowndeasupra.gif" border="0"></a> 
     779                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveLeft"><img src="{%sPh_LAYOUT_PFX%}/images/buldeasupra.gif" border="0"></a> 
     780                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveRight"><img src="{%sPh_LAYOUT_PFX%}/images/burdeasupra.gif" border="0"></a> 
     781                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=ZoomIn"><img src="{%sPh_LAYOUT_PFX%}/images/buplusdeasupra.gif" border="0"></a> 
     782                <a href="data_request?id=lr_sPhone_action&room={%room%}&device={%device%}&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=ZoomOut"><img src="{%sPh_LAYOUT_PFX%}/images/buminusdeasupra.gif" border="0"></a> 
     783                <br><a href="data_request?id=lr_sPhone_camimg&device={%device%}&time={%time%}&js={%js%}&r={%g_is_remote%}">Refresh</a> 
    742784            ]]):template (tmpl_params) 
    743785        end 
     
    747789    function lug_sPhoneRequest_room(lul_request,lul_parameters,lul_outputformat) 
    748790        local lul_room = lul_parameters.room 
    749         local lul_js = lul_parameters.js 
    750         if( lul_js==nil or tonumber(lul_js)==0 ) then 
    751             lul_js = 0; 
    752         end 
    753  
    754         luup.log("lul_js = " .. lul_js) 
     791        local lul_js = flag(lul_parameters.js) 
     792        g_is_remote = flag (lul_parameters.r) 
     793--      if( lul_js==nil or tonumber(lul_js)==0 ) then 
     794--          lul_js = 0; 
     795--      end 
     796 
     797        luup.log("lul_js = " .. tostring(lul_js)) 
    755798 
    756799        if( lul_room==nil or tonumber(lul_room)==0 ) then -- Room 0 means the main menu 
     
    765808 
    766809        local lul_html = {html_header, ([[ 
    767             <div id="toolbar" class="toolbar"> <div class="b_left"><a href="data_request?id=lr_sPhone"><img src="/port_3480/L_sPhoneUI_layout/images/backButton.gif" border="0"></a></div>  <div align="right" class="b_right"><a href="data_request?id=lr_sPhone_room&room=%{room}%&time=%{time}%&js=%{js}%"><img src="/port_3480/L_sPhoneUI_layout/images/refresh.gif" border="0"></a></div></div> 
     810            <div id="toolbar" class="toolbar"> <div class="b_left"><a href="data_request?id=lr_sPhone"><img src="{%sPh_LAYOUT_PFX%}/images/backButton.gif" border="0"></a></div>  <div align="right" class="b_right"><a href="data_request?id=lr_sPhone_room&room={%room%}&time={%time%}&js={%js%}&r={%g_is_remote%}"><img src="{%sPh_LAYOUT_PFX%}/images/refresh.gif" border="0"></a></div></div> 
    768811            <ul title="Room" selected="true"> 
    769812        ]]):template (tmpl_params)} 
     
    783826                    table.insert (lul_html, ([[ 
    784827                        <li class="bg"> 
    785                             <a href="data_request?id=lr_sPhone_action&remote=%{remote}%&page=%{page}%&room=%{room}%&device=0&service=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=%{scene}%&time=%{time}%"> 
    786                                 <img src="/port_3480/L_sPhoneUI_layout/buttons/go.gif" alt="" width="36" height="36" border="0" align="absmiddle" class="icon"/> 
     828                            <a href="data_request?id=lr_sPhone_action&remote={%remote%}&page={%page%}&room={%room%}&device=0&service=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum={%scene%}&time={%time%}"> 
     829                                <img src="{%sPh_LAYOUT_PFX%}/buttons/go.gif" alt="" width="36" height="36" border="0" align="absmiddle" class="icon"/> 
    787830                            </a> 
    788                             %{description}% 
     831                            {%description%} 
    789832                        </li> 
    790833                    ]]):template (tmpl_params)) 
     
    792835                    table.insert (lul_html, ([[ 
    793836                        <li class="bg"> 
    794                             <img src="/port_3480/L_sPhoneUI_layout/images/spacer.gif" border="0" width="20" height="20" id="scene_action_icon_%{scene}%" style="vertical-align:middle"> 
    795                             <a href="javascript:void(0)" onClick="set_scene_icon(%{scene}%,1);sp_run_scene('data_request?id=lr_sPhone_action_js&remote=%{remote}%&page=%{page}%&room=%{room}%&device=0&service=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=%{scene}%&time=%{time}%',%{scene}%);"> 
    796                                 <img src="/port_3480/L_sPhoneUI_layout/buttons/go.gif" alt="" width="36" height="36" border="0" style="vertical-align:middle" class="icon"/> 
     837                            <img src="{%sPh_LAYOUT_PFX%}/images/spacer.gif" border="0" width="20" height="20" id="scene_action_icon_{%scene%}" style="vertical-align:middle"> 
     838                            <a href="javascript:void(0)" onClick="set_scene_icon({%scene%},1);sp_run_scene('data_request?id=lr_sPhone_action_js&remote={%remote%}&page={%page%}&room={%room%}&device=0&service=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum={%scene%}&time={%time%}',{%scene%});"> 
     839                                <img src="{%sPh_LAYOUT_PFX%}/buttons/go.gif" alt="" width="36" height="36" border="0" style="vertical-align:middle" class="icon"/> 
    797840                            </a> 
    798                             %{description}% 
     841                            {%description%} 
    799842                        </li> 
    800843                    ]]):template (tmpl_params)) 
     
    804847        end 
    805848 
    806         list_devices (lul_room, lul_html) 
     849        list_devices (lul_room, lul_html, lul_js) 
    807850 
    808851        table.insert (lul_html, html_footer) 
Note: See TracChangeset for help on using the changeset viewer.