Hi All,
I’m new here and would like some help to get my integration moving.
I built a blinds automation using a NodeMCU board and a NEMA 17 stepper motor, mostly because why not
That part works fine. Now I am in phase 2 of my project where i want to integrate my board with ST. For that i used the Lightbulb-lan-esp8266 example here: Tutorial | Creating Drivers for LAN Devices with SmartThings Edge
I am taking the sample code from the tutorial and modify it to fit my project. Kinda painful as I am new to ST and documentation for edge drivers doesn’t seem to help my case.
The problem at hand is in create_device function in discovery.lua:
local function create_device(driver, device)
log.info(’===== CREATING DEVICE…’)
log.info(’===== DEVICE DESTINATION ADDRESS: ‘…device.location)
– device metadata table
local metadata = {
type = config.DEVICE_TYPE,
device_network_id = device.location,
label = device.name,
profile = config.DEVICE_PROFILE,
manufacturer = device.mn,
model = device.model,
vendor_provided_label = device.UDN
}
local success, drv = pcall(driver:try_create_device(metadata))
if success then
log.info(’===== SUCCESS CREATING DEVICE: ‘…drv)
return drv
else
log.error(’===== ERROR CREATING DEVICE: '…drv)
return nil
end
– return driver:try_create_device(metadata) – replaced with code above to handle exception
end
The driver installation on the hub worked fine. When i use the ST app on my phone and “scan for nearby devices” here is what the hub log looks like:
PS M:\Projects\Smartthings\SmartThings-Blinds> smartthings edge:drivers:logcat c71db051-5ae0-49dd-8017-de3e029355c3 --hub-address 192.168.1.112
2022-03-28T04:01:21.930529191+00:00 TRACE Blinds8266 Setup driver Blinds8266 with lifecycle handlers:
DeviceLifecycleDispatcher: Blinds8266
default_handlers:
added:
removed:
init:
driverSwitched:
child_dispatchers:
2022-03-28T04:01:21.937877191+00:00 TRACE Blinds8266 Setup driver Blinds8266 with Capability handlers:
CapabilityCommandDispatcher: Blinds8266
default_handlers:
switchLevel:
setLevel
refresh:
refresh
windowShade:
switch:
on
off
windowShadeLevel:
colorControl:
setColor
child_dispatchers:
2022-03-28T04:01:21.953832191+00:00 TRACE Blinds8266 Server.new_with
2022-03-28T04:01:21.959421191+00:00 TRACE Blinds8266 Server:post
2022-03-28T04:01:21.964810858+00:00 TRACE Blinds8266 Server:listen
2022-03-28T04:01:21.999297524+00:00 TRACE Blinds8266 Received event with handler _resync
2022-03-28T04:01:22.004975191+00:00 TRACE Blinds8266 Received event with handler environment_info
2022-03-28T04:01:22.011954858+00:00 TRACE Blinds8266 Received event with handler environment_info
2022-03-28T04:01:22.017430191+00:00 DEBUG Blinds8266 Z-Wave hub node ID environment changed.
2022-03-28T04:01:22.025332524+00:00 TRACE Blinds8266 Received event with handler discovery
2022-03-28T04:01:22.056635858+00:00 INFO Blinds8266 ===== SCANNING NETWORK…
2022-03-28T04:01:24.076328859+00:00 ERROR Blinds8266 ===== DEVICE NOT FOUND IN NETWORK
2022-03-28T04:01:24.101847192+00:00 INFO Blinds8266 ===== SCANNING NETWORK…
2022-03-28T04:01:25.276274526+00:00 INFO Blinds8266 ===== DEVICE FOUND IN NETWORK…
2022-03-28T04:01:25.290782193+00:00 INFO Blinds8266 ===== DEVICE DESCRIPTION AT: http://192.168.1.79:80/Blinds8266.xml
2022-03-28T04:01:25.340767193+00:00 INFO Blinds8266 ===== FETCHING DEVICE METADATA…
2022-03-28T04:01:25.981597193+00:00 INFO Blinds8266 ===== DEVICE LOCATION at: http://192.168.1.79:80
2022-03-28T04:01:26.006243860+00:00 INFO Blinds8266 ===== CREATING DEVICE…
2022-03-28T04:01:26.020344193+00:00 INFO Blinds8266 ===== DEVICE DESTINATION ADDRESS: http://192.168.1.79:80
2022-03-28T04:01:26.053823860+00:00 ERROR Blinds8266 ===== ERROR CREATING DEVICE: attempt to call a number value
2022-03-28T04:01:26.061588860+00:00 DEBUG Blinds8266 discovery device thread event handled
2022-03-28T04:01:51.298623872+00:00 TRACE Blinds8266 Received event with handler discovery
listening for logs… done
Any idea what this exception “attempt to call a number value” is about?
Is there documentation for driver:try_create_device that anyone can point me to ?