Skip to content

Commit

Permalink
Fix some bugs from API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
void-spark committed Jan 24, 2022
1 parent 8b7a4cf commit b8998a1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin.service.mqtt/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.service.mqtt" name="MQTT Adapter" version="0.21" provider-name="owagner,jvandenbroek,richcrabtree,Eugene Schava,rubikscuber,DevTown,2Zero,Marcin U,drlobo,existsec,Aitor Iturrioz,Marian Soban,Mark Ferry,Patrick Pimentel Jr.,void-spark">
<addon id="plugin.service.mqtt" name="MQTT Adapter" version="0.22" provider-name="owagner,jvandenbroek,richcrabtree,Eugene Schava,rubikscuber,DevTown,2Zero,Marcin U,drlobo,existsec,Aitor Iturrioz,Marian Soban,Mark Ferry,Patrick Pimentel Jr.,void-spark">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
</requires>
Expand Down
4 changes: 4 additions & 0 deletions plugin.service.mqtt/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.22 - 2022-01-24
- Fixed some things to follow conventions
- Tested on 19.4 Matrix

v0.21 - 2021-03-22
- Convert to work with Kodi 19 Matrix (just some minor changes were needed)
- Update MQTT client Paho to latest: 1.5.1
Expand Down
6 changes: 3 additions & 3 deletions plugin.service.mqtt/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def ignorelist(data,val):

def mqttlogging(log):
if __addon__.getSetting("mqttdebug")=='true':
#xbmc.log(log)
xbmc.log(log,level=xbmc.LOGNOTICE)
xbmc.log(log,level=xbmc.LOGINFO)

def sendrpc(method,params):
res=xbmc.executeJSONRPC(json.dumps({"jsonrpc":"2.0","method":method,"params":params,"id":1}))
Expand Down Expand Up @@ -260,6 +259,7 @@ def processcecstate(data):
os.system('kodi-send --action=""')

def processcommand(topic,data):
mqttlogging("MQTT: Received command %s with data %s" % (topic, data))
if topic=="notify":
processnotify(data)
elif topic=="play":
Expand Down Expand Up @@ -287,7 +287,7 @@ def msghandler(mqc,userdata,msg):
return
mytopic=msg.topic[len(topic):]
if mytopic.startswith("command/"):
processcommand(mytopic[8:],msg.payload)
processcommand(mytopic[8:],msg.payload.decode("utf-8"))
except Exception as e:
mqttlogging("MQTT: Error processing message %s: %s" % (type(e).__name__,e))

Expand Down

0 comments on commit b8998a1

Please sign in to comment.