Skip to content

Commit

Permalink
Add additional logging around discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
dljsjr committed Sep 22, 2023
1 parent 869bc7c commit 3c3b543
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/SmartThings/jbl/src/discovery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local fields = require "fields"
local discovery_mdns = require "discovery_mdns"

local socket = require "cosock.socket"
local st_utils = require "st.utils"

local discovery = {}

Expand Down Expand Up @@ -68,6 +69,8 @@ local function discovery_device(driver)

local ip_table = discovery.find_ip_table(driver)

log.debug(st_utils.stringify_table(ip_table, "DNI IP Table after processing mDNS Discovery Response", true))

for dni, ip in pairs(ip_table) do
log.info(string.format("discovery_device dni, ip = %s, %s", dni, ip))
if not known_devices or not known_devices[dni] then
Expand Down
7 changes: 6 additions & 1 deletion drivers/SmartThings/jbl/src/discovery_mdns.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local log = require "log"
local mdns = require "st.mdns"
local net_utils = require "st.net_utils"
local st_utils = require "st.utils"

local discovery_mdns = {}

Expand Down Expand Up @@ -126,6 +127,8 @@ local function get_dni_ip_table_from_mdns_responses(driver, service_type, domain

local filtered_responses = filter_response_by_service_name(service_type, domain, discovery_responses)

log.debug(st_utils.stringify_table(filtered_responses, "[get_dni_ip_table(...)] Filtered Responses", true))

insert_dni_ip_from_answers(driver, filtered_responses, dni_ip_table)
insert_dni_ip_from_found(driver, filtered_responses, dni_ip_table)

Expand All @@ -138,9 +141,11 @@ function discovery_mdns.find_ip_table_by_mdns(driver)
local service_type, domain = driver.discovery_helper.get_service_type_and_domain()
local discovery_responses = mdns.discover(service_type, domain) or {found = {}}

log.debug(st_utils.stringify_table(discovery_responses, "Raw mDNS Discovery Response", true))

local dni_ip_table = get_dni_ip_table_from_mdns_responses(driver, service_type, domain, discovery_responses)

return dni_ip_table
end

return discovery_mdns
return discovery_mdns

0 comments on commit 3c3b543

Please sign in to comment.