Skip to content

Commit

Permalink
add missing docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitlouy committed Jun 22, 2018
1 parent 155bc33 commit b06c71b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions homeassistant/components/media_player/pjlink.py
Expand Up @@ -40,6 +40,7 @@


def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the PJLink platform."""
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
name = config.get(CONF_NAME)
Expand All @@ -56,7 +57,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):


class PjLinkDevice(MediaPlayerDevice):
"""Representation of a PJLink device."""

def __init__(self, host, port, name, encoding, password):
"""Iinitialize the PJLink device."""
self._host = host
self._port = port
self._name = name
Expand All @@ -73,13 +77,15 @@ def __init__(self, host, port, name, encoding, password):
self.update()

def projector(self):
"""Create PJLink Projector instance."""
from pypjlink import Projector
projector = Projector.from_address(self._host, self._port,
self._encoding)
projector.authenticate()
return projector

def update(self):
"""Get the latest state from the device."""
with self.projector() as projector:
pwstate = projector.get_power()
if pwstate == 'off':
Expand Down

0 comments on commit b06c71b

Please sign in to comment.