Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: improve miotdevice API, add gosund plug support (cuco.plug.cp1) #672

Closed
wants to merge 5 commits into from

Commits on Apr 18, 2020

  1. improve miotdevice with some helpers

    * add miot_info() to get the common information from the device
      * this includes manufacturer, model, firmeware version and serial number
    
    * add get_properties_for_dataclass(cls) which allows easy implementation for get_properties mappings
      * each field() can define metadata containing siid and piid, these are mapped automatically to the response container
      * _siid can be used to define common siid, _max_properties can be used to set number of maximum properties per request
    
    * get_properties_for_mapping() requires explicit passing of the mapping, no more passing over __init__
    rytilahti committed Apr 18, 2020
    Configuration menu
    Copy the full SHA
    fa2096b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c7ba649 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    93fb155 View commit details
    Browse the repository at this point in the history
  4. Add more helpers to miotdevice

    * rename old set_property to set_property_from_mapping
    * add set_properties_from_dataclass (allows passing a mapping object with all wanted values at once)
    
    ```
    device.set_properties_from_dataclass(GosundPlugStatus(state=True, some_other_property=123)
    ```
    
    * new set_property helper which takes kwargs that are used automatically with the help of the class-given _MAPPING:
    
    ```
    device.set_property(state=True)
    ```
    rytilahti committed Apr 18, 2020
    Configuration menu
    Copy the full SHA
    63d6dc0 View commit details
    Browse the repository at this point in the history
  5. Add support for gosund miot plug (cuco.plug.cp1)

    this is just a poc to show how the new api could function
    rytilahti committed Apr 18, 2020
    Configuration menu
    Copy the full SHA
    6e40d90 View commit details
    Browse the repository at this point in the history