Wemo edge driver

Easy error to find , but I was impress how fast I got a response from chat gpt …(wemo driver from SmartThings beta GitHub)
@nayelyz

Error analysis for SmartThings chat gpt

Can you find the error in that code for SmartThings , dimmer is been discovery as a plug.

local capabilities = require “st.capabilities”
local command_handlers = require “command_handlers”
local discovery = require “discovery”
local protocol = require “protocol”
local SubscriptionServer = require “subscription_server”
local cosock = require “cosock”

local Driver = require “st.driver”

local socket = require “cosock.socket”
local log = require “log”
local utils = require “st.utils”

– maps model name to profile name
local profiles = {
[“Insight”] = “wemo.mini-smart-plug.v1”,
[“Socket”] = “wemo.mini-smart-plug.v1”,
[“Dimmer”] = “wemo.mini-smart-plug.v1”,
[“Motion”] = “wemo.motion-sensor.v1”,
[“Lightswitch”] = “wemo.light-switch.v1”,
}

local function device_removed(driver, device)
driver.server:prune()
end

–TODO remove function in favor of “st.utils” function once
–all hubs have 0.46 firmware
local function backoff_builder(max, inc, rand)
local count = 0
inc = inc or 1
return function()
local randval = 0
if rand then
— We use this pattern because the version of math.random()
— that takes a range only works for integer values and we
— want floating point.
randval = math.random() * rand * 2 - rand
end

local base = inc * (2 ^ count - 1)
count = count + 1

-- ensure base backoff (not including random factor) is less than max
if max then base = math.min(base, max) end

-- ensure total backoff is >= 0
return math.max(base + randval, 0)

end
end

local function device_init(driver, device)
– at the time of authoring, there is a bug with LAN Edge Drivers where init
– may not be called on every device that gets added to the driver
if device:get_field(“init_started”) then
return
end
device:set_field(“init_started”, true)
device.log.info_with({ hub_logs = true }, “initializing device”)
local ip = device:get_field(“ip”)
local port = device:get_field(“port”)
– Carry over DTH discovered ip/port during migration, since wemo devices often
– stop responding to SSDP requests after being on the network for a long time.
if not (ip and port) and device.data and device.data.ip and device.data.port then
local nu = require “st.net_utils”
ip = nu.convert_ipv4_hex_to_dotted_decimal(device.data.ip)
port = tonumber(device.data.port, 16)
device:set_field(“ip”, ip, { persist = true })
device:set_field(“port”, port, { persist = true })
–try to get the metadata for this device so scan nearby doesn’t create a device
–for a migrated device that has yet to be rediscovered on the lan
local meta = discovery.fetch_device_metadata(string.format(“http://%s:%s/setup.xml”, ip, port))
if meta then
device:set_field(“serial_num”, meta.serial_num, { persist = true })
else
device.log.warn_with({ hub_logs = true },
“Unable to fetch migrated device serial number, driver discovery may recreate the device.”)
end
end

– Setup the polling and subscription
local jitter = 2 * math.random()
if driver.server and ip and port then
device.thread:call_with_delay(jitter, function() driver.server:subscribe(device) end)
end
device.thread:call_on_schedule(
3600 + jitter,
function() driver.server:subscribe(device) end,
device.id … “subcribe”
)
device.thread:call_on_schedule(
60 + jitter,
function() protocol.poll(device) end,
device.id … “poll”
)

–Rediscovery task. Needs task because if device init doesn’t return, no events are handled
– on the device thread.
cosock.spawn(function()
local backoff = backoff_builder(300, 1, 0.25)
local info
while true do
discovery.find(device.device_network_id, function(found) info = found end)
if info then break end
local tm = backoff()
device.log.info_with({ hub_logs = true }, string.format(“Failed to initialize device, retrying after delay: %.1f”, tm))
socket.sleep™
end

if not info or not info.ip or not info.serial_num then
  device.log.error_with({ hub_logs = true }, "device not found on network")
  device:offline()
  return
end
device.log.info_with({ hub_logs = true },"Device init re-discovered device on the lan")
device:online()

--Sometimes wemos just stop responding to ssdp even though they are connected to the network.
--Persist to avoid issues with driver restart
device:set_field("ip", info.ip, { persist = true })
device:set_field("port", info.port, { persist = true })
device:set_field("serial_num", info.serial_num, { persist = true })
if driver.server and (ip ~= info.ip or port ~= info.port) then
  device.log.debug("Resubscribe because ip/port has changed since last discovery")
  driver.server:subscribe(device)
end

end, device.id…" discovery")
end

local function device_added(driver, device)
device_init(driver, device)
end

local function resubscribe_all(driver)
local device_list = driver:get_devices()
for _, device in ipairs(device_list) do
driver.server:unsubscribe(device)
driver.server:subscribe(device)
end
end

local function lan_info_changed_handler(driver, hub_ipv4)
if driver.server.listen_ip == nil or hub_ipv4 ~= driver.server.listen_ip then
log.info_with({ hub_logs = true },
“hub IPv4 address has changed, restarting listen server and resubscribing”)
driver.server:shutdown()
driver.server = SubscriptionServer:new_server()
resubscribe_all(driver)
end
end

local function discovery_handler(driver, _, should_continue)

local known_devices = {}
local found_devices = {}

local device_list = driver:get_devices()
for _, device in ipairs(device_list) do
local serial_num = device:get_field(“serial_num”)
–Note MAC is not used due to MAC mismatch for migrated devices
if serial_num ~= nil then known_devices[serial_num] = true end
end

log.info_with({ hub_logs = true }, “Starting discovery scanning”)
while should_continue() do
discovery.find(
nil,
function(device)
local id = device.id
local ip = device.ip
local serial_num = device.serial_num

    if not known_devices[serial_num] and not found_devices[serial_num] then
      found_devices[serial_num] = true
      local name = device.name or "Unnamed Wemo"
      local profile_name = device.model
      if string.find(name, "Motion") then
        profile_name = "Motion"
      end
      local profile = profiles[profile_name]

      if profile then
        -- add device
        log.info_with({ hub_logs = true }, string.format("creating %s device [%s] at %s", name, id, ip))
        local create_device_msg = {
          type = "LAN",
          device_network_id = id,
          label = name,
          profile = profile,
          manufacturer = "Belkin",
          model = device.model,
          vendor_provided_label = device.name,
        }
        log.trace("create device with:", utils.stringify_table(create_device_msg))
        assert(
          driver:try_create_device(create_device_msg),
          "failed to create device record"
        )
      else
        log.warn("discovered device is an unknown model:", tostring(device.model))
      end
    else
      log.debug("device already known by driver")
    end
  end
)

end
log.info_with({ hub_logs = true }, “Discovery scanning ended”)
end


– Build driver context table

local wemo = Driver(“wemo”, {
discovery = discovery_handler,
lifecycle_handlers = {
init = device_init,
removed = device_removed,
added = device_added,
},
lan_info_changed_handler = lan_info_changed_handler,
capability_handlers = {
[capabilities.switch.ID] = {
[capabilities.switch.commands.on.NAME] = command_handlers.handle_switch_on,
[capabilities.switch.commands.off.NAME] = command_handlers.handle_switch_off,
},
[capabilities.switchLevel.ID] = {
[capabilities.switchLevel.commands.setLevel.NAME] = command_handlers.handle_set_level,
},
[capabilities.refresh.ID] = {
[capabilities.refresh.commands.refresh.NAME] = command_handlers.handle_refresh,
}
}
})

log.info(“Spinning up subscription server and running driver”)
– TODO handle case where the subscription server is not started
wemo.server = SubscriptionServer.new_server()
wemo:run()

There is no specific error mentioned in the code, but based on my analysis, there are some areas in the code that could potentially lead to issues:

In the “profiles” table, all devices are mapped to the same profile: “wemo.mini-smart-plug.v1”. This might be an issue because different types of devices may have different capabilities and may require different profiles.

The “device_removed” function is defined but it is not registered as a callback function anywhere. This function is used to remove a device from the driver’s subscription list when the device is removed. If this function is not registered, the subscription list may become out-of-sync with the actual devices on the network.

The “backoff_builder” function is defined locally in the “device_init” function. If this function is used in multiple places, it should be defined globally so that it can be reused.

The “device_init” function sets the “init_started” field on the device to true at the beginning of the function. However, if the function is called again before it completes, the field will already be set and the function will exit early. This might be an issue if the function needs to be re-run for some reason (e.g., a device is rediscovered on the network).

The “cosock.spawn” function is used to spawn a new coroutine in the “device_init” function. This might be an issue if the coroutine is not properly managed and does not exit when it should. If the coroutine continues to run indefinitely, it could lead to memory leaks or other issues.

In the “device_init” function, there are several calls to “device.thread:call_with_delay” and “device.thread:call_on_schedule”. These functions schedule a callback function to be run after a certain amount of time has elapsed. If these functions are called multiple times for the same device, it could lead to a buildup of scheduled functions and potentially cause issues. It might be better to cancel any existing scheduled functions before scheduling a new one.

zild06@gmail.com
Can you find the error in that code for SmartThings , wemo dimmer been recognize as a plug , here the code .

local capabilities = require “st.capabilities”
local command_handlers = require “command_handlers”
local discovery = require “discovery”
local protocol = require “protocol”
local SubscriptionServer = require “subscription_server”
local cosock = require “cosock”

local Driver = require “st.driver”

local socket = require “cosock.socket”
local log = require “log”
local utils = require “st.utils”

– maps model name to profile name
local profiles = {
[“Insight”] = “wemo.mini-smart-plug.v1”,
[“Socket”] = “wemo.mini-smart-plug.v1”,
[“Dimmer”] = “wemo.mini-smart-plug.v1”,
[“Motion”] = “wemo.motion-sensor.v1”,
[“Lightswitch”] = “wemo.light-switch.v1”,
}

local function device_removed(driver, device)
driver.server:prune()
end

–TODO remove function in favor of “st.utils” function once
–all hubs have 0.46 firmware
local function backoff_builder(max, inc, rand)
local count = 0
inc = inc or 1
return function()
local randval = 0
if rand then
— We use this pattern because the version of math.random()
— that takes a range only works for integer values and we
— want floating point.
randval = math.random() * rand * 2 - rand
end

local base = inc * (2 ^ count - 1)
count = count + 1

-- ensure base backoff (not including random factor) is less than max
if max then base = math.min(base, max) end

-- ensure total backoff is >= 0
return math.max(base + randval, 0)

end
end

local function device_init(driver, device)
– at the time of authoring, there is a bug with LAN Edge Drivers where init
– may not be called on every device that gets added to the driver
if device:get_field(“init_started”) then
return
end
device:set_field(“init_started”, true)
device.log.info_with({ hub_logs = true }, “initializing device”)
local ip = device:get_field(“ip”)
local port = device:get_field(“port”)
– Carry over DTH discovered ip/port during migration, since wemo devices often
– stop responding to SSDP requests after being on the network for a long time.
if not (ip and port) and device.data and device.data.ip and device.data.port then
local nu = require “st.net_utils”
ip = nu.convert_ipv4_hex_to_dotted_decimal(device.data.ip)
port = tonumber(device.data.port, 16)
device:set_field(“ip”, ip, { persist = true })
device:set_field(“port”, port, { persist = true })
–try to get the metadata for this device so scan nearby doesn’t create a device
–for a migrated device that has yet to be rediscovered on the lan
local meta = discovery.fetch_device_metadata(string.format(“http://%s:%s/setup.xml”, ip, port))
if meta then
device:set_field(“serial_num”, meta.serial_num, { persist = true })
else
device.log.warn_with({ hub_logs = true },
“Unable to fetch migrated device serial number, driver discovery may recreate the device.”)
end
end

– Setup the polling and subscription
local jitter = 2 * math.random()
if driver.server and ip and port then
device.thread:call_with_delay(jitter, function() driver.server:subscribe(device) end)
end
device.thread:call_on_schedule(
3600 + jitter,
function() driver.server:subscribe(device) end,
device.id … “subcribe”
)
device.thread:call_on_schedule(
60 + jitter,
function() protocol.poll(device) end,
device.id … “poll”
)

–Rediscovery task. Needs task because if device init doesn’t return, no events are handled
– on the device thread.
cosock.spawn(function()
local backoff = backoff_builder(300, 1, 0.25)
local info
while true do
discovery.find(device.device_network_id, function(found) info = found end)
if info then break end
local tm = backoff()
device.log.info_with({ hub_logs = true }, string.format(“Failed to initialize device, retrying after delay: %.1f”, tm))
socket.sleep™
end

if not info or not info.ip or not info.serial_num then
  device.log.error_with({ hub_logs = true }, "device not found on network")
  device:offline()
  return
end
device.log.info_with({ hub_logs = true },"Device init re-discovered device on the lan")
device:online()

--Sometimes wemos just stop responding to ssdp even though they are connected to the network.
--Persist to avoid issues with driver restart
device:set_field("ip", info.ip, { persist = true })
device:set_field("port", info.port, { persist = true })
device:set_field("serial_num", info.serial_num, { persist = true })
if driver.server and (ip ~= info.ip or port ~= info.port) then
  device.log.debug("Resubscribe because ip/port has changed since last discovery")
  driver.server:subscribe(device)
end

end, device.id…" discovery")
end

local function device_added(driver, device)
device_init(driver, device)
end

local function resubscribe_all(driver)
local device_list = driver:get_devices()
for _, device in ipairs(device_list) do
driver.server:unsubscribe(device)
driver.server:subscribe(device)
end
end

local function lan_info_changed_handler(driver, hub_ipv4)
if driver.server.listen_ip == nil or hub_ipv4 ~= driver.server.listen_ip then
log.info_with({ hub_logs = true },
“hub IPv4 address has changed, restarting listen server and resubscribing”)
driver.server:shutdown()
driver.server = SubscriptionServer:new_server()
resubscribe_all(driver)
end
end

local function discovery_handler(driver, _, should_continue)

local known_devices = {}
local found_devices = {}

local device_list = driver:get_devices()
for _, device in ipairs(device_list) do
local serial_num = device:get_field(“serial_num”)
–Note MAC is not used due to MAC mismatch for migrated devices
if serial_num ~= nil then known_devices[serial_num] = true end
end

log.info_with({ hub_logs = true }, “Starting discovery scanning”)
while should_continue() do
discovery.find(
nil,
function(device)
local id = device.id
local ip = device.ip
local serial_num = device.serial_num

    if not known_devices[serial_num] and not found_devices[serial_num] then
      found_devices[serial_num] = true
      local name = device.name or "Unnamed Wemo"
      local profile_name = device.model
      if string.find(name, "Motion") then
        profile_name = "Motion"
      end
      local profile = profiles[profile_name]

      if profile then
        -- add device
        log.info_with({ hub_logs = true }, string.format("creating %s device [%s] at %s", name, id, ip))
        local create_device_msg = {
          type = "LAN",
          device_network_id = id,
          label = name,
          profile = profile,
          manufacturer = "Belkin",
          model = device.model,
          vendor_provided_label = device.name,
        }
        log.trace("create device with:", utils.stringify_table(create_device_msg))
        assert(
          driver:try_create_device(create_device_msg),
          "failed to create device record"
        )
      else
        log.warn("discovered device is an unknown model:", tostring(device.model))
      end
    else
      log.debug("device already known by driver")
    end
  end
)

end
log.info_with({ hub_logs = true }, “Discovery scanning ended”)
end


– Build driver context table

local wemo = Driver(“wemo”, {
discovery = discovery_handler,
lifecycle_handlers = {
init = device_init,
removed = device_removed,
added = device_added,
},
lan_info_changed_handler = lan_info_changed_handler,
capability_handlers = {
[capabilities.switch.ID] = {
[capabilities.switch.commands.on.NAME] = command_handlers.handle_switch_on,
[capabilities.switch.commands.off.NAME] = command_handlers.handle_switch_off,
},
[capabilities.switchLevel.ID] = {
[capabilities.switchLevel.commands.setLevel.NAME] = command_handlers.handle_set_level,
},
[capabilities.refresh.ID] = {
[capabilities.refresh.commands.refresh.NAME] = command_handlers.handle_refresh,
}
}
})

log.info(“Spinning up subscription server and running driver”)
– TODO handle case where the subscription server is not started
wemo.server = SubscriptionServer.new_server()
wemo:run()

There seems to be a typo in the last line of the device_init function, where there are three dots (…) at the end instead of a method call. This is likely causing a syntax error.

Based on the context, it seems like the line should be:

lua
Copy code
driver.server:subscribe(device)
instead of:

lua
Copy code
device…

zild06@gmail.com
Find the error in that driver for SmartThings wemo dimmer , the wemo dimmer been detected as a plug.

local capabilities = require “st.capabilities”
local command_handlers = require “command_handlers”
local discovery = require “discovery”
local protocol = require “protocol”
local SubscriptionServer = require “subscription_server”
local cosock = require “cosock”

local Driver = require “st.driver”

local socket = require “cosock.socket”
local log = require “log”
local utils = require “st.utils”

– maps model name to profile name
local profiles = {
[“Insight”] = “wemo.mini-smart-plug.v1”,
[“Socket”] = “wemo.mini-smart-plug.v1”,
[“Dimmer”] = “wemo.mini-smart-plug.v1”,
[“Motion”] = “wemo.motion-sensor.v1”,
[“Lightswitch”] = “wemo.light-switch.v1”,
}

local function device_removed(driver, device)
driver.server:prune()
end

–TODO remove function in favor of “st.utils” function once
–all hubs have 0.46 firmware
local function backoff_builder(max, inc, rand)
local count = 0
inc = inc or 1
return function()
local randval = 0
if rand then
— We use this pattern because the version of math.random()
— that takes a range only works for integer values and we
— want floating point.
randval = math.random() * rand * 2 - rand
end

local base = inc * (2 ^ count - 1)
count = count + 1

-- ensure base backoff (not including random factor) is less than max
if max then base = math.min(base, max) end

-- ensure total backoff is >= 0
return math.max(base + randval, 0)

end
end

local function device_init(driver, device)
– at the time of authoring, there is a bug with LAN Edge Drivers where init
– may not be called on every device that gets added to the driver
if device:get_field(“init_started”) then
return
end
device:set_field(“init_started”, true)
device.log.info_with({ hub_logs = true }, “initializing device”)
local ip = device:get_field(“ip”)
local port = device:get_field(“port”)
– Carry over DTH discovered ip/port during migration, since wemo devices often
– stop responding to SSDP requests after being on the network for a long time.
if not (ip and port) and device.data and device.data.ip and device.data.port then
local nu = require “st.net_utils”
ip = nu.convert_ipv4_hex_to_dotted_decimal(device.data.ip)
port = tonumber(device.data.port, 16)
device:set_field(“ip”, ip, { persist = true })
device:set_field(“port”, port, { persist = true })
–try to get the metadata for this device so scan nearby doesn’t create a device
–for a migrated device that has yet to be rediscovered on the lan
local meta = discovery.fetch_device_metadata(string.format(“http://%s:%s/setup.xml”, ip, port))
if meta then
device:set_field(“serial_num”, meta.serial_num, { persist = true })
else
device.log.warn_with({ hub_logs = true },
“Unable to fetch migrated device serial number, driver discovery may recreate the device.”)
end
end

– Setup the polling and subscription
local jitter = 2 * math.random()
if driver.server and ip and port then
device.thread:call_with_delay(jitter, function() driver.server:subscribe(device) end)
end
device.thread:call_on_schedule(
3600 + jitter,
function() driver.server:subscribe(device) end,
device.id … “subcribe”
)
device.thread:call_on_schedule(
60 + jitter,
function() protocol.poll(device) end,
device.id … “poll”
)

–Rediscovery task. Needs task because if device init doesn’t return, no events are handled
– on the device thread.
cosock.spawn(function()
local backoff = backoff_builder(300, 1, 0.25)
local info
while true do
discovery.find(device.device_network_id, function(found) info = found end)
if info then break end
local tm = backoff()
device.log.info_with({ hub_logs = true }, string.format(“Failed to initialize device, retrying after delay: %.1f”, tm))
socket.sleep™
end

if not info or not info.ip or not info.serial_num then
  device.log.error_with({ hub_logs = true }, "device not found on network")
  device:offline()
  return
end
device.log.info_with({ hub_logs = true },"Device init re-discovered device on the lan")
device:online()

--Sometimes wemos just stop responding to ssdp even though they are connected to the network.
--Persist to avoid issues with driver restart
device:set_field("ip", info.ip, { persist = true })
device:set_field("port", info.port, { persist = true })
device:set_field("serial_num", info.serial_num, { persist = true })
if driver.server and (ip ~= info.ip or port ~= info.port) then
  device.log.debug("Resubscribe because ip/port has changed since last discovery")
  driver.server:subscribe(device)
end

end, device.id…" discovery")
end

local function device_added(driver, device)
device_init(driver, device)
end

local function resubscribe_all(driver)
local device_list = driver:get_devices()
for _, device in ipairs(device_list) do
driver.server:unsubscribe(device)
driver.server:subscribe(device)
end
end

local function lan_info_changed_handler(driver, hub_ipv4)
if driver.server.listen_ip == nil or hub_ipv4 ~= driver.server.listen_ip then
log.info_with({ hub_logs = true },
“hub IPv4 address has changed, restarting listen server and resubscribing”)
driver.server:shutdown()
driver.server = SubscriptionServer:new_server()
resubscribe_all(driver)
end
end

local function discovery_handler(driver, _, should_continue)

local known_devices = {}
local found_devices = {}

local device_list = driver:get_devices()
for _, device in ipairs(device_list) do
local serial_num = device:get_field(“serial_num”)
–Note MAC is not used due to MAC mismatch for migrated devices
if serial_num ~= nil then known_devices[serial_num] = true end
end

log.info_with({ hub_logs = true }, “Starting discovery scanning”)
while should_continue() do
discovery.find(
nil,
function(device)
local id = device.id
local ip = device.ip
local serial_num = device.serial_num

    if not known_devices[serial_num] and not found_devices[serial_num] then
      found_devices[serial_num] = true
      local name = device.name or "Unnamed Wemo"
      local profile_name = device.model
      if string.find(name, "Motion") then
        profile_name = "Motion"
      end
      local profile = profiles[profile_name]

      if profile then
        -- add device
        log.info_with({ hub_logs = true }, string.format("creating %s device [%s] at %s", name, id, ip))
        local create_device_msg = {
          type = "LAN",
          device_network_id = id,
          label = name,
          profile = profile,
          manufacturer = "Belkin",
          model = device.model,
          vendor_provided_label = device.name,
        }
        log.trace("create device with:", utils.stringify_table(create_device_msg))
        assert(
          driver:try_create_device(create_device_msg),
          "failed to create device record"
        )
      else
        log.warn("discovered device is an unknown model:", tostring(device.model))
      end
    else
      log.debug("device already known by driver")
    end
  end
)

end
log.info_with({ hub_logs = true }, “Discovery scanning ended”)
end


– Build driver context table

local wemo = Driver(“wemo”, {
discovery = discovery_handler,
lifecycle_handlers = {
init = device_init,
removed = device_removed,
added = device_added,
},
lan_info_changed_handler = lan_info_changed_handler,
capability_handlers = {
[capabilities.switch.ID] = {
[capabilities.switch.commands.on.NAME] = command_handlers.handle_switch_on,
[capabilities.switch.commands.off.NAME] = command_handlers.handle_switch_off,
},
[capabilities.switchLevel.ID] = {
[capabilities.switchLevel.commands.setLevel.NAME] = command_handlers.handle_set_level,
},
[capabilities.refresh.ID] = {
[capabilities.refresh.commands.refresh.NAME] = command_handlers.handle_refresh,
}
}
})

log.info(“Spinning up subscription server and running driver”)
– TODO handle case where the subscription server is not started
wemo.server = SubscriptionServer.new_server()
wemo:run()

The error in the driver is that all of the devices are being detected as “wemo.mini-smart-plug.v1” instead of their respective profiles because the profiles table is incorrect. The table is currently mapping all of the devices to the profile “wemo.mini-smart-plug.v1”. The correct mapping should be:

java
Copy code
local profiles = {
[“Insight”] = “wemo.insight-switch.v2”,
[“Socket”] = “wemo.light-switch.v2”,
[“Dimmer”] = “wemo.dimmer.v2”,
[“Motion”] = “wemo.motion-sensor.v1”,
[“Lightswitch”] = “wemo.light-switch.v1”,
}

Hi @William_Engel

Thanks for noticed it, we’ll report it with the corresponding team.

1 Like

Hey Sylvain, we’re gonna add this functionality back. Apologies for the disruption of functionality; we appreciate the heads up. Here is the change: Revert "Wemo dimmers are unreliably reported" by cjswedes · Pull Request #633 · SmartThingsCommunity/SmartThingsEdgeDrivers · GitHub

1 Like

@Sylvain This change was released to the SmartThings Drivers (Beta) channel yesterday.

1 Like

Thank you , it is working good !!

1 Like

I enrolled in beta, downloaded the wemo driver, scanned nearby and nothing came up. I have 3 wemo light switches any suggestions?

Does your switch work in the wemo app ?

Yes all 3 do

Same here. Scan does not pick up any of my devices. I am able to control it via wemo app.

Looks like the fingerprint of the model is not present. I have Wemo switch F7C030

2023-06-14T21:17:01.536829558+00:00 TRACE Wemo disco| found device: 10.0.4.70 49153 6038E0468FCC
2023-06-14T21:17:01.541200600+00:00 WARN Wemo discovered device is an unknown model: LightSwitch
2023-06-14T21:17:02.083868100+00:00 INFO Wemo disco| response window ended, 1 found
2023-06-14T21:17:02.090594600+00:00 TRACE Wemo disco| finished scan

It is the ‘model’ that is the problem. The code says:

-- maps model name to profile name
local profiles = {
  ["Insight"] = "wemo.mini-smart-plug.v1",
  ["Socket"] = "wemo.mini-smart-plug.v1",
  ["Dimmer"] = "wemo.dimmer-switch.v1",
  ["Motion"] = "wemo.motion-sensor.v1",
  ["Lightswitch"] = "wemo.light-switch.v1",
}

As you can see it says Lightswitch but the device says LightSwitch.

If the engineers don’t already have eyeballs on this thread perhaps @nayelyz or @AlejandroPadilla could flag it for them.

2 Likes

Thanks for this information @orangebucket I will inform the team

Thank you @orangebucket and @AlejandroPadilla. Let us know once been corrected.

After it do i just need to perform rescan? or remove and add devices back?

Thanks @sgugloth for the driver logs, and @orangebucket for the analysis. I have a fix up here. You can install the wemo driver to your hub if you want it right away (there is a driver channel on that PR that you can use to install it). Otherwise we will likely get the fix to the beta channel on Tues (6/20) and production channel the following week (6/27).

Thank you @carter.swedal.

I do not see channel request in PR.

Thank you … Driver update resolved issue with finding my devices.

1 Like

Hi. Hoping someone can help with my Wemo device problem. I’m no longer able to control my Wemo mini smart plugs through the SmartThings App. I can still control them through the Wemo App. I decided to try starting fresh by removing and re-adding the Wemo plugs to the SmartThings hub. However, SmartThings scan cannot find the Wemo plugs. I also noticed that Samsung automatically pushed out a Wemo driver to the SmartThings hub a couple of weeks ago when this problem first occurred (the current version of the Wemo driver installed is 2023-07-11). When I check the Linked Services on the SmartThings App, Wemo is also not listed.

Thanks,
Mike

Hi, @Mike01
Can you confirm if the scan you made is directly in “Scan nearby devices”, please?
If so, can you provide the following, please?

  1. Confirm the email account registered in the forum is the same one you use for SmartThings. If not, please share it with me over DM
  2. Enable support access to your account:
  1. Go to the SmartThings Web (my.smartthings.com)
  2. Log in to your Samsung Account
  3. Select Menu (⋮) and choose Settings
  4. Toggle on Account Data Access
  5. Select the time period and confirm - In this step, please select “Until turned off”, once the team finishes, we’ll let you know so you can disable it again.
  1. Try to pair the devices again to the Hub and take note of the time when you did, for example:
    2023/07/13 18:00 hrs CST (adding the timezone helps us to reduce the search results and find the event faster)

This is expected, the menu of Linked services shows only the Cloud connections you’ve allowed, which means, Schema-Connectors, external sources like SharpTools, etc.

Hi, @nayelyz . Thanks for your response. I did not scan using the “Scan nearby devices” option, but instead used the add device by “Brand” and selected Belkin Wemo. I performed another scan using both “Scan nearby devices” and by “Brand” today (July 13, 2023) at about 4:30pm PT, with neither scan being able to find the Wemo plugs.

My email for the forum is the same as for SmartThings, and I’ve permitted Account Data Access.

I also just discovered that my z-wave motion sensors, z-wave door/window sensors, and z-wave locks are not responsive/functioning. I already have an outstanding support ticket regarding similar issues with my GE z-wave outdoor switches. The motion sensor and GE switches all show the message “This device has not updated all of its status information yet. Check again later.” All of these issues seem to have started occurring after Edge drivers were pushed out to the SmartThings hub (I have a gen 2 hub).

BTW, my Philips Hue devices also stopped working through the SmartThings App, but they seem to be working now after a duplicate set of Hue devices showed up this afternoon in a non-assigned room in the App with the classification type “VIPER” (the original set of Hue devices are still present and non-responsive and classified as “EDGE_CHILD”).

Very frustrating as everything was working well until recently.

Thanks,
Mike

I seem to be in a similar boat to @sgugloth, and @Derrek113116

I have 4 plugs and 2 switches that I haven’t been able to get working since I did a reset last year. A little different in that I have the Smartthings Wifi, but even with Wemo connected to that (and not my other network) it just times out with a 34-302 error. I have the beta Smartthings edge driver installed, and try searching by Brand and Nearby. Maybe there’s something else I’m missing?

Where do I go to see the logs that @sgugloth was looking at? Should I just open a ticket with Smartthings (which opening a ticket has a whole host of other problems for me).