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

Fix ChuangmiPlugStatus repr format #341

Merged

Conversation

syssi
Copy link
Collaborator

@syssi syssi commented Jun 17, 2018

No description provided.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 72.413% when pulling 1354e3d on syssi:feature/chuangmi-plug-status-format-fix into fb595be on rytilahti:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 72.413% when pulling 1354e3d on syssi:feature/chuangmi-plug-status-format-fix into fb595be on rytilahti:master.

@rytilahti
Copy link
Owner

rytilahti commented Jun 17, 2018

Do you think it'd be a good idea simply to expose the available attributes in an array (like __device_attrs__ or similar) and simply do one __repr__() in Device? Something akin to:

def __repr__(self):
    prefix = "<%s" % self.__class__.__name__
    attr_s = ""
    for attr in self.__device_attrs__:
        attr_s += "%s: %s " % (attr, self.data[attr])
    postfix = "@ %s>" % self.host
    return prefix + attr_s + postfix

@syssi
Copy link
Collaborator Author

syssi commented Jun 18, 2018

I prefer the class properties instead of the miio api property names because of the naming and conversion.

@rytilahti
Copy link
Owner

Ah, maybe that was put badly. So yeah, of course exposing the proper names & converted outputs. This is also something that the json-output could use (which currently simply delivers the data contents).

@rytilahti
Copy link
Owner

I'm unsure why this wasn't merged already, seems to be no-brainer so let's get it done.

@rytilahti rytilahti merged commit 99b7067 into rytilahti:master Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants