Witty Fox Smart Plug - Digital Relay
Witty Fox Smart Plug - Digital Relay
The Witty Fox Smart Plug - Digital Relay is an innovative Internet of Things (IoT) device designed to transform traditional household appliances into smart devices, enhancing home automation and remote control capabilities. This compact, Wi-Fi-enabled smart plug combines a digital relay with advanced features, allowing users to monitor, control, and schedule their appliances remotely using a smartphone or tablet.
0C to 40C (32F to 104F)
10% to 90% RH (non-condensing)
| Wi-Fi Frequency | 2.4GHz |
| Wi-Fi Protocol | IEEE 802.11 b/g/n |
100-240V AC, 50/60Hz
15A, 1800W
UL, ETL, FCC, CE, and RoHS compliant
60mm (2.36 inches)
40mm (1.57 inches)
25mm (0.98 inches)
White
Black
1-year limited warranty
Dedicated customer support team for assistance and troubleshooting
The Witty Fox Smart Plug - Digital Relay is an ideal solution for users seeking to enhance their home automation experience, offering a unique blend of convenience, energy efficiency, and remote control capabilities.
Witty Fox Smart Plug - Digital Relay DocumentationOverviewThe Witty Fox Smart Plug - Digital Relay is a Wi-Fi enabled smart plug that allows remote control and monitoring of electrical devices via a mobile app or web interface. This smart plug features a digital relay that can be controlled programmatically, making it an ideal component for IoT projects.Hardware SpecificationsWi-Fi connectivity (2.4GHz)
Digital relay output (max 10A, 250VAC)
Microcontroller: ESP8266
Power supply: 100-240VAC, 50-60Hz
Dimensions: 60 x 40 x 30 mmSoftware SpecificationsCompatible with iOS and Android devices
Supports HTTP and Websocket protocols
Firmware upgradeable via OTA (Over-the-Air)Programming InterfaceThe Witty Fox Smart Plug - Digital Relay can be controlled using the following programming interfaces:HTTP API: Send HTTP requests to control the relay and retrieve its status.
Websocket API: Establish a WebSocket connection to receive real-time updates on the relay's status.Code Examples### Example 1: Controlling the Relay using HTTP API (Python)In this example, we will demonstrate how to control the relay using the HTTP API in Python.
```python
import requests# Set the IP address and API key of your Witty Fox Smart Plug
ip_address = "192.168.1.100"
api_key = "your_api_key_here"# Turn on the relay
response = requests.get(f"http://{ip_address}/relay?state=1&apikey={api_key}")
if response.status_code == 200:
print("Relay turned on")
else:
print("Error turning on relay")# Turn off the relay
response = requests.get(f"http://{ip_address}/relay?state=0&apikey={api_key}")
if response.status_code == 200:
print("Relay turned off")
else:
print("Error turning off relay")
```
### Example 2: Receiving Real-time Updates using Websocket API (JavaScript)In this example, we will demonstrate how to establish a WebSocket connection to receive real-time updates on the relay's status using JavaScript.
```javascript
const WebSocket = require('ws');// Set the IP address and API key of your Witty Fox Smart Plug
const ip_address = "192.168.1.100";
const api_key = "your_api_key_here";// Establish a WebSocket connection
const ws = new WebSocket(`ws://${ip_address}/ws?apikey=${api_key}`);ws.on('message', (message) => {
console.log(`Received message: ${message}`);
const relayState = JSON.parse(message).relay;
if (relayState === 1) {
console.log("Relay is on");
} else {
console.log("Relay is off");
}
});ws.on('error', (error) => {
console.log(`Error occurred: ${error}`);
});ws.on('close', () => {
console.log("WebSocket connection closed");
});
```
### Example 3: Home Automation using IFTTT (Webhook)In this example, we will demonstrate how to use IFTTT (If This Then That) to create a home automation scenario using the Witty Fox Smart Plug.
```markdown
IFTTT Recipe:This: "Sun sets" ( Weather service trigger )
That: "Turn on living room lamp" ( Witty Fox Smart Plug webhook action )Webhook URL: `http://{ip_address}/relay?state=1&apikey={api_key}`
```
In this example, when the sun sets, IFTTT will send an HTTP request to the Witty Fox Smart Plug's webhook URL, turning on the living room lamp.