Home Assistant Integration
This guide will walk you through the process of setting up the Home Assistant integration with Telemetry Harbor. Easily collect and visualize your smart home data in Grafana with Telemetry Harbor.
Repo Link: https://github.com/TelemetryHarbor/harbor-home-assistant
Features
- Push Home Assistant sensor data to Telemetry Harbor
- Automate data collection using REST commands
- View live dashboards in Grafana
Prerequisites
Before starting, ensure you have:
- Home Assistant installed and running
- A working knowledge of YAML for Home Assistant configurations
- Smart home sensors or devices set up in Home Assistant
Setup
1. Create a Telemetry Harbor Account
-
Sign up at Telemetry Harbor
-
Verify your email and log in
-
Create a Harbor:
- Click Create Harbor on your dashboard
- Choose a name and select General as the type
- Select the Free plan (or upgrade for more data capacity)
- Click Create
-
Retrieve your credentials:
- After creation, go to View Details
- Note down:
API Endpoint
API Batch Endpoint
API Key
Grafana Endpoint
Grafana Username
Grafana Password
2. Configure Home Assistant
Edit your configuration.yaml
to include the following REST command:
configuration.yaml
rest_command:
push_all_sensors_data:
url: "YOUR_API_BATCH_ENDPOINT"
method: POST
headers:
X-API-Key: "YOUR_API_KEY"
Content-Type: "application/json"
payload: >
[
{% for sensor in states.sensor
| selectattr('state', 'is_number')
| list %}
{
"time": "{{ now().utcnow().isoformat() }}Z",
"ship_id": "{{ sensor.entity_id.split('.')[1].replace('_', ' ').title() }}",
"cargo_id": "{{ sensor.attributes.friendly_name | default(sensor.entity_id.split('.')[-1].replace('_', ' ').title()) }}",
"value": {{ sensor.state }}
}{% if not loop.last %},{% endif %}
{% endfor %}
]
3. Save & Restart
Save your Yaml file and restart your home assistant