Connect Solarwatt Manager Flex to Home Assistant via REST

The Solarwatt Manager Flex controls your local energy system, but importing its data into Home Assistant requires a bit of manual setup. Using the local REST API, you can retrieve real-time readings for grid feed-in, grid consumption, and battery storage. This guide walks you through querying the endpoints and properly defining the entities in Home Assistant via YAML.

What You Need

  • Home Assistant with access to your configuration.yaml file
  • A Solarwatt Manager Flex on your local network (ideally configured with a static IP address)

1. Identify Network Data Points

The Solarwatt Manager Flex provides a local interface. Open your web browser and navigate to http://<YOUR-MANAGER-IP>/rest/items to view the list of all reported data points in JSON format.

Search the JSON output for your component names (such as batteryStateOfCharge, harmonized_net_power_in, or harmonized_net_power_out). Once identified, you can query these individual data points directly via their respective URLs.

2. Add REST Sensors to configuration.yaml

Add the desired sensors to your configuration. Querying individual data points directly prevents issues that occur with fixed array indices when device configurations change. Because the raw data frequently contains timestamps and units (such as 1729607445000|8.33 W), you can parse the string using split or trim to extract a clean numerical value.

Add the following block to your configuration.yaml, making sure to replace the IP address 192.168.1.176 and the component IDs with your own:

sensor:
  - platform: rest
    resource: "http://192.168.1.176/rest/items/solarwattBattery_batteryflex_BatteryFlex_0BC333_batteryChannelGroup_batteryStateOfCharge"
    name: "Solarwatt - Battery State of Charge"
    unique_id: "intern.solarwatt.battery.soc"
    device_class: battery
    state_class: measurement
    unit_of_measurement: "%"
    value_template: "{{ float(value_json.state) }}"

  - platform: rest
    resource: "http://192.168.1.176/rest/items/kiwigrid_location_standard_f3383059f84f_harmonized_power_in"
    name: "Solarwatt - Grid Consumption Power"
    unique_id: "intern.solarwatt.net.power.in"
    device_class: power
    state_class: measurement
    unit_of_measurement: "W"
    value_template: "{{ float(value_json.state.split('|')[1].split(' ')[0]) }}"

  - platform: rest
    resource: "http://192.168.1.176/rest/items/kiwigrid_location_standard_f3383059f84f_harmonized_power_out"
    name: "Solarwatt - Grid Feed-in Power"
    unique_id: "intern.solarwatt.net.power.out"
    device_class: power
    state_class: measurement
    unit_of_measurement: "W"
    value_template: "{{ float(value_json.state.split('|')[1].split(' ')[0]) }}"

3. Check and Reload the Configuration

Validate your configuration under Developer Tools > YAML > Check Configuration. Next, reload REST Entities or restart Home Assistant to initialize the new sensors.

4. Optional: Integral Sensor for Energy Values

If your endpoint only outputs instantaneous power in watts, you can use a helper to calculate cumulative energy consumption over time.

Navigate to Settings > Devices & Services > Helpers > Create Helper and select Integration – Riemann sum integral sensor. Choose your grid feed-in or grid consumption sensor as the input, select Left Riemann sum as the integration method, set the metric prefix to k (kilo), and select Hours as the time unit.

Verify the Setup

Open Developer Tools > States and filter for sensor.solarwatt. The new sensors should display numerical values for both state of charge and power readings. The values will refresh according to the REST integration’s polling interval.

Troubleshooting

  • Entity displays “unknown”: The format in the state field differs. Access the REST URL directly in your browser and check whether the string includes a delimiter like | or simply ends with the unit. Adjust the value_template accordingly.
  • “Authorization required” error: Certain firmware versions require authentication credentials for the web interface. Check your energy manager’s device password (often found on a sticker on the unit or inside your electrical cabinet).
  • Sensor reports unexpected values: Check the units and data types in your configuration, as well as the delimiters in the raw response.

With clean telemetry data in Home Assistant, you can now automate EV chargers or home appliances based on PV surplus.

Quellen: Forum: Simon42 – Forum, community.simon42.com, community.simon42.com, community.home-assistant.io

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top