2020 Edition: What's the best way to track battery levels in Z-Wave Devices?

I’m trying to figure out what the state of the art is in 2020 for getting sensors to monitor battery levels of zwave devices.

I setup a whack of Zooz ZSE40 multisensors, Lock and Flood Sensors (all zwave) awhile ago, and at the time I had trouble getting sensors for batteries. Stumbling my way through it, I found the Attributes Add-on, and added this to my config which created a sensor for each zwave device, automatically named based on the original device and adding the suffix _battery_level for each:

- platform: attributes
  friendly_name: "Batteries"
  attribute: battery_level
  unit_of_measurement: "%"
  entities:
    - zwave.foyer_multisensor
    - zwave.front_door_lock
    - zwave.kids_room_multisensor
    - zwave.master_bedroom_multisensor
    - zwave.playroom_multisensor
    - zwave.basement_dehumidifier_flood_sensor
    - zwave.basement_water_tank_flood_sensor
    - zwave.bathroom_2f_flood_sensor
    - zwave.kitchen_sink_flood_sensor

which results in these entities being created:

I’m not sure if this has always been the case, but HA reports the battery level next to the Zwave devices in the device registry UI:

Then using the Entity Card and Battery Entities Row, I create this:

with this custom card config:

type: entities
title: Multi-sensors
entities:
  - type: 'custom:battery-entity-row'
    entity: sensor.master_bedroom_battery_level
    name: Master Bedroom Multi-sensor
    attribute: battery_percent
    secondary_info: last-changed
    warning: 50
    critical: 25
  - type: 'custom:battery-entity-row'
    entity: sensor.kids_room_multisensor_battery_level
    name: Kid's Room Multi-sensor
    attribute: battery_percent
    secondary_info: last-changed
    warning: 50
    critical: 25
  - type: 'custom:battery-entity-row'
    entity: sensor.foyer_multisensor_battery_level
    name: Foyer Multi-sensor
    attribute: battery_percent
    secondary_info: last-changed
    warning: 50
    critical: 25
  - type: 'custom:battery-entity-row'
    entity: sensor.playroom_multisensor_battery_level
    name: Playroom Multi-sensor
    attribute: battery_percent
    secondary_info: last-changed
    warning: 50
    critical: 25
  - type: 'custom:battery-entity-row'
    entity: sensor.front_door_lock_battery_level
    name: Front Door Lock
    attribute: battery_percent
    secondary_info: last-changed
    warning: 50
    critical: 25
  - type: 'custom:battery-entity-row'
    entity: sensor.basement_dehumidifier_flood_sensor_battery_level
    name: Basement Dehumidifer Flood Sensor
    attribute: battery_percent
    secondary_info: last-changed
    warning: 50
    critical: 25
  - type: 'custom:battery-entity-row'
    entity: sensor.foyer_multisensor_battery_level
    name: Foyer Multi-sensor
    attribute: battery_percent
    secondary_info: last-changed
    warning: 50
    critical: 25

Is this still the correct thing to do in 2020? Want to make sure I’m not missing something easy here to switch to that reduces the # of moving parts I have to do something simple as tracking battery life of my sensors.

I have an easier setup that won’t leave out any batteries as long as there is a good naming technique.
I list all batteries but you could filter for Zwave and batteries.

type: 'custom:auto-entities'
sort:
  method: state
  numeric: true
card:
  type: 'custom:bar-card'
  severity:
    - color: '#bf4040'
      from: 0
      to: 30
    - color: '#bf9540'
      from: 30.1
      to: 70
    - color: '#40bf40'
      from: 70.1
      to: 100
  show_header_toggle: false
  title: Batteries
filter:
  include:
    - entity_id: '*battery_level*'

I recently stated using the auto-entries card, and it is great. I don’t have to go back and edit my cards each time I add a device, it is just done auto-magically.

Thanks for the info on the card itself. But for the battery level sensors themselves, are you creating them in the same way as I am? I’m not seeing zwave device battery levels exposed automatically unless i’m missing something.

All mine have been automatically exposed. I just utilize customize.yaml to put friendly names on them.
Most of my Z-Wave devices are AeoTech, I can’t say what other manufactures do but battery level seems to be a common data point.
The only non AeoTech battery powered zwave device I have is a Smoke/CO listener, but it also reports battery level.

On your Z-Wave integration click the “xx entities” link; it should list all your zwave devices and every thing they report. Beyond that you may have to look at the configuration of the devices and tell them to report (if that option is available).

Ok thanks! i’m going to remove my battery level sensor creation and restart to see what exists and doesn’t.

You actually have the info you need.
Instead of attributes (which is a valid way to do it) you can use sensor.playroom_multisensor_battery_level. You can do that for every device but as I showed using the Auto Entry card is by far the easiest way to do this.

Digging in on this further, when looking at SOME of my Zooz ZSE40 multisensors, there are no entities exposed for battery levels. But other ZWave devices do including other ZSE40:

E.g for my basement ZSE40 multisensor, notice lack of battery level entity/sensor:

However, for the Aeotec Multisensor 6 it does have battery level entity/sensor:

I thought this a shortcoming of the Zooz ZSE40 but other ZSE40 sensors I’ve got also report battery levels as entities/sensors. This is one:

To try to fix the problem ZSE40, I excluded it, then factory reset it (pressing the action button 10 times within 10 seconds). I then re-added it, which then showed more sensors/entities. However, battery is still missing as a sensor!

Here is the info from dev tools (notice battery level is shown as an attribute):

but then looking at the entities of the device you’ll see battery level has no sensor:

what is going on?

I have a few of the Zooz myself, but not nearly the amount of sensors you do now. My battery level does, however, come through.

Are you using the OpenZWave Add-on to populate the data into HA? If so, you can look at each sensor and see what values it sends over.

There is a nifty custom card that does all of this.

This is my instantiation of the lovelace card.

  - type: custom:battery-state-card
    title: Batteries
    sort_by_level: asc
    collapse: 4
    style: |
      .card-header {
        font-size: 16px;
        font-variant: small-caps;
      }
    entities:
      - entity: sensor.upstairs_nest_protect_battery_health
        state_map:
          - from: "Ok"
            to: 100
          - from: "Replace"
            to: 25
      - entity: sensor.downstairs_nest_protect_battery_health
        state_map:
          - from: "Ok"
            to: 100
          - from: "Replace"
            to: 25
    filter:
      include:
        - name: entity_id
          value: "*_battery_level"
        - name: attributes.device_class
          value: battery
      exclude:
        - name: entity_id
          value: "*_battery_state"

Here is the result.

image

I think the “OpenZWave Add-on” you’re referring to is the new alpha/beta add-on? Assuming yes, I’m not. I’m only using the built in Zwave integration.

Thanks I’ll look at that.

I’m still having issue with the battery level entity not being exposed but since it’s a different topic than what I originally posted about, I started a new thread here:

Btw, thanks for idea to monitor the Nest Protects. super handy. I have multiple units so simplified your card to this which may be helpful for you.

It moves the state_map to the common settings section and includes all nest protects with a wildcard inclusion filter.

  - type: custom:battery-state-card
    title: Batteries
    sort_by_level: asc
    collapse: 4
    style: |
      .card-header {
        font-size: 16px;
        font-variant: small-caps;
      }
    state_map:
      - from: "Ok"
        to: 100
      - from: "Replace"
        to: 25
    filter:
      include:
        - name: entity_id
          value: "*_battery_level"
        - name: attributes.device_class
          value: battery
        - name: entity_id
          value: "*_nest_protect_battery_health"
      exclude:
        - name: entity_id
          value: "*_battery_state"
1 Like

That is a little more robust, thanks! Definitely a nifty little card, don’t understand why it doesn’t get more love.