Skip to content

Home Assistant: Smart Meter Integration

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 how often the electricity consumption should be loaded.
  • Follow the further instructions in the user interface to complete the configuration.
Vienna Smart Meter Home Assistant Integration Setup
Vienna Smart Meter Home Assistant Integration Setup

Usage

Once the integration is configured, energy consumption sensors will be automatically created in Home Assistant. Access these sensors from the dashboard to monitor consumption, track historical trends, and analyze energy usage patterns.
Feel free to adapt the custom component and edit the sensor.py.

Energy Consumption

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