-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Problem/Motivation
Currently, only pre line X devices are supported. Tado X has many API and functionality changes which are not compatible with V3, V2, etc.
Expected behaviour
Tado X being supported.
Proposed changes
Implementation of Tado X. I've already started working on it in a fork which I would like to merge later on. However there are some basic design choices which would have to be made. I'm opening this issue to discuss them:
-
Currently, the
Tadoclass has methods which are the same for pre X and X but some are not. One way to approach this would be to implement Tado X in the same class with some new and some modified methods and to raise an exception on unsupported methods. Alternatively (which I think would be more elegant) there could be a common base class with everything that stayed the same over the generations and one class for pre line X and one for line X. Both inherit from the common base class but implement the features with API and functionality changes separately. The base class could be an abstract base class to keep typing mostly consistent. However, the detection if the system is line X or pre line X has to be done somewhere different than in the class itself. -
there are some models which are mostly the same, but some properties have different names in the new API. For Example in the Device model the Device type isn't called
deviceTypeanymore but justtype. Mashumaro supports multiple aliases for this case but only with theAnnotatednotation. For the before mentioned device type this would be:device_type: Annotated[str, Alias("deviceType"), Alias("type")]
I think it would be good to decide whether this notation should be used consistently with everything or if there should be separate models for X and pre X. Later would mean a lot of duplicated code but maybe better readability (personally I like the
Annotatednotation more) -
For some functions currently the argument type is
strbut I think anEnumwould be more appropriate. For example for the Overlay termination type or the presence, this would ensure that the Input is always one of the supported options. Alternatively aLiteraltype with the options could be used, personally I like Enums more since there are suggestions in the IDE which options exist. (This has nothing to do with Tado X directly, but I would like to discuss it anyway.)