- Platform information:
runtimeInfo:
version: 4.0.2
buildString: Release Build
locale: en-US
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 17.0.7
javaVendor: Raspbian
osName: Linux
osVersion: 6.1.21-v8+
osArchitecture: arm
availableProcessors: 4
freeMemory: 112259504
totalMemory: 778567680
startLevel: 100
bindings: null
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.5
prefersColorScheme: light
isSecureContext: false
locationbarVisible: true
menubarVisible: true
navigator:
cookieEnabled: true
deviceMemory: N/A
hardwareConcurrency: 8
language: en-US
languages:
- en-US
- en
onLine: true
platform: Win32
screen:
width: 1707
height: 1067
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/116.0.0.0 Safari/537.36
timestamp: 2023-08-27T14:16:20.749Z
- Issue of the topic: I am in the process of creating new items using a consistent structure so that I can process them using one rule that is able to glean needed information from the item name, inspired by Design Pattern: Working with Groups in Rules.
When I created a new item for an iPhone Thing’s Location Accuracy Channel, it did not behave as I expected from reading the documentation, and from how the Item it is intended to replace behaves.
The Channel is Number (dimensionless). I want a Quantity with a unit to ensure consistency in other calculations.
The old Item, to which I had added the Unit metadata “m” works as expected. The new Item that I created using the “Add Items from Textual Definition” Developer Tool included {Unit=“m”}, appears to be treating the channel input as inches (default for my locale) and converting it to the unit specified in the metadata.
From the UI Channel view of the Thing:
The Items looks the same:
Old:
New:
In the events log, it is clear that the new one is thinking in inches:
2023-08-27 08:33:48.534 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Midway_MLE_Watch_Accuracy' changed from 12.156181357471018 in to 44.00847666450469 in
2023-08-27 08:38:49.784 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Emilys_Apple_Watch_Apple_Watch_SE_Location_Accuracy' changed from 44.00847666450469 m to 12.156181357471018 m
Based upon Units Of Measurement | openHAB
" In case you set a different unit (see above, e.g. km
) that is taken and the item will set it’s state to 5 km.", I would expect that in both cases my Items would get the same behavior and the dimensionless number received from the channel would be taken as in the unit specified in the metadata.
I created a new Item using the UI “Add Link to Item”, create a new item. I created it as the default Number item. It displayed the same number as the old item, but without the unit. Then I edited the Item and changed the Type to Number:Length, and added Unit metadata “m”. At first it displayed the same number and unit as the new item, but after the next update from the channel, it displayed the same number and unit as the old item (and which is the correct data).
Based on the above, I tried changing the new Item type to Number. It immediately displayed the same number as the old item, but without units. I couldn’t figure out how to remove the Unit metadata. I then edited it again back to Number:Length. Unfortunately, it returned to the original behavior and is treating the channel input as inches and converted it to meters.
I’m sure I’m missing something, but can’t figure it out. It seems odd that creating a Number:Length Item with Unit metadata yields a different result than creating a Number Item and then changing it to Number:Length and adding the unit metatdata. I guess it is a path function.