* initial commit * small corrections * fix linting error * add new files to coveragerc * rename devolo_sensor to devolo_device * use correct import * use binary_switch platform * use binary_switch platform * add binary_sensor to coverage * adjustments according PR review * make super call easier to read * use f-string instead of concatenating * update docstrings - remove device_id property * add will_remove_from_hass
19 lines
516 B
Python
19 lines
516 B
Python
"""Subscriber for devolo home control API publisher."""
|
|
|
|
import logging
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
class Subscriber:
|
|
"""Subscriber class for the publisher in mprm websocket class."""
|
|
|
|
def __init__(self, name, callback):
|
|
"""Initiate the subscriber."""
|
|
self.name = name
|
|
self.callback = callback
|
|
|
|
def update(self, message):
|
|
"""Trigger hass to update the device."""
|
|
_LOGGER.debug('%s got message "%s"', self.name, message)
|
|
self.callback(message)
|