Hello,
I wonder why all of Gladys’ constants are not exposed by the SDK? This would avoid having to duplicate them in integrations and would limit errors. Example of a constant:
Thanks
Hi @Sescandell ![]()
Thanks for the suggestion, the need is indeed real! Having to manually copy values like category: 'switch' or the codes for BUTTON_STATUS, with the risk of typos that cause device discovery to fail, is not a good developer experience.
However, I don’t think we’ll expose all internal constants. The core’s constants.js file mixes two things:
STATE, BUTTON_STATUS, weather conditions, transports…) → these, yes, it makes sense to expose them in the SDK, with TypeScript typings for autocompletion and compile-time errors So the idea we’re keeping: expose in the SDK the subset of constants that are part of the public contract (those that the API actually validates), with automatic CI checking to ensure they stay synchronized with the core.
One small clarification though: the reference for execution remains the version of Gladys installed at the user’s location. If a new category is added in a future version, it won’t be accepted by an older Gladys, even with an up-to-date SDK.
I’ll add it to the SDK roadmap!