-
Notifications
You must be signed in to change notification settings - Fork 378
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
Expose 'manufacturer' and 'product_name' properties in 'Chromecast' class. #895
base: master
Are you sure you want to change the base?
Expose 'manufacturer' and 'product_name' properties in 'Chromecast' class. #895
Conversation
…lass. [Justification]: Field 'model_name' evaluates to 'Chromecast' for all device models. Field 'product_name' allows to actually distinguish between Chromecast models: - Chromecast 3 => 'caprica' - Chromecast Ultra => 'steak' - Chromecast Android TV => 'sabrina'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this make sense. Would map to new field in HA too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not fully sure about the benefit of this, why is it better to expose this in a property, instead of accessing via the public cast_info
?
def manufacturer(self) -> str: | ||
"""Returns the manufacturer of the Chromecast device.""" | ||
if TYPE_CHECKING: | ||
# get_cast_type is guaranteed to return a CastInfo with a non-None model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is misleading
def product_name(self) -> str: | ||
"""Returns the product name of the Chromecast device.""" | ||
if TYPE_CHECKING: | ||
# get_cast_type is guaranteed to return a CastInfo with a non-None model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Didn't realize cast_info was public already. Seem pointless yes. One can wonder why we expose the others then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing addition of the new field here:
https://github.com/home-assistant-libs/pychromecast/pull/895/files#diff-c7c448ef8026704bcb4f958857c133335170bbeda706cea0bfeaa033ad829a7dR265
and
https://github.com/home-assistant-libs/pychromecast/pull/895/files#diff-c7c448ef8026704bcb4f958857c133335170bbeda706cea0bfeaa033ad829a7dR251
and
dial.py
It's due to some old design choice to forward selected attributes and methods from sub-objects to the See for example here: pychromecast/pychromecast/__init__.py Lines 344 to 356 in 4917898
It's currently applied very inconsistently; new functionality has not been forwarded like this for several years. Notice how |
Expose 'manufacturer' and 'product_name' properties in 'Chromecast' class.
[Justification]:
Field 'model_name' evaluates to 'Chromecast' for all device models.
Field 'product_name' allows to actually distinguish between Chromecast models: