Table of Contents
- Gardena Smart System Integration v2.0.0
β οΈ Important: Complete Reimplementation- π v2 New Features
- π§ͺ Testing Status
- π Features
- π§ Available Services
- π οΈ Installation
- π§ Technical Architecture
- π§ͺ Tests
- π Migration from Previous Versions
- π Troubleshooting
- π€ Contribution
- π License
- π Useful Links
A complete reimplementation of the Home Assistant integration for the Gardena Smart System, based on Gardena's v2 API.
This is a complete rewrite of the Gardena Smart System integration. It is strongly recommended to:
- Remove the existing integration from Home Assistant
- Restart Home Assistant
- Re-add the integration with this new version
This ensures a clean installation and prevents any conflicts between the old and new implementations.
- New API v2: Uses Gardena's completely new API architecture
- Modern Framework: Built using the latest Home Assistant integration patterns
- Improved Architecture: Better state management and error handling
- Enhanced Features: More reliable device detection and control
- Modern Architecture : Uses Home Assistant recommended patterns
- Standardized Framework : Based on the official integration framework
- Python 3.11+ : Support for recent Python versions
- API v2 : Uses the new Gardena Smart System API
- Centralized State Management : Coordinator for data synchronization
- Automated Tests : Unit tests with mocks
- Lawn Mower (
lawn_mower) : β Fully tested and functional- Start/pause/dock controls working
- Real-time status updates via WebSocket
- Custom service buttons operational
- Smart Irrigation Control (
valve) : β Fully tested and functional- Multiple valve control (6 valves detected)
- Open/close operations working
- Real-time status updates
- Power Socket (
switch) : β Fully tested and functional- On/off control working
- Real-time status updates
- Water Control (
valve) :β οΈ Implementation complete but not tested- Single valve control implementation ready
- Needs real device testing
- Sensors (
sensor) :β οΈ Implementation complete but not tested- Temperature, humidity, light sensors
- Soil sensors implementation ready
- Needs real device testing
- Lawn Mowers (
lawn_mower) : Control of automatic lawn mowers - Sensors (
sensor) : Temperature, humidity sensors, etc. - Binary Sensors (
binary_sensor) : Online/offline status - Switches (
switch) : Smart power sockets - Valves (
valve) : Irrigation valves
- Start mowing
- Pause
- Return to charging station
- State and activity monitoring
The integration provides several services that can be called from automations, scripts, or the Developer Tools. All services require a device_id parameter.
Start automatic mowing (follows the device's schedule).
Parameters:
device_id(required): The device ID of the lawn mower
Example:
service: gardena_smart_system.mower_start
data:
device_id: "your_mower_device_id"Start manual mowing for a specified duration.
Parameters:
device_id(required): The device ID of the lawn mowerduration(optional): Duration in seconds (60-14400, default: 1800)
Example:
service: gardena_smart_system.mower_start_manual
data:
device_id: "your_mower_device_id"
duration: 3600 # 1 hourPark the mower until the next scheduled task.
Parameters:
device_id(required): The device ID of the lawn mower
Example:
service: gardena_smart_system.mower_park
data:
device_id: "your_mower_device_id"Park the mower until further notice (ignores schedule).
Parameters:
device_id(required): The device ID of the lawn mower
Example:
service: gardena_smart_system.mower_park_until_notice
data:
device_id: "your_mower_device_id"Turn on the power socket for a specified duration.
Parameters:
device_id(required): The device ID of the power socketduration(optional): Duration in seconds (60-86400, default: 3600)
Example:
service: gardena_smart_system.power_socket_on
data:
device_id: "your_power_socket_device_id"
duration: 7200 # 2 hoursTurn on the power socket indefinitely.
Parameters:
device_id(required): The device ID of the power socket
Example:
service: gardena_smart_system.power_socket_on_indefinite
data:
device_id: "your_power_socket_device_id"Turn off the power socket immediately.
Parameters:
device_id(required): The device ID of the power socket
Example:
service: gardena_smart_system.power_socket_off
data:
device_id: "your_power_socket_device_id"Pause automatic operation of the power socket.
Parameters:
device_id(required): The device ID of the power socket
Example:
service: gardena_smart_system.power_socket_pause
data:
device_id: "your_power_socket_device_id"Resume automatic operation of the power socket.
Parameters:
device_id(required): The device ID of the power socket
Example:
service: gardena_smart_system.power_socket_unpause
data:
device_id: "your_power_socket_device_id"Open the valve for a specified duration.
Parameters:
device_id(required): The device ID of the valveduration(optional): Duration in seconds (60-14400, default: 3600)
Example:
service: gardena_smart_system.valve_open
data:
device_id: "your_valve_device_id"
duration: 1800 # 30 minutesClose the valve immediately.
Parameters:
device_id(required): The device ID of the valve
Example:
service: gardena_smart_system.valve_close
data:
device_id: "your_valve_device_id"Pause automatic operation of the valve.
Parameters:
device_id(required): The device ID of the valve
Example:
service: gardena_smart_system.valve_pause
data:
device_id: "your_valve_device_id"Resume automatic operation of the valve.
Parameters:
device_id(required): The device ID of the valve
Example:
service: gardena_smart_system.valve_unpause
data:
device_id: "your_valve_device_id"Force reconnection of the WebSocket connection.
Parameters: None
Example:
service: gardena_smart_system.reconnect_websocketReload the Gardena Smart System integration.
Parameters: None
Example:
service: gardena_smart_system.reloadGet WebSocket connection diagnostics and status information.
Parameters:
detailed(optional): Include detailed connection information (default: false)
Example:
service: gardena_smart_system.websocket_diagnostics
data:
detailed: trueTo find the device ID for a specific device:
- Go to Developer Tools > States
- Search for your device (e.g., "mower", "valve", "switch")
- Look for the
device_idattribute in the entity state - Or check the entity's unique ID (usually contains the device ID)
Example entity state:
device_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"Before installing this new version, you must remove the existing Gardena Smart System integration:
- Go to Configuration > Integrations
- Find Gardena Smart System in the list
- Click on it and select Delete
- Confirm the deletion
- Restart Home Assistant
- Copy the
custom_components/gardena_smart_systemfolder to yourconfig/custom_components/folder - Restart Home Assistant
- Go to Configuration > Integrations
- Click + Add Integration
- Search for Gardena Smart System
- Enter your API credentials
You will need:
- Client ID : Your Gardena application key
- Client Secret : Your Gardena application secret
These credentials can be obtained through the Gardena Developer Portal.
custom_components/gardena_smart_system/
βββ __init__.py # Main entry point
βββ config_flow.py # UI configuration flow
βββ const.py # Integration constants
βββ coordinator.py # Data coordinator
βββ gardena_client.py # Gardena API client
βββ lawn_mower.py # Lawn mower entities
βββ sensor.py # Sensor entities
βββ binary_sensor.py # Binary sensor entities
βββ switch.py # Switch entities
βββ valve.py # Valve entities
βββ manifest.json # Integration metadata
βββ strings.json # Translation strings
βββ services.yaml # Custom services
βββ translations/ # Translations
- Manages data synchronization with the API
- Automatically updates entities
- Handles errors and reconnection
- Communication with Gardena v2 API
- OAuth2 authentication
- HTTP request management
- Each device type has its own entity
- Uses modern Home Assistant patterns
- Supports specific features
# Install test dependencies
pip install pytest pytest-asyncio
# Run tests
pytest custom_components/gardena_smart_system/test_init.py -v- Configuration : Configuration flow test
- Authentication : Invalid credentials test
- Installation : Integration installation test
- Uninstallation : Integration uninstallation test
This is a complete reimplementation and requires a full migration:
- Remove the existing integration from Home Assistant
- Restart Home Assistant
- Install this new version
- Re-add the integration with your API credentials
- New entity IDs: All entities will have new unique IDs
- New device structure: Devices are now organized differently
- Enhanced features: Better device detection and control
- Improved reliability: More stable connection and state management
- Remove existing Gardena Smart System integration
- Restart Home Assistant
- Install new integration files
- Re-add integration with API credentials
- Verify all devices are detected
- Update any automations or scripts that reference old entity IDs
Authentication Error
- Check your API credentials
- Make sure your account has access to the v2 API
No Devices Detected
- Check that your devices are connected to the Smart System
- Make sure they are visible in the Gardena app
- Ensure you've removed the old integration first
Entities Not Available
- Check internet connection
- Check Home Assistant logs for more details
- Verify you've restarted Home Assistant after removing the old integration
Duplicate Entities or Conflicts
- This usually happens when the old integration wasn't properly removed
- Remove the integration completely and restart Home Assistant
- Re-add the integration fresh
Enable detailed logs in configuration.yaml:
logger:
default: info
logs:
custom_components.gardena_smart_system: debugContributions are welcome! To contribute:
- Fork the project
- Create a branch for your feature
- Add tests for your code
- Submit a pull request
This project is under MIT license. See the LICENSE file for more details.