Drayton Wiser Home Assistant Integration

I wonder if this is a python3.6 issue. The line above

Mar 31 14:38:09 centos8. hass[7608]: if cur_step.get(“data_schema”) is not None and user_input is not None:
Mar 31 14:38:09 centos8. hass[7608]: AttributeError: ‘NoneType’ object has no attribute ‘get’

Is not from my code and this appears to be in HA itself, the new integration uses config flow so that might be the issue…

you could try 1.9 instead , it doesnt use config flow…

Alternatively have you tried docker? thats what I use for Home Assistant and it works fab…

tried 2.1 beta 2 and had same issue so have now reverted back to 1.9dev which seems to work fine.

Hi Angelo

Just updated to 2.1 from 1.9 and got a missing sensor, a few new ones and a few errors.

  1. My smartplug sensor has disappeared. it was of the form sensor.wiser_smartplug_xxxxxxxxxxx. I cannot find it in dev / states and I only know about it as I had it in Glance card so I could see the zigbee signal strength, now in its place is a warning icon.

  2. Whilst looking for the smartplug sensor, I see we have battery sensor now for the TRV’s, I didn’t see this mentioned in the change log and the readme. I only mention this because…

  3. I have a lot of recurring errors which I believe are being caused because the battery_voltage attribute of the TRV sensor is not there anymore. I have an automation that checks the voltage status and templates embedded in the glance card that show the signal strength of the TRV’s which render them red if the battery voltage goes below the magic 26 number.

So, is the loss of the smartplug sensor and the battery_voltage attribute by design or an ommission? Just so I know before I go and rewrite my stuff. :slight_smile:

Thanks for the great integration BTW

mmm lots here to see!

  1. I just checked my setup and smartplug sensor and switch are both there … but Ive just noticed its just called sensor.smartplug whereas all the other wiser devices are called ‘sensor.wiser_xxxx’ so I wonder if this is the bug , it got renamed…

Logged a new issue (#88) and fixed it in a new commit in the dev branch.

  1. Yes, added to readme.md in dev, thanks

  2. This is a breaking change, we created the battery sensors and then removed the attributes but forgot this is a breaking change and shouldnt of happened… . Sorry… What Ive done is fixed this one too in the dev branch

Ive created a R2.2.alpha release with these fixes , please let me know if there are any other issues

Hi,

Thanks for the quick fixes.

I have downloaded R2.2.alpha which has fixed the battery_voltage attribute of the trv sensors.

But I am a bit confused, you said your smartplug showed up as sensor.smartplug but mine isn’t.
It shows as sensor.wiser_switch in my setup not as smartplug, (which it did before your alpha fix I notice - doh!).
I have now also lost the switch switch! (switch.wiser_switch which was ok in R2.1)
It now is switch.wiser_wiser_switch

I can change things to accommodate these no problem but will they revert later?

I notice there is a newer sensor.py to fix a battery discrepancy should I download that as well?

Thanks

oh , i’ll look at it again…

you should be able to download 2.2alpha for both fixes unless I screwed that up too…

I’ll look again tonight.

Hi,

Don’t bust a gut on my behalf. I have it working ok with your fix and the changes.
I will need to alter things once you have sorted it to your satisfaction though.

Cheers

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