JSONRPC.NotifyAll resquest sent but no call to onNotification of custom monitor - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174) +---- Thread: JSONRPC.NotifyAll resquest sent but no call to onNotification of custom monitor (/showthread.php?tid=379733) |
JSONRPC.NotifyAll resquest sent but no call to onNotification of custom monitor - Ayuzerak - 2024-12-10 JSONRPC.NotifyAll resquest sent but onNotification method of custom monitor class doesn't seem to be called. Is there any specific things to do? RE: JSONRPC.NotifyAll resquest sent but no call to onNotification of custom monitor - izprtxqkft - 2024-12-10 usually expect to see this with a malformed JSON RPC call can you share the JSON you are using to invoke NotifyAll? RE: JSONRPC.NotifyAll resquest sent but no call to onNotification of custom monitor - Ayuzerak - 2024-12-10 def notifyTestAddon(self, data): """ Notify the TestAddon addon with data. Args: data (dict): Data to send to the TestAddon addon. Returns: bool: True if the notification was successful, False otherwise. """ logger.info("notifyTestAddon called") try: # Encode the data as JSON testaddon_data = json.dumps(data) # Create the JSON-RPC request jsonrpc_request = { "jsonrpc": "2.0", "id": 1, "method": "JSONRPC.NotifyAll", "params": { "sender": 'plugin.video.kodiconnect.SIGNAL', "message": 'testaddon_data', "data": [testaddon_data], } } request = json.dumps(jsonrpc_request) response = xbmc.executeJSONRPC(request) response = json.loads(response) if response.get('result') == 'OK': logger.info("Data successfully notified to TestAddon.") return True else: logger.error("Failed to notify data to TestAddon. Response: %s", response) return False except Exception as e: logger.error(f"Error in notifyTestAddon: {e}") return False RE: JSONRPC.NotifyAll resquest sent but no call to onNotification of custom monitor - Ayuzerak - 2024-12-10 In logfile: "Data successfully notified to TestAddon" RE: JSONRPC.NotifyAll resquest sent but no call to onNotification of custom monitor - Ayuzerak - 2024-12-10 The data variable contains videofilter from kodiconnect. RE: JSONRPC.NotifyAll resquest sent but no call to onNotification of custom monitor - izprtxqkft - 2024-12-10 had to fake my own data but it appears to work, maybe it's on the monitor side created a generic py to output the JSON (outside of kodi) Code: import json output is this Code: {"jsonrpc": "2.0", "id": 1, "method": "JSONRPC.NotifyAll", "params": {"sender": "plugin.video.kodiconnect.SIGNAL", "message": "testaddon_data", "data": ["{\"test\": \"data\"}"]}} i sent it to kodi while listening with a generic monitor service Code: import xbmc and the log reflects that the monitor received the notification info <general>: Monitor: sender plugin.video.kodiconnect.SIGNAL, method: Other.testaddon_data, data: ["{\"test\": \"data\"}"] |