GitHub - openhab/openhab-vscode: VS Code extension for openHAB configuration files is a nice extension for DSL rules where you can get mouse over item state tool tips.
However, it does not seem to work with js files. Is there an equivalent for javascript ?
No, there is no extension for VSCode that supports JS openHAB rules like that.
In the UI one has access to the developer sidebar which provides that sort of thing and more, but through VSCode there’s just support for generic JS extensions that are not openHAB aware.
From JavaScript Scripting - Automation | openHAB
openHAB JavaScript library provides type definitions for most of its APIs to enable code completion is IDEs like VS Code (opens new window). To use the type definitions, install the
openhabnpm package (opens new window)(read the installation guide (opens new window)for more information), and manually import the used namespaces (see above).
You need to special extension for VS Code, VS Code only needs the type definitions available.
You need more than that to do what OP was after, hover over an Item’s name and see it’s current state.
Thx, works great, was looking for that for a long time already ![]()
Ah, sorry did overlook that. Probably I shouldn’t use the community from my phone.
I just updated the extension. Tooltip now also reports variable states if found in the log. All you have to do is log the variable. E.g. myVariable=”state” should appear in the log and when you mouse over it looks like this:
If the string is found in the log and has no = “..” formatting, it looks like this:
Check it out here: Release v1.0.1 · s0170071/openhab-vscode · GitHub
You have to configure the location of the log. In the settings you would search for openhab.log and then edit the settings file:
"openhab.log.openhabLogPath": "/opt/openhab/userdata/logs/openhab.log",
"openhab.log.eventsLogPath": "/opt/openhab/userdata/logs/events.log"
Now Iet me look into breakpoints…
Mouse over for Item values does not work anymore on *.sitemap files. Any idea?
Jep. That never had worked in the first place. Noticed that too. Added sitemap support.
Here you go: Release v1.0.1 · s0170071/openhab-vscode · GitHub
Works like a charm, makes troubleshooting so much easier.
Thx a lot ![]()
I would encourage you to consider a PR or series of PRs with all of these improvements being made. It will benefit the community more widely.
Thx for the PR.
Unfortunately there were no PR merged since years for that repo ![]()
It is part of the openHAB project so it should be possible to get someone to review and merge the PR. Someone may need to volunteer to be a maintainer though if the current maintainer is no longer active. It’s better than needing to fork the repo at least.
Check this out:
The link to the vsix file leads to a 404 error, could you please provide it again?
I had to reinstall my system and unfortunately I did not save this very helpful file.
I did not find any other way to show the actual state of Items in js files … thx a lot.
thanks for the heads up. I updated the link: https://github.com/s0170071/openhab-vscode/releases/ta
The link in the “Downloads” section on GitHub - s0170071/openhab-vscode: VS Code extension for openHAB configuration files · GitHub also results in a 404 error.
Changes in v1.0.1
Added
- Hover tooltips for
.itemsfiles: Hovering over item names in.itemsconfiguration files now provides live state information from the REST API and log files.- Hover tooltips for JavaScript automation files: Item hover tooltips work in
.jsfiles, not just DSL files.- Hover tooltips for sitemap files: Item name hover tooltips work in
.sitemapfiles, includingitem=<name>references on widget lines.- Key-value state extraction from log lines: Hovering a variable found in
events.logoropenhab.logshows its value when the line containsvarname="state"format.
The Hover tooltips for sitemap files don’t work for me.
No, works for me.
Browser cache issue?
https://github.com/s0170071/openhab-vscode/releases/download/v1.0.1/openhab-1.0.1.vsix
Edit: ah, you are talking about another link, sorry


