IoT TP-LINK HS100 Smart Plug bash API Power On Off

Controlling IoT TP-LINK HS100 Smart Plug via Bash API

This article introduces how to turn the IoT TP-LINK HS100 smart plug on/off via API from the command line in Bash. This is the smart plug HS100. The idea is that instead of buying expensive LEDs, you can buy the power plug itself and remotely control the LED itself. Well, for LEDs, I'm satisfied with Lifx because I want features like gradually dimming the light or being able to go up to 9000 lux or down to 2500 lux if needed…

Shou Arisaka
2 min read
Nov 17, 2025

This article introduces how to turn the IoT TP-LINK HS100 smart plug on/off via API from the command line in Bash.

This is the smart plug HS100. The idea is that instead of buying expensive LEDs, you can buy the power plug itself and remotely control the LED itself.

Well, for LEDs, I’m satisfied with Lifx because I want features like gradually dimming the light or being able to go up to 9000 lux or down to 2500 lux if needed, so smart LEDs are better. However, for purposes like just turning on the LED, or automatically turning on the TV, air purifier, or heating appliances when you come home, this should be sufficient.

plasticrake/tplink-smarthome-api: TP-Link Smarthome WiFi API (formerly hs100-api)

npm install -g tplink-smarthome-api
tplinkHost(){
    : abbr of tplink-smarthome-api search
    [ -z $TPLINK_HOST ] && TPLINK_HOST=$(tplink-smarthome-api search | awk '{print $4}' | chomp) ; echo ${TPLINK_HOST}
}

tplink-smarthome-api setPowerState "$(tplinkHost)" "false"
tplink-smarthome-api setPowerState "$(tplinkHost)" "true"

Note that the PC must be connected to the same WiFi. Also be careful with VPN. I wanted to get the current state as well, but couldn’t do it.

As a side note, I bought a 4-pack of Lifx. IoT is now my boom. Just over 10,000 yen on amazon.com. Cheap. For now, I won’t have to worry about home lighting for 5 years.

Share this article

Shou Arisaka Nov 17, 2025

🔗 Copy Links