Skip to content

Order of data description fields seems to be hard-coded #910

@escalate

Description

@escalate

If I send a request where the data description of the URL-fields are in a order like the following I get all fields filled correctly in the Web-UI.

REQUEST
{  
   "name":"bedroom light",
   "deviceType":"switch",
   "onUrl":"[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41\",\"type\":\"veraDevice\"}]",
   "offUrl":"[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41\",\"type\":\"veraDevice\"}]"
}

RESPONSE
{  
   "id":"12345",
   "name":"bedroom light",
   "deviceType":"switch",
   "onUrl":"[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41\",\"type\":\"veraDevice\"}]",
   "offUrl":"[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41\",\"type\":\"veraDevice\"}]"
}

But if I change the order like in the following example the HA-Bridge does not parse it. In the end I get the whole JSON string in the field "Target Item" in the Web-UI.

REQUEST
{  
   "name":"bedroom light",
   "deviceType":"switch",
   "onUrl":"[{\"type\":\"veraDevice\",\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41\"}]",
   "offUrl":"[{\"type\":\"veraDevice\",\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41\"}]"
}
RESPONSE
{  
   "id":"12345",
   "name":"bedroom light",
   "deviceType":"switch",
   "onUrl":"[{\"type\":\"veraDevice\",\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41\"}]",
   "offUrl":"[{\"type\":\"veraDevice\",\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41\"}]"
}

It seams the order of the data description is hard-coded.
It would be better if the order of the data description would not be static or a real JSON list (like requested in issue #909).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions