WIP: General Vacuum Interface (#1059)#1060
Conversation
|
@rytilahti there's also another option – using universal MixIns, kinda like traits in Google Assistant/Home That'd be more universal: there would be "MixIn"s for battery status, start/stop, pause/resume, setting fan speed, which can be reused for other kinds of devices but I'm not quite sure if it's worth the effort for now |
|
Valetudo also has capabilities based design, see https://valetudo.cloud/pages/general/capabilities-overview.html |
|
@rytilahti any thoughts? |
|
Hey @stek29 and thanks for the PR! I'm currently very busy with other things and cannot currently do a full review, but did you take a look at my comment related to the directory structure? IMO the base classes should be inside the main package, and the implementations moved out to their own directories. On the mixins, I feel that they are not very pythonic, and will likely just cause more confusion than they are worth. For example: if you are implementing support for new device, you either must search for the wanted mixins (or sadly, simply copy&paste them over from something else). So I think it's better to have explicit interfaces (e.g., using abstract classes) that are directly useful if you are using a proper IDE for development. When it will get quieter at some point late next week, I'll write some more comments! |
|
@stek29 I have also been thinking about how to generalize the interface of python-miio, see #929 (comment). In my opinion there schould be one common .update() function that all integrations use to update all available data. I think most of the current implementations use info classes to represent the data, so the .status() could return that info class. preferably there would also be a .status_dict() function that would return the status as a dictionarry. In that way implementations as HomeAssistant can use common functions to extract common device status attributes like "temperature". I already did this for the subdevices of the xiaomi gateway where I define the available properties in a .yaml file: HomeAssistant uses the common attributes to easily setup sensor entities: |
|
Hey @starkillerOG, in most of the cases there exists a Now, on how to expose the separate sensors is an open question, but we should find a way to do that. Introducing a separate decorator (instead of using pure See also my (rather preliminary) comment about the general (re)structure here #1059 (comment) . It's a quite a bit of work to do such restructuring without breaking existing use cases, but it will hopefully be worth it at the end. This should also make it simpler to add support for generic device-type specific miot devices (@ha0y has done great work on creating a custom HA component, but not everyone uses HA, this comment from him/her is relevant on the topic #1029 (comment)). While I'm reluctant to add any sort of cloud requirement to this library, we could still provide a way to use already downloaded miot spec files for generic device support. |
|
sadly I'm no longer interested in this since valetudo is now available for Dreame robots |
WIP: suggestions and corrections are welcome :)
todo:
Would be nice to add: