# Integratie met Home-Assistant

Home Assistant kan op twee manieren gegevens uit de DSMR-logger32 (met de **DSMRlogger32** firmware) ophalen.

### Via restAPI

Om de gegevens door middel van de restAPI's uit de DSMR-logger32 te halen moet het **`configuration.yaml`** bestand er ongeveer als volgt uit zien:

<mark style="color:red;">**Heeft iemand een werkend YAML bestand dat met restAPI's werkt????**</mark>

```
##################################
# uitbreiding configuratie.yaml  #
##################################
# koppeling met de DSMR-logger32 #
# via restAPI's                  #
##################################
```

### Via MQTT:

Om de gegevens via een MQTT broker uit de DSMR-logger32 te halen moet het **`configuration.yaml`** bestand er ongeveer zo uit zien:

```
##################################
# uitbreiding configuratie.yaml  #
##################################
# koppeling met de DSMR-logger32 #
# via MQTT broker                #
##################################

mqtt:
    sensor:
        -  state_topic: "DSMR-ESP32" 
           name: "Gebruik"
           device_class: "energy"
           unit_of_measurement:'kWh'
           value_template: "{{ value_json.power_delivered | round(3) }}"

        -  state_topic: "DSMR-ESP32"
           name: "Gebruik l1"
           device_class: "power"
           unit_of_measurement: 'W'
           value_template: "{{ (value_json.power_delivered_l1 | float * 1000.0) | round(1) }}"

        -   state_topic: "DSMR-ESP32"
            name: "Gebruik l2"
            device_class: "power"
            unit_of_measurement: 'W'
            value_template: "{{ (value_json.power_delivered_l2 | float * 1000.0) | round(1) }}"

        -   state_topic: "DSMR-ESP32"
            name: "Gebruik l3"
            device_class: "power"
            unit_of_measurement: 'W'
            value_template: "{{ (value_json.power_delivered_l3 | float * 1000.0) | round(1) }}"

        -   state_topic: "DSMR-ESP32"
            name: "Gas gebruik"
            device_class: "gas"
            unit_of_measurement: 'm³'
            value_template: "{{ value_json.gas_delivered | round(3) }}"
  
        -   state_topic: "DSMR-ESP32"
            name: "Spanning-L1"
            device_class: "voltage"
            unit_of_measurement: 'V'
            value_template: "{{ value_json.voltage_l1 | round(1) }}"

        -   state_topic: "DSMR-ESP32"
            name: "Spanning-L2"
            device_class: "voltage"
            unit_of_measurement: 'V'
            value_template: "{{ value_json.voltage_l2 | round(1) }}"

        -   state_topic: "DSMR-ESP32"
            name: "Spanning-L3"
            device_class: "voltage"
            unit_of_measurement: 'V'
            value_template: "{{ value_json.voltage_l3 | round(1) }}"
            
        -   state_topic: "DSMR-ESP32"
            name: "Stroom-L1"
            device_class: "current"
            unit_of_measurement: 'A'
            value_template: "{{ value_json.current_l1 | round(1) }}"

        -   state_topic: "DSMR-ESP32"
            name: "Stroom-L2"
            device_class: "current"
            unit_of_measurement: 'A'
            value_template: "{{ value_json.current_l2 | round(1) }}"

        -   state_topic: "DSMR-ESP32"
            name: "Stroom-L3"
            device_class: "current"
            unit_of_measurement: 'A'
            value_template: "{{ value_json.current_l3 | round(1) }}"
```

(met dank aan *Henk Elzing*)

<figure><img src="/files/9tzP4Thdd5pOVajI5uzI" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mrwheel-docs.gitbook.io/dsmrlogger32/integratie-met-home-assistant.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
