homebridge-lg-thinq-ceiling-fan
v1.2.0
Published
A Homebridge plugin for controlling LG ceiling fans via the LG ThinQ platform with working speed control
Maintainers
Readme
Homebridge LG Ceiling Fan
A Homebridge plugin for controlling LG ceiling fans via the LG ThinQ platform.
Features
- 4-Speed Discrete Control: Shows as 4 distinct speed buttons in Home app (Off, Low, Medium, High, Turbo)
- Power Control: Turn ceiling fan on/off
- Status Monitoring: Real-time status updates from LG ThinQ
- Automatic Authentication: Handles LG ThinQ API authentication
- 🎯 Easy Setup: Built-in UI for automatic LG ThinQ authentication and device discovery
- Auto-Discovery: Automatically discovers LG ceiling fans from your ThinQ account
- Manual Configuration: Configure specific devices with custom settings
- HomeKit Integration: Native HomeKit support through Homebridge
Requirements
- Node.js 14.18.1 or later
- Homebridge 1.3.5 or later
- LG ThinQ account with registered ceiling fans
- LG ThinQ API v2 compatible ceiling fans
Installation
You can install this plugin in two ways:
Option 1: Homebridge Config UI X (Recommended)
- Install via Homebridge Config UI X by searching for "homebridge-lg-thinq-ceiling-fan"
- Configure using the user-friendly setup interface (see Configuration section below)
Option 2: Manual Installation
npm install -g homebridge-lg-thinq-ceiling-fanConfiguration
Easy Setup (Recommended)
This plugin includes a custom user interface for easy configuration. After installation:
- Go to Homebridge Config UI X
- Navigate to the plugin settings for "LG Ceiling Fan"
- Use the authentication interface to:
- Enter your LG ThinQ credentials
- Automatically obtain refresh token
- Discover and configure your ceiling fans
- Save configuration with automatic token refresh
⚠️ Important: Child Bridge Warning
IMPORTANT NOTICE: If you move this plugin to a Child Bridge, the plugin configuration UI becomes inaccessible and there is no way to get back to the configuration interface. This is a known Homebridge issue, not a plugin issue.
Before moving to Child Bridge:
- ✅ Complete all configuration using the plugin UI while it's still in the main bridge
- ✅ Test that authentication and device discovery work properly
- ✅ Ensure all settings are correct and saved
- ✅ Make note of your refresh token and device IDs
If you need to reconfigure after moving to Child Bridge:
- You will need to manually edit the
config.jsonfile - Or temporarily move the plugin back to the main bridge to access the UI
We strongly recommend completing all initial setup before considering Child Bridge separation.
Automatic Token Refresh
The plugin supports automatic token refresh to prevent authentication failures:
Features:
- Auto-Refresh: Automatically refreshes expired tokens without manual intervention
- Credential Storage: Optionally saves your username/password securely for seamless re-authentication
- Fallback Authentication: If refresh token fails, automatically re-authenticates with stored credentials
- Smart Error Handling: Gracefully handles token expiry and network issues
Configuration Options:
auto_refresh: Enable automatic token refresh (default: true)save_credentials: Save username/password for automatic re-authentication (recommended)- When enabled, the plugin will automatically handle token expiry without requiring manual intervention
Security Note: Credentials are stored securely in your Homebridge configuration and only used for automatic token refresh when needed.
Manual Configuration
If you prefer to configure manually, add the following to your Homebridge config.json:
{
"platforms": [
{
"name": "LG Ceiling Fan",
"platform": "LGCeilingFan",
"auth_mode": "token",
"refresh_token": "your_refresh_token_here",
"country": "US",
"language": "en-US",
"auto_refresh": true,
"save_credentials": true,
"username": "[email protected]",
"password": "your_password",
"devices": [
{
"id": "your_device_id",
"name": "Living Room Ceiling Fan",
"model": "LG Ceiling Fan",
"max_speed": 4
}
],
"polling_interval": 30,
"debug": false
}
]
}Configuration Parameters:
auth_mode: Authentication method ("token"recommended)refresh_token: LG ThinQ refresh token (get via Custom UI)country: Your country code (e.g., "US", "TR", "KR")language: Your language code (e.g., "en-US", "tr-TR", "ko-KR")auto_refresh: Enable automatic token refresh (default: true, recommended)save_credentials: Save credentials for automatic re-authentication (recommended)username: LG ThinQ username/email (required if save_credentials is true)password: LG ThinQ password (required if save_credentials is true)devices: Array of ceiling fan configurationspolling_interval: Status update interval in seconds (default: 30)debug: Enable debug logging (default: false)
Configuration Options
Authentication
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| auth_mode | string | Yes | Authentication method: token or account |
| refresh_token | string | If auth_mode = token | LG ThinQ refresh token (use UI to get automatically) |
| username | string | If auth_mode = account | LG ThinQ username |
| password | string | If auth_mode = account | LG ThinQ password |
| country | string | Yes | Country code (e.g., "US", "KR") |
| language | string | Yes | Language code (e.g., "en-US", "ko-KR") |
Device Configuration
| Option | Type | Required | Default | Description |
|--------|------|----------|---------|-------------|
| devices | array | No | [] | List of devices to configure (empty = auto-discover) |
| devices[].id | string | Yes | - | Device ID from LG ThinQ |
| devices[].name | string | No | Device alias | Custom name for the fan |
| devices[].model | string | No | Device type | Fan model name |
| devices[].max_speed | number | No | 5 | Maximum fan speed (1-10) |
Auto-Refresh Configuration
| Option | Type | Required | Default | Description |
|--------|------|----------|---------|-------------|
| auto_refresh | boolean | No | true | Enable automatic token refresh |
| save_credentials | boolean | No | false | Save credentials for automatic re-authentication |
| username | string | If save_credentials = true | - | LG ThinQ username for auto-refresh |
| password | string | If save_credentials = true | - | LG ThinQ password for auto-refresh |
Advanced Options
| Option | Type | Required | Default | Description |
|--------|------|----------|---------|-------------|
| polling_interval | number | No | 30 | Status update interval (seconds) |
| debug | boolean | No | false | Enable debug logging |
Getting Your Refresh Token
Method 1: Using the Built-in UI (Recommended)
The easiest way to get your refresh token is through the plugin's built-in UI:
- Install the plugin
- Go to plugin settings in Homebridge Config UI X
- Click "Plugin Config"
- Enter your LG ThinQ credentials
- Click "Login & Get Refresh Token"
- The token will be automatically saved to your configuration
Method 2: Using Developer Tools
Device Discovery
The plugin can automatically discover LG ceiling fans in two ways:
Auto-Discovery (Recommended)
Use the built-in UI or leave the devices array empty:
- The plugin fetches all devices from your LG ThinQ account
- Filters devices that appear to be ceiling fans
- Automatically configures them with default settings
Supported Features
Fan Control
- Power: Turn fan on/off
- Speed: 4 discrete speed steps (Off, Low, Medium, High, Turbo)
Troubleshooting
Token Issues
Token Expired Error:
- Enable
auto_refreshandsave_credentialsin your configuration - If auto-refresh fails, use the Custom UI to get a new refresh token
- Check your username/password are correct in the configuration
Authentication Failures:
- Verify your LG ThinQ credentials are correct
- Check your country and language codes match your LG account region
- Try using the Custom UI to re-authenticate and get a fresh token
Auto-Refresh Not Working:
- Ensure
auto_refresh: trueandsave_credentials: truein config - Verify
usernameandpasswordare set correctly - Check Homebridge logs for authentication error details
Common Issues
Authentication Failed
- Use the built-in UI for automatic authentication
- Verify your LG ThinQ credentials are correct
- Check country and language codes match your LG account
- Try using account authentication instead of token
No Devices Found
- Use the device discovery feature in the UI
- Ensure your ceiling fans are registered in the LG ThinQ app
- Check that devices are online and accessible
- Try specifying device IDs manually in configuration
Device Not Responding
- Check your internet connection
- Verify the ceiling fan is connected to WiFi
- Use the "Test Token" feature in the UI
- Increase the polling interval to reduce API load
HomeKit Shows "No Response"
- Check Homebridge logs for errors
- Restart Homebridge
- Verify device configuration is correct
- Use the built-in UI to test your authentication
Debug Mode
Enable debug logging by setting debug: true in your configuration. This will provide detailed logs about:
- API authentication
- Device discovery
- Status updates
- Command execution
Getting Device IDs
To find your device IDs:
- Use the built-in UI device discovery feature (recommended)
- Enable debug mode in the plugin configuration
- Restart Homebridge
- Check the logs for discovered devices
- Use the device IDs shown in the logs
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
Credits
Plugin by orkank
Disclaimer
This plugin is not officially supported by LG Electronics. It uses reverse-engineered APIs that may change without notice. Use at your own risk.
Support
If you encounter issues:
- Try the built-in UI for easy setup and testing
- Check the troubleshooting section above
- Enable debug mode and check logs
- Search existing GitHub issues
- Create a new issue with logs and configuration details
For questions and discussion, please use GitHub Discussions.
Changelog
See CHANGELOG.md for version history and updates.
