w35l3y
(Wesley Menezes)
January 5, 2023, 12:20pm
#1
A user reported this driver didn’t work for him.
We checked the logs and got it:
[string “tuyaEF00_generic_defaults.lua”]:88: attempt to call a nil value (method ‘get_child_by_parent_assigned_key’)
So we found out he uses an old firmware (43.5)
But there wasn’t any warning or something in the screen. It just failed silently.
output[list.dpid.value] = datapoint_types_to_fn[type_to_configuration[msg.type.value] .. "Datapoints"]
end
return output,num
end
local lifecycle_handlers = {}
local function create_child(driver, device, ndpid, profile)
local dpid = string.format("%02X", ndpid)
local created = device:get_child_by_parent_assigned_key(dpid)
if not created then
driver:try_create_device({
type = "EDGE_CHILD",
device_network_id = nil,
parent_assigned_child_key = dpid,
label = "Child " .. tonumber(dpid, 16),
profile = profile,
parent_device_id = device.id,
manufacturer = driver.NAME,
model = profile,
I would like to report the user that its action didn’t go well for some reason.
How I could accomplish that ?
I can use pcall
at create_child
to catch the error, but how can I send this to the screen ?
fido
(Mike )
January 5, 2023, 1:03pm
#2
@nayelyz may be able to help your issue
1 Like
nayelyz
(Developer Support Team)
January 5, 2023, 3:16pm
#3
You cannot send a notification from the Edge driver, so, in this case, the device was never created, right?
As you mentioned the user uses firmware 43.5, it means he has a Wi-Fi Hub which is the only one with that firmware version, so, you need to mention that having v45 or higher is a requirement to use your driver which implements the parent-child model.
Thanks for the tag, @fido
1 Like
w35l3y
(Wesley Menezes)
January 5, 2023, 3:22pm
#4
Where is the best place to mention that the driver requires it ?
I tried to use these fields, but I don’t know how to fill them.
Descrição → Description
Informações de suporte → Support Informations
w35l3y
(Wesley Menezes)
January 5, 2023, 3:30pm
#5
The device is created, but the child device isn’t because I check if the child device exists before calling try_create_device
.
In this case, child devices are created in the preferences.
nayelyz
(Developer Support Team)
January 5, 2023, 3:33pm
#6
Then, you could use a custom capability to show a message of “success” or “failure” when they request the creation of the child device.
1 Like
w35l3y
(Wesley Menezes)
January 5, 2023, 3:37pm
#7
What about these fields ?
Do you know how I could define some texts there ?
nayelyz
(Developer Support Team)
January 5, 2023, 3:59pm
#9
Thanks, @philh30
Just to clarify, @w35l3y , they cannot change dynamically as they are part of the config.yaml
file.
1 Like
csstup
(Corey Stup)
January 5, 2023, 6:52pm
#10
It would be nice if one of the permissions of a driver was version or other firmware capability flags.
2 Likes