Battery level issue on Aeotec Multisensor 6

Hey,

I’ve added template sensors for a whole bunch of Fibaro door/motion/flood/smoke sensors so that I can monitor the battery level, but trying to use the same syntax for the battery level of an Aeotec Multisensor 6 gives me a configuration error.

Here is the sensor:

And its template:

And this is a comparable sensor which works fine:

And its template:

Whenever I have the Aeotec template uncommented, I get this error:

What gives??

Thanks in advance for any info!

Just an idea: it looks as if HA is tripping over the sensor name - maybe confused by the fact that its name starts with a number followed by underscore. You could try renaming the sensor to at least start with a letter to see if the same issue still occurs.

Found this in the docos:

If your template uses an entity_id that begins with a number (example: states.device_tracker.2008_gmc) you must use a bracket syntax to avoid errors caused by rendering the entity_id improperly. In the example given, the correct syntax for the device tracker would be: states.device_tracker['2008_gmc']

1 Like

Ah, that is excellent! I had not seen that, thanks a lot!

Will have a go with the brackets, renaming it would have been much more time consuming as it is included in various things and also brought into HA via Vera.

johnflorin,

were you able to make the battery sensor work for you multisensor 6? I have two and for both of them, the batter sensor always shows 100%.

In fact, i have a bunch of the aeotec door switches and their battery sensors always show 100% too.

I am trying several different examples i have found in the forum.

#1
    - platform: template
        sensors:
          battery_ms6_1:
            value_template: '{{ states.switch.ms6_1_5.attributes.battery_level|default(0) }}'
            unit_of_measurement: "%"
            icon_template: >
              {% set battery_level = states.switch.ms6_1_5.attributes.battery_level | default(0) | int %}
              {% set battery_round = (battery_level / 10) |int * 10 %}
              {% if battery_round >= 100 %}
                mdi:battery
              {% elif battery_round > 0 %}
                mdi:battery-{{ battery_round }}
              {% else %}
                mdi:battery-alert
              {% endif %}

#2
- platform: template
        sensors:
          battery_front_door:
            value_template: >-
              {%- if states.switch.front_door_33 -%}
                {{ states.switch.front_door_33.attributes.battery_level }}
              {%- else -%}
                n/a
              {%- endif -%}
            unit_of_measurement: '%'
            entity_id: switch.front_door_33

The issue is that both techniques show 100%.

Another observation, the battery attribute or all of my aeotec switches shows 100%
all the time.

switch.ms6_1_5 off
battery_level: 100
device_armed: False
last_tripped_time: 2018-07-30T13:43:05+00:00
device_tripped: True
Vera Device Id: 5
friendly_name: MS6_1

I wonder if the root cause is my use of Vera Plus for my z-wave hub. Maybe Vera does not correctly handle the battery level?

You need to put all the sensors under 1 platform:

    - platform: template
        sensors:
          battery_ms6_1:
            value_template: '{{ states.switch.ms6_1_5.attributes.battery_level|default(0) }}'
            unit_of_measurement: "%"
            icon_template: >
              {% set battery_level = states.switch.ms6_1_5.attributes.battery_level | default(0) | int %}
              {% set battery_round = (battery_level / 10) |int * 10 %}
              {% if battery_round >= 100 %}
                mdi:battery
              {% elif battery_round > 0 %}
                mdi:battery-{{ battery_round }}
              {% else %}
                mdi:battery-alert
              {% endif %}

          battery_front_door:
            value_template: >-
              {%- if states.switch.front_door_33 -%}
                {{ states.switch.front_door_33.attributes.battery_level }}
              {%- else -%}
                n/a
              {%- endif -%}
            unit_of_measurement: '%'
            entity_id: switch.front_door_33

2 other things.

  1. If you use device_class, you don’t need to use an icon template.

  2. Also I have a multisensor 5, I have to get my battery levels from the zwave object. Here’s my config:

      hallway_motion_battery:
        device_class: battery
        value_template: >
          {% if states.zwave.hallway_ms.state %}
            {{ states.zwave.hallway_ms.attributes.battery_level }}
          {% else %}
            0
          {% endif %}
        unit_of_measurement: "%"

I know you don’t want to rename it, but you will have other problems down the road because of this. Never start the name of an object with a number. Pretty much every code language has this restriction.

Petro,

Thanks for your help. I have just opened a support ticket with Vera because I believe the root cause is my VeraPlus not correctly reporting % of battery for my MultiSensor 6 and Recessed Door Switch devices.

Is there any progress with this issue? I’m having the same problem, the sensor reports “100” as bettery level all the time.

In the meantime I figured out that I had plugged this particular sensor into a wall socket and it had no battery inside. D’oh!

Well, mine isn’t yet it still reports 100 all the time. Maybe it’s a software bug or something.