google-code-export / openhab

Automatically exported from code.google.com/p/openhab
GNU General Public License v3.0
0 stars 0 forks source link

Mapping uses surrounding quotes as part of key #483

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a sitemap element that requires a mapping.
2. Make a key in the mapping contain a space. You will need to surround it with 
quotes for the key to work.
3. When the value is sent to the openhab server, the surrounding quotes are 
part of the string.

What is the expected output? What do you see instead?
I expect the value to be reported to the binding without the quotes. 

What version of the product are you using? On what operating system?
1.3.1 on Windows 8 x64

Please provide any additional information below.
Trimming the surrounding quotes in the binding is not a viable solution.  This 
is because a problem arises if my sitemap element is a "Selection". When I 
report an update for this value that does not contain the quotes, the client 
application does not seem to know how to map this to the display string.  I 
assume this is because the client is expecting the value from the server to 
contain the surrounding quotes.

Example:
- mappings=[HDMI1=Computer, HDMI2=PS3, "NET RADIO"="NET RADIO"]
- 22:55:19.316 INFO  runtime.busevents[:42] - BsmtReceiver_Input received 
command HDMI1
- 22:56:02.728 INFO  runtime.busevents[:42] - BsmtReceiver_Input received 
command "NET RADIO"

Notice that in the first command there are no quotes around HDMI1, but there 
are around "NET RADIO".

Now it is possible for me to just always put quotes around Strings with 
spaces... But if a user decides to put quotes around all of the words for 
continuity (including words without spaces), then I have problems again because 
I don't know to report updates using spaceless-words with or without quotes.

Original issue reported on code.google.com by ejthill@gmail.com on 4 Oct 2013 at 4:01

GoogleCodeExporter commented 9 years ago
I should also mention that a viable workaround is for me to require all strings 
in my binding to be surrounded by quotes... But this doesn't seem like the 
nicest solution for the user.

Original comment by ejthill@gmail.com on 4 Oct 2013 at 4:08

GoogleCodeExporter commented 9 years ago
I will propose a fix to this with the other UI changes I'm making. It's a 
simple change and one that I've already had to do for the additional color 
attributes.

Original comment by ch...@cd-jackson.com on 25 Oct 2013 at 10:12

GoogleCodeExporter commented 9 years ago
Fixed with https://github.com/openhab/openhab/pull/57

Original comment by kai.openhab on 5 Dec 2013 at 10:14