Moxified
(Moxified)
September 12, 2021, 1:12pm
1
I’m finding that if I create selection item mappings that contain odd characters such as < or spaces via the design tab and then subsequently try to use the code tab, it throws errors because they aren’t contained inside quotes.
Example:
Selection item=LivingRoomHeatPump_WideVane mappings=[<<="<<",<="<",|="|",>=">",>>=">>",SWING="SWING"]
Switch item=HarmonyHub_currentActivity mappings=[PowerOff="Off",Watch Video on XBox One="Video",Play Game on XBox One="Game"]
Error: Syntax error at line 107 col 78:
Selection item=LivingRoomHeatPump_WideVane mappings=[<
^
Unexpected lt token: "<". Instead, I was expecting to see one of the following:
If I “fix” the items to have quotes, save, go to design and come right back, the quotes are gone with the errors returned. This makes bulk work via code painful as I have to fix these issues each time.
I suspect I should open an issue but I’m not sure where that would go? Just the Issues · openhab/openhab-core (github.com) ?
rossko57
(Rossko57)
September 12, 2021, 1:53pm
2
As this is about “sitemap editor” I think it’s a UI issue.
Moxified
(Moxified)
September 12, 2021, 2:13pm
3
Moxified
(Moxified)
September 12, 2021, 2:20pm
4
1 Like
I’m currently having the same error on an openHAB 4.0.3 installation. Investigating on this i came across this github issue:
opened 01:05AM - 29 Dec 20 UTC
closed 09:52AM - 15 Dec 22 UTC
main ui
Using the BasicUI. I need to send a command to a device that has a space or a da… sh in it (e.g., Yamaha receiver expects to see "Scene 1" or "Scene 2", or "V-AUX"). I can define these mappings in the sitemap using the GUI editor just fine, and they work as expected. This results in the following code:
```
Frame icon="receiver" label="Receiver" {
Switch icon="switch" label="Power" item=RXA710MainZone_Power
Setpoint icon="soundvolume" item=RXA710MainZone_VolumeindB minValue=-80 maxValue=12 step=0.5 label="Adjust Volume"
Switch icon="soundvolume_mute" label="Mute" item=RXA710MainZone_Mute
Slider icon="soundvolume" label="Volume" item=RXA710MainZone_VolumeindB maxValue=12 minValue=-80 step=0.5
Frame label="Input" {
Switch mappings=[Scene 1="BD/DVD",Scene 2="Dish TV",Scene 3="Roku",Scene 4="Fire Stick"] icon="receiver" item=RXA710MainZone_Scene label="Main"
Switch item=RXA710MainZone_Inputsource mappings=[Bluetooth="Bluetooth",VAUX="Aux",AV1="Nintendo Wii"] label="Other"
}
Switch label="Sound" item=RXA710MainZone_SurroundProgram mappings=[Straight="Straight Src",7ch Stereo="7ch Stereo",Surround_Decoder="Enh Surround"]
}
```
But, the syntax validator flags the whitespace and the dash as errors. E.g.:
```
Error: Syntax error at line 25 col 47:
Switch mappings=[Scene
^
Unexpected WS token: " ". Instead, I was expecting to see one of the following:
A equals token based on:
Mapping → MappingCommand ● %equals MappingLabel
Mappings → ● Mapping
WidgetAttrValue → %lbracket _ ● Mappings _ %rbracket
WidgetAttr → WidgetAttrName ● WidgetAttrValue
WidgetAttrs → ● WidgetAttr
Widget$ebnf$1 → Widget$ebnf$1 ● WidgetAttrs
Widget → %nlwidget _ ● Widget$ebnf$1
Widgets → ● Widget
Widget → %lwidget _ Widget$ebnf$3 __ %lbrace __ ● Widgets __ %rbrace
Widgets → Widgets _ ● Widget
Widget → %lwidget _ Widget$ebnf$3 __ %lbrace __ ● Widgets __ %rbrace
Widgets → Widgets _ ● Widget
Widget → %lwidget _ Widget$ebnf$3 __ %lbrace __ ● Widgets __ %rbrace
Widgets → ● Widget
Widget → %lwidget _ Widget$ebnf$3 __ %lbrace __ ● Widgets __ %rbrace
Widgets → ● Widget
Widget → %lwidget _ Widget$ebnf$3 __ %lbrace __ ● Widgets __ %rbrace
Widgets → ● Widget
Sitemap → %sitemap _ SitemapName __ SitemapLabel __ %lbrace _ ● Widgets _ %rbrace
Main → _ ● Sitemap _
```
Since it reports them as errors, you can't save any changes in the integrated Code editor without "fixing" them, but of course "fixing" them changes the commands to include the quotes since commands are treated as literal strings.
```
runtimeInfo:
version: 3.0.0
buildString: Release Build
locale: en_US
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 11.0.9.1
javaVendor: Ubuntu
osName: Linux
osVersion: 5.4.0-58-generic
osArchitecture: amd64
availableProcessors: 4
freeMemory: 1083634136
totalMemory: 2061500416
bindings:
- airquality
- amazonechocontrol
- hdpowerview
- http
- hue
- networkupstools
- openweathermap
- oppo
- samsungtv
- snmp
- sonos
- unifi
- upnpcontrol
- weatherunderground
- yamahareceiver
clientInfo:
device:
ios: false
android: false
androidChrome: false
desktop: true
iphone: false
ipod: false
ipad: false
edge: false
ie: false
firefox: false
macos: false
windows: true
cordova: false
phonegap: false
electron: false
nwjs: false
webView: false
webview: false
standalone: false
os: windows
pixelRatio: 1
prefersColorScheme: light
isSecureContext: false
locationbarVisible: true
menubarVisible: true
navigator:
cookieEnabled: true
deviceMemory: N/A
hardwareConcurrency: 16
language: en-US
languages:
- en-US
- en
onLine: true
platform: Win32
screen:
width: 1920
height: 1200
colorDepth: 24
support:
touch: false
pointerEvents: true
observer: true
passiveListener: true
gestures: false
intersectionObserver: true
themeOptions:
dark: light
filled: true
pageTransitionAnimation: default
bars: filled
homeNavbar: default
homeBackground: default
expandableCardAnimation: default
userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/87.0.4280.88 Safari/537.36
timestamp: 2020-12-29T01:04:39.538Z
```
which is marked as closed and fixed by this pull request:
openhab:main
← mherwege:sitemap-fixes
opened 04:30PM - 11 Dec 22 UTC
Signed-off-by: Mark Herwege [mark.herwege@telenet.be](mailto:mark.herwege@telene… t.be)
Closes [#1538](https://github.com/openhab/openhab-webui/issues/1538)
Closes [#748](https://github.com/openhab/openhab-webui/issues/748)
Closes [862](https://github.com/openhab/openhab-webui/issues/862)
This PR improves sitemap handling for strings with blanks and special characters.
It also fixes attributes with value 0.
I’m a little confused how to handle this - should i open a new issue on github referencing the above mentioned issue and pr or should i just reopen the old issue?
regards,
Christoph
In the end i created a new issue on Github:
opened 07:53AM - 23 Oct 23 UTC
bug
main ui
<!--
Please DO NOT ERASE this template, but fill in the details as requested. T… his will ensure your issue is properly filed and will be considered. Otherwise, we may reserve the right to close it without further action.
-->
## The problem
When editing a sitemap in openHAB 4.0.3 in the code view, i get the same error as described in this issue:
https://github.com/openhab/openhab-webui/issues/748
A screenshot showing this:

When adding " around the special characters, the errors are fixed until i edit the sitemap in the code view again.
## Expected behavior
The code view should keep the added " signs.
## Steps to reproduce
1. Create a new sitemap with this code:
sitemap page_7376626e53 label="New Sitemap" {
Switch item=test mappings=[TEXT="[=]", SUBTITLE="[_]"]
}
2. Save and close it.
3. Re-open the sitemap and switch to the code view.
## Your environment
<!--
As an admin, in the main UI, choose *Help & About* on the left sidebar, expand *Technical information* and click on *View details*, then click *Copy* and paste the results here. You may omit information that is not pertinent to this issue if you feel it's divulging information you'd like not to share.
-->
```yaml
runtimeInfo:
version: 4.0.3
buildString: Release Build
locale: de-DE
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 17.0.8.1
javaVendor: Private Build
osName: Linux
osVersion: 5.15.0-86-generic
osArchitecture: amd64
availableProcessors: 4
freeMemory: 321543632
totalMemory: 1778384896
startLevel: 100
addons:
- automation-groovyscripting
- automation-jsscripting
- binding-airquality
- binding-astro
- binding-avmfritz
- binding-deconz
- binding-dwdpollenflug
- binding-dwdunwetter
- binding-ecovacs
- binding-enigma2
- binding-exec
- binding-gpstracker
- binding-homeconnect
- binding-http
- binding-icalendar
- binding-kodi
- binding-lgwebos
- binding-mpd
- binding-mqtt
- binding-network
- binding-ntp
- binding-openweathermap
- binding-playstation
- binding-rfxcom
- binding-shelly
- binding-smartmeter
- binding-snmp
- binding-sonos
- binding-systeminfo
- binding-tankerkoenig
- binding-tr064
- binding-unifi
- binding-zwave
- misc-openhabcloud
- persistence-influxdb
- persistence-mapdb
- transformation-bin2json
- transformation-exec
- transformation-jinja
- transformation-jsonpath
- transformation-map
- transformation-regex
- transformation-scale
- transformation-xpath
- transformation-xslt
- ui-basic
- ui-habot
- ui-habpanel
- voice-marytts
- voice-picotts
- voice-porcupineks
- voice-voicerss
- voice-voskstt
clientInfo:
device:
ios: false
android: false
androidChrome: false
desktop: true
iphone: false
ipod: false
ipad: false
edge: false
ie: false
firefox: true
macos: true
windows: false
cordova: false
phonegap: false
electron: false
nwjs: false
webView: false
webview: false
standalone: false
os: macos
pixelRatio: 1
prefersColorScheme: light
isSecureContext: true
locationbarVisible: true
menubarVisible: true
navigator:
cookieEnabled: true
deviceMemory: N/A
hardwareConcurrency: 8
language: de-DE
languages:
- de-DE
- en
onLine: true
platform: MacIntel
screen:
width: 2560
height: 1440
colorDepth: 30
support:
touch: false
pointerEvents: true
observer: true
passiveListener: true
gestures: false
intersectionObserver: true
themeOptions:
dark: light
filled: true
pageTransitionAnimation: default
bars: filled
homeNavbar: default
homeBackground: default
expandableCardAnimation: default
userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0)
Gecko/20100101 Firefox/118.0
timestamp: 2023-10-23T07:51:25.234Z
```
## Browser console
<!--
Open the developer tools in your browser, go to the Console tab and paste errors and other messages that might be relevant to this issue.
You may also paste a screenshot if you prefer.
-->
```txt
```
## Browser network traffic
<!--
Open the developer tools in your browser, go to the Network tab and paste
screenshots of the network traffic and the details of individual requests that failed.
-->
## Additional information
<!--
Provide any information not pertinent to the above sections that you'd still like to share.
-->