Nope, they don’t have the resources, even with lots of resources, it is an issue of focus; I totally agree with you on this point: Certainly in the short-term SmartThings has much more pressing priorities than any major re-architecting, which is why it is understandable that they lean towards the “flexible” side of things, rather than making things more strict and rigorous.
But I assert my recommendations are incremental inconsequential to the existing platform architecture:
(And, though those of us in the discussion may use different terminology and emphasize some components more than others, we have a lot of consensus here, I think!)
I’ll call this a summary; sure, it is a bit of a rehash of what I wrote earlier, but I am also including super appreciated comments made by other posters, and hoping @matthewnohr and/or @thegibertchan can let me know if what I’m proposing is indeed → NOT A PLATFORM CHANGE! (i.e., no rearchitecting, no-rewriting, and minimal, if any, refactoring…).
-
SmartThings’s concept of Capabilities is a good thing, and has worked pretty well for hundreds of Device Types, SmartApps and Services. The existing Capabilities Taxonomy, however, has some “bad examples”, but we may have to live with them to avoid refactoring. New Capabilities should not consider all of the current ones to be useful examples!!!
-
Hopefully the current use of ad-hoc additional attributes, commands, and arbitrary events in Device Types is not widespread, since it breaks the intention of the Capabilities concept. Device Types that have ad-hoc added characteristics will have some SmartApps use these characteristics, and those SmartApps will not be compatible with similar, but different, Device Types that would/should/could otherwise have the same Capability list.
But, these “optional added attributes and commands” won’t break conforming SmartApps (i.e., apps that utilize only the standard attributes and commands defined by the Capabilities), unlike the other way around (i.e., if a Device Type is missing an attribute and/or command for a Capability, then that breaks the contract with all SmartApps & Services selecting devices of the Capability).
I’m still unsure, but it is worth considering that a Capability itself could have such “optional attributes and commands”, and this could be implemented purely “by definition”. (Refer to Aaron and NB: SmartApps need to have some way of checking if individual Device Instances have these optional characteristics, but only if they want to use these extras): [quote=“AaronZON, post:39, topic:9917”]
Would we also consider the same or similar approach for new attributes of existing capabilities? As has been noted, changing current attributes would break things - a bad thing - but I would think that we should consider a process to add new attributes to existing capabilities in a thoughtful way. Existing SmartApps that utilize existing attributes would not be broken but new SmartApps that wanted to leverage some new functionality made possible by a new attribute could do so.
[/quote]
-
It is not too late to make it mandatory that all Attributes and Commands of a standard official Capability must be implemented by any SmartDevice Type that claim that Capability. If there are existing SmartDevice Types that violate this, that refactoring can be done over time, using default value Attributes and stub Commands if necessary for expediency. This “mandatory” requirement can be enforced by the SmartDevice Type submission - certification - publication process. The compiler does not need to be modified.
-
Capabilities should be granular to maximize flexibility; redundant attributes and methods from one Capability should not be included in another Capability. This can be done immediately without rearchitecting to add support for “combo-capabilities”; since the SmartDevice Type already accepts a list of Capabilities in the current platform. (Unfortunately, Jody’s which for a “device class” cannot be properly accommodated without changes to the platform; though the concept can be implemented solely through documentation – i.e., we can document various categories like “refrigerator” and document the default or mandatory list of Capabilities that device types in that category should contain, with optional additional capabilities permitted). [quote=“jody.albritton, post:59, topic:9917”]
We also need device classes.
In my smart app I could say “requires a device class of refrigerator and a capability coolSetPoint”
[/quote]
Existing Capabilities that are obvious combo’s (e.g., capability.thermostat
) could be phased out, but refactoring of both Device Types and SmartApps is required. Not urgent. Just try to avoid creating more of them.
BTW: There are many reasons to avoid redundancy and to optimize granularity:
- If a Device Type supports “
locked/unlocked
& lock()/unlock()
” then using capability.lock
ensures that the “meaning” of those Attributes and Commands is consistent in all such Device Types. Theoretically, the “locked/unlocked
& lock()/unlock()
” of capability.lockCodes
could have a different “meaning”. Just basic redundancy risk – I come from an SQL background … normalization is a good thing.
- Pulling out “
locked/unlocked
& lock()/unlock()
” from capability.lockCodes
makes the definition of that Capability smaller (more granular), and thus easier to maintain and implement Device Types which properly conform to it. (Reference Gary D: [quote=“garyd9, post:40, topic:9917”] … 1. It is completely realistic to have a device that supports locking codes, but doesn’t actually support a lock mechanism. Perhaps it requires a code to turn on a switch instead, or a code to turn on an alarm system, etc. … [/quote] )
5. In order to avoid the problem areas of #2, SmartThings must implement an expedient but rigorous process to add new standard global Capabilities. If a new Capability can be swiftly added to the platform, then the need for ad-hoc Attributes and/or Commands is minimized or eliminated.
6. To conform to #4, New Capability Requests should be well-vetted – i.e., well named, well defined Attributes and Methods, optimal granularity: low to zero redundancy, etc… Again – no architecture or code changes required, just a management process; hopefully with time for Community input, and also mapping against major standards (Z-Wave, ZigBee) where applicable.
I close again with a disclaimer: This is a Forum post, a summary, a discussion: Not a formal proposed specification. I think there is enough detail here for readers and contributors to get the gist; but before adoption, a formal spec with a review and confirmation period is needed in order to clear up ambiguity and irrelevant tangents.
Thanks,
…CP / Terry.