Wiser Home Assistant Integration

repository·master·Indexed 43 days ago

https://github.com/asantaga/wiserhomeassistantplatform

A local-first Home Assistant integration for Drayton Wiser and Schneider Electric Wiser hubs. It enables control of heating, hot water, lights, and blinds without cloud dependency, supporting v2 hubs and European versions. Requires Home Assistant version 2025.5 or higher and is recommended for installation via HACS.

Tokens
10.2K
Snippets
15
Records
21
Agent score
55%

What's inside Wiser Home Assistant Integration

  1. Overview of Wiser Home Assistant Integration

    master

    The Wiser Home Assistant Integration provides local control for the Drayton Wiser Heating solution. It communicates directly with your Wiser hub and does not require cloud connectivity.

    Key features include:

    • Local communication with the Wiser hub.
    • Support for European versions of the Wiser Hub under the Schneider Electric brand (including support for lights and blinds).
    • Support for v2 hubs and various v2 hub devices.
    • Climate entity support for controlling hot water using an external tank temperature sensor.
  2. Create a binary sensor for Wiser heating status

    master

    To monitor whether a Wiser heating zone is active, create a template binary sensor. This sensor checks the control_output_state attribute of the Wiser climate entity. If the state is 'On', the binary sensor turns on and displays a radiator icon; otherwise, it turns off and displays a radiator-off icon.

    Note: This configuration assumes you are using a split configuration (e.g., binary_sensor.yaml). If using a single configuration.yaml, adjust the indentation accordingly.

    - platform: template
        heating_flur:
          friendly_name: Heating Flur
          value_template: '{{is_state_attr("climate.wiser_flur","control_output_state","On")}}'
          icon_template: >-
            {% if is_state("binary_sensor.heating_flur", "on") %}
              mdi:radiator
            {% else %}
              mdi:radiator-off
            {% endif %}
  3. Create template sensors for battery levels

    master

    To create clean battery level sensors for Lovelace cards, use Home Assistant template sensors to extract the battery_percent attribute from Wiser sensors.

    Key implementation details:

    • Default Value: Use a default value of 101. This allows Lovelace cards (like custom:bar-card) to discard the value if it is invalid/missing without triggering UI error messages.
    • Device Class: Set device_class: battery to enable automatic templated battery icons in the UI.
    • Unit: Set unit_of_measurement: "%".

    Example template logic: {{ states.sensor.[YOUR_SENSOR].attributes.battery_percent | default(101) | int if states.sensor.[YOUR_SENSOR].attributes.battery_percent is not none }}

    thermostat_wohnzimmer_battery_level:
      friendly_name: Thermostat Wohnzimmer Batterie
      value_template: "{{ states.sensor.wiser_itrv_wohnzimmer.attributes.battery_percent | default(101) | int if states.sensor.wiser_itrv_wohnzimmer.attributes.battery_percent is not none}}"
      device_class: battery
      unit_of_measurement: "%"
  4. Manage room temperature accuracy using external sensors

    master

    You can improve room temperature accuracy by using an external temperature sensor to drive Wiser heating boosts. This automation monitors external sensors and, when a temperature discrepancy is detected between the sensor and the Wiser device's scheduled temperature, it triggers a boost to the Wiser climate device.

    Logic Overview

    • Boosting: If the external sensor reading is significantly lower than the Wiser scheduled temperature, the automation boosts the room by approximately 1.5x the difference.
    • Cancelling: If the room temperature is within 0.5°C of the scheduled temperature, any active boost is cancelled.

    Requirements

    1. Wiser Integration Version: Requires at least version 3.0.20 of the Wiser integration for Home Assistant to access the current_schedule_temp attribute.
    2. Home Assistant Areas: The external temperature sensor and the Wiser climate device must be assigned to the same Area in Home Assistant. The automation uses area_entities() to find the corresponding climate device.
    3. Sensor Filtering: The automation's trigger condition must be customized to match your specific temperature sensors (e.g., filtering for specific entity IDs or integration types like zha).
    alias: Adjust Wiser Boost for Ext Temp Sensor Heat Management
    description: Uses External Temp Sensor To Achieve Target Temp in Room
    trigger:
      - platform: event
        event_type: state_changed
    condition:
      - condition: and
        conditions:
          - condition: template
            value_template: |
              {% if trigger.event.data.entity_id in integration_entities('zha') and 
                  trigger.event.data.entity_id.startswith('sensor.lumi') 
                  and trigger.event.data.entity_id.endswith('temperature')
              %}
                True
              {% endif %}
          - condition: template
            value_template: |
              {% set trigger_entity = trigger.event.data.entity_id %}
    
              {# find corresponding room climate sensor #}
              {% for wiser_climate in area_entities(area_name(trigger_entity))
                  if wiser_climate.startswith('climate.') 
                      and wiser_climate in integration_entities('wiser')
              %}
                {% if loop.first %}
                  {% set sensor_temp = states(trigger_entity)|float %}
                  {% set schedule_temp = state_attr(wiser_climate, 'current_schedule_temp')|float %}
                   {% 
                    if (
                        (schedule_temp - sensor_temp) > 0.5 
                        and not state_attr(wiser_climate, 'is_heating')
                        and not state_attr(wiser_climate, 'is_boosted')
                      )
                      or
                      (
                        (schedule_temp - sensor_temp) < 0.5 
                        and state_attr(wiser_climate, 'is_boosted')
                      )
                  %}
                    True    
                  {% endif %}
                {% endif %}
              {% endfor %}
    action:
      - service: wiser.boost_heating
        data_template:
          entity_id: >-
            {% set sensor = trigger.event.data.entity_id %} {% for wiser_climate in
            area_entities(area_name(sensor))
                  if wiser_climate.startswith('climate.') 
                  and wiser_climate in integration_entities('wiser') 
            %}
              {% if loop.first %}{{wiser_climate}}{% endif %}
            {% endfor %}
          time_period: >-
            {% set sensor = trigger.event.data.entity_id %} {% for wiser_climate in
            area_entities(area_name(sensor)))
                  if wiser_climate.startswith('climate.') 
                  and wiser_climate in integration_entities('wiser') 
            %}
              {% if loop.first %}
                {% set sensor_temp = states(sensor)|float %}
                {% set schedule_temp = state_attr(wiser_climate, 'current_schedule_temp')|float %}
                {% set delta = (schedule_temp - sensor_temp)|round(1) %}
                {% if delta < 0.5 %}
                  0
                {% else %}
                  30
                {% endif %}
              {% endif %}
            {% endfor %}
          temperature_delta: >-
            {% set sensor = trigger.event.data.entity_id %} {% for wiser_climate in
            area_entities(area_name(sensor)) %} {% for wiser_climate in
            area_entities(area_name(sensor))}
              {% if loop.first %}
                {% set sensor_temp = states(sensor)|float %}
                {% set schedule_temp = state_attr(wiser_climate, 'current_schedule_temp')|float %}
                {% set delta = (schedule_temp - sensor_temp)|round(1) %}
                {% if delta < 0.5 %}
                  {% set delta = 0 %}
                {% endif %}
                {% set boost_delta = (((delta * 1.5) * 2 )|round(0)/2) %}
                {{boost_delta}}
              {% endif %}
            {% endfor %}
      - service: logbook.log
        data_template:
          name: Wiser Temp Boost by Ext Sensor
          message: |
            {% set sensor = trigger.event.data.entity_id %}  {% for wiser_climate in
                  area_entities(area_name(sensor)) 
            %} ... {% endfor %}
    mode: queued
    max: 10
  5. Link 3rd party sensors to Wiser heating using Generic Thermostat

    master

    You can use non-Wiser temperature sensors (e.g., SONOFF Zigbee sensors) to trigger Wiser heating by using the Home Assistant generic_thermostat platform. This involves three main steps:

    1. Define a Generic Thermostat: Create a climate entity in configuration.yaml that uses your 3rd party sensor as the target_sensor and a template switch as the heater.
    2. Create a Template Switch: Define a switch that calls the wiser.boost_heating service when turned on and resets the Wiser to auto mode when turned off.
    3. Sync Schedules: Use an automation to copy the target temperature from the Wiser device to your generic thermostat so both rooms follow the same schedule.
    # 1. Define the Generic Thermostat
    climate:
      - platform: generic_thermostat
        name: cucina
        heater: switch.switch_t_cucina
        target_sensor: sensor.t_cucina_temperature
        min_temp: 5
        max_temp: 30
        ac_mode: false
        target_temp: 20
        cold_tolerance: 0.3
        hot_tolerance: 0
        initial_hvac_mode: "heat"
    
    # 2. Define the Template Switch to control Wiser
    switch:
      - platform: template
        switches:
          switch_t_cucina:
            turn_on:
              service: wiser.boost_heating
              data:
                entity_id: climate.wiser_soggiorno
                time_period: 30
                temperature: 21
                temperature_delta: 1
            turn_off:
              service: climate.set_hvac_mode
              data:
                entity_id: climate.wiser_soggiorno
            hvac_mode: "auto"
  6. Install the Wiser Home Assistant Integration via HACS

    master

    The recommended way to install the latest version of the Wiser Home Assistant Platform is through the Home Assistant Community Store (HACS).

    Requirements:

    • A minimum Home Assistant version of 2025.5 is required.

    Installation Options:

    • Stable: Install via HACS for the standard release.
    • Bleeding Edge: Checkout the dev branch for the latest features.
    • Beta: Look for beta releases via HACS.

    Note: Depending on your installation method, you may need to use 'Manual Code Installation' as described in the project Wiki.

  7. Set up the Wiser Room Boost Automation

    master

    The second part of the automation listens for the external_temp_sensor_changed event and manages the Wiser heating.

    Configuration Variables: Adjust these in the trigger_variables section of the YAML:

    • boost_time: Duration (in minutes) to boost the temperature. The automation will cancel this early if the target is reached.
    • tolerance_delta: The temperature difference (in °C) allowed between the sensor and the schedule before triggering or canceling a boost.
    • max_boost_delta: The maximum temperature increase allowed (e.g., 5 for a max 5°C boost).

    Advanced Tuning: To change the intensity of the boost, you must modify the boost_delta_temp template line within the trigger block. The current multiplier is 1.5.

    Example logic for boost_delta_temp:

    boost_delta_temp: '{{(((current_temp_delta * 1.5) * 2 )|round(0)/2)|round(1)}}'
    alias: Adjust Wiser Boost for Ext Temp Sensor Heat Management
    description: Uses External Temp Sensor To Achieve Target Temp in Room
    trigger:
      - platform: event
        event_type: external_temp_sensor_changed
        variables:
          temp_sensor: '{{trigger.event.data.entity_id}}'
          temp_sensor_temp: '{{trigger.event.data.new_temp}}'
          climate_entity: |- 
            {% for wiser_climate in area_entities(area_name(temp_sensor))
                if wiser_climate.startswith('climate.') 
                and wiser_climate in integration_entities('wiser')
            %}
              {% if loop.first %}
                {{wiser_climate}}
              {% endif %}
            {% endfor %}
          schedule_temp: '{{state_attr(climate_entity, "current_schedule_temp")|float(0)}}'
          current_temp_delta: '{{(schedule_temp - temp_sensor_temp)|round(1)}}'
          boost_delta_temp: '{{(((current_temp_delta * 1.5) * 2 )|round(0)/2)|round(1)}}'
    condition:
      - condition: and
        conditions:
          - condition: template
            value_template: '{{ states(climate_entity) is defined }}'
          - condition: template
            value_template: |- 
              {% if (
                    current_temp_delta > tolerance_delta
                    and not state_attr(climate_entity, 'is_heating')
                    and not state_attr(climate_entity, 'is_boosted')
                  )
                  or
                  (
                    current_temp_delta < tolerance_delta 
                    and state_attr(climate_entity, 'is_boosted')
                  )
              %}
                  True    
              {% endif %}
    action:
      - service: wiser.boost_heating
        data_template:
          entity_id: '{{climate_entity}}'
          time_period: '{{ 0 if current_temp_delta < tolerance_delta else boost_time }}'
          temperature_delta: >-
            {{ 0 if current_temp_delta < tolerance_delta else [boost_delta_temp, max_boost_delta]|min}}
      - service: logbook.log
        data_template:
          name: Wiser Temp Boost by Ext Sensor
          message: |- 
            Temp Sensor - {{temp_sensor}},
            Temp Sensor Temp - {{temp_sensor_temp}}°C, 
            Climate Entity - {{climate_entity}},
            Schedule Temp - {{schedule_temp}}°C, 
            Current Temp Delta - {{current_temp_delta}}, 
            Action - 
            {% if current_temp_delta < tolerance_delta %}
              Boost Cancelled
            {% else %}
              Boosted By {{[boost_delta_temp, max_boost_delta]|min}}°C for {{boost_time}} mins
            {% endif %}
          entity_id: '{{climate_entity}}'
          domain: wiser
    trigger_variables:
      boost_time: 30
      tolerance_delta: 0.5
      max_boost_delta: 5
    mode: queued
    max: 10
  8. Manage Room Temperature Accuracy with External Sensors (V2)

    master

    This automation improves room heating accuracy by using external temperature sensors instead of relying solely on the iTRV's built-in sensor (which is often too close to the heat source).

    How it works:

    1. It monitors external temperature sensors.
    2. It compares the sensor reading to the Wiser climate device's current_schedule_temp.
    3. If the room is not heating or boosted, it applies a boost (default 1.5x the temperature difference) to reach the target.
    4. It cancels the boost if the room temperature comes within a defined tolerance_delta of the scheduled temperature.

    Requirements:

    • Wiser Integration: Version 3.0.20 or higher (requires the current_schedule_temp attribute).
    • Home Assistant: Version 2022.4 or higher (requires trigger variable functionality).
    • Configuration: Temperature sensors and Wiser climate entities must be assigned to the same HA Area (the same room).
  9. Rename history graph element names via Lovelace UI overrides

    master

    You can rename the labels used in history graphs by providing a name override for specific entities within your Lovelace YAML configuration. This is useful for shortening long entity names like "Upstairs current temperature".

    Note: Using a single space ' ' as a name can help minimize the prefix, though it may affect capitalization (e.g., resulting in lowercase 'current').

    entities:
      - entity: climate.wiser_upstairs
        name: Upstairs
    hours_to_show: 12
    refresh_interval: 0
    title: Upstairs Heating
    type: history-graph
  10. Automatically upload schedule files on change

    master

    You can automate the process of uploading and applying Wiser climate schedules whenever a YAML file in your Home Assistant configuration directory is modified. This is achieved using the folder_watcher integration to monitor a specific directory and the wiser.set_heating_schedule service to apply the changes to the hub.

    Prerequisites

    1. Folder Watcher Setup: You must have the folder_watcher integration configured in your configuration.yaml to monitor the directory where your schedules are stored (e.g., config/schedules).
    2. File Naming Convention: The automation logic provided assumes a specific naming pattern for files to distinguish between occupancy modes:
      • Files containing _occupied (e.g., living_room_schedule_occupied.yaml) are applied when the house state is Occupied.
      • Files containing _unoccupied (e.g., living_room_schedule_unoccupied.yaml) are applied when the house state is Unoccupied.
    3. Entity Mapping: The automation expects that the resulting climate entity name follows the pattern climate.wiser_<filename_prefix> (where the suffix like _schedule_occupied.yaml is stripped).
    alias: Climate Schedule File Change Upload to Wiser
    description: ''
    trigger:
      - platform: event
        event_type: folder_watcher
        event_data:
          event_type: modified
    condition:
      - condition: template
        value_template: >-
          {{
          (trigger.event.data.file|regex_search('_occupied', ignorecase=TRUE) and
          is_state('sensor.house','Occupied'))
    
          or
    
          (trigger.event.data.file|regex_search('_unoccupied', ignorecase=TRUE) and
          is_state('sensor.house','Unoccupied'))
    
          }}
    action:
      - service: persistent_notification.create
        data_template:
          title: Climate Schedule Updated
          message: >
            {%- if is_state('sensor.house','Occupied') -%}
              Updated climate.{{'wiser_' + trigger.event.data.file|regex_replace(find='_schedule_occupied.yaml', replace='', ignorecase=False)}}
            {% else %}
              Updated climate.{{'wiser_' + trigger.event.data.file|regex_replace(find='_schedule_unoccupied.yaml', replace='', ignorecase=False)}}
            {% endif %} from file {{ trigger.event.data.folder }}/{{
            trigger.event.data.file }} 
          notification_id: 8002
      - service: wiser.set_heating_schedule
        data_template:
          entity_id: |
            {%- if is_state('sensor.house','Occupied') -%}
              climate.{{'wiser_' + trigger.event.data.file|regex_replace(find='_schedule_occupied.yaml', replace='', ignorecase=False)}}
            {% else %}
              climate.{{'wiser_' + trigger.event.data.file|regex_replace(find='_schedule_unoccupied.yaml', replace='', ignorecase=False)}}
            {% endif %}
          filename: '{{ trigger.event.data.folder }}/{{ trigger.event.data.file }}'
    mode: single
  11. Switch between custom schedules using the Lovelace UI

    master

    Since Home Assistant does not natively provide a way to view or select Wiser schedules directly in the UI, you can implement a custom switching mechanism using Home Assistant scripts and a Lovelace card.

    To achieve this:

    1. Create a script in Home Assistant: Define scripts that trigger the specific schedule changes you want to automate.
    2. Create a card in Lovelace: Use a button card or a similar UI element to call these scripts. This allows you to switch between different schedules instantly from your dashboard.
  12. Turn off Wiser Away Mode at a specific date and time

    master

    You can automate the disabling of Wiser Away Mode using a Home Assistant automation triggered by a datetime helper. This is useful for ensuring your home is warm when you return from a trip.

    Setup Steps:

    1. Create a Datetime Helper: In Home Assistant, create an input_datetime entity (e.g., input_datetime.return_home).
    2. Add to UI: Place this helper on a Lovelace dashboard card so you can easily set the return date and time.
    3. Configure Automation: Create an automation that triggers when the input_datetime reaches its set value and calls the switch.turn_off service on your Wiser Away Mode switch.
    alias: Turn off Away Mode
    description: ''
    trigger:
      - platform: time
        at: input_datetime.return_home
    condition: []
    action:
      - service: switch.turn_off
        target:
          entity_id: switch.wiser_away_mode
    mode: single