From bb55a47b475cb69636bb4e2a292103bdd5b5866d Mon Sep 17 00:00:00 2001 From: nohum Date: Sun, 20 Aug 2017 20:55:21 +0200 Subject: [PATCH] ~ commenting changes, fixed whitespace pylint issue --- handler/event.py | 2 +- handler/properties.py | 2 +- helper/mqtt.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/handler/event.py b/handler/event.py index af4eff3..5aea87b 100644 --- a/handler/event.py +++ b/handler/event.py @@ -54,7 +54,7 @@ def __init__(self): def on_mqtt_connected(self, client): self.logger.debug("mqtt connected callback has been invoked") self.mqtt_client = client - # insert + as identifier so that every command to every identifier (= ip address) will be recognized + # insert + as identifier so that every command to every identifier (= friendly names) will be recognized self.mqtt_client.subscribe(TOPIC_COMMAND_VOLUME_LEVEL % "+") self.mqtt_client.subscribe(TOPIC_COMMAND_VOLUME_MUTED % "+") self.mqtt_client.subscribe(TOPIC_COMMAND_PLAYER_POSITION % "+") diff --git a/handler/properties.py b/handler/properties.py index cc3009e..c4b145d 100644 --- a/handler/properties.py +++ b/handler/properties.py @@ -79,7 +79,7 @@ def __init__(self, mqtt_connection, mqtt_topic_filter, changes_callback): def is_topic_filter_matching(self, topic): """ - Check if a topic (e.g.: chromecast/192.168.0.1/player_state) matches our filter (the ip address part). + Check if a topic (e.g.: chromecast/my_device_name/player_state) matches our filter (the name part). """ try: return topic.split("/")[1] == self.topic_filter diff --git a/helper/mqtt.py b/helper/mqtt.py index 67945a5..a7913c7 100644 --- a/helper/mqtt.py +++ b/helper/mqtt.py @@ -1,6 +1,7 @@ from paho.mqtt.client import Client, MQTT_ERR_NO_CONN, MQTT_ERR_SUCCESS import logging + class MqttConnectionCallback: def on_mqtt_connected(self, client): @@ -9,6 +10,7 @@ def on_mqtt_connected(self, client): def on_mqtt_message_received(self, topic, payload): pass + class MqttConnection: def __init__(self, ip, port, username, password, connection_callback):