BWT - Best Water Tech­nology - Support

@anon63427907 is the new api based integration available via HACS?

Does anyone know where to find the code ?
Its not the one for the BWT account.

thx

back to here, I will focus on this integration and aiming to complete it by the end of January. I was very distracted with other integrations I maintain.

Keep in mind that, we will not have same set of sensors.

Output of device state;

{
  "displayName": "BWT Perla",
  "productCode": "XXXX-YYYY",
  "stateTitle": "Everything is OK!",
  "stateBody": "Your softener produces silky soft luxury water.",
  "deviceState": "NotSet",
  "lastTimeDataReceived": "2023-01-02T12:16:07.967+00:00",
  "remainingAmountOfResourcePercent": 80,
  "refillResourceInDays": 102,
  "isHolidayModeActive": false,
  "scheduledHolidayModeStart": null,
  "firmwareVersion": 2.0012,
  "waterTreatedTotal": 40000
}

And water consumption API is working backwards and will generate consumption of previous day, not today.

Hi!
I tried this solution but getting an error message on the syntax. As I’m not at all familiar with YAML I don’t have an idea how to solve this?! Any hint?
Screenshot 2023-01-10 171046

Edit: I finally got it correct. But where do I find the sensor now and how to use it for water comsumption?

You should see it under entities (device and services menu > entities), search for perla if you called the sensor the same as me, and there you have the properties for it:

Thank’s!
Seems that something is wrong with my setup?!
Screenshot_20230111_160449
Screenshot_20230111_160511

Do you know how to check if the API is working correct?

I think the best way to debug is using postman, just to see if the rest api is working.

i confirm that rest api is working but it is very difficult to read yesterday’s consumption with status because it requires you to wait couple of seconds between each api call.

Correct there is a limitation on the frequency, but guess that is something you can live with as the machine is not sending live updates

The problem is, on home assistant startup, it automatically tries to fetch it and causes error.

  - platform: rest
    scan_interval: SECONDS-GO-HERE
    resource_template: https://bwt-real-smarthome-backend.azurewebsites.net/api/Perla/DEVICE-ID-GOES-HERE/waterconsumption?since={{ (now() - timedelta(days = 1)).strftime("%Y-%m-%d") }}
    name: "Water Consumption - Yesterday"
    unique_id: water_consumption_yesterday
    headers:
      content-type: "application/json"
      ApiKey: API-KEY-GOES-HERE
    value_template: "{{ value_json.totalWaterConsumption | float(default=0) }}"
    json_attributes:
      - since

Please replace;

  • SECONDS-GO-HERE: interval to be refreshed in seconds (once in a day should be enough)
  • DEVICE-ID-GOES-HERE: get it from your mobile app
  • API-KEY-GOES-HERE: get it from BWT website

Works like a charm!

1 Like

Do you only use the BWT system for the water consumption sensor?

Ever thought about showing more stuff and controlling Holiday mode (security) with a switch?

Can you somehow integrate the BWT water supply into the energy panel for water consumption?

Hey here is my BWT overview:

See here the config:

Currently trying to integrate the water consumption information for the energy dashboard. See here:

Maybe someone has an idea

Thanks for all the infos in this thread.
I am trying to set it up for my BWT Perla using REST API… but get stuck with my config [1]
Configuration seems to be valid, as I do not get an error when running config check in HA.
But no sensors shown in developer tool…

When putting the yaml config snippet into developer tools / template, I get the error “UndefinedError: ‘value_json’ is undefined”

Maybe someone has an idea about the error/missing commands?

[1] #file: /config/sensors.yaml

 - platform: rest
    scan_interval: 3600
    resource: >my-personal-bwt-url<
    name: "BWT Perla"
    headers:
      content-type: "application/json"
      ApiKey: >my-personal-bwt-api-token< 
    value_template: "{{ value_json.stateTitle }}"
    json_attributes:
      - displayName
      - productCode
      - stateTitle
      - stateBody
      - deviceState
      - lastTimeDataReceived
      - remainingAmountOfResourcePercent
      - refillResourceInDays
      - isHolidayModeActive
      - scheduledHolidayModeStart
      - firmwareVersion
      - waterTreatedTotal

Some information from my side.

I am using 2 different endpoints from this API for my Perla Home. It is important that the scan intervals are different, cause there is a rate limiting.
/api/Perla/{productCode}/waterconsumption
​/api​/Perla​/{productCode}

rest:
  - resource_template: !secret bwt_waterconsumption_url
    headers:
      content-type: "application/json"
      ApiKey: !secret bwt_token
    scan_interval: 86400
    timeout: 45
    sensor:
      - name: bwt_water_consumption_yesterday
        value_template: "{{ value_json.totalWaterConsumption | float(default=0) | round(0) }}"
        unit_of_measurement: "L"
        device_class: water
        icon: mdi:water
        #state_class: total
        #last_reset: {{ now() }}

  - resource: !secret bwt_url
    scan_interval: 3540
    timeout: 45
    headers:
      content-type: "application/json"
      ApiKey: !secret bwt_token
    sensor:
      - name: "bwt_state_title"
        value_template: "{{ value_json.stateTitle }}"
        #friendly_name: "Status"
      - name: "bwt_status"
        value_template: >
          {% if is_state('sensor.bwt_state_title','Alles OK!') %}
            ok
          {% elif is_state('sensor.bwt_state_title','unknown') %}
            ok
          {% elif is_state('sensor.bwt_state_title','None') %}
            ok
          {% elif is_state('sensor.bwt_state_title','Warnung') %}
            warning
          {% elif is_state('sensor.bwt_state_title','Vorrat Regeneriermittel niedrig') %}
            warning
          {% else %}
            error
          {% endif %}
      - name: "bwt_display_name"
        value_template: "{{ value_json.displayName }}"
        #friendly_name: "Anzeigename"
        json_attributes:
          - displayName
      - name: "bwt_state_body"
        #friendly_name: "State Body"
        value_template: "{{ value_json.stateBody }}"
        json_attributes:
          - stateBody
      - name: "bwt_remaining_amount_of_resource_percent"
        #friendly_name: "Perla Tabs Vorrat %"
        value_template: "{{ value_json.remainingAmountOfResourcePercent }}"
        device_class: humidity
        unit_of_measurement: "%"
      - name: "bwt_refill_resource_in_days"
        #friendly_name: "Perla Tabs Vorrat-Tage"
        value_template: "{{ value_json.refillResourceInDays }}"
        unit_of_measurement: "days"
      - name: "bwt_water_treated_total"
        #friendly_name: "Gesamtverbrauch"
        value_template: "{{ value_json.waterTreatedTotal }}"
        unit_of_measurement: "L"
        device_class: water
        state_class: total
        icon: "mdi:water-pump"
      - name: "bwt_last_time_data_received"
        #friendly_name: "Letzte Aktualisierung"
        value_template: "{{ value_json.lastTimeDataReceived }}"
        icon: "mdi:calendar-clock"
        device_class: timestamp
      - name: "bwt_water_treated_total_m3"
        unit_of_measurement: "m³"
        value_template: "{{ ( states('sensor.bwt_water_treated_total') | float / 1000 ) | round(3) }}"
        icon: "mdi:water-pump"
        device_class: water
        state_class: total
    binary_sensor:
      - name: "bwt_is_holiday_mode_active"
        #friendly_name: "Urlaubsmodus"
        value_template: "{{ value_json.isHolidayModeActive }}"

Known issues:

  • Water consumption not working in energy dashboard see my other threads
  • Not all warnings and errors are known, because there are not documented.

Sorry for the most likely stupid question… but where, in which file, did you put in your shown above?
I am asking as your code starts with

rest:
  - resource_template:

and mine, inside the file /config/sensors.yaml starts with

  - platform: rest
    resource_template:

In configuration.yaml new REST structure:

Hi, i have used this setup, and it works, but only once on HA bootup? Then it will never fetch data again.
Do you have issues with this?

No it works fine, can you share your config?