homematic-community / XML-API

HomeMatic CCU Addon implementing a xml request functionality
https://github.com/homematic-community/XML-API
GNU General Public License v3.0
122 stars 27 forks source link

devicelist.cgi returns invalid xml if device_id is set #93

Open Tommi2Day opened 8 months ago

Tommi2Day commented 8 months ago

Thanks for this great addon

I think I found a small issue running raspberrymatic v3.73.9.20240130 with xml-api Addon 2.3

I call https://ccu.xxx/addons/xmlapi/devicelist.cgi?sid=xxx&device_id=4740,4763 and it returns an invalid xml (for golang)

<?xml version='1.0' encoding='ISO-8859-1' ?><deviceList><device name='Bewegungsmelder Garage' address='000955699D3D84' ise_id='4740' interface='HmIP-RF' device_type='HmIP-SMO' ready_config='true'><channel name='Bewegun
gsmelder Garage:0' type='30' address='000955699D3D84:0' ise_id='4741' direction='UNKNOWN' parent_device='4740' index='0' group_partner='' aes_available='false' transmission_mode='AES' visible='true' ready_config='true' operate='true' /><channel name='Bewegungsmelder Gara
ge' type='17' address='000955699D3D84:1' ise_id='4763' direction='SENDER' parent_device='4740' index='1' group_partner='' aes_available='false' transmission_mode='AES' visible='true' ready_config='true' operate='true' /><channel name='HmIP-SMO 000955699D3D84:2' type='17'
 address='000955699D3D84:2' ise_id='7802' direction='RECEIVER' parent_device='4740' index='2' group_partner='' aes_available='false' transmission_mode='AES' visible='true' ready_config='true' operate='true' /><channel name='HmIP-SMO 000955699D3D84:3' type='26' address='0
00955699D3D84:3' ise_id='7803' direction='UNKNOWN' parent_device='4740' index='3' group_partner='' aes_available='false' transmission_mode='AES' visible='false' ready_config='true' operate='true' /></device><device name='Bewegungsmelder Garage' address='000955699D3D84:1'
 ise_id='4763' interface='HmIP-RF' device_type='MOTIONDETECTOR_TRANSCEIVER' ready_config='true'></deviceList>

[Sat, 17 Feb 2024 14:13:14 CET] ERROR devicelist returned error: XML syntax error on line 1: element <device> closed by </deviceList>

the closing </device> before </devicelist> is missed.

Without the device_id parameter it has the correct output

Maik2208 commented 7 months ago

The problem occurs if you enter the ise_id of a channel and not of a device as device_id