-
-
Notifications
You must be signed in to change notification settings - Fork 192
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error requesting method listDevices when registering an external XML-RPC Server #2272
Comments
Please provide the full payload of your application trying to register your XMLRPC server to the HMIPServer. |
Hi,
these are the server and the client to register the server.
Server runs on: 192.168.0.50:8000
CCU runs on: 192.168.0.25:2010
Tried Port 2001 and also 2010. Both gave the same result.
According to wireshark, the server responds with an empyt XML-RPC response after registering it.
This is the wireshark trace:
###########################
# INIT Request
###########################
POST /RPC2 HTTP/1.1
Host: 192.168.0.25:2001
Accept-Encoding: gzip
Content-Type: text/xml
User-Agent: Python-xmlrpc/3.10
Content-Length: 221
<?xml version='1.0'?>
<methodCall>
<methodName>init</methodName>
<params>
<param>
<value><string>192.168.0.50:8000</string></value>
</param>
<param>
<value><string>test12</string></value>
</param>
</params>
</methodCall>
###########################
# CCU Response
###########################
HTTP/1.1 200 OK
Content-Type: text/xml; charset=iso-8859-1
Content-Length: 132
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Robots-Tag: none
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Referrer-Policy: no-referrer
Cache-Control: private, no-cache, must-revalidate, no-transform, max-age=0
Date: Fri, 31 Mar 2023 05:59:32 GMT
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse><params><param>
<value></value>
</param></params></methodResponse>
###########################
# Server code
##############################
import xmlrpc.server
class MyServer(xmlrpc.server.SimpleXMLRPCServer):
def __init__(self, addr):
super().__init__(addr, allow_none=True)
self.devices = []
def event(self, device_id, event_type, event_data):
# Handle the event
print(f"Received event from device {device_id}: {event_type} - {event_data}")
def listDevices(self):
# Return a list of all devices
print("List of devices:", self.devices)
return self.devices
def newDevices(self, devices):
# Add new devices to the list
print("add new Devices")
self.devices.extend(devices)
print(f"Added {len(devices)} new devices")
def newDevice(self, device):
# Add a single new device to the list
print("add new Device")
self.devices.append(device)
print(f"Added new device: {device}")
# Create the server and register the methods
server = MyServer(('192.168.0.50', 8000)) # address of server
server.register_function(server.event, 'event')
server.register_function(server.listDevices, 'listDevices')
server.register_function(server.newDevices, 'newDevices')
server.register_function(server.newDevice, 'newDevice')
# Start the server
print("Server started")
server.serve_forever()
##############################
# Client code to register server
##############################
# pylint: disable=C0103
# pylint: disable=C0114
import xmlrpc.client
# Create the client
ccu_ip = "http://192.168.0.25" # IP of the CCU
client = xmlrpc.client.ServerProxy(ccu_ip + ':2001') # tried also Port 2010
# Register the server at the CCU
interface_id = "test12"
client.init('192.168.0.50:8000', interface_id)
# manually Call the listDevices method
devices = client.listDevices()
print("List of devices:", devices)
|
Sorry, but please no email reply to github emails. Use the web browser to edit/add comments and don't answer via email to github emails because all your things end up unformatted in the ticket. And please use code tags for formatting code! |
Sorry, but perhaps you should have a look for other python related projects communicating via XMLRPC to a CCU/RaspberryMatic device like https://github.com/danielperna84/pydevccu from @danielperna84 since this can't be a general issue/bug within RaspberryMatic what you are describing here. And this here isn't a discussion fora where you seek for help in your development but only for reporting issues/bugs that need to be fixed in RaspberryMatic itself. However, if you want I can move over this ticket/issue to the discussion section and then other ppl could help you accordingly. |
Hi Jens, thanks for your time and looking into. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the issue you are experiencing
When registering an external XML-RPC Server (using INIT Method) the CCU should respond with a list Devices.
This doesn't happen, but instead in the log File it appears an error:
Error requesting method listDevices: <class 'TypeError'>:MyServer.listDevices() takes 1 positional argument but 2 were given Code: 1
An external triggerd "listDevices()" respondes with the expected behaviour.
Describe the behavior you expected
When registering an external XML-RPC Server (using INIT Method) the CCU should respond with a list Devices.
This doesn't happen, but instead in the log File it appears an error:
Error requesting method listDevices: <class 'TypeError'>:MyServer.listDevices() takes 1 positional argument but 2 were given Code: 1
An external triggerd "listDevices()" respondes with the expected behaviour.
Steps to reproduce the issue
...
What is the version this bug report is based on?
3.67.10.20230114
Which base platform are you running?
oci (Open Container Infrastructure)
Which HomeMatic/homematicIP radio module are you using?
RPI-RF-MOD
Anything in the logs that might be useful for us?
Additional information
No response
The text was updated successfully, but these errors were encountered: