It becomes part of the add-on when I update the add-on’s POM, I am usually trying to open a PR to the add-on ASAP, but obviously I have to wait for a review (I usually ping @laursen who is really fast at reviewing and merging these PRs, thanks!!).
So I think there is a good chance that it is available in the next snapshot, but if it is not, it should be in the next next snapshot.
EDIT: It’ll be in the next snapshot, my PR was just merged!
I unfortunately missed to announce version 4.7.0 and 4.8.0 here, but anyway, I’m happy to announce openhab-js 4.9.0.
Most notably, we have upgraded JS-Joda to the latest version, which brings several fixes to JS-Joda (accessible from the time namespace) and also managed to shrink the size of the compiled, add-on included openhab-js library, which I hope speeds up library injection.
Please have a look at the changelog to learn more about the changes.
For those who are maintaining rule templates and want to retain backwards support you can use the following technique (which I use in my Persistence Based Presence Simulation rule template).
If you don’t have OHRT (why not! ), the helpers.compareVersions function is as follows:
/**
* Validates that the passed in version number is of the format X.Y.Z where
* X, Y, and Z are numbers.
*
* @param {string} version a version string to validate
* @returns {boolean} true if valid, false otherwise
*/
const _validateVersionNum = (version) => {
const re = /\d+\.\d+\.\d+/;
if (version === null || version === undefined || !(typeof version === 'string')) return false;
return re.test(version);
};
/**
* Compare version numbers of the format X.Y.Z.
*
* @param {string} v1 the first version number
* @param {string} v2 the second version number
* @throws error if v1 or v2 are not parsable
* @returns {-1|0|1} 0 if the versions are equal, -1 if v1 is lower and 1 if v1 is higher
*/
const compareVersions = (v1, v2) => {
if (!_validateVersionNum(v1)) throw v1 + ' is not a valid version number in the format X.Y.Z where X, Y, and Z are numbers!';
if (!_validateVersionNum(v2)) throw v2 + ' is not a valid version number in the format X.Y.Z where X, Y, and Z are numbers!';
const v1Version = Number.parseFloat(v1);
const v1Point = Number.parseInt(v1.split('.')[2]);
const v2Version = Number.parseFloat(v2);
const v2Point = Number.parseFloat(v2.split('.')[2]);
if (v1 == v2) return 0;
else if (v1Version > v2Version) return 1;
else if (v1Version == v2Version && v1Point > v2Point) return 1;
else return -1;
};
We are on track for openHAB 4.2.0, I have just released version 5.1.0 of the openHAB JavaScript library!
Please have a look at my first post to see what’s new,
As we are getting close to the openHAB 4.2.0 Release, we have published two new minor versions in the last week: 5.2.0 and 5.3.0, which bring some last minute additions before the feature freeze.
Hi thanks for the awesome work. Sorry if I have missed anything anywhere already, I’m curious if you had seen the below posts in the OH5 feature request thread in relation to extending the functionality of the send command / update methods in JS?
I have read through the changelog and noticed references to additional parameters for commands. Is there already existing functionality, or is that something that can be added to JS scripting to interact with the source property (string) in item command events? Thanks