-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Home Assistant sidebar #1880
Home Assistant sidebar #1880
Conversation
@@ -25,6 +25,7 @@ | |||
"license": "MIT", | |||
"icon": "assets/logo.png", | |||
"activationEvents": [ | |||
"onCommand:vscode-home-assistant.fetchEntities", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add other commands there?
if (entities) { | ||
const values: HassEntity[] = Object.values(entities); | ||
await vscode.window.showInformationMessage( | ||
`Fetched ${values.length} entities` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think it's needed anymore
await client.sendRequest("renderTemplate", { template: selectedText }); | ||
`${extensionId}.openEntityLogbook`, | ||
(treeItem) => { | ||
const { hostUrl } = vscode.workspace.getConfiguration()[extensionId]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a clever way to detect if we're using process.env.HASS_SERVER
and process.env.HASS_TOKEN
that's outside language server.
return Promise.resolve(this.getEntityTreeItems(this.entities)); | ||
} | ||
|
||
void vscode.window.showInformationMessage("No entities found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a simple output log will suffice
We should not be using the REST endpoint. If anything, we should get rid of all rest. The REST endpoint isn't really kept up to date or maintained. All of HA is built on top of the WebSockets nowadays. |
Interesting, haven't seen it mentioned in REST API docs and thought it can be used. Thanks for the heads up. |
Your latest addition for groups, will actually create old-style (original for the old, removed states-UI) groups. These groups are actually discouraged. As of Home Assistant 2022.2, the groups.yaml isn't even created anymore (on new installs). The use of platform-specific groups is preferred and function a lot better. |
Could you point me where exactly are they discouraged?
Do you mean cover.group and light.group? I could write a logic that iterates over domains of selected entities, and if they're all the same, the result snippet would be platform-specific... |
We are removing them in multiple places, e.g., the groups.yaml is no more as of this release. As said, the generic groups are leftover from the old UI interface. In most cases, specific groups should be used. For example, if you want to bundle lights, you should use light groups, not groups. The old groups have quite a few issues and often do not provide the expected behavior. Considering that, I would not recommend adding the creation of old-fashioned groups like this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
A long time ago in a galaxy far far away I've made an Items explorer for openhab-vscode extension.
This PR implements a sidebar with the following Tree Views:
Demo
Entities:
Create a group:
TODO:
haConnection
/ websocket subscription and make a REST call to get/states
. This will make things a lot faster, since right now the Entities sidebar waits for LanguageServer to finish loading.fetchEntities
&fetch_entities_completed
cycle - maybe remove it altogetherI know it's a lot to grasp, but it'll be quite a useful feature once it's done 🙌🏻
Cheers! 🍻