30.04.2021

Category: Tp link smart plug api python

Tp link smart plug api python

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again. See more examples. Install the command line utility with npm install -g tplink-smarthome-api. Run tplink-smarthome-api --help for help. Full API docs can be found here.

For functions that send commands, the last argument is SendOptions where you can set the transport 'tcp','udp' and timeout. Functions that take more than 3 arguments are passed a single options object as the first argument and if its a network command, SendOptions as the second. Kind : global class Extends : EventEmitter. Encrypts payload and sends to device. Kind : instance method of Client Returns : Promise.

See Device constructor and Bulb constructor for valid options. See Device constructor and Plug constructor for valid options. Creates a Plug or Bulb after querying device to determine type. See Device constructorBulb constructorPlug constructor for valid options. Kind : instance method of Client Returns : string - 'plug','bulb','device'. Kind : instance method of Client Returns : Client - this Emits : errordevice-newdevice-onlinedevice-offlinebulb-newbulb-onlinebulb-offlineplug-newplug-onlineplug-offlinediscovery-invalid.

Kind : instance method of Client.

TP-Link SMART PLUG REVIEW - HS100 / HS110 Unboxing, Review, HowTo, Kasa, Alexa Tutorial

Kind : event emitted by Client Properties. Kind : global class Extends : DeviceEventEmitter Emits : lightstate-onlightstate-offlightstate-changelightstate-updateemeter-realtime-update See : Device.

Kind : instance method of cloud Returns : Promise. Kind : instance property of emeter. Requests emeter. Supports childId. Kind : instance method of emeter Returns : Promise.

Kind : instance property of lighting. Kind : instance method of lighting Returns : Promise. Kind : instance method of schedule Returns : Promise. Kind : instance method of time Returns : Promise.

Kind : instance property of Bulb. Kind : instance property of Bulb Returns : Object - range. Kind : instance property of Bulb Overrides : alias. Kind : instance property of Bulb Overrides : id.

Kind : instance property of Bulb Overrides : deviceId. Kind : instance property of Bulb Overrides : description. Kind : instance property of Bulb Overrides : model. Kind : instance property of Bulb Overrides : name.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again.

If nothing happens, download the GitHub extension for Visual Studio and try again. Commands can be nested, for example:. A full list of commands is provided in tplink-smarthome-commands. Provide the target IP using -t and a command to send using either -c or -j. Commands for the -c flag:. More advanced commands such as creating or editing rules can be issued using the -j flag by providing the full JSON string for the command. Please consult tplink-smarthome-commands.

Copy tplink-smarthome. TDDP can read and write a device's configuration and issue special commands.

tp link smart plug api python

Commands are issued by setting the appropriate values in the Type and SubType header fields. Data is returned DES-encrypted and requires the username and password of the device to decrypt. Likewise, configuration data to be written to the device needs to be sent encrypted. The DES key is constructed by taking the MD5 hash of username and password concatenated together, and then taking the first 8 bytes of the MD5 hash.

Provide the target IP using -t. They are necessary to decrypt the data that is returned. Provide the command as a two-character hex string, e. What type of data a command might read out will be different for various TP-Link devices.

Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up. Python Lua. Python Branch: master. Find file. Sign in Sign up. Go back.I was scurrying down the home automation isle at the local electronics discounter, firm in my determination to make it without distractions to the computer section, when one of those fancy new Wi-Fi power sockets caught my attention.

I was afraid for a second that this was encrypted data and would only work in your wifi. However I just tried it and it works great. Like Like. Would you have the base64 string for polling as well? Further I wanted to share this PHP snippet of sendtoplug, which might be helpful for someone else. I wrote some Java code using your command strings and it works correctly.

Using Wireshark, I can see the traffic from my code to the device. However, I can't see traffic except the UDP heartbeat via the android app. I ask because I am interested in reverse engineering other similar devices ex. Ankuoo NEO. Right, this works only if you can eavesdrop on the traffic. Maybe it's possible to set up a laptop as an access point for both the mobile phone and the power plug?

I am running Wireshark on a Win10 laptop and can see the phone app sending the UDP messages to port I don't see any TCP messages from the phone.

tp link smart plug api python

Thank you, that worked! I just noticed that it takes a while for the plug to settle on a status; if you query the state right after changing it you still get the old state. Unbelievable but true, I managed to convert your programme into a bash script and integrate it with the rest of the plug script. Thank you for this! Just like you, I tried looking for API when I bought this a couple of months ago but didn't find any. Searched for it again and you had done the research and published it!

TP Link HS110 smartplug linux monitoring with Grafana

So now I just need to figure out how to do the same use C and. Like Liked by 1 person. Thanks for the suggestion. Apparently C async socket connections have become a lot easier in. NET 4. Knowing that I can communicate with my device a TP-Link HS switch via your script gives me a great jumping-off point. According to the authors, there are some security vulnerabilities in the devices. Stroetmann and Esser did their work several months after George first experimented with the HS Well, this is very cool.

I copied your script onto a Raspberry Pi, along with the ha-bridge program.Apr 22 Digging through the internet i found a few scripts that can read data from it. I used a script with Grafana and Prometheus and made a nice dashboard with the collected data. BASH — link. I used the python version of the script with python prometheus exporter. Below are my results. TP Link HS smart-plug general data : state, wireless signal, instant consumption, time running, total power consumption since start.

