A Home Assistant integration for tracking Loca GPS devices. This integration provides device tracking and sensor data for your Loca devices.
Current Status: v1.1.5 fixes a critical entity initialization error. Update recommended for all users.
- Device Tracking: Track the location of your Loca GPS devices on the Home Assistant map
- Comprehensive Sensors: Multiple sensors for device monitoring:
- Battery level monitoring
- Location accuracy and GPS information
- Current speed tracking
- Last seen timestamps
- Asset information (brand, model, type)
- Location update configuration status
- Human-readable address information
- Multi-language Support: Translations in 9 languages (EN, NL, DE, ES, FR, IT, PL, PT, SV)
- Services: Manual refresh and device update services
- Diagnostics: Comprehensive diagnostics for troubleshooting
- Repairs: Automatic issue detection and repair suggestions
- Multiple Devices: Support for multiple devices on one account
- HACS Compatible: Easy installation via HACS with zip releases
Before installing this integration, you need:
- A Loca account with GPS tracking devices
- API credentials from Loca:
- API Key
- Username
- Password
Contact Loca support to obtain your API credentials.
- Make sure HACS is installed in your Home Assistant
- Go to HACS → Integrations
- Click the three dots menu → Custom repositories
- Add this repository URL:
https://github.com/steynovich/ha-loca - Select "Integration" as the category
- Click "Add"
- Search for "Loca Device Tracker" and install it
- Restart Home Assistant
- Download the latest release from the releases page
- Extract the
custom_components/locafolder to your Home Assistantcustom_componentsdirectory - The final directory structure should look like:
custom_components/ └── loca/ ├── __init__.py ├── config_flow.py ├── const.py ├── api.py ├── coordinator.py ├── device_tracker.py ├── sensor.py ├── services.py ├── diagnostics.py ├── repairs.py ├── services.yaml ├── manifest.json └── translations/ ├── de.json ├── en.json ├── es.json ├── fr.json ├── it.json ├── nl.json ├── pl.json ├── pt.json └── sv.json - Restart Home Assistant
- Go to Settings → Devices & Services → Add Integration
- Search for "Loca Device Tracker"
- Enter your Loca API credentials:
- API Key: Your Loca API key (obtained from Loca support)
- Username: Your Loca account username
- Password: Your Loca account password
- Click Submit
The integration will automatically discover all devices associated with your account.
The integration supports the following configuration options:
- API Key (required): Your unique Loca API key
- Contact Loca support to obtain this key
- Must be a valid alphanumeric string
- Username (required): Your Loca account username
- Must match your registered Loca account
- Password (required): Your Loca account password
- Must match your registered Loca account
- Update Interval: Device data refresh rate (default: 60 seconds)
- Minimum recommended: 30 seconds
- Maximum recommended: 300 seconds (5 minutes)
- Lower values increase API usage but provide more frequent updates
- The integration automatically discovers all GPS devices linked to your account
- Devices appear as both device trackers and sensors
- Device names are taken from your Loca device configuration
- If no name is set, devices use the format "Loca Device [ID]"
- All Loca GPS tracking devices
- Both personal and fleet tracking devices
- Devices with GPS and cellular (LBS) positioning
To modify settings after initial setup:
- Go to Settings → Devices & Services
- Find your Loca integration
- Click Configure
- Update your credentials or settings
- Click Submit to save changes
If your Loca credentials change or expire:
- Home Assistant will automatically detect authentication failures
- A notification will appear prompting you to update credentials
- Click the notification and enter your new credentials
- The integration will automatically reload with the new settings
You can add multiple Loca accounts:
- Repeat the initial setup process
- Each account creates a separate integration instance
- Devices from different accounts are kept separate
- Services can target specific accounts using config entry IDs
For each Loca device, the integration creates:
device_tracker.loca_[device_name]- Shows device location on the map
sensor.loca_[device_name]_battery- Battery percentage (diagnostic)sensor.loca_[device_name]_last_seen- Last time the device reported its location (diagnostic)sensor.loca_[device_name]_location_accuracy- GPS accuracy in meters (diagnostic, disabled by default)sensor.loca_[device_name]_asset_info- Asset information with brand/model (diagnostic)sensor.loca_[device_name]_speed- Current speed in km/hsensor.loca_[device_name]_location_update- Location update configuration status (diagnostic)sensor.loca_[device_name]_location- Current location address
The integration provides the following services:
Manually refresh device data from the Loca API for all or specific config entries.
Parameters:
config_entry_id(optional): Specific config entry to refresh. If not provided, refreshes all Loca integrations.
Example:
service: loca.refresh_devicesExample with specific config entry:
service: loca.refresh_devices
data:
config_entry_id: "abc123def456"Force an immediate update for a specific device by refreshing the coordinator containing that device.
Parameters:
device_id(required): Device ID to update (found in device diagnostics or entity attributes)
Example:
service: loca.force_update
data:
device_id: "12345"Note: Services are automatically registered when the integration is loaded and unregistered when unloaded.
Here are some example automations you can create:
automation:
- alias: "Loca Device Low Battery"
trigger:
- platform: numeric_state
entity_id: sensor.loca_device_battery
below: 20
action:
- service: notify.mobile_app_your_phone
data:
message: "Loca device {{ trigger.to_state.attributes.friendly_name }} has low battery ({{ trigger.to_state.state }}%)"automation:
- alias: "Loca Device Offline"
trigger:
- platform: template
value_template: >
{{ (now() - states.sensor.loca_device_last_seen.last_changed).total_seconds() > 3600 }}
action:
- service: notify.mobile_app_your_phone
data:
message: "Loca device has been offline for more than 1 hour"This integration uses the Loca API v1:
- Base URL:
https://api.loca.nl/v1/ - Authentication: Session-based with API key
- Update Interval: 60 seconds (configurable)
- Endpoints Used:
Login.json- Authentication (returns user object)Assets.json- Device information and locations
- Response Format: JSON with user object on successful login
-
Authentication Failed
- Verify your API key, username, and password are correct
- Check that your Loca account is active
- Ensure API key has proper permissions (contact Loca support)
- Check Home Assistant logs for detailed error messages
- Try the test script:
python3 test_api.py(in integration directory) - Verify internet connectivity and DNS resolution for api.loca.nl
-
No Devices Found
- This is normal for new or empty Loca accounts
- If you have devices, ensure they are properly set up and active
- Check that devices are associated with your account in the Loca app/website
- Verify devices are powered on and have GPS/cellular connectivity
- Wait a few minutes after device setup for them to appear in the API
-
Location Not Updating
- Check if the device has GPS signal
- Verify the device battery is not low
- Check device settings in the Loca app
To enable debug logging, add this to your configuration.yaml:
logger:
default: warning
logs:
custom_components.loca: debugFor issues and feature requests, please use the GitHub Issues page.
For Loca API or account issues, contact Loca Support.
The integration provides detailed diagnostics for troubleshooting while protecting sensitive information:
Config Entry Diagnostics:
- Coordinator status and update intervals
- Device count and overview
- API connection status and configuration
- Sanitized configuration details
- Endpoint usage information
Device Diagnostics:
- Individual device status and capabilities
- Location and sensor data availability
- Entity status and expected entity count
- API attribute keys (values excluded for privacy)
- Battery and GPS accuracy information
Privacy & Security Features:
- Credentials: API keys, passwords, usernames masked as
***REDACTED*** - Location Privacy: Exact coordinates excluded (only availability flags)
- Sensitive Data: Only configuration status and lengths provided
- Raw API Data: Key names only, no sensitive values
Access: Settings → Devices & Services → Loca → Device → Download Diagnostics
The integration includes a repairs system that automatically detects and suggests fixes for common issues:
- Authentication failures and credential problems
- API connectivity issues
- Device configuration problems
- Missing or invalid device data
Access: Settings → System → Repairs (issues appear automatically when detected)
ha-loca/
├── .github/workflows/ # GitHub Actions CI/CD
│ ├── test.yml # Automated testing
│ ├── validate.yml # HACS validation
│ └── release.yml # Release automation
├── assets/ # Brand assets
│ ├── icon.svg # Integration icon
│ └── logo.svg # Integration logo
├── custom_components/loca/ # Main integration
│ ├── __init__.py # Integration setup
│ ├── api.py # Loca API client
│ ├── config_flow.py # Configuration flow
│ ├── const.py # Constants and mappings
│ ├── coordinator.py # Data update coordinator
│ ├── device_tracker.py # Device tracker platform
│ ├── sensor.py # Sensor platform (7 sensor types)
│ ├── services.py # Integration services
│ ├── diagnostics.py # Diagnostics support
│ ├── repairs.py # Repairs framework
│ ├── services.yaml # Service definitions
│ ├── manifest.json # Integration metadata
│ └── translations/ # Multi-language support
│ ├── de.json # German
│ ├── en.json # English (default)
│ ├── es.json # Spanish
│ ├── fr.json # French
│ ├── it.json # Italian
│ ├── nl.json # Dutch
│ ├── pl.json # Polish
│ ├── pt.json # Portuguese
│ └── sv.json # Swedish
├── tests/ # Comprehensive test suite
│ ├── conftest.py # Test configuration
│ ├── test_*.py # Test modules for each component
├── hacs.json # HACS configuration
├── requirements_test.txt # Test dependencies
├── pytest.ini # Pytest configuration
└── validate_*.py # HACS compliance validation scripts
# Install test dependencies
pip install -r requirements_test.txt
# Run all tests
pytest
# Run with coverage report
pytest --cov=custom_components.loca --cov-report=html
# Run specific test categories
pytest tests/test_api.py # API tests
pytest tests/test_sensor.py # Sensor tests
pytest tests/test_config_flow.py # Config flow tests
# Run with verbose output
pytest -v
# Run integration tests only
pytest -k "not unit"The integration includes comprehensive tests covering:
Core Functionality:
- API client with authentication and session management
- Data coordinator with error handling and retry logic
- Config flow with validation and user feedback
- Device tracker entity with location mapping
- All 7 sensor types with proper state and attributes
Advanced Features:
- Services registration and execution
- Diagnostics data collection with privacy protection
- Repairs framework with issue detection
- Multi-language translation support
- HACS compliance validation
Quality Assurance:
- Integration setup and teardown procedures
- Error handling and edge cases
- Mock API responses and network failures
- Configuration validation and user input sanitization
Run HACS compliance checks:
# Basic compliance check
python validate_hacs_compliance.py
# Complete HACS validation
python validate_hacs_complete.py
# Test coverage validation
python validate_test_coverage.py
# Platinum quality validation
python validate_platinum.pyFor HACS compatibility, ensure the GitHub repository has the following topics set:
Required topics:
home-assistanthacsintegrationlocadevice-trackergps-tracking
Optional but recommended:
home-assistant-componenthacs-integrationiotlocation-tracking
To set topics on GitHub:
- Go to your repository on GitHub
- Click the gear icon next to "About" (top right)
- Add topics in the "Topics" field
- Click "Save changes"
Via GitHub CLI:
gh repo edit --add-topic home-assistant,hacs,integration,loca,device-tracker,gps-trackingIf you're experiencing authentication problems, especially after upgrading from v1.1.0:
- Solution: Update to v1.1.1-alpha.1 or later
- Cause: Import conflict in v1.1.0 that has been fixed
- Solution: Update to v1.1.1-alpha.1 or later
- Cause: Coordinator attribute error in v1.1.0 that has been fixed
- Verify Credentials: Double-check your API key, username, and password
- Check API Status: Ensure the Loca API is accessible
- Restart Integration:
- Go to Settings → Devices & Services
- Find your Loca integration
- Click the three dots → Reload
- Check Logs: Look for detailed error messages in Home Assistant logs
- Check the GitHub Issues page
- Review Release Notes for known issues
- Enable debug logging for detailed troubleshooting
To enable detailed logging for troubleshooting:
# Add to configuration.yaml
logger:
default: info
logs:
custom_components.loca: debug
custom_components.loca.api: debug
custom_components.loca.coordinator: debugThis project is licensed under the MIT License - see the LICENSE file for details.
This is an unofficial integration for Loca devices. It is not affiliated with or endorsed by Loca BV.