Skip to content

thecem/gardena-smart-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒฑ Gardena Smart System Integration for Home Assistant

GitHub Release GitHub Activity License hacs

A complete Home Assistant integration for the Gardena Smart System, providing comprehensive control and monitoring of your smart garden devices with lightning-fast WebSocket updates and 96% performance improvement.

๐Ÿš€ What's New in v1.0.4

  • โšก 96% Performance Boost: Startup time improved from 0.271s to 0.01s
  • ๐Ÿ”„ Real-time WebSocket Updates: Valve and device status updates within seconds
  • ๐Ÿ› ๏ธ Enhanced Valve Control: Improved reliability and immediate feedback
  • ๐Ÿ”ง Better Error Handling: More informative messages and automatic recovery
  • ๐Ÿ“ˆ Code Quality Improvements: Cleaner, more maintainable codebase

๐ŸŒฑ Features

Complete Device Support

  • ๐Ÿค– Robotic Mowers: Full control with scheduling, manual override, and real-time status
  • ๐Ÿ’ง Water Control: Smart irrigation and watering with timer management (Enhanced in v1.0.4)
  • ๐ŸŒฟ Smart Irrigation: Multi-valve systems with individual zone control (Real-time updates)
  • ๐Ÿ”Œ Power Sockets: Smart outlet management with timer functionality
  • ๐Ÿ“Š Environmental Sensors: Temperature, humidity, light, and soil monitoring
  • ๐Ÿ”” Status Monitoring: Device connectivity and operational states

Advanced Features

  • โฑ๏ธ Real-time Duration Tracking: Live countdown timers for all operations
  • ๐ŸŒ WebSocket Communication: Lightning-fast updates within seconds (Optimized in v1.0.4)
  • ๐Ÿ” OAuth2 Authentication: Secure API connection with improved token management
  • ๐ŸŒ Multi-Language Support: EN, DE, FR, NL, FI, SK, SV, NB
  • ๐Ÿ“ฑ Full Home Assistant Integration: Native UI, automations, and notifications

๐Ÿš€ Installation

HACS (Recommended)

  1. Open HACS in Home Assistant
  2. Go to "Integrations"
  3. Click the three dots in the top right corner
  4. Select "Custom repositories"
  5. Add https://github.com/thecem/gardena-smart-system as repository
  6. Select "Integration" as category
  7. Click "Add"
  8. Search for "Gardena Smart System" and install
  9. Restart Home Assistant

Manual Installation

  1. Download the latest release from GitHub releases
  2. Extract the files
  3. Copy the custom_components/gardena_smart_system folder to your Home Assistant config/custom_components/ directory
  4. Restart Home Assistant

๐Ÿš€ v1.0.4 Note: This version features significantly improved startup performance and real-time WebSocket updates for instant device status changes.

โš™๏ธ Configuration

Prerequisites

You need a Gardena Smart System account and API credentials:

  1. Go to Gardena Developer Portal
  2. Create an account and register your application
  3. Note your Client ID and Client Secret

Setup Integration

  1. In Home Assistant, go to Settings โ†’ Devices & Services
  2. Click Add Integration
  3. Search for "Gardena Smart System"
  4. Enter your API credentials:
    • Client ID: Your application's client ID
    • Client Secret: Your application's client secret
  5. Follow the OAuth2 authentication flow
  6. Select your garden locations
  7. Complete the setup

๐ŸŽ›๏ธ Supported Entities

Lawn Mower

  • Entity Type: lawn_mower
  • Features: Start, stop, dock, pause, resume
  • Attributes: Battery level, activity, error states, cutting height
  • Services:
    • Start mowing
    • Park until next scheduled task
    • Park until further notice
    • Override schedule with duration

Water Control & Irrigation

  • Entity Type: valve
  • Features: Open/close valves, duration control
  • Attributes: Valve activity, remaining time, water flow
  • Services:
    • Manual watering with duration
    • Stop watering
    • Cancel override

Power Sockets

  • Entity Type: switch
  • Features: On/off control, timer operations
  • Attributes: Power state, activity, remaining time
  • Services:
    • Turn on/off
    • Override with duration
    • Cancel override

Sensors

  • Types: Temperature, humidity, light intensity, soil temperature, soil moisture
  • Attributes: Real-time values, battery status, signal strength
  • Updates: Automatic via WebSocket connection

