Python plugin: Kodi

Python and python framework

Moderator: leecollings

User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin: Kodi

Post by Dnpwwo »

@jake,

You need to set Debug to True in the Hardware page for the plugin and post that log so I can see what the plugin is doing.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Kodi

Post by jake »

I'm sorry, here is the log after I initiate the 'Pause' command from my LUA controlled switch:

Code: Select all

2018-02-17 23:21:19.874 (Kodi Woonkamer - Playing) Updating device from 2:'63' to have values 2:'68'.
2018-02-17 23:21:19.883 (Kodi Woonkamer) Update 2:'68' (Kodi Woonkamer - Playing)
2018-02-17 23:21:22.695 (Virtual Devices) Light/Switch (Koditest)
2018-02-17 23:21:24.994 (Kodi Woonkamer) Calling message handler 'onCommand'.
2018-02-17 23:21:24.994 (Kodi Woonkamer) onCommand called for Unit 4: Parameter 'Pause', Level: 0, Connected: True
2018-02-17 23:21:24.994 (Kodi Woonkamer) Sending 82 bytes of data:
2018-02-17 23:21:24.994 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:21:24.994 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 50 6c 61 79 50 61 thod":"Player.PlayPa
2018-02-17 23:21:24.995 (Kodi Woonkamer) 75 73 65 22 2c 22 70 61 72 61 6d 73 22 3a 7b 22 70 6c 61 79 use","params":{"play
2018-02-17 23:21:24.995 (Kodi Woonkamer) 65 72 69 64 22 3a 30 2c 22 70 6c 61 79 22 3a 66 61 6c 73 65 erid":0,"play":false
2018-02-17 23:21:24.995 (Kodi Woonkamer) 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }}
2018-02-17 23:21:25.145 (Kodi Woonkamer) Received 146 bytes of data:
2018-02-17 23:21:25.145 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:21:25.146 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 4f 6e 50 61 75 73 thod":"Player.OnPaus
2018-02-17 23:21:25.146 (Kodi Woonkamer) 65 22 2c 22 70 61 72 61 6d 73 22 3a 7b 22 64 61 74 61 22 3a e","params":{"data":
2018-02-17 23:21:25.146 (Kodi Woonkamer) 7b 22 69 74 65 6d 22 3a 7b 22 69 64 22 3a 31 33 31 35 2c 22 {"item":{"id":1315,"
2018-02-17 23:21:25.146 (Kodi Woonkamer) 74 79 70 65 22 3a 22 73 6f 6e 67 22 7d 2c 22 70 6c 61 79 65 type":"song"},"playe
2018-02-17 23:21:25.146 (Kodi Woonkamer) 72 22 3a 7b 22 70 6c 61 79 65 72 69 64 22 3a 30 2c 22 73 70 r":{"playerid":0,"sp
2018-02-17 23:21:25.146 (Kodi Woonkamer) 65 65 64 22 3a 30 7d 7d 2c 22 73 65 6e 64 65 72 22 3a 22 78 eed":0}},"sender":"x
2018-02-17 23:21:25.146 (Kodi Woonkamer) 62 6d 63 22 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. bmc"}}
2018-02-17 23:21:25.146 (Kodi Woonkamer) Received 153 bytes of data:
2018-02-17 23:21:25.146 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:21:25.146 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 4f 6e 53 70 65 65 thod":"Player.OnSpee
2018-02-17 23:21:25.146 (Kodi Woonkamer) 64 43 68 61 6e 67 65 64 22 2c 22 70 61 72 61 6d 73 22 3a 7b dChanged","params":{
2018-02-17 23:21:25.147 (Kodi Woonkamer) 22 64 61 74 61 22 3a 7b 22 69 74 65 6d 22 3a 7b 22 69 64 22 "data":{"item":{"id"
2018-02-17 23:21:25.147 (Kodi Woonkamer) 3a 31 33 31 35 2c 22 74 79 70 65 22 3a 22 73 6f 6e 67 22 7d :1315,"type":"song"}
2018-02-17 23:21:25.147 (Kodi Woonkamer) 2c 22 70 6c 61 79 65 72 22 3a 7b 22 70 6c 61 79 65 72 69 64 ,"player":{"playerid
2018-02-17 23:21:25.147 (Kodi Woonkamer) 22 3a 30 2c 22 73 70 65 65 64 22 3a 30 7d 7d 2c 22 73 65 6e ":0,"speed":0}},"sen
2018-02-17 23:21:25.147 (Kodi Woonkamer) 64 65 72 22 3a 22 78 62 6d 63 22 7d 7d .. .. .. .. .. .. .. der":"xbmc"}}
2018-02-17 23:21:25.147 (Kodi Woonkamer) Calling message handler 'onMessage'.
2018-02-17 23:21:25.147 (Kodi Woonkamer) Player.OnPause recieved, Player ID: 0
2018-02-17 23:21:25.148 (Kodi Woonkamer - Status) Updating device from 5:'Georg Philipp Telemann:Telemann:Concerto in A; Sicilienne' to have values 2:'Georg Philipp Telemann:Telemann:Concerto in A; Sicilienne'.
2018-02-17 23:21:25.156 (Kodi Woonkamer) Update 2:'Georg Philipp Telemann:Telemann:Concerto in A; Sicilienne' (Kodi Woonkamer -Status)
2018-02-17 23:21:25.157 (Kodi Woonkamer - Playing) Updating device from 2:'68' to have values 0:'68'.
2018-02-17 23:21:25.164 (Kodi Woonkamer) Update 0:'68' (Kodi Woonkamer - Playing)
2018-02-17 23:21:25.165 (Kodi Woonkamer) Calling message handler 'onMessage'.
2018-02-17 23:21:25.165 (Kodi Woonkamer) Unhandled unsolicited response: {"jsonrpc":"2.0","method":"Player.OnSpeedChanged","params":{"data":{"item":{"id":1315,"type":"song"},"player":{"playerid":0,"speed":0}},"sender":"xbmc"}}
2018-02-17 23:21:29.825 (Kodi Woonkamer) Calling message handler 'onHeartbeat'.
2018-02-17 23:21:29.825 (Kodi Woonkamer) Sending 126 bytes of data:
2018-02-17 23:21:29.825 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:21:29.825 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 47 65 74 50 72 6f thod":"Player.GetPro
2018-02-17 23:21:29.825 (Kodi Woonkamer) 70 65 72 74 69 65 73 22 2c 22 69 64 22 3a 31 30 30 32 2c 22 perties","id":1002,"
2018-02-17 23:21:29.825 (Kodi Woonkamer) 70 61 72 61 6d 73 22 3a 7b 22 70 6c 61 79 65 72 69 64 22 3a params":{"playerid":
2018-02-17 23:21:29.825 (Kodi Woonkamer) 30 2c 22 70 72 6f 70 65 72 74 69 65 73 22 3a 5b 22 6c 69 76 0,"properties":["liv
2018-02-17 23:21:29.825 (Kodi Woonkamer) 65 22 2c 22 70 65 72 63 65 6e 74 61 67 65 22 2c 22 73 70 65 e","percentage","spe
2018-02-17 23:21:29.825 (Kodi Woonkamer) 65 64 22 5d 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. ed"]}}
2018-02-17 23:21:29.876 (Kodi Woonkamer) Received 94 bytes of data:
2018-02-17 23:21:29.876 (Kodi Woonkamer) 7b 22 69 64 22 3a 31 30 30 32 2c 22 6a 73 6f 6e 72 70 63 22 {"id":1002,"jsonrpc"
2018-02-17 23:21:29.876 (Kodi Woonkamer) 3a 22 32 2e 30 22 2c 22 72 65 73 75 6c 74 22 3a 7b 22 6c 69 :"2.0","result":{"li
2018-02-17 23:21:29.876 (Kodi Woonkamer) 76 65 22 3a 66 61 6c 73 65 2c 22 70 65 72 63 65 6e 74 61 67 ve":false,"percentag
2018-02-17 23:21:29.876 (Kodi Woonkamer) 65 22 3a 37 30 2e 38 38 37 33 37 34 38 37 37 39 32 39 36 38 e":70.88737487792968
2018-02-17 23:21:29.876 (Kodi Woonkamer) 37 35 2c 22 73 70 65 65 64 22 3a 30 7d 7d .. .. .. .. .. .. 75,"speed":0}}
2018-02-17 23:21:29.876 (Kodi Woonkamer) Calling message handler 'onMessage'.
2018-02-17 23:21:29.876 (Kodi Woonkamer) 1002 response received: {"id":1002,"jsonrpc":"2.0","result":{"live":false,"percentage":70.8873748779296875,"speed":0}}
2018-02-17 23:21:29.876 (Kodi Woonkamer - Playing) Updating device from 0:'68' to have values 0:'71'.
2018-02-17 23:21:29.881 (Kodi Woonkamer) Update 0:'71' (Kodi Woonkamer - Playing)
2018-02-17 23:21:39.801 (Kodi Woonkamer) Calling message handler 'onHeartbeat'.
2018-02-17 23:21:39.801 (Kodi Woonkamer) Sending 126 bytes of data:
2018-02-17 23:21:39.801 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:21:39.801 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 47 65 74 50 72 6f thod":"Player.GetPro
2018-02-17 23:21:39.801 (Kodi Woonkamer) 70 65 72 74 69 65 73 22 2c 22 69 64 22 3a 31 30 30 32 2c 22 perties","id":1002,"
2018-02-17 23:21:39.801 (Kodi Woonkamer) 70 61 72 61 6d 73 22 3a 7b 22 70 6c 61 79 65 72 69 64 22 3a params":{"playerid":
2018-02-17 23:21:39.801 (Kodi Woonkamer) 30 2c 22 70 72 6f 70 65 72 74 69 65 73 22 3a 5b 22 6c 69 76 0,"properties":["liv
2018-02-17 23:21:39.801 (Kodi Woonkamer) 65 22 2c 22 70 65 72 63 65 6e 74 61 67 65 22 2c 22 73 70 65 e","percentage","spe
2018-02-17 23:21:39.801 (Kodi Woonkamer) 65 64 22 5d 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. ed"]}}
2018-02-17 23:21:39.852 (Kodi Woonkamer) Received 94 bytes of data:
2018-02-17 23:21:39.852 (Kodi Woonkamer) 7b 22 69 64 22 3a 31 30 30 32 2c 22 6a 73 6f 6e 72 70 63 22 {"id":1002,"jsonrpc"
2018-02-17 23:21:39.852 (Kodi Woonkamer) 3a 22 32 2e 30 22 2c 22 72 65 73 75 6c 74 22 3a 7b 22 6c 69 :"2.0","result":{"li
2018-02-17 23:21:39.852 (Kodi Woonkamer) 76 65 22 3a 66 61 6c 73 65 2c 22 70 65 72 63 65 6e 74 61 67 ve":false,"percentag
2018-02-17 23:21:39.852 (Kodi Woonkamer) 65 22 3a 37 30 2e 39 30 32 37 38 36 32 35 34 38 38 32 38 31 e":70.90278625488281
2018-02-17 23:21:39.852 (Kodi Woonkamer) 32 35 2c 22 73 70 65 65 64 22 3a 30 7d 7d .. .. .. .. .. .. 25,"speed":0}}
Further down the log, it is pretty much the same of the last request for 'Calling message handler 'onHeartbeat'

Next log is when I click on the LUA controlled 'Play' button, after the above 'Pause'

Code: Select all

2018-02-17 23:30:00.017 (Kodi Woonkamer) Calling message handler 'onMessage'.
2018-02-17 23:30:00.018 (Kodi Woonkamer) 1002 response received: {"id":1002,"jsonrpc":"2.0","result":{"live":false,"percentage":70.9347076416015625,"speed":0}}
2018-02-17 23:30:05.323 (Virtual Devices) Light/Switch (Koditest)
2018-02-17 23:30:05.635 (Kodi Woonkamer) Calling message handler 'onCommand'.
2018-02-17 23:30:05.635 (Kodi Woonkamer) onCommand called for Unit 4: Parameter 'Play', Level: 0, Connected: True
2018-02-17 23:30:05.635 (Kodi Woonkamer) Sending 82 bytes of data:
2018-02-17 23:30:05.635 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:30:05.635 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 50 6c 61 79 50 61 thod":"Player.PlayPa
2018-02-17 23:30:05.635 (Kodi Woonkamer) 75 73 65 22 2c 22 70 61 72 61 6d 73 22 3a 7b 22 70 6c 61 79 use","params":{"play
2018-02-17 23:30:05.635 (Kodi Woonkamer) 65 72 69 64 22 3a 30 2c 22 70 6c 61 79 22 3a 66 61 6c 73 65 erid":0,"play":false
2018-02-17 23:30:05.635 (Kodi Woonkamer) 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }}
2018-02-17 23:30:09.942 (Kodi Woonkamer) Calling message handler 'onHeartbeat'.
2018-02-17 23:30:09.943 (Kodi Woonkamer) Sending 126 bytes of data:
2018-02-17 23:30:09.943 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:30:09.943 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 47 65 74 50 72 6f thod":"Player.GetPro
2018-02-17 23:30:09.943 (Kodi Woonkamer) 70 65 72 74 69 65 73 22 2c 22 69 64 22 3a 31 30 30 32 2c 22 perties","id":1002,"
2018-02-17 23:30:09.943 (Kodi Woonkamer) 70 61 72 61 6d 73 22 3a 7b 22 70 6c 61 79 65 72 69 64 22 3a params":{"playerid":
2018-02-17 23:30:09.943 (Kodi Woonkamer) 30 2c 22 70 72 6f 70 65 72 74 69 65 73 22 3a 5b 22 6c 69 76 0,"properties":["liv
2018-02-17 23:30:09.943 (Kodi Woonkamer) 65 22 2c 22 70 65 72 63 65 6e 74 61 67 65 22 2c 22 73 70 65 e","percentage","spe
2018-02-17 23:30:09.943 (Kodi Woonkamer) 65 64 22 5d 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. ed"]}}
2018-02-17 23:30:09.993 (Kodi Woonkamer) Received 94 bytes of data:
2018-02-17 23:30:09.994 (Kodi Woonkamer) 7b 22 69 64 22 3a 31 30 30 32 2c 22 6a 73 6f 6e 72 70 63 22 {"id":1002,"jsonrpc"
2018-02-17 23:30:09.994 (Kodi Woonkamer) 3a 22 32 2e 30 22 2c 22 72 65 73 75 6c 74 22 3a 7b 22 6c 69 :"2.0","result":{"li
2018-02-17 23:30:09.994 (Kodi Woonkamer) 76 65 22 3a 66 61 6c 73 65 2c 22 70 65 72 63 65 6e 74 61 67 ve":false,"percentag
2018-02-17 23:30:09.994 (Kodi Woonkamer) 65 22 3a 37 30 2e 39 33 34 37 30 37 36 34 31 36 30 31 35 36 e":70.93470764160156
2018-02-17 23:30:09.994 (Kodi Woonkamer) 32 35 2c 22 73 70 65 65 64 22 3a 30 7d 7d .. .. .. .. .. .. 25,"speed":0}}
From a playing situation, I click the LUA controlled 'Play' again:

Code: Select all

2018-02-17 23:34:10.036 (Kodi Woonkamer) Calling message handler 'onMessage'.

2018-02-17 23:34:10.037 (Kodi Woonkamer) 1002 response received: {"id":1002,"jsonrpc":"2.0","result":{"live":false,"percentage":76.812591552734375,"speed":1}}
2018-02-17 23:34:10.037 (Kodi Woonkamer - Playing) Updating device from 2:'71' to have values 2:'77'.
2018-02-17 23:34:10.046 (Kodi Woonkamer) Update 2:'77' (Kodi Woonkamer - Playing)
2018-02-17 23:34:11.390 (Virtual Devices) Light/Switch (Koditest)
2018-02-17 23:34:11.653 (Kodi Woonkamer) Calling message handler 'onCommand'.
2018-02-17 23:34:11.653 (Kodi Woonkamer) onCommand called for Unit 4: Parameter 'Play', Level: 0, Connected: True
2018-02-17 23:34:11.653 (Kodi Woonkamer) Sending 82 bytes of data:
2018-02-17 23:34:11.653 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:34:11.653 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 50 6c 61 79 50 61 thod":"Player.PlayPa
2018-02-17 23:34:11.653 (Kodi Woonkamer) 75 73 65 22 2c 22 70 61 72 61 6d 73 22 3a 7b 22 70 6c 61 79 use","params":{"play
2018-02-17 23:34:11.653 (Kodi Woonkamer) 65 72 69 64 22 3a 30 2c 22 70 6c 61 79 22 3a 66 61 6c 73 65 erid":0,"play":false
2018-02-17 23:34:11.653 (Kodi Woonkamer) 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }}
2018-02-17 23:34:11.804 (Kodi Woonkamer) Received 146 bytes of data:
2018-02-17 23:34:11.804 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:34:11.804 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 4f 6e 50 61 75 73 thod":"Player.OnPaus
2018-02-17 23:34:11.804 (Kodi Woonkamer) 65 22 2c 22 70 61 72 61 6d 73 22 3a 7b 22 64 61 74 61 22 3a e","params":{"data":
2018-02-17 23:34:11.804 (Kodi Woonkamer) 7b 22 69 74 65 6d 22 3a 7b 22 69 64 22 3a 31 33 31 35 2c 22 {"item":{"id":1315,"
2018-02-17 23:34:11.804 (Kodi Woonkamer) 74 79 70 65 22 3a 22 73 6f 6e 67 22 7d 2c 22 70 6c 61 79 65 type":"song"},"playe
2018-02-17 23:34:11.804 (Kodi Woonkamer) 72 22 3a 7b 22 70 6c 61 79 65 72 69 64 22 3a 30 2c 22 73 70 r":{"playerid":0,"sp
2018-02-17 23:34:11.804 (Kodi Woonkamer) 65 65 64 22 3a 30 7d 7d 2c 22 73 65 6e 64 65 72 22 3a 22 78 eed":0}},"sender":"x
2018-02-17 23:34:11.804 (Kodi Woonkamer) 62 6d 63 22 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. bmc"}}
2018-02-17 23:34:11.804 (Kodi Woonkamer) Received 153 bytes of data:
2018-02-17 23:34:11.804 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:34:11.804 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 4f 6e 53 70 65 65 thod":"Player.OnSpee
2018-02-17 23:34:11.804 (Kodi Woonkamer) 64 43 68 61 6e 67 65 64 22 2c 22 70 61 72 61 6d 73 22 3a 7b dChanged","params":{
2018-02-17 23:34:11.804 (Kodi Woonkamer) 22 64 61 74 61 22 3a 7b 22 69 74 65 6d 22 3a 7b 22 69 64 22 "data":{"item":{"id"
2018-02-17 23:34:11.804 (Kodi Woonkamer) 3a 31 33 31 35 2c 22 74 79 70 65 22 3a 22 73 6f 6e 67 22 7d :1315,"type":"song"}
2018-02-17 23:34:11.804 (Kodi Woonkamer) 2c 22 70 6c 61 79 65 72 22 3a 7b 22 70 6c 61 79 65 72 69 64 ,"player":{"playerid
2018-02-17 23:34:11.804 (Kodi Woonkamer) 22 3a 30 2c 22 73 70 65 65 64 22 3a 30 7d 7d 2c 22 73 65 6e ":0,"speed":0}},"sen
2018-02-17 23:34:11.804 (Kodi Woonkamer) 64 65 72 22 3a 22 78 62 6d 63 22 7d 7d .. .. .. .. .. .. .. der":"xbmc"}}
2018-02-17 23:34:11.804 (Kodi Woonkamer) Calling message handler 'onMessage'.
2018-02-17 23:34:11.805 (Kodi Woonkamer) Player.OnPause recieved, Player ID: 0
2018-02-17 23:34:11.805 (Kodi Woonkamer - Status) Updating device from 5:'Georg Philipp Telemann:Telemann:Concerto in A; Sicilienne' to have values 2:'Georg Philipp Telemann:Telemann:Concerto in A; Sicilienne'.
2018-02-17 23:34:11.810 (Kodi Woonkamer) Update 2:'Georg Philipp Telemann:Telemann:Concerto in A; Sicilienne' (Kodi Woonkamer - Status)
2018-02-17 23:34:11.810 (Kodi Woonkamer - Playing) Updating device from 2:'77' to have values 0:'77'.
2018-02-17 23:34:11.820 (Kodi Woonkamer) Update 0:'77' (Kodi Woonkamer - Playing)
2018-02-17 23:34:11.820 (Kodi Woonkamer) Calling message handler 'onMessage'.
2018-02-17 23:34:11.820 (Kodi Woonkamer) Unhandled unsolicited response: {"jsonrpc":"2.0","method":"Player.OnSpeedChanged","params":{"data":{"item":{"id":1315,"type":"song"},"player":{"playerid":0,"speed":0}},"sender":"xbmc"}}
2018-02-17 23:34:19.986 (Kodi Woonkamer) Calling message handler 'onHeartbeat'.
2018-02-17 23:34:19.986 (Kodi Woonkamer) Sending 126 bytes of data:
2018-02-17 23:34:19.986 (Kodi Woonkamer) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2018-02-17 23:34:19.986 (Kodi Woonkamer) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 47 65 74 50 72 6f thod":"Player.GetPro
2018-02-17 23:34:19.986 (Kodi Woonkamer) 70 65 72 74 69 65 73 22 2c 22 69 64 22 3a 31 30 30 32 2c 22 perties","id":1002,"
2018-02-17 23:34:19.986 (Kodi Woonkamer) 70 61 72 61 6d 73 22 3a 7b 22 70 6c 61 79 65 72 69 64 22 3a params":{"playerid":
2018-02-17 23:34:19.987 (Kodi Woonkamer) 30 2c 22 70 72 6f 70 65 72 74 69 65 73 22 3a 5b 22 6c 69 76 0,"properties":["liv
2018-02-17 23:34:19.987 (Kodi Woonkamer) 65 22 2c 22 70 65 72 63 65 6e 74 61 67 65 22 2c 22 73 70 65 e","percentage","spe
2018-02-17 23:34:19.987 (Kodi Woonkamer) 65 64 22 5d 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. ed"]}}
2018-02-17 23:34:20.037 (Kodi Woonkamer) Received 94 bytes of data:
2018-02-17 23:34:20.037 (Kodi Woonkamer) 7b 22 69 64 22 3a 31 30 30 32 2c 22 6a 73 6f 6e 72 70 63 22 {"id":1002,"jsonrpc"
2018-02-17 23:34:20.037 (Kodi Woonkamer) 3a 22 32 2e 30 22 2c 22 72 65 73 75 6c 74 22 3a 7b 22 6c 69 :"2.0","result":{"li
2018-02-17 23:34:20.037 (Kodi Woonkamer) 76 65 22 3a 66 61 6c 73 65 2c 22 70 65 72 63 65 6e 74 61 67 ve":false,"percentag
2018-02-17 23:34:20.037 (Kodi Woonkamer) 65 22 3a 37 37 2e 33 36 30 31 35 33 31 39 38 32 34 32 31 38 e":77.36015319824218
2018-02-17 23:34:20.037 (Kodi Woonkamer) 37 35 2c 22 73 70 65 65 64 22 3a 30 7d 7d .. .. .. .. .. .. 75,"speed":0}}
Shall I log with the 'Rewind' command as well? From which situation, from a playing or paused situation?
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Kodi

Post by jake »

@Dnpwwo,
As addition to the above, I clicked on the 'Rewind' button, while the track was playing. Result: the track started playing at 0% (as requested). The same if I paused the track with a Kodi remote. Clicking on the 'Rewind' button, not only 'rewinded', but started playing as well. Although it can be debated if that, after a Pause command, is desired, it is more than OK for me.

I did one more test with a 'SET level 50 after 2' command and that worked as expected as well.

Summarizing, it is the 'Play' command that is not working properly, it acts as the 'Pause' button.
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin: Kodi

Post by Dnpwwo »

@jake,

The Kodi doesn't actually have a 'Play' or 'Pause' command in the JSON API the plugin uses, it has a "Play/Pause" toggle. That means that if you get the timing wrong it may not work like you expect.

From what you have said it sounds like you just need to:
  • Send a Pause to the Kodi
  • Send a 'Rewind AFTER 10' to the Kodi
and it will do what you want

I tried pausing and playing using the 'Kodi - Playing' icon and it toggled as expected. I'll try some more tests
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Kodi

Post by jake »

Indeed toggling the Kodi icon in the 'Playing' device pauses and plays the current track.

The LUA 'play command' (commandArray['Kodi Woonkamer - Playing']='Play') doesn't work. It put a track to 'pause', but not to 'play'. No matter how many times I activate that command. The same for the 'pause command' commandArray['Kodi Woonkamer - Playing']='Pause' although there it is expected.

It doesn't matter if I use the 'Playing' or 'Status' device, although the first one is an on/off type, while the second is a media player device.
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin: Kodi

Post by Dnpwwo »

@jake,

Pushed version 2.4.2 that should resolve this
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Kodi

Post by jake »

Dnpwwo wrote:@jake,

Pushed version 2.4.2 that should resolve this
Thanks, this fix resolves the issue. Great!

One minor thing I came across:
I restarted the plugin/hardware and checked the log afterwards:
During initialisation it still shows the following: " Initialized version 2.3.11, author 'dnpwwo' "
I assume this should be 2.4.2 instead.

It would be good when this plugin got it's own page in the wiki. Functionality and LUA options are then easily accessible to all users.
My next step is to convert the mentioned simple script in dzVents. I'm not sure if this framework can handle your plugin, since it is not the original 'Kodi hardware'.
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Kodi

Post by jake »

I have converted the above mentioned LUA script into a dzVents variant. It turns out that at the moment the specific dzVents Kodi commands are not available. Instead there has to be worked with the 'state' and 'setState' commands instead:

Code: Select all

return {
	active = true,                  -- set to true to activate this script 
	on = {
     devices = {
		   'Koditest'
		}
	},
	
	execute = function(domoticz, device)
		local koditest = domoticz.devices('Koditest').state
		local kodiDevice = domoticz.devices('Kodi Woonkamer - Playing')

	if koditest == 'Pause' then
		kodiDevice.setState ('Pause AFTER 2')
		print('given the Pause command after 2 sec')
	elseif koditest == 'Rewind' then
		kodiDevice.setState ('Rewind')
		print('given the rewind command')
	elseif koditest == 'Play' then
		kodiDevice.setState ('Play')
		print('given the Play command')
	elseif koditest == 'Half' then
		kodiDevice.setState ('Set level 50')
		print('given the Half command')
	end
end
}
1 setback after implementing the above code snippets inside my original script:

While giving the 'Rewind' command, (the amp is ready at that time), Kodi starts playing for a split second, than rewind, than plays from 0.00.
The split second playing unfortunately takes away all the effort I put into getting this to work. It sounds just as bad as missing out the first couple seconds as I had it before when Kodi kept playing, while the amp was still 'booting'.
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Kodi

Post by jake »

Since 2.4.2? version I have it happening twice that all Kodi devices are red and the log displaying that the onhearbeat failed. While I tried to turn off/on 'kodi players' hardware at the first Kodi freeze, Domoticz locked up. At the second time the above happened, I was able to interact with Domoticz for half a minute, but as soon I tried to open the log files, Domoticz locked up again.
Both times I had to restart the Domoticz service.

During the first problem, Kodi was opening an add-on, which usually takes some time, it may act like if it locks up.
The reason for the 2nd time, I don't have, but Kodi was not running and I manually had to restart the Kodi service.

Domoticz log records every 10 seconds:

Code: Select all

2018-02-25 11:18:49.646  Error: (Kodi Woonkamer) 'onHeartbeat' failed 'AttributeError':''str' object has no attribute 'Connected''.
2018-02-25 11:18:49.646  Error: (Kodi Woonkamer) ----> Line 642 in /home/pi/domoticz/plugins/Kodi/plugin.py, function onHeartbeat
2018-02-25 11:18:49.647  Error: (Kodi Woonkamer) ----> Line 495 in /home/pi/domoticz/plugins/Kodi/plugin.py, function onHeartbeat
The plugin doesn't revive itself after Kodi is brought back to live
statusever1
Posts: 2
Joined: Monday 26 February 2018 16:35
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: Kodi

Post by statusever1 »

Got some knowledge about my problem..thanks
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin: Kodi

Post by Dnpwwo »

@jake,

Almost looks like the Kodi has disconnected and the connection hasn't been cleaned up properly. I similar issue has been reported elsewhere with the plugin framework.

As a workaround I've added some exception handling and forced a disconnect in version 2.4.3. I can't test it but can you try it and see if it fixes this?
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Kodi

Post by jake »


Dnpwwo wrote:@jake,

Almost looks like the Kodi has disconnected and the connection hasn't been cleaned up properly. I similar issue has been reported elsewhere with the plugin framework.

As a workaround I've added some exception handling and forced a disconnect in version 2.4.3. I can't test it but can you try it and see if it fixes this?
Thanks. I tried it by powering down the Pi with Kodi. I waited 5 minutes before booting it back up. After +/- 30 sec? the Kodi devices went from red to 'alive' again.
So far, so good! (a minor, minor thing: during initialisation the plugin still shows 2.4.2)
MnM001
Posts: 4
Joined: Wednesday 31 January 2018 3:42
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Kodi

Post by MnM001 »

Hi,

I have a few users/profiles on my kodi.
Any way to display who is logged in - perhaps in the status?

Cheers.
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Python plugin: Kodi

Post by sincze »

@Dnpwwo, great plugin. Easy to install. Have now 3 kodi machines up and running. :D
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
TheCondor
Posts: 78
Joined: Thursday 18 June 2015 10:32
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: Kodi

Post by TheCondor »

Dnpwwo wrote: Friday 03 February 2017 23:15 Thread for all things related to the Python Kodi plugin.

Latest full versions is available here: https://github.com/dnpwwo/Domoticz-Kodi-Plugin

Latest Update: v2.4.2 - February 22nd, 2018
  • Bug fix: Changed handling for Play and Pause commands from scripts,
  • Added initial Description that will appear in Hardware page
Latest Update: v2.3.11 - February 17th, 2018
  • Added Blockly support,
  • Uplift error response handling
  • Added 'Rewind' command
Update: v2.2.1 - February 11th, 2018
  • Activates the screensaver using the proper "ActivateScreensaver" function via the UDP interface
Previous Update: v2.0.6 - December 12th, 2017
  • Optionally highlights devices that can not be found on the network (red banner in web UI)
  • Supports screensaver events (Kodi 17+) and shows Kodi as 'Sleeping' when screensaver is on
Hi Dnpwwo
Do you think it will bè possible to overdose the default in/off button off the switch? Currently when it's on(awake) and we push on the device it send the command spero(screensaver) and it's really good, but the opposite doesn't work:
On -> send the same Active screensaver so it turn on and instantly goes in sleep again.
May it's possible to convert the ON to a simple OK or BACK Just for send a wakeup input when option 'sleep' is set in hardware panel options?
Thanks!
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Python plugin: Kodi

Post by Brutus »

I have updated to the latest plugin version.
Domoticz is running: V3.9565
Kodi is running 17.6

When executing this command:

Code: Select all

commandArray['Kodi TV Woonkamer'] = 'Play Favorites 0'
At favorites 0 I have a URL Radio stream saved.

I get this as a response:

Code: Select all

2018-05-10 14:10:58.944 EventSystem: Script event triggered: LUA-Kodi 
2018-05-10 14:10:58.996 (Kodi) onCommand called for Unit 1: Parameter 'Play Favorites', Level: 0, Connected: True 
2018-05-10 14:10:58.996 (Kodi) 'Play' command ignored, No active Player ID. Kodi has not reported that it is playing media. 
"Kodi has not reported it is playing media" It doens't have to because I want it to play media ;)

When you Pause the playing stream you can resume it with the: 'Play Favorites 0' comment. Stopping it and then start the stream again gives the given error.
Last edited by Brutus on Wednesday 06 June 2018 18:07, edited 1 time in total.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Kodi

Post by jake »

I am running the last version of the Kodi plugin, 2.5.6

Today my Domoticz crashed: these are the last lines in the log:
First:

Code: Select all

(Kodi Woonkamer) Device has disconnected                                                   
(Kodi Woonkamer) Update 9:'Screensaver' (Kodi Woonkamer - Status)                          
(Kodi Woonkamer) Update 20:'20' (Kodi Woonkamer - Source)                                  
(Kodi Woonkamer) Update 2:'100' (Kodi Woonkamer - Volume)                                  
(Kodi Woonkamer) Update 0:'0' (Kodi Woonkamer - Playing)
then a couple seconds later:

Code: Select all

Error: Plugin: Connection Exception: 'resolve: Host not found (authoritative)' connecting to 'onHeartbeat:9090'
(Kodi Woonkamer) Connect directive received, action initiation failed.                     
Domoticz received fatal signal 11 !...                                              
/home/pi/domoticz/domoticz() [0x2522b8]                                           
/home/pi/domoticz/domoticz(_Z14signal_handleri+0x4c) [0x252370]                   
/lib/arm-linux-gnueabihf/libc.so.6(__default_sa_restorer_v2+0) [0x76cb3180]
The weird thing is that nobody used/started Kodi at all today. Kodi is running fine on it's own pi as well.

A restart of Domoticz got things rolling again, but a plugin crashing the whole setup wasn't what I had in mind today ;-)
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Python plugin: Kodi

Post by Brutus »

@Dnpwwo:

Any suggestions regarding the commands that not work in the plugin?

The play option isn't working when nothing is playing.
And the "Set Volume" isn't working to.

I trigger the commands in LUA scripts. You see the options being activated in de log but nothing happens.

The only options that work now are:
- Pause when a stream is active.
- Start when a stream is Paused
- Stop

With the Internal "Kodi Media Server" all the commands work great.

Thanks for your help.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
Dnpwwo
Posts: 819
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin: Kodi

Post by Dnpwwo »

@Brutus,

Can you be a little more specific? I use the plugin version and don't know of commands that don't work.

If you can turn on debugging for te plugin and execute the commnds I can have a look. Also, what version of Domoticz and the plugin are you running?

thanks, dnpwwo
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Python plugin: Kodi

Post by Brutus »

Dnpwwo wrote: Wednesday 06 June 2018 12:42 @Brutus,

Can you be a little more specific? I use the plugin version and don't know of commands that don't work.

If you can turn on debugging for te plugin and execute the commnds I can have a look. Also, what version of Domoticz and the plugin are you running?

thanks, dnpwwo
Have you seen my post from 10May? :roll: viewtopic.php?f=65&t=15892&start=80#p180233
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest