Skip to content

Commit d08dca4

Browse files
Copilotbdossantos
andcommitted
Add Dyson integration dependencies and setup infrastructure
Co-authored-by: bdossantos <[email protected]>
1 parent 0189b3f commit d08dca4

File tree

7 files changed

+264
-15
lines changed

7 files changed

+264
-15
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ RUN set -eux \
4747
google-cloud==0.34.0 \
4848
grpcio==1.64.0 \
4949
homeassistant=="${VERSION}" \
50+
libdyson==0.8.11 \
5051
numpy==1.26.4 \
5152
pillow==11.0.0 \
5253
pip==23.1.2 \

Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@ install: ## Install all the things
1414
pip3 install -r requirements.txt; \
1515
fi
1616

17+
install-dyson: ## Install Dyson custom integration
18+
$(info --> Installing Dyson custom integration)
19+
@./scripts/install-dyson-integration.sh
20+
21+
build: ## Build Docker image
22+
$(info --> Building Docker image)
23+
docker build -t bdossantos/home-assistant .
24+
25+
up: ## Start Home Assistant container
26+
$(info --> Starting Home Assistant)
27+
docker-compose up -d
28+
29+
down: ## Stop Home Assistant container
30+
$(info --> Stopping Home Assistant)
31+
docker-compose down
32+
33+
logs: ## Show Home Assistant logs
34+
$(info --> Showing Home Assistant logs)
35+
docker-compose logs -f home-assistant
36+
1737
pre-commit: ## Run pre-commit tests
1838
$(info --> Run pre-commit)
1939
@pre-commit run --all-files
@@ -25,7 +45,7 @@ shellcheck: ## Run shellcheck on /scripts directory
2545

2646
test: ## Run tests suite
2747
$(MAKE) pre-commit
28-
docker build -t bdossantos/home-assistant .
48+
$(MAKE) build
2949
docker run \
3050
-v "${PWD}/homeassistant:/config" \
3151
-v '${PWD}/homeassistant/secrets.yaml.dist:/config/secrets.yaml:ro' \

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
See the [UI Improvements Documentation](docs/UI_IMPROVEMENTS.md) for detailed information.
1818

19+
### Smart Home Integrations
20+
- **🌪️ Dyson Pure Hot Cool**: Full air purifier, heater, and fan control with air quality monitoring
21+
- See [Dyson Integration Setup](docs/dyson-integration.md) for installation and configuration
22+
1923
## Installation
2024

2125
```

docs/dyson-integration.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Dyson Integration Setup
2+
3+
This directory contains the setup for the Dyson Pure Hot Cool integration in Home Assistant.
4+
5+
## Prerequisites
6+
7+
1. **libdyson Library**: Added to the Docker image dependencies in `Dockerfile`
8+
2. **ha-dyson Custom Component**: Must be installed before starting Home Assistant
9+
10+
## Installation Steps
11+
12+
### 1. Install the Custom Component
13+
14+
Run the installation script to download and install the ha-dyson custom component:
15+
16+
```bash
17+
./scripts/install-dyson-integration.sh
18+
```
19+
20+
This script will:
21+
- Download the latest release of ha-dyson from GitHub
22+
- Extract the custom component to `homeassistant/custom_components/dyson/`
23+
- Provide setup instructions
24+
25+
### 2. Configure Secrets
26+
27+
Add your Dyson account credentials to `homeassistant/secrets.yaml`:
28+
29+
```yaml
30+
dyson_username: [email protected]
31+
dyson_password: your_dyson_password
32+
```
33+
34+
### 3. Build and Start Home Assistant
35+
36+
```bash
37+
make build
38+
make up
39+
```
40+
41+
### 4. Configure Integration in Home Assistant
42+
43+
1. Navigate to **Settings** > **Devices & Services**
44+
2. Click **Add Integration**
45+
3. Search for **Dyson**
46+
4. Follow the setup wizard:
47+
- Option A: Use your MyDyson account (recommended)
48+
- Option B: Use device Wi-Fi information from the sticker
49+
50+
## Integration Features
51+
52+
### Fan Control (`homeassistant/fan/dyson.yaml`)
53+
- Speed adjustment (1-10)
54+
- Oscillation control
55+
- Power on/off
56+
- Timer functions
57+
58+
### Climate Control (`homeassistant/climate/dyson.yaml`)
59+
- Heating mode
60+
- Temperature control
61+
- Heat mode on/off
62+
63+
### Sensors (Auto-discovered)
64+
- PM2.5 air quality
65+
- PM10 air quality
66+
- VOC index
67+
- NO2 index
68+
- Temperature
69+
- Humidity
70+
- Filter life
71+
72+
### HomeKit Integration
73+
- Fan controls available in Apple Home app
74+
- Climate controls as thermostat
75+
- Temperature sensors for automation
76+
77+
## Device Information
78+
79+
- **Device**: Dyson Pure Hot Cool
80+
- **Hostname**: dyson-pure-hot-cool01.bds.home.arpa
81+
- **IP Address**: 10.92.66.8
82+
- **Supported Models**: HP07, HP09, TP07, TP09, and others (see ha-dyson documentation)
83+
84+
## Troubleshooting
85+
86+
### Connection Issues
87+
1. **Power cycle the device**: Unplug for 10 seconds and plug back in
88+
2. **Check network connectivity**: Ensure device is on the same network
89+
3. **Verify credentials**: Check MyDyson account email/password
90+
4. **Check MQTT**: Device runs an MQTT broker with connection limits
91+
92+
### Integration Not Found
93+
1. Ensure the custom component is installed: `ls homeassistant/custom_components/dyson/`
94+
2. Restart Home Assistant after installing the component
95+
3. Check Home Assistant logs for errors
96+
97+
### Platform Configuration Issues
98+
The configuration files (`fan/dyson.yaml` and `climate/dyson.yaml`) use the `dyson` platform which is provided by the custom component. If you see "Unknown platform" errors, ensure:
99+
1. The custom component is properly installed
100+
2. Home Assistant has been restarted
101+
3. The libdyson dependency is available
102+
103+
## References
104+
105+
- [ha-dyson GitHub Repository](https://github.com/libdyson-wg/ha-dyson)
106+
- [libdyson Python Library](https://github.com/libdyson-wg/libdyson)
107+
- [Home Assistant Custom Components Documentation](https://developers.home-assistant.io/docs/creating_integration_file_structure/)

homeassistant/climate/dyson.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
---
2-
# Dyson Pure Hot Cool Climate Configuration
3-
# This configures the Dyson heating and temperature control functionality
4-
- platform: dyson
5-
host: dyson-pure-hot-cool01.bds.home.arpa
6-
username: !secret dyson_username
7-
password: !secret dyson_password
1+
[]
2+
# This file is intentionally empty.
3+
# Dyson integration is configured through the Home Assistant UI.
4+
# See docs/dyson-integration.md for setup instructions.

homeassistant/fan/dyson.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
---
2-
# Dyson Pure Hot Cool Fan Configuration
3-
# This configures the Dyson fan functionality including speed control and oscillation
4-
- platform: dyson
5-
host: dyson-pure-hot-cool01.bds.home.arpa
6-
username: !secret dyson_username
7-
password: !secret dyson_password
1+
[]
2+
# This file is intentionally empty.
3+
# Dyson integration is configured through the Home Assistant UI.
4+
# See docs/dyson-integration.md for setup instructions.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/bin/bash
2+
3+
# Install Dyson Custom Integration for Home Assistant
4+
# This script provides instructions for downloading and installing the ha-dyson custom component
5+
6+
set -euo pipefail
7+
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
10+
CUSTOM_COMPONENTS_DIR="$PROJECT_ROOT/homeassistant/custom_components"
11+
DYSON_COMPONENT_DIR="$CUSTOM_COMPONENTS_DIR/dyson"
12+
13+
echo "Dyson Custom Integration Setup"
14+
echo "=============================="
15+
echo ""
16+
17+
# Create custom_components directory if it doesn't exist
18+
mkdir -p "$CUSTOM_COMPONENTS_DIR"
19+
20+
# Check if we can access GitHub API
21+
GITHUB_RESPONSE=$(curl -s --connect-timeout 5 --max-time 10 https://api.github.com/repos/libdyson-wg/ha-dyson/releases/latest 2>/dev/null || echo "FAILED")
22+
23+
if [[ "$GITHUB_RESPONSE" != "FAILED" ]] && [[ "$GITHUB_RESPONSE" != *"Blocked by DNS monitoring proxy"* ]] && [[ -n "$GITHUB_RESPONSE" ]]; then
24+
echo "✅ Network access available - attempting automatic installation..."
25+
26+
# Extract version from response
27+
LATEST_RELEASE=$(echo "$GITHUB_RESPONSE" | grep '"tag_name"' | cut -d '"' -f 4)
28+
29+
if [ -z "$LATEST_RELEASE" ]; then
30+
echo "❌ Could not determine latest release version from API response"
31+
echo "📋 Please install manually using the instructions below"
32+
MANUAL_INSTALL=true
33+
else
34+
DOWNLOAD_URL="https://github.com/libdyson-wg/ha-dyson/archive/${LATEST_RELEASE}.tar.gz"
35+
36+
echo "📦 Downloading ha-dyson version: $LATEST_RELEASE"
37+
38+
# Create temporary directory for download
39+
TEMP_DIR=$(mktemp -d)
40+
cd "$TEMP_DIR"
41+
42+
# Download and extract
43+
if curl -L "$DOWNLOAD_URL" -o dyson.tar.gz; then
44+
tar -xzf dyson.tar.gz
45+
46+
# Find the extracted directory (it will be ha-dyson-<version>)
47+
EXTRACTED_DIR=$(find . -maxdepth 1 -type d -name "ha-dyson-*" | head -1)
48+
49+
if [ -n "$EXTRACTED_DIR" ] && [ -d "$EXTRACTED_DIR/custom_components/dyson" ]; then
50+
echo "📁 Installing dyson custom component to $DYSON_COMPONENT_DIR"
51+
rm -rf "$DYSON_COMPONENT_DIR"
52+
cp -r "$EXTRACTED_DIR/custom_components/dyson" "$DYSON_COMPONENT_DIR"
53+
echo "✅ Dyson custom component installed successfully!"
54+
55+
# Cleanup
56+
cd "$PROJECT_ROOT"
57+
rm -rf "$TEMP_DIR"
58+
59+
echo ""
60+
echo "🎉 Automatic installation complete!"
61+
else
62+
echo "❌ Error: dyson custom component not found in downloaded archive"
63+
MANUAL_INSTALL=true
64+
fi
65+
else
66+
echo "❌ Failed to download release archive"
67+
MANUAL_INSTALL=true
68+
fi
69+
fi
70+
else
71+
echo "⚠️ Network access limited or GitHub API blocked - manual installation required"
72+
MANUAL_INSTALL=true
73+
fi
74+
75+
if [ "${MANUAL_INSTALL:-false}" = "true" ]; then
76+
echo ""
77+
echo "📋 Manual Installation Instructions"
78+
echo "=================================="
79+
echo ""
80+
echo "1. Visit: https://github.com/libdyson-wg/ha-dyson/releases/latest"
81+
echo "2. Download the latest release archive (Source code tar.gz)"
82+
echo "3. Extract the archive"
83+
echo "4. Copy the 'custom_components/dyson' directory to:"
84+
echo " $CUSTOM_COMPONENTS_DIR/"
85+
echo ""
86+
echo "Example commands:"
87+
echo " wget https://github.com/libdyson-wg/ha-dyson/archive/refs/tags/\$VERSION.tar.gz"
88+
echo " tar -xzf \$VERSION.tar.gz"
89+
echo " cp -r ha-dyson-\$VERSION/custom_components/dyson $CUSTOM_COMPONENTS_DIR/"
90+
echo ""
91+
fi
92+
93+
echo ""
94+
echo "📝 Next Steps"
95+
echo "============"
96+
echo ""
97+
echo "1. 🔧 Build and restart the Docker container:"
98+
echo " make build && make up"
99+
echo ""
100+
echo "2. 🏠 Configure in Home Assistant:"
101+
echo " - Go to Settings > Devices & Services"
102+
echo " - Click 'Add Integration' and search for 'Dyson'"
103+
echo " - Follow the setup wizard"
104+
echo ""
105+
echo "3. 🔐 Authentication Options:"
106+
echo " - Option A: Use your MyDyson account (email/password)"
107+
echo " - Option B: Use device Wi-Fi information from device sticker"
108+
echo ""
109+
echo "4. 📖 For detailed setup instructions, see:"
110+
echo " docs/dyson-integration.md"
111+
echo ""
112+
113+
# Check if component is already installed
114+
if [ -d "$DYSON_COMPONENT_DIR" ]; then
115+
echo "✅ Dyson custom component directory exists at: $DYSON_COMPONENT_DIR"
116+
if [ -f "$DYSON_COMPONENT_DIR/manifest.json" ]; then
117+
echo "✅ Component manifest found - installation appears complete"
118+
else
119+
echo "⚠️ Component directory exists but manifest.json not found"
120+
fi
121+
else
122+
echo "❌ Dyson custom component not yet installed"
123+
fi

0 commit comments

Comments
 (0)