-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Add initial support for Sony SDCP projector control #20269
Conversation
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.
Don't forget to update requirements_all.txt
📚Please, update the documentation and open a PR for it (be sure to create a documentation PR against the 🏷 I am adding the 👍 Thanks (times a million!) |
- Validation of connection during setup_platform - Docs pending
Docs PR 8390: home-assistant/home-assistant.io#8390 |
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.
Don't forget to update .coveragerc :).
@alistairg can you update the description with the docs PR in the correct place per the template? |
Co-Authored-By: alistairg <alistair@alistairs.net>
@rohankapoorcom - Forgive me... is there something I need to do to close this out? As far as I can see it's all good to go, but Git still shows as "changes requested"... |
Sorry - I hadn't had a chance to review this again. LGTM. |
Can be merged when build passes. |
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.
Please open a new PR where we can address the comments.
return self._state | ||
|
||
@property | ||
def state_attributes(self): |
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.
Use device_state_attributes
instead. state_attributes
should only be used by the base entity in the base component (switch).
_LOGGER.debug("Powering on projector '%s'...", self.name) | ||
if self._sdcp.set_power(True): | ||
_LOGGER.debug("Powered on successfully.") | ||
self._state = STATE_ON |
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.
We can remove the change of state holding instance attributes. update
will be called at the end of the service call, ie after this method is called.
_LOGGER.debug("Powering off projector '%s'...", self.name) | ||
if self._sdcp.set_power(False): | ||
_LOGGER.debug("Powered off successfully.") | ||
self._state = STATE_OFF |
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.
See above.
sdcp_connection.get_power() | ||
except ConnectionError: | ||
_LOGGER.error("Failed to connect to projector '%s'", host) | ||
return False |
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.
Nothing is checking this return value. Just return
.
return False | ||
_LOGGER.debug("Validated projector '%s' OK", host) | ||
add_entities([SonyProjector(sdcp_connection, name)], True) | ||
return True |
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.
See above. We can remove this statement.
"""Turn the projector on.""" | ||
_LOGGER.debug("Powering on projector '%s'...", self.name) | ||
if self._sdcp.set_power(True): | ||
_LOGGER.debug("Powered on successfully.") |
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.
We don't end logging messages with period.
Description:
Add basic support as a Switch platform for turning on and off Sony projectors via network SDCP control.
Related issue (if applicable): fixes #
Pull request in home-assistant/home-assistant.io#8390
(To be added)
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: