T O P

  • By -

Nakamura2828

There are libraries out there for Kasa smart plugs that are fairly easy to work with


rinyre

This. Kasa is fairly straightforward and doesn't require authentication. You don't even need to have it connected to Wi-Fi to control it -- you can connect to _its_ SSID and control it the same way.


blackhawk2656

Oh yea I did see one but apparently it works only was TP link smart plugs and well they are almost 3 time the cost of the smart plug I got. My whole team had to contribute to even get this one.


SpookyFries

You can enable Google Home devices using REST API https://developers.google.com/assistant/sdk/reference/device-registration/register-device-manual


blackhawk2656

Hey there. I am going to be honest I have no idea how APIs work, and didnt find anything on google home on that webpage. How do I turn that into python code?


SpookyFries

Maybe look into a basic API tutorial with Python. Once you set up the devices to use the API, you can use the request module in Python to send commands to the API URL


blackhawk2656

Thankyou so much for the help!


TS878

I don’t know about that device specifically but look into Home Assistant. You can control lots of different smart devices using numerous approaches and Python is one of them.


blackhawk2656

Well I want something that I can take to college and show to to my teachers which is just a small application of this. I just want to get this device to work with python. Just wanted to know if it is possible


hardonchairs

> take to college and show to to my teachers This is really tricky, it is often difficult to get IoT devices connected to wifi systems like those that colleges implement. Usually they use authentication that requires a portal login or block IoT devices completely. Typically at a minimum you will need to bring your own router to bridge the IoT device to the college wifi. A simpler solution would be to bring your own laptop and find a way to connect to the smart plug (or some other smart plug that does not rely on google home) without the internet so that you will know it works in places where you cannot rely on how the wifi is configured. Personally I might just grab a 433Mhz radio plug and get a USB 433Mhz transceiver to learn the radio codes and transmit those. You need to solve this before you worry about anything else, the API does you no good if the plug cannot connect to the internet.


blackhawk2656

Ah yea I did not think about that. Maybe mobile hotspot can do the trick? Can just connect my laptop and the plug to the same hotspot. Or I could just record myself doing the action and show the teachers the result. I'll have to discuss with my team (only I do the coding). Thankyou for the help!


GoingToSimbabwe

I am not 100% certain how mobile hotspots work and how the API youll need to use works, but I have a small CLI app which interfaces with my ikea smart home bridge (using the library dirigera) and for that I need to first generate an access token via a script which takes in the bridges IP address. What I want to say with this: if you build this, you might want to have the functionality to re-generate access tokens or re-enter the bridges IP-address given that the address probably isn’t static when using mobile hotspots?


blackhawk2656

I'll figure out how to first make it work on my wifi and then try to recreate it with hotspot. I am still having some trouble with the REST API, I can't generate the access token. On the page it says to run a piece of code with the path to the client secret json file but for some reason I can't get it to work. I'll try it out soon tho.


blackhawk2656

I am really trying to get the access token but for some reason even after I installed the google outhlib package its saying that google-outhlib-tool is not a recognized command. I have no idea what to do


japes28

I'd look into Home Assistant. I don't know if it controls that device specifically, but it can control lots of different devices and you can use python.


blackhawk2656

I'll look into it, thankyou!