From cd715e884cc60da38f3e285d1297759b9a763589 Mon Sep 17 00:00:00 2001 From: Piotr Dobrowolski Date: Sat, 20 Apr 2019 14:26:06 +0200 Subject: [PATCH] Cleanup python3 support --- spejsmdc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)