Changes in / [20:30]


Ignore:
Files:
67 added
4 edited

Legend:

Unmodified
Added
Removed
  • /trunk/S_TCPLightingGateway1.xml

    r20 r30  
    2222  <actionList> 
    2323    <action> 
    24       <name>Login</name> 
     24      <name>Pair</name> 
    2525    </action> 
    2626    <action> 
  • /trunk/I_TCPLighting1.xml

    r20 r30  
    133133          local current_value = luup.attr_get (attr_name, device_number) 
    134134          if (not current_value) or (new_value ~= current_value) then 
    135               luup.log ("TCPLighting:  update_attr - device_number=" .. device_number) 
    136               luup.log ("TCPLighting:  update_attr - attr_name=" .. attr_name) 
    137               luup.log ("TCPLighting:  update_attr - new_value=" .. new_value) 
     135              luup.log ("TCPLighting:  update_attr - device_number=" .. tostring(device_number)) 
     136              luup.log ("TCPLighting:  update_attr - attr_name=" .. tostring(attr_name)) 
     137              luup.log ("TCPLighting:  update_attr - new_value=" .. tostring(new_value)) 
    138138              luup.attr_set (attr_name, new_value, device_number) 
    139139          end 
     
    309309       -- for subsequent calls 
    310310       -- --------------------------------------------------------------------- 
    311        function login_to_gateway (lul_device) 
    312  
    313            luup.log ("TCPLighting: login_to_gateway - start") 
     311       function pair_with_gateway (lul_device) 
     312 
     313           luup.log ("TCPLighting: pair_with_gateway - start") 
    314314 
    315315           local device_number = tonumber(lul_device) 
     
    337337 
    338338           -- login to the gateway 
    339            luup.log ("TCPLighting:  login_to_gateway - IP=" .. tostring(gateway.gateway_ip)) 
    340            luup.log ("TCPLighting:  login_to_gateway - UUID=" .. tostring(gateway.gateway_uuid)) 
    341            tcplighting_gateway_login (gateway) 
    342            luup.log ("TCPLighting:  login_to_gateway - Token=" .. tostring(gateway.gateway_token)) 
     339           luup.log ("TCPLighting:  pair_with_gateway - IP=" .. tostring(gateway.gateway_ip)) 
     340           luup.log ("TCPLighting:  pair_with_gateway - UUID=" .. tostring(gateway.gateway_uuid)) 
     341           tcplighting_gateway_pair (gateway) 
     342           luup.log ("TCPLighting:  pair_with_gateway - Token=" .. tostring(gateway.gateway_token)) 
    343343 
    344344           if (gateway.gateway_token) then 
    345345            
     346               -- update device variables 
    346347               update_variable (GATEWAY_SERVICE_ID, "GatewayToken", gateway.gateway_token, device_number) 
    347348               update_variable (GATEWAY_SERVICE_ID, "GatewayUUID",  gateway.gateway_uuid,  device_number) 
    348349               update_variable (GATEWAY_SERVICE_ID, "ErrorText",    gateway.error_text,    device_number) 
     350                
     351               -- initiate a sync 
     352               luup.log ("TCPLighting: pair_with_gateway - synchronizing") 
     353               return synchronize_gateway (lul_device) 
    349354 
    350355           else 
    351356 
    352357               -- flag that there was an error 
    353                luup.log ("TCPLighting:  login_to_gateway - error: " .. gateway.error_text) 
     358               luup.log ("TCPLighting:  pair_with_gateway - error: " .. gateway.error_text) 
    354359               update_variable (GATEWAY_SERVICE_ID, "ErrorText", gateway.error_text, device_number) 
    355360 
    356361           end 
    357362 
    358            luup.log ("TCPLighting: login_to_gateway - end") 
     363           luup.log ("TCPLighting: pair_with_gateway - end") 
    359364 
    360365           return true 
     
    379384           local gateway_token = luup.variable_get  (GATEWAY_SERVICE_ID, "GatewayToken", device_number) 
    380385           if (not gateway_token) or (gateway_token == "") then 
    381                gateway.error_text = "No gateway token assigned, use device configuration UI to login first" 
     386               gateway.error_text = "No gateway token assigned, use device configuration UI to pair first" 
    382387               update_variable (GATEWAY_SERVICE_ID, "ErrorText", gateway.error_text, device_number) 
    383388               return true 
     
    523528    <action> 
    524529      <serviceId>urn:pmcode-org:serviceId:TCPLightingGateway1</serviceId> 
    525       <name>Login</name> 
    526       <run>return login_to_gateway (lul_device)</run> 
     530      <name>Pair</name> 
     531      <run>return pair_with_gateway (lul_device)</run> 
    527532    </action> 
    528533 
  • /trunk/L_TCPLighting1.lua

    r20 r30  
    4747 
    4848-- ---------------------------------------------------------------------------- 
    49 -- Login to a Connected by TCP gateway 
     49-- Pair with a Connected by TCP gateway 
    5050-- 
    5151-- Note: User must put gateway into "pairing" mode by pressing  
    5252--       green sync button (green on the model I have anyway) 
    5353-- ---------------------------------------------------------------------------- 
    54 function tcplighting_gateway_login (gateway) 
     54function tcplighting_gateway_pair (gateway) 
    5555 
    5656    -- Bail if we don't a gateway 
    5757    if (not gateway) then 
    58        gateway.error_text = "No gateway object provided, login failed" 
     58       gateway.error_text = "No gateway object provided, pairing failed" 
    5959       return gateway 
    6060    end 
     
    6262    -- Bail if we don't a gateway IP 
    6363    if (not gateway.gateway_ip) then 
    64        gateway.error_text = "No gateway IP address specified, login failed" 
     64       gateway.error_text = "No gateway IP address specified, pairing failed" 
    6565       return gateway 
    6666    end 
     
    6868    -- Bail if we  don't have a gateway UUID 
    6969    if (not gateway.gateway_uuid) then 
    70        gateway.error_text = "No gateway UUID address derived, login failed" 
     70       gateway.error_text = "No gateway UUID address derived, pairing failed" 
    7171       return  
    7272    end 
     
    9696 
    9797    if (not gateway.gateway_token) then 
    98        gateway.error_text = "No gateway token extracted, login failed" 
     98       gateway.error_text = "No gateway token extracted, pairing failed" 
    9999       if status   then gateway.error_text = gateway.error_text .. " - HTTPS status=" .. status  end 
    100100       if rc_value then gateway.error_text = gateway.error_text .. " - Gateway RC=" .. rc_value  end 
  • /trunk/D_TCPLightingGateway1.json

    r20 r30  
    5757            { 
    5858            "ControlType": "label", 
    59             "Label":       {"lang_tag": "login_desc","text": "Securely Login/Pair with the gateway - Press the green sync button on the gateway first "}, 
     59            "Label":       {"lang_tag": "pair_desc","text": "Securely Login/Pair with the gateway - Press the green sync button on the gateway first "}, 
    6060            "Display":     {"Top": 20,"Left": 50,"Width": 200,"Height": 20} 
    6161            }, 
    6262            { 
    6363            "ControlType":  "button", 
    64             "Label":       {"lang_tag": "login_command","text": "Login"}, 
     64            "Label":       {"lang_tag": "pair_command","text": "Pair"}, 
    6565            "Display":     {"Top": 37,"Left": 50, "Width": 100, "Height": 20 }, 
    66             "Command":     {"Service": "urn:pmcode-org:serviceId:TCPLightingGateway1", "Action": "Login", "Parameters": []} 
     66            "Command":     {"Service": "urn:pmcode-org:serviceId:TCPLightingGateway1", "Action": "Pair", "Parameters": []} 
    6767            }, 
    6868            { 
Note: See TracChangeset for help on using the changeset viewer.