Drayton Wiser Home Assistant Integration

lol, i wont, I have a beer waiting for me later :slight_smile:

The name if this will be different based on what you have called your switch when you installed it. I guess yours is call smartplug and the other guys wiser_switch. Mine is called wiser plug 1 so my sensor/switch is called sensor.wiser_plug_1. Slightly different from how TRVs are named as when setup i guess they were just given the name of the room without wiser in the name. Not sure prefixing wiser is a good idea, just rename the plug in app or accept how its named. Or add prefix but dont name plugs with wiser at start.

1 Like

If you havenā€™t worked this out yet, use automation to turn away mode switch on. Ie switch.turn_on service on switch.wiser_away_mode

RobC would highly recommend installing in docker. This way you know that all the required items are there and upgrading is really simple. There is very good instructions on doing this. And this integration and HA needs python 3.7 to correctly function. This is already in the docker HassIO release.

Thank you!

So simple!

Iā€™m new to HA and was over thinking my automation using climate.set_preset_mode

@Duke_box I opened https://github.com/asantaga/wiserHomeAssistantPlatform/issues/88 for the smartplug naming issue.

I looked again and the plug is now named correctly, everything has ā€œwiser_ā€ as a prefix and is pretty consistentā€¦ I think this is fixed? if not please comment in the issue above.

@RobC , totally agree with @msp1974, run HA in docker and let it do the heavy lifting, These instructions are pretty clear https://www.home-assistant.io/docs/installation/docker/

Thanks all! I have manually installed python 3.7 and recreated the venv and now have a fully updated system.
Fair to say quite a lot has changed with a fully functional python (althought google assistant has broken).
See all the trv and battery sensors as expected.
Great work all

1 Like

Hey @Duke_box

From memory you were monitoring the different trvs for low battery, how are you doing this? Id like to implement, and document, a recipe which monitors the different TRVs and sends a notification when a device is lowā€¦

I can do this via python but I was wondering if there was another way

Hi Angelo,

Yes, I monitor them in two places.
I have only 4 TRVā€™s at the moment.
I monitor them in the Lovelace yaml and also using an automation.

The automation:

#####
- id: '1585511648237'
  alias: TRV battery notifications
  description: ''
  trigger:
  - below: '34'
    entity_id: sensor.wiser_itrv_conservatory_battery_level
    for: '01:00:00'
    platform: numeric_state
  - below: '34'
    entity_id: sensor.wiser_itrv_conservatory_battery_level_2
    for: '01:00:00'
    platform: numeric_state
  - below: '34'
    entity_id: sensor.wiser_itrv_kitchen_battery_level
    for: '01:00:00'
    platform: numeric_state
  - below: '34'
    entity_id: sensor.wiser_itrv_kitchen_battery_level_2
    for: '01:00:00'
    platform: numeric_state
  action:
  - data_template:
      message: >
        {% set map = { 'sensor.wiser_itrv_conservatory_battery_level': 'Conservatory Deck',
                     'sensor.wiser_itrv_conservatory_battery_level_2': 'Conservatory Hedge',
                     'sensor.wiser_itrv_kitchen_battery_level': 'Kitchen Conservatory',
                     'sensor.wiser_itrv_kitchen_battery_level_2': 'Kitchen Door' } %}
        Check {{ map[trigger.entity_id] }} TRV's batteries
    service: persistent_notification.create
#####

I use card-mod in the Lovelace yaml to alter the colour of the sensor icon as below:

      - cards:
          - columns: 8
            entities:
              - entity: sensor.wiser_itrv_conservatory
                style: |
                  :host {
                    --paper-item-icon-color:
                      {% if states.sensor.wiser_itrv_conservatory_battery_level.state | int < 34 %}
                       red 
                      {% else %}
                       var(--state-icon-color)
                      {% endif %}
                      ;
                  }
              - entity: sensor.wiser_itrv_conservatory_2
                style: |
                  :host {
                    --paper-item-icon-color:
                      {% if states.sensor.wiser_itrv_conservatory_battery_level_2.state | int < 34 %}
                       red 
                      {% else %}
                       var(--state-icon-color)
                      {% endif %}
                      ;
                  }
              - entity: sensor.wiser_itrv_kitchen
                style: |
                  :host {
                    --paper-item-icon-color:
                      {% if states.sensor.wiser_itrv_kitchen_battery_level.state | int < 34 %}
                       red 
                      {% else %}
                       var(--state-icon-color)
                      {% endif %}
                      ;
                  }
              - entity: sensor.wiser_itrv_kitchen_2
                style: |
                  :host {
                    --paper-item-icon-color:
                      {% if states.sensor.wiser_itrv_kitchen_battery_level_2.state | int < 34 %}
                       red 
                      {% else %}
                       var(--state-icon-color)
                      {% endif %}
                      ;
                  }
              - entity: sensor.wiser_roomstat_house
              - entity: sensor.wiser_heathub
              - entity: sensor.wiser_switch
              - entity: switch.wiser_wiser_switch
            gridcol: 1 / 4
            gridrow: 3 / 3
            show_icon: true
            show_name: true
            show_state: true
            style: 'ha-card { height: 100%; }'
            type: glance

Hope this helps.

Cool, Iā€™ll try it out and then add it to the recipes section ā€¦

I was trying to avoid listing out each and every device but that appears to be the way to do itā€¦ that said the automation UI is quite good nowā€¦

Just wondering you have a value of 34ā€¦ is this a typo?.. the values will probably always be below 34ā€¦ dont you mean 26?

Hi,

I was meaning to ask you about that.

I was using the battery voltage attribute on the sensor originally, before your last update ( which broke it :slight_smile: ). Now, since you are exposing the battery sensor I am using that as you can see.
However the state of this sensor appears to be a percentage not a voltage, hence me going for one third ( < 34% ). As you say in your documentation the magic number is 26 or ā€œOneThirdā€. If this is wrong then please enlighten me.

Cheers.

This might be a breaking changeā€¦ Or something we fixedā€¦

Looking at the code in the latest dev branch
Both iTRV and Batteries now report battery data

and image

For your usecase Id probably use battery voltage in the iTRV as this is a integer without the ā€œvā€ā€¦

The right range is now

(from const.py)

Battery Constants

TRV_FULL_BATTERY_LEVEL = 30
TRV_MIN_BATTERY_LEVEL = 25
ROOMSTAT_MIN_BATTERY_LEVEL = 17
ROOMSTAT_FULL_BATTERY_LEVEL = 27

Ive just noticed that the values/format in iTRV are different, I think they should both be the same.
What I am going to do is change it so that the number has a decimal point and no trailing v as the name implies voltage

Your first screen shot and your highlighted battery voltage was what I was checking for originally. But since the last update the battery voltage level sensor became available.
And because iā€™m lazy i just used the base state of that, not the voltage attribute of it.

If you make the voltage attribute an integer then that would simplify the template code in the lovelace yaml. for example:

                style: |
                  :host {
                    --paper-item-icon-color:
                      {% if states.sensor.wiser_itrv_kitchen_battery_level_2.attribute[ battery_voltage] | int < 26 %}
                       red 
                      {% else %}
                       var(--state-icon-color)
                      {% endif %}
                      ;
                  }

The automation is still checking for the numeric state of the sensor though, which is a percentage not a voltage ( I think ).

Duh! Of course, sorry, then yeah 34 (%) is right :slight_smile:

and yes it is a % of voltage given the ranges weā€™ve discovered.

The batteries are still good for kids toys after their done with wiser, but not enough juice the wiser motors in the trvs

yeah - discovered they power clocks for years afterwards. Just donā€™t have enough clocks to re-use 'em :slight_smile:
thanks for the clarification though

Hi Angelo,

Just wanted to let you know that your code helped me a lot to create an integration of the Schneider Wiser Smart platform.
I hope you wonā€™t mind but Iā€™ve reused part of your code to make it map my version of the wiser system

Regards,
Thomas.

Hey Thomas ,

No worries, is all about the community, but im baffledā€¦ How is Schneider Wiser Smart platform different to Drayton wiser, isnt it the same kit???

It is an older platform that does not have a direct API to control the system where the Drayton one must be based on a more recent one.

Iā€™ve used Wireshark to retrieve the API calls to the main Controller and mapped it with your code. Thankfully it was quite simple API.

Ahh I get itā€¦

I wonder if we could modify my code so that we have a single install base. My concern is the name youā€™ve given the component may confuse peopleā€¦ (it confused me! :slight_smile: )

Perhaps in your readme put a big banner explaining the difference between the two for now, meanwhilst Iā€™ll have a good nose at the changes youve made and see if we can merge it as a switch in the base code (depends how close they areā€¦)

BTW Awesome this helped out :slight_smile: