'Turn on/off local wifi device with bash script

I have a raspberry pi in my local wifi network. Also I bought smart socket which can be integrated with Alexa or Google Home Assistant. What is a best option to turn the socket on/off from my raspberry? I thought about installing alexa or google home assistant on the raspberry and somehow use one of these to control my socket. However I don't want to do that by voice but simply a bash script.



Solution 1:[1]

It is possible to control the local wifi device with a bash script. You can use ifconfig to bring an interface up/down and configure it accordingly. But, it also depends on the integration of the smart socket with Alexa/Assistant, whether the manufacturer provides their own API endpoints for you to use or whether the user interacts through Assistant/Alexa. If you are using Google Assistant, you can leverage automations on Google Home App to control the device automatically.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anish Yadav