The Vienna Smart Meter Integration enables seamless integration of your Vienna Smart Meter into the Home Assistant setup. It allows monitoring and tracking of your electricity consumption data directly from the Home Assistant dashboard.

Currently the Vienna energy infrastructure “Wiener Netze” does unfortunately not provide any official API to retrieve energy consumption data from Smart Meter that could be integrated into Smart Home systems. Therefore we implemented a customer component to integrate the energy provider’s publicly available backend API into Home Assistant and gain insights into energy usage patterns.

This blog post describes how our custom component Vienna Smart Meter Integration can be used to integrate the Vienna Smart Meter into Home Assistant.

Installation

To install the Vienna Smart Meter Integration, follow these steps:

  • Check out the project.
  • Copy the smart_meter folder into the custom_components directory of your Home Assistant setup.
  • Restart Home Assistant

Obtain Authentication Token

The custom component we developed uses the same backend APIs as the web application of “Wiener Netze”. All their APIs are secured by an access token that is provided by their Keycloak Identity Provider. The following steps describe how to retrieve the KEYCLOAK_IDENTITY cookie that is used by our custom component to retrieve the required access token.

  • Visit https://smartmeter-web.wienernetze.at
  • Open the developer tools in your browser (usually accessible via F12 or right-click > Inspect).
  • Navigate to the Application tab.
  • Log in to your Vienna Smart Meter account.
  • Look for a cookie named KEYCLOAK_IDENTITY in the cookies list.
  • Copy the value of the Cookie Value. This is your authentication cookie that is valid for 3 years.
Copy KEYCLOAK_IDENTITY Cookie from Developer Tools

Integration Configuration

Once the integration files are in place, you can configure the integration.

  • Visit the Home Assistant user interface.
  • Navigate to Configuration > Integrations.
  • Click on the + icon to add a new integration.
  • Search for “Smart Meter” and select it.
  • Enter the required information.
    Hint: Most required parameters you can copy from https://smartmeter-web.wienernetze.at
    • User (Geschäftspartner): Your user ID for the smart meter.
    • Device Number of Smart Meter (Zählpunktnummer): The number of your smart meter.
    • KEYCLOAK_IDENTITY Cookie: The Cookie value from the section “Obtaining Authentication Token
    • Update Rate in Minutes: Specify the consumption update rate.
    • Number of consumption days: The number of consumption days you want to import at integration initialization.
  • Follow the further instructions in the user interface to complete the configuration.
Smart Meter Integration Setup
Vienna Smart Meter Home Assistant Integration Setup

Usage

Once the integration is configured, Home Assistant will automatically create a Smart Meter Reading sensor (sensor.smart_meter_reading).
You can access this sensor from your dashboard to monitor your current meter value, track historical trends, and analyze your energy usage patterns.

Energy Consumption

In addition to the main sensor, the integration also provides two statistics that are recorded in Home Assistant’s statistics database:

  • smart_meter:consumption → Represents the hourly energy consumption.
  • smart_meter:consumption_counter → Represents the cumulative energy consumption per hour.

The cumulative statistic (smart_meter:consumption_counter) is especially important, since it allows the Home Assistant Energy Dashboard to properly calculate and display your total energy usage.

Home Assistant Energy Dashboard Configuration
Home Assistant Energy Dashboard
Home Assistant Energy Dashboard with smart_meter:consumption_counter Statistic

This custom component is designed to be flexible, so feel free to adapt it to your needs. You can easily extend or customize the behavior by editing the sensor.py file.

In case of any questions, feedback, or if you’d like to contribute, just drop me a line!

This project was done in cooperation with https://seaa.dev/

Categories: Automation