esphome/esphome-vscode

Virtual environement?

grischard opened this issue · 6 comments

Has anyone managed to use this with a python venv?

I am also looking for this. The issue I have is that I cannot flash from vcs because esphome is not found. I imagine that there should be a way to activate the venv for this plugin. Besides for that issue it seems everything works fine.

Not that I tried but what if you start code from the venv?

Just in case make sure you close all code instances.

Then from the venv enter code .

:) Thanks. That worked. I was thinking of much more complicated ways to do it... This was simple and to the point.

Did this work for you too @grischard? can we close this then?

Yes, that works for me, but would fit nicely in the documentation :)

Looking in the task provider files in my extension I found that I can add the path to esphome and then it works without having to start it from within the venv.
}, 'esphome compile', 'ESPHome', new vscode.ShellExecution('<path to venv>/bin/esphome ${relativeFile} run --upload-port OTA'));
this was in .vscode/extensions/esphome.esphome-vscode-0.3.0/out/EsphomeTaskProvider.js line 7 for me.

Maybe it would be possible to add a way to configure this in a configuration file so someone can have an alternate esphome binary.
I didn't try this but adding esphome to the system path should also work.