Skip to content
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

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

Closed
escalate opened this issue Mar 5, 2018 · 2 comments
Closed

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

escalate opened this issue Mar 5, 2018 · 2 comments
Milestone

Comments

@escalate
Copy link
Contributor

escalate commented Mar 5, 2018

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:https://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:https://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:https://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:https://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:https://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:https://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:https://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:https://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).

@escalate escalate changed the title Data Description for urls needs Ordering Data description for urls needs ordering Mar 5, 2018
@escalate escalate changed the title Data description for urls needs ordering Data description for URLs needs ordering Mar 5, 2018
@escalate escalate changed the title Data description for URLs needs ordering Order of data description fields seems to be hard-coded Mar 5, 2018
@bwssytems
Copy link
Owner

Will take a look

@bwssytems bwssytems added the bug label Mar 8, 2018
@bwssytems bwssytems added this to the 5.2.0 milestone Mar 8, 2018
@bwssytems
Copy link
Owner

Good catch! It was in the javascript function that formats the urls for backwards compatability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants