I am running my home-assistant (not HassIO) as a docker container and wanted to install vscode. Here is what I did.
- create local folders to hold vscode config data
install docker container
docker run --name vscode --restart unless-stopped -p 8443:8443 -itd -v /vscode:/config -v /path_to_hass_config_folder:/config/workspace -e ‘TZ=Australia/Adelaide’ -e PASSWORD=xxx -e SUDO_PASSWORD=xxx linuxserver/code-server
log into vscode web-ui on http://ip:8443. you should be able to see all your hass config files. At this point, we have a working code editor.
However to make it similar to hassio extension, with all those autofill bells and whistles, we need to install a few extensions. I fetched the list from the official addon here.
for some reason I am unable to search for them with in vscode web-ui. so I downloaded vsix files and install them manually. here is how I did it.
a) goto vscode market place and search for the above extensions, one at a time, and download them.
b) move those vsix files to vscode config folder
c) In the vscode web-ui, click on hamburger icon (top left) > view > extensions
d) in the extensions side bar click the 3 dots (’…’) and click “install from vsix”. under /config select and install the extensions, one by one.
- close the vscode web-ui (browser) and reopen it.
- In order to provide home-assistant access to vscode, in the settings, search for home assistant and provide url (http://ip:8123) and a long lived token.
- similarly you need to provide esphome url (http://ip:6052) as well.
hope this helps someone.