Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,25 @@ function ButtonLifecycleHandlers.init(driver, device)
if not hue_id_to_device[device_button_resource_id] then
hue_id_to_device[device_button_resource_id] = device
end

local maybe_idx_map = device:get_field(Fields.BUTTON_INDEX_MAP)
local svc_rids_for_device = driver.services_for_device_rid[hue_device_id] or {}

if not svc_rids_for_device[device_button_resource_id] then
svc_rids_for_device[device_button_resource_id] = HueDeviceTypes.BUTTON
end

for resource_id, _ in pairs(maybe_idx_map or {}) do
if not hue_id_to_device[resource_id] then
hue_id_to_device[resource_id] = device
end

if not svc_rids_for_device[resource_id] then
svc_rids_for_device[resource_id] = HueDeviceTypes.BUTTON
end
end
driver.services_for_device_rid[hue_device_id] = svc_rids_for_device

local button_info, err
button_info = Discovery.device_state_disco_cache[device_button_resource_id]
if not button_info then
Expand Down
10 changes: 5 additions & 5 deletions drivers/SmartThings/philips-hue/src/hue/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function PhilipsHueApi.new_bridge_manager(base_url, api_key, socket_builder)
true
))
local control_tx, control_rx = channel.new()
control_rx:settimeout(30)
control_rx:settimeout(45)
local self = setmetatable(
{
headers = { [APPLICATION_KEY_HEADER] = api_key or "" },
Expand Down Expand Up @@ -217,7 +217,7 @@ end
---@return ...
local function do_get(instance, path)
local reply_tx, reply_rx = channel.new()
reply_rx:settimeout(10)
reply_rx:settimeout(45)
local msg = ControlMessageBuilders.Get(path, reply_tx);
try_send(instance, msg)
local recv, err = reply_rx:receive()
Expand All @@ -236,7 +236,7 @@ end
---@return ...
local function do_put(instance, path, payload)
local reply_tx, reply_rx = channel.new()
reply_rx:settimeout(10)
reply_rx:settimeout(45)
local msg = ControlMessageBuilders.Put(path, payload, reply_tx);
try_send(instance, msg)
local recv, err = reply_rx:receive()
Expand All @@ -255,7 +255,7 @@ end
---@return ...
function PhilipsHueApi.get_bridge_info(bridge_ip, socket_builder)
local tx, rx = channel.new()
rx:settimeout(10)
rx:settimeout(45)
cosock.spawn(
function()
tx:send(table.pack(process_rest_response(RestClient.one_shot_get("https://" .. bridge_ip .. "/api/config", nil,
Expand All @@ -278,7 +278,7 @@ end
---@return ...
function PhilipsHueApi.request_api_key(bridge_ip, socket_builder)
local tx, rx = channel.new()
rx:settimeout(10)
rx:settimeout(45)
cosock.spawn(
function()
local body = json.encode { devicetype = "smartthings_edge_driver#" .. bridge_ip, generateclientkey = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function grouped_utils.queue_group_scan(driver, bridge_device)
if queue == nil then
local tx, rx = cosock.channel.new()
-- Set timeout to 30 seconds to allow for other queued scans to come in.
rx:settimeout(30)
rx:settimeout(45)
cosock.spawn(function()
while true do
-- The goal here is to timeout on the receive. If we receive a message then another request
Expand Down
Loading