question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HS220 v2 hardware support?

See original GitHub issue

Just received a HS220 from Amazon today. Packaging was different (smaller) than the previous two I ordered. Switch itself was identical to the other two I already have up and running with this plugin.

Expected Behavior

Shutdown Homebridge, add new switch through the Kasa app and then restart Homebridge. Was expecting new switch to be available through HomeKit.

Current Behavior

Device not available through HomeKit. Looking at the switch, it seems to be going through reboot loops. Even basic light control right from the switch aren’t working and device shows up as offline in Kasa app. Sometimes appear to come online but sending commands fail. Uninstalling this plugin from Homebridge makes the device functional again from the Kasa app.

After several hard reset, realize that it reports as being of “Hardware Version 2.0” where my to other devices report as 1.0. Firmware and MAC address are also quite different: v1.0.3 and B0:95:75 (instead of v1.5.11 and 1C:3B:F3 for my v1.0 hardware devices).

Versions

  • Node: v12.18.1
  • Homebridge: 1.1.1
  • OS: CentOS 7.7.1908

Configuration

        {
            "name": "TplinkSmarthome",
            "platform": "TplinkSmarthome"
        }

Homebridge Log / Command Output

Nothing relevant shows up in the Homebridge log. Only the discovery packet being sent out and the discovery of both my v1.0 devices. 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:35 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
joeiocommented, Jul 23, 2020

If you guys don’t need the energy monitoring portion of the api, you can keep using the plugin by manually editing the file

homebridge/node_modules/homebridge-tplink-smarthome/node_modules/tplink-smarthome-api/lib/client.js

At line 19, replace: const discoveryMsgBuf = encrypt( '{"system":{"get_sysinfo":{}},"emeter":{"get_realtime":{}},"smartlife.iot.common.emeter":{"get_realtime":{}}}' );

with

const discoveryMsgBuf = encrypt('{"system":{"get_sysinfo":{}}}');

Keep in mind that this will break as soon as the plugin is updated or removed and reinstalled in Homebridge.

For my part, I’ve been running with this edit for the past two weeks without any issues.

1reaction
budlitercommented, Sep 29, 2020

Ok - so I figured out how to edit the code per the information above. I have now gotten this to work with a switch in the wall. This approach definitely fixed my problem with it constantly resetting. Thank you to everyone that figured out the line of code that was the problem!

  • You need to update your file manager so you log in as the root user. Note - this approach is a bit risky as you can now edit all system files, so you may want to change back when done. 1) Go to menu>preferences>main menu editor>click on accessories then “new item”. 2) In the launcher properties - Name: Root File Manager | Command: sudo pcmanfm | Comment: Open the file manager as root;
  • This will create a new icon in the accessory drop down for a file manager that is now running as the root user - so all files are editable
  • Run the new icon you created
  • Click view and check “show hidden”
  • Then find the file - for me it is in /usr/lib/node_modules/homebridge-tplink-smarthome/node_modules/tplink-smarthome-api/lib -Right click on the client.js file and edit in Geany…then save

Per the info above - you are changing the following code:

At line 19, replace: const discoveryMsgBuf = encrypt( ‘{“system”:{“get_sysinfo”:{}},“emeter”:{“get_realtime”:{}},“smartlife.iot.common.emeter”:{“get_realtime”:{}}}’ );

with

const discoveryMsgBuf = encrypt(‘{“system”:{“get_sysinfo”:{}}}’);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Download for HS220 - TP-Link
Download for HS220 V3.8. Please choose hardware version: V3.8. V3.8 · V3 · V2 · V1 · >How to find the hardware version...
Read more >
Kasa Smart Wi-Fi Light Switch, Dimmer
Dim from Wherever You Are | HS220. From dinner parties to late-night study sessions, this switch lets you set the right atmosphere for...
Read more >
Kasa Smart Dimmer Switch HS220, Single Pole, Needs ...
Kasa Smart Dimmer Switch HS220, Single Pole, Needs Neutral Wire, 2.4GHz Wi-Fi Light Switch Works with Alexa ... Support: Free Amazon tech support...
Read more >
Kinivo HS220 4K 60Hz Premium HDMI 2.0 Splitter (1X2
Buy Kinivo HS220 4K 60Hz Premium HDMI 2.0 Splitter (1X2 - One Input to Two Outputs) - Supports 4K 60Hz, HDR, High-Speed 18Gbps...
Read more >
TP-Link Kasa Dimmer and Switch Hardware Versions ... - Reddit
Hardware version 2.0 (2.0 on the box, 2 in the app) - Made in China ... and tested was a single HS220 version...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found