Automatically protect your inflatable decorations from wind damage by controlling a TP-Link Kasa smart plug based on real-time wind speed data.
WindGuard monitors local wind conditions using the OpenWeatherMap API and automatically turns your TP-Link Kasa outdoor smart plug on or off to protect inflatable decorations. The system uses configurable wind speed thresholds and operates only during scheduled hours.
- Smart wind monitoring: Uses OpenWeatherMap API for real-time local weather data
- Configurable thresholds: Set different wind speeds for turning decorations off and back on
- Time-based operation: Only active during specified hours (default: 5 PM - 10 PM)
- Secure credential storage: TP-Link and API credentials stored in AWS Secrets Manager
- Email notifications: Optional alerts when the plug state changes
- Serverless architecture: Cost-effective with AWS Lambda, triggered every 5 minutes
- Easy deployment: Single CloudFormation template
- TP-Link Kasa Account: Set up a Kasa account and connect your outdoor smart plug
- OpenWeatherMap API Key: Sign up at OpenWeatherMap for a free API key
- AWS Account: Required for deploying the CloudFormation stack
Click the "Launch Stack" button above and fill in the required parameters.
- TPLinkEmail: Your TP-Link Kasa account email
- TPLinkPassword: Your TP-Link Kasa account password
- TPLinkDeviceAlias: The friendly name of your smart plug in the Kasa app
- OpenWeatherApiKey: Your OpenWeatherMap API key
- Latitude: Latitude of your location (decimal degrees)
- Longitude: Longitude of your location (decimal degrees)
- WindOffThreshold: Wind speed (mph) to turn off plug (default: 20)
- WindOnThreshold: Wind speed (mph) to turn on plug (default: 10)
- OnStartHour: Hour to start monitoring (24h format, default: 17)
- OnEndHour: Hour to stop monitoring (24h format, default: 22)
- TimeZone: Your timezone (default: America/New_York)
- NotifyEmail: Email for notifications (optional)
- Weather Monitoring: Every 5 minutes, the Lambda function fetches current wind speed from OpenWeatherMap
- Schedule Check: Verifies if current time is within the configured operating hours
- Threshold Evaluation:
- If wind speed exceeds the "off" threshold during operating hours: turns plug OFF
- If wind speed drops below the "on" threshold during operating hours: turns plug ON
- Notifications: Sends SNS notifications when plug state changes
- Device Control: Uses TP-Link Kasa Cloud API to control the smart plug
- AWS Lambda: Serverless function handling weather checks and device control
- AWS Secrets Manager: Secure storage for TP-Link credentials and API keys
- Amazon EventBridge: Triggers Lambda function every 5 minutes
- Amazon SNS: Sends notifications when plug state changes
- AWS IAM: Least-privilege permissions for Lambda execution
WindGuard is designed to be cost-effective:
- Lambda: ~8,640 invocations/month (free tier covers 1M requests) = FREE
- Secrets Manager: Credential storage = ~$0.40/month
- DynamoDB: State tracking (~8,640 reads, ~100 writes/month) = ~$0.01/month
- SNS: Notifications (50-100 messages/month) = ~$0.0001/month
- EventBridge: Standard rule = FREE
Total estimated cost: $0.41/month ($5/year)
This is less than the cost of a single coffee for a full year of automated decoration protection!
- Device not found: Ensure the TPLinkDeviceAlias exactly matches the name in your Kasa app
- Weather API errors: Verify your OpenWeatherMap API key is valid and active
- No notifications: Check that your email is confirmed in the SNS subscription
View Lambda logs in CloudWatch:
aws logs tail /aws/lambda/WindGuard-WindGuardFunction-XXXXX --followThis project is licensed under the MIT License - see the LICENSE file for details.

