Skip to content

A Home Assistant Integration setting up a remote tunnel for VSCode.

License

Notifications You must be signed in to change notification settings

adechant/ha_vscode

Repository files navigation

Home Assistant VSCode Tunnel

GitHub Release GitHub Activity License

pre-commit Black

hacs Project Maintenance BuyMeCoffee

Community Forum

Home Assistant VSCode Tunel logo

HACS Installation

  1. Install the custom component from HACS.
  2. Restart Home Assistant.
  3. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Home Assistant VSCode Tunnel".
  4. Follow the installation instructions. Authenticating with github is required.
  5. Restart Home Assistant
  6. Turn on the VSCode Tunnel Switch entity to start the tunnel.
  7. Go to https://vscode.dev/your_tunnel_name to access your home assistant files (configuartion.yaml, etc)
  8. Turn off the VScode Tunnel Switch if you want to stop the tunnel and the associated external connection.

https://vscode.dev can't be opened in an iframe, so this will not work as a sidebar menu item in home assistant - YET! Apparently this feature has been requested and hopefully will be available soon! (see microsoft/vscode#150152)

This component will set up the following platforms.

Platform Description
switch VSCode tunnel in your HA Docker container. Turn it on/off with the switch

Manual Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called ha_vscode.
  4. Download all the files from the custom_components/ha_vscode/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Home Assistant"
  8. Turn on the VSCode Tunnel Switch entity to start the tunnel.
  9. Go to https://vscode.dev/your_tunnel_name to access your home assistant files (configuartion.yaml, etc)
  10. Turn off the VScode Tunnel Switch if you want to stop the tunnel and the associated external connection.

Using your HA configuration directory (folder) as a starting point you should now also have this:

custom_components/ha_vscode/translations/en.json
custom_components/ha_vscode/__init__.py
custom_components/ha_vscode/config_flow.py
custom_components/ha_vscode/const.py
custom_components/ha_vscode/exceptions.py
custom_components/ha_vscode/manifest.json
custom_components/ha_vscode/switch.py
custom_components/ha_vscode/vscode_device.py

Configuration is done in the UI

If you are having trouble with authentication, increase the timeout in the options.

If you are experiencing a "reload error" after browsing to https://vscode.dev/your_tunnel_name, ensure that you have "turned on" the switch in your home assistant instance. If you are still having difficulties browse to https://vscode.dev and select you tunnel instance from the workspace dropdown menu at the top of the page.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

Credits

This project was generated from @oncleben31's Home Assistant Custom Component Cookiecutter template.

Code template was mainly taken from @Ludeeus's integration_blueprint template