Use German open city data in Home Assistant
Step-by-step guide: bring weather, air quality and electricity price for your city into Home Assistant as a sensor through the free, keyless InfraNode API.
Why InfraNode for Home Assistant
To couple smart home automations to real environmental data you need a source that works without sign-up and returns stable JSON. InfraNode bundles open data for 84 major German cities behind a free, keyless REST API. Every response carries source, license and timestamp, so you can filter reliably in Home Assistant.
Air quality as a REST sensor
Add the following sensor to your configuration.yaml. It reads
the PM10 value from the envelope under data.payload:
# configuration.yaml
sensor:
- platform: rest
name: Air quality Berlin
resource: https://infranode.dev/api/v1/cities/berlin/air-uba
method: GET
value_template: "{{ value_json.data.payload.pm10 }}"
unit_of_measurement: "ug/m3"
scan_interval: 1800 Electricity price for dynamic tariffs
The nationwide day-ahead spot price is ideal for shifting loads like a wallbox or heat pump into cheaper hours:
- platform: rest
name: Day ahead electricity price
resource: https://infranode.dev/api/v1/cities/berlin/power-price
method: GET
value_template: "{{ value_json.data.payload.value }}"
unit_of_measurement: "EUR/MWh"
scan_interval: 3600 Use the value as a condition in an automation, for example "only charge the car when the price is below X".
Understand the envelope
All domain data sits under data.payload, metadata such as
source and cache status under meta. Inspect a raw response:
curl https://infranode.dev/api/v1/cities/berlin/weather The data types are described on the pages for weather, air quality and electricity price. Find the slug for your city in the cities overview.
Frequently asked questions
- Do I need an API key for Home Assistant?
- No. The InfraNode API is keyless and free. The REST sensor calls the URL directly, without headers or tokens.
- How often can I poll?
- The rate limit is 300 requests per minute per IP. A scan_interval of 1800 seconds (30 minutes) is more than enough for environmental data and is gentle on the source.
- Which cities are supported?
- 84 major German cities. Just replace berlin in the path with your city slug from the cities overview.