Binary Sensors

  • Types: Device connectivity, RF link status, error states
  • States: Connected/disconnected, online/offline, ok/error

๐Ÿ”ง Services

gardena_smart_system.start_mowing

Start mowing operation

service: gardena_smart_system.start_mowing
target:
  entity_id: lawn_mower.my_mower
data:
  duration: 60  # minutes (optional)

gardena_smart_system.park_until_next_task

Park mower until next scheduled task

service: gardena_smart_system.park_until_next_task
target:
  entity_id: lawn_mower.my_mower

gardena_smart_system.start_watering

Start watering with duration

service: gardena_smart_system.start_watering
target:
  entity_id: valve.my_valve
data:
  duration: 30  # minutes

gardena_smart_system.stop_watering

Stop current watering operation

service: gardena_smart_system.stop_watering
target:
  entity_id: valve.my_valve

๐ŸŒ Supported Regions

This integration supports all European Gardena Smart System regions:

๐Ÿ‡ฉ๐Ÿ‡ช Germany | ๐Ÿ‡ฆ๐Ÿ‡น Austria | ๐Ÿ‡จ๐Ÿ‡ญ Switzerland | ๐Ÿ‡ซ๐Ÿ‡ท France | ๐Ÿ‡ฎ๐Ÿ‡น Italy | ๐Ÿ‡ช๐Ÿ‡ธ Spain | ๐Ÿ‡ณ๐Ÿ‡ฑ Netherlands | ๐Ÿ‡ง๐Ÿ‡ช Belgium | ๐Ÿ‡ฑ๐Ÿ‡บ Luxembourg | ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom | ๐Ÿ‡ฎ๐Ÿ‡ช Ireland | ๐Ÿ‡ฉ๐Ÿ‡ฐ Denmark | ๐Ÿ‡ธ๐Ÿ‡ช Sweden | ๐Ÿ‡ณ๐Ÿ‡ด Norway | ๐Ÿ‡ซ๐Ÿ‡ฎ Finland | ๐Ÿ‡ต๐Ÿ‡ฑ Poland | ๐Ÿ‡จ๐Ÿ‡ฟ Czech Republic | ๐Ÿ‡ธ๐Ÿ‡ฐ Slovakia | ๐Ÿ‡ญ๐Ÿ‡บ Hungary | ๐Ÿ‡ธ๐Ÿ‡ฎ Slovenia | ๐Ÿ‡ญ๐Ÿ‡ท Croatia | ๐Ÿ‡ง๐Ÿ‡ฌ Bulgaria | ๐Ÿ‡ท๐Ÿ‡ด Romania | ๐Ÿ‡ช๐Ÿ‡ช Estonia | ๐Ÿ‡ฑ๐Ÿ‡ป Latvia | ๐Ÿ‡ฑ๐Ÿ‡น Lithuania

๐Ÿ”„ Automation Examples

Water Garden When Temperature is High

automation:
  - alias: "Water garden when hot"
    trigger:
      - platform: numeric_state
        entity_id: sensor.garden_temperature
        above: 30
    action:
      - service: gardena_smart_system.start_watering
        target:
          entity_id: valve.garden_irrigation
        data:
          duration: 45

Mow Lawn After Rain Stops

automation:
  - alias: "Mow after rain"
    trigger:
      - platform: state
        entity_id: binary_sensor.rain_sensor
        from: "on"
        to: "off"
        for: "01:00:00"
    action:
      - service: gardena_smart_system.start_mowing
        target:
          entity_id: lawn_mower.robomow
        data:
          duration: 120

๐Ÿ› ๏ธ Troubleshooting

Common Issues

Integration not appearing in setup

  • Restart Home Assistant after installation
  • Check that files are in the correct directory
  • Verify HACS installation if using HACS

Authentication failures

  • Verify your Client ID and Client Secret
  • Check that your Gardena account is active
  • Ensure your application is approved in the developer portal

Devices not appearing

  • Ensure devices are online in the Gardena app
  • Check that devices are assigned to a location
  • Restart the integration from Settings โ†’ Devices & Services

WebSocket connection issues

  • Check your internet connection
  • Verify firewall settings
  • The integration automatically reconnects after connection loss
  • v1.0.4: Improved WebSocket stability with better error handling and faster reconnection

Debug Logging

Enable debug logging to troubleshoot issues:

logger:
  default: info
  logs:
    custom_components.gardena_smart_system: debug

๐Ÿ”ง Development

Development Container

This project includes a complete development environment using VS Code Dev Containers. The devcontainer provides:

  • Pre-configured Environment: Debian GNU/Linux 12 (bookworm) with all necessary tools
  • Python Development: Python 3.11+ with pip3 and Python language extensions
  • Node.js Support: Node.js, npm, and eslint for JavaScript development
  • Git Integration: Latest Git version built from source
  • Command Line Tools: Full suite of development tools (curl, wget, ssh, rsync, etc.)

Getting Started with Dev Container

  1. Prerequisites:

  2. Open in Dev Container:

    # Clone the repository
    git clone https://github.com/thecem/gardena-smart-system.git
    cd gardena-smart-system
    
    # Open in VS Code
    code .
    
    # VS Code will prompt to reopen in container
    # Or use Command Palette: "Dev Containers: Reopen in Container"
  3. Development Features:

    • Auto-completion: Full Python IntelliSense and type checking
    • Debugging: Integrated Python debugger for Home Assistant
    • Testing: Pre-configured test environment
    • Linting: ESLint for JavaScript and Python linting tools
    • Git Integration: Full Git workflow with VS Code integration

Development Scripts

The devcontainer includes helper scripts in the scripts/ directory:

  • scripts/develop - Start Home Assistant in development mode
  • scripts/lint - Run code linting and formatting
  • scripts/release.sh - Automated release process
  • scripts/fix-and-release.sh - Fix git sync issues and release

Browser Integration

Use the built-in browser opener for testing:

# Open Home Assistant in host browser
"$BROWSER" http://localhost:8123

Requirements

  • Python 3.11+
  • Home Assistant 2025.2.4+

Dependencies

# Core dependencies used in the integration:
oauthlib==3.2.2      # OAuth2 authentication flow
httpx>=0.24.0        # HTTP client for API requests
websockets           # WebSocket communication with Gardena API
backoff>=2.0.0       # Retry logic with exponential backoff

Note: These dependencies are required for the integration to function properly. The exact versions are specified in custom_components/gardena_smart_system/manifest.json.### Local Development Setup

If not using the dev container, set up your environment manually:

  1. Install Python Dependencies:

    pip3 install -r requirements.txt
  2. Install Home Assistant:

    pip3 install homeassistant
  3. Development Configuration:

    • Copy the integration to your HA config directory
    • Enable debug logging in configuration.yaml
    • Restart Home Assistant

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes using the dev container
  4. Add tests if applicable
  5. Run linting: scripts/lint
  6. Submit a pull request

VS Code Tasks

The project includes pre-configured VS Code tasks:

  • Run Debug (Home Assistant Core): Start HA in debug mode
  • Run Lint: Execute code linting and formatting
  • Run Tests: Execute test suite (if available)

Access tasks via: Terminal โ†’ Run Task or Ctrl+Shift+P โ†’ Tasks: Run Task

๐Ÿ“ Changelog

v1.0.4 - Performance Revolution & Real-time WebSocket Updates

  • โšก Performance Breakthrough: 96% startup time improvement (0.271s โ†’ 0.01s)
  • ๐Ÿ”„ Real-time WebSocket Updates: Device status updates within seconds
  • ๐Ÿ› ๏ธ Enhanced Valve Control: Improved reliability and immediate response
  • ๐Ÿ”ง Better Error Handling: More informative messages and automatic recovery
  • ๐Ÿ“ˆ Code Quality: Cleaner, more maintainable codebase
  • ๐Ÿ” Authentication Improvements: Better session management and error recovery
  • ๐Ÿ› Bug Fixes: Resolved WebSocket connection issues and authentication conflicts

v1.0.3 - Complete Integration Implementation

  • Complete Gardena Smart System integration
  • Full device support for all device types
  • Real-time duration tracking and monitoring
  • WebSocket communication for live updates
  • Multi-language support
  • OAuth2 authentication with token management
  • Comprehensive error handling and logging
  • HACS integration ready

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Thanks to the Home Assistant community
  • Gardena/Husqvarna for providing the API
  • All contributors and testers

๐Ÿ› Issues & Feature Requests

Please report issues and feature requests on GitHub Issues

๐Ÿ’ฌ Support

  • GitHub Issues: Bug reports and feature requests
  • Home Assistant Community: General discussions and help
  • Documentation: Full guides and API reference

โญ If you find this integration useful, please give it a star on GitHub!