[ST Edge] Is there a new limitation imposed on driver's size?

Hi,

My driver that used to compile (package) fine, now fails to upload.
I can create a zip file with package -b, but can’t upload it.
I get an error that the driver exceeds the max size.
Is it something new?
Is there a way to exclude specific directories from being packaged? For example, the directory that contains only capability definitions and presentations?

Thanks

PS.
The error I get is

smartthings edge:drivers:package drivers/zigbee/switch
    Error: Request failed with status code 400: 
    {"requestId":"280610B6-B2D8-456A-A97B-A9835F5C6626","error":{"code":"ConstraintViolationError","message":"The request is
    malformed.","details":[{"code":"SizeError","target":"Total bytes","message":"Total bytes must have a number between 0 and
    524288.","details":[]}]}}
FAILED to compile 
1 Like

Hi, @ygerlovin

Sorry for the late response. I checked this issue with the team. We have always had the same limit size, and nothing about this has changed recently. We are wondering if there is any chance that a change on your driver has suddenly incremented its size, for example adding/not-excluding the tests that some drivers have, but are useless at the moment of installing it on the Hub.

Hi @andresg ,

Thank you for your answer.
Yes, I already figured that anything under the root driver directory is packed.
I have a lot of custom capabilities and their presentations that is very convenient to store in the same place.
Is there any way I can provide exclude path when packaging a driver?

Let me elaborate why I think it could be useful.
I have several drivers that might share code, capabilities and presentations.
So I’m organizing potentially sharable things as libraries and put them all in libs repo,
Something like that:
lib/
libs/capabilities/definitions/.yml
libs/capabilities/impl/
.lua
libs/utils/*.lua
libs/utils/zigbee/lua
etc
Then each driver consumes libraries as a subproject.
drivers/driver1/profiles
drivers/driver1/src/
.lua
drivers/driver1/src/libs ← this is a subproject

Not all libraries are required for each driver and none of them require capabilities definitions.
So, I’d like to exclude some paths when packaging a driver, for example, to package everything under
drivers/driver1/src/*
But excluding
drivers/driver1/src/libs/capabilities/definitions/*.yml

Is it possible?

Hi, @ygerlovin

I am not sure if that is possible, but let me ask the team and I will get back to you as soon as I have an answer.

1 Like

Custom capabilities and presentations are not a part of driver , driver contains only a reference to capability. At least I was able to use custom capabilities created by @Mariano_Colmenarejo to increase decrease brightness, without re-export them from my account

I think they are packed even though they are not needed, if they are located undet src dir

I don’t think there is at the moment but I’d be surprised if a way couldn’t be found. After all it is just a zip file and it is rare to see zip utilities without a bazillion options.

Packaging doesn’t do any compiling of lua source, no way it could detect which libraries it might need to include or not. The entire directory is packaged up.

I would do some build processing in my IDE to create a package using only the needed libraries and dependencies, package that built directory. Lots of build tool options.

Hi, @ygerlovin

That is true, and no they are not packaged anyways. The way to do it is, for example:

local waterFlowRate = capabilities["commonsmall09402.waterFlowRate"]

I still asked the question you were asking, about leaving out a directory inside the driver and the answer is yes. There is a way to exclude tests folders that are usually found inside the drivers but useless once installed in the Hub, and you can extend that to other folders. If you are still interested I can tell you how to do it.

2 Likes

Hi @andresg

My understanding is different. Perhaps, only json files are excluded, but not yml.
I tried to create a zip package, instead of directly uploading it to the hub. Then I opened it. Capabilities in yml format were packaged.

Yes, I’m interested. Thank you for your help

1 Like

Hi, @ygerlovin

Not sure what to say about this. What I do can say is that someone on the Engineering team told me the answer I gave you before. I will double-check this, though.

It’s pretty easy. All you have to do is modify your config.yaml to add an edgeDriverTestDirs where you list all directories to be excluded. It should look something like this:

default:
  edgeDriverTestDirs:
    - tests/**
    - test/**
    - __tests__/**

FYI we use picomatch for global matching.

1 Like