My project was to shutdown my PC by using a voice assistant. This is a Russian voice assistant called Alisa (by Yandex) - it’s like Alexa (by Amazon). To do so I found a guide, but it’s in Russian. Anyways you can find it here, because my project isn’t actually mine.
The thing is that you use Blynk and Python. I did everything as it is described in the guide on my old PC with the old version of Blynk on iOS. And it worked. Now I have a new PC and there is a new Blynk app on iOS.
I will try to describe what I’ve done since the guide is in Russian. Please note that I’m completely noob in this kind of things and did everything according to the guide.
- I downloaded the latest Python and installed it on my Windows 11 (yes, I did the %PATH% thing). Also I downloaded some libs. I used these commands:
python -m pip install --upgrade pip
pip install blynklib
pip install pyautogui.
- I created blynk_2.0 folder in C:/Program Files/ where I placed some files. Here is the descriptions from the guide what these files do:
- blynk.py - the main body of the script.
- config.py - configuration file.
- install_libs.bat is a script for installing python libraries from the chapter “Installing Python”.
- nircmd.exe - command-line extension utility.
- start.bat is a batch file for running the script in normal mode.
- start_hide.bat is a batch file for running the script in hidden mode.
- close_script.bat is a batch file for closing a script that works in hidden mode.
- If you want to see the code of the scripts, you can download these files here.
- I registered myself in the new Blynk app on iOS 15.2.1.
- In the app I had to improvise and try to understand it by myself, because in the guide the legacy app was used. So I did this, step by step: Add new device > Quickstart device > OK. I’m ready! > Hardware: ESP32, Connection type: Wi-Fi. And here I need to stop. When I did it on my old PC, I remember that originally the guide said to use NodeMCU. Now the guide was a little bit changed and now it says that it doesn’t matter what device and connection type to select. Well, it seems logic even for a noob like me. But still in the new app there is no NodeMCU.
- After I did this I received an e-mail. I figured out where is my auth token.
- Back to PC. I edited the scripts. In blynk.py I pasted my auth token in
BLYNK_AUTH = "myToken". The same I did in config.py. In config.py I also changed the curpath to
curpath = "С:\\Program Files\\blynk_2.0"(yes, it should have double slash). The same changes with directories I did in strt.bat and strt_hide.bat.
- In config.py I also changed third virtual pin to
V3=[0,"shutdown /s /f"], so it runs CMD and this command and my PC shuts down.
- Back to Blynk app. I edited the template. I deleted all pre-installed buttons and added just one button. In Datastream I chose Button Image (v3) so the button triggers that v3 pin on my PC. Some cosmetic changes were also done.
- Finally I ran strt.bat as an Administrator. The appeared CMD just showed me Blynk logo and… nothing. No errors, no further info. Just a _ pycache _ folder was created in …/blynk_2.0/ folder.
And here is the problem. In the app my device is offline. The button doesn’t work. I tried to trigger the virtual pin via webhook https: . //blynk-cloud . com/my_token/update/V3?value=1, but it also didn’t work. Actually this guide leads to this webhook that I should connect via some workarounds to the voice assistant. But to do so I need Blynk working.
I tried to explain everything as detailed as I can. I double checked the tokens, actually I recreated them six times. I even connected to the same local network, even if it is not necessary. So the question is, how to make it work? If the solution need additional information, I’ll try to provide it. Thank you.