July 9, at am UTC 3 Link to this comment. Any chance you could write up a guide on how you set this up? September 8, at am UTC 3 Link to this comment. September 27, at am UTC 3 Link to this comment.

Controlling the TP-LINK HS100 Wi-Fi smart plug

January 8, at am UTC 3 Link to this comment. January 8, at pm UTC 3 Link to this comment. I have installed grafana 4. January 9, at am UTC 3 Link to this comment. Grafana is just for showing graphs. For storing data, you need Prometheus.

3d printer flex coupler

Prometheus is one of the data stores for Grafana. It is gathering data by polling info from exporters. Exporters are usually executable files that expose data on a port.

See this as an example for your raspberry : Raspberry exporter. January 24, at am UTC 3 Link to this comment. How did you get the rectangular shape? February 21, at pm UTC 3 Link to this comment. Hello, and thank you for sharing.

Plays Well with Others

February 23, at pm UTC 3 Link to this comment. For me the data source is Prometheus. I think you are using InfluxDB. Am I right? July 13, at pm UTC 3 Link to this comment. September 2, at pm UTC 3 Link to this comment. Unfortunately, I do not really understand what I have to do to record the values and get them in Grafana.

October 15, at pm UTC 3 Link to this comment. Can You be of actual use and write step by step guide with needed hardware how to set this thing up? I think a lot of people would be interested to have detailed graphs as well.

P chart minitab

I am programmer and still have hard time to understand your setup. Your email address will not be published. This site uses Akismet to reduce spam. Learn how your comment data is processed. Powered by WordPress and the Graphene Theme.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again.

The first byte of the plaintext is XORed with the key. The key is then set to the plaintext byte. During the next iteration, the next plaintext byte is XORed with the previous plaintext byte. Decryption works the same, with the keystream made out of cyphertext bytes.

This is known as an autokey cipher and while it has better statistical properties than simple XOR encryption with a repeating key, it can be easily broken by known plaintext attacks. Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up. Python Branch: master. Find file. Sign in Sign up.

Ktsf channel 26 program schedule

Go back. Launching Xcode If nothing happens, download Xcode and try again. Latest commit. Latest commit b Aug 27, You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Add examples. Nov 6, Fixed tuple format for LED setter. Aug 27, Add license and readme. Add json formatting. Add setup script.The TP-Link HS Wi-Fi is a cloud-enabled power plug that can be turned on and off remotely via app and offers energy monitoring and scheduling capabilities.

As part of ongoing research into Internet of Things security, we performed a security analysis by reverse engineering the device firmware and Android app, sniffing app-to-device and device-to-app communications and fuzzing the proprietary protocols being used. TDDP is in use across most of the TP-Link product line including routers and access points and thus merits further research.

We also release a Wireshark dissector and two python clients for the proprietary protocols on GitHub. Security Analysis Summary. Device Setup. The attack is not successful; however repeated deauthentication can be used to perform a temporary Denial of Service attack against the device.

This is the certificate used to verify the identity of the cloud server. A determined attacker could buy his own EV certificate and use it to impersonate a cloud server. The shd binary also contains a copy of OpenSSL 1.

We load the shd binary into IDA and start analyzing!

How to control your TP-Link HS100 smartplug from Internet

For this to work, those values have to be actually used by the shell script invoking udhcpc. As we can see, the hostname is hardcoded and none of the other options are used. Unfortunately, the udhcpc vulnerability is not exploitable in this case. The Webserver on Port 80 replies with a meaningless ellipsis, no matter what the request is:. The first byte of the plaintext is XORed with the key. The key is then set to the plaintext byte.

During the next iteration, the next plaintext byte is XORed with the previous plaintext byte. Decryption works the same, with the keystream made out of cyphertext bytes.

This is known as an autokey cipher and while it has better statistical properties than simple XOR encryption with a repeating key, it can be easily broken by known plaintext attacks.

Appx4fun com xap

We provide a comprehensive list of JSON commands tplink-smarthome-commands. We provide several predefined commands to read out information from the HS Smart Plug using —c options. Alternatively, you can use the —j option and provide the full JSON string:.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Internet of Things Stack Exchange is a question and answer site for builders and users of networked sensors and control devices in the contexts of smart homes, industry automation, or environmental sensors.

It only takes a minute to sign up. Now I able to control the bulb using Kasa app. Like turn on, off, change the colour of the light etc. So I need to set up the same things via an API. I have found some node modules, but I don't know whether the modules are officially published by TP-Link.

They are unlikely to be officially supported by given there is discusion of reverse engineering the protocol, it even includes a wireshark plugin to help decode the network protocol. The only way to get a definitive answer will be to ask tp-link directly or find the documentation on their website.

Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Ask Question.

tp link smart plug api python

Asked 2 years ago. Active 2 years ago. Viewed 2k times. Why do you need them to be officially supported by TP-Link if they work? There is no documentation. So by using this NPM we can get an access token by passing the account credentials. How do I know the expiry time of the access token? If we have a perfect documentation, we don't block with these type of scenarios. This is just an example. Also how long these APIs are work?

Active Oldest Votes. This is an un-official npm. Actually, I don't know how long it should work.


thoughts on “Tp link smart plug api python

Leave a Reply

Your email address will not be published. Required fields are marked *