Hi,
Iām finding a few bugs and wondering if anyone knows anything about them before I submit issues on gitub.
1. time.Duration
const timerDuration = items.getItem('BackHall_Ceiling_Light_MotionTimer').state // A Number Item
console.info(time.Duration.ofSeconds(1))
console.info(time.Duration.ofMinutes(1))
console.info(time.Duration.ofSeconds(timerDuration))
give me PT1S
, PT1M
, and PT1S
respectively.
But
console.info(time.Duration.ofMinutes(timerDuration))
throws an error:
ArithmeticException: Multiplication overflows: 1 * 60: ArithmeticException: Multiplication overflows: 1 * 60
and ofHours
says something similar:
ArithmeticException: Multiplication overflows: 1 * 3600: ArithmeticException: Multiplication overflows: 1 * 3600
only āofSecondsā seems to work.
2. things.getThings() .setLabel
When I change a thingās label with JS Scripting, it works, but doesnāt stick after a reboot.
things.getThing('test:thing:45636344247:62464367').setLabel('A New Label')
3. items.replaceItem
With JS Scripting, if I set the giBaseType to āStringā, it doesnāt apply this to the new item. Other base types and aggregation functions work fine.
items.replaceItem({
type: 'Group',
name: 'Item_Name',
label: 'Item Label',
groups: ['group1', 'group2'],
tags: ['Setpoint'],
category: 'lightbulb',
giBaseType: 'Switch'
// groupFunction: aggregationFunction
});
4. Applying metadata
When I apply metadata (any kind) using JS scripting, it works, but the UI displays āNot Setā
let itemToEdit = items.getItem('Test_Item);
itemToEdit.replaceMetadata('stateDescription', '', { options: 'ON=MOTION,OFF=NO MOTION'} );
5. material icons
I can apply a material icon and it works in most places.
but it shows as blank in a default list widget
******** I Posted this in the wrong place and am moving it here. I already got a reply which Iāll post here: *******
Please post to openHAB 4.0 SNAPSHOT discussion where the 4.0 SNAPSHOT problems are discussed.
Note that timerDuration
in this case is a String. The .state
is always a String. You might need to parse it to a Number first.
But in any case, this is 100% implemented in the joda-js library so any issue would need to be filed and corrected there. Itās not an OH problem.
How is the Thing defined? In a text file or through the UI?
What use case would have you changing the label of a Thing?
Note, this code is not correct (missing a closing ā on the first line).
Which version of openhab-js are you using? The metadata was completely reworked in the latest release.
Show the full config from the āCodeā tab.
You are testing the 4.0 SNAPSHOT. Tons of breaking changes are being introduced with almost every build. Welcome to the bleeding edge.