diff --git a/spejsmdc.py b/spejsmdc.py index 1b8111a..28d7a5d 100644 --- a/spejsmdc.py +++ b/spejsmdc.py @@ -37,7 +37,7 @@ class SpejsIoTClient(mqtt.Client): if node in self.endpoints: self.logger.info('Passing to %r', self.endpoints[node]) try: - self.endpoints[node].process(attrib, msg.payload) + self.endpoints[node].process(attrib, msg.payload.decode()) except Exception: self.logger.exception('Error occured') @@ -53,7 +53,7 @@ class SpejsIoTClient(mqtt.Client): def notify(self, node, attribute, value, retain=True): if type(value) in [int, float, bool]: value = str(value).lower() - elif type(value) not in [str, unicode]: + elif type(value) not in [str, bytes]: value = str(value) self.publish('{}{}/{}'.format(self.topic_prefix, node, attribute), value, retain=retain)