Howto create battery alert without creating a template for every device


Ok, never mind then


It looks like the next release should have what’s needed to make it work. I’ll look at it when that feature is released.


how can we remove a battery entity? My issue is that I renamed an entity in HA and now I have both the new and old entity_id’s trying to give me a battery level. The new one works and the old one is giving me alerts all the time due to it having an unknown battery level.


Copy the mqtt_state_topic attribute from the sensor you wish to delete and paste it into the MQTT Topic to Clear input text box. Repeat for the mqtt_config_topic attribute.


thank you :smiley:


I don’t understand is it correct this way.
entity_id: sensor.bedroom_1_ac_battery
entity_id: sensor.livingroom_ac_battery
entity_id: sensor.livingroom_ac_battery_2

These 3 sensor state unknown and actually there is no these 3 devices.
So in input text box need to type these 3 topics right?


There should be attributes named mqtt_state_topic and mqtt_config_topic on those sensors. Those are the topics that need to be cleared to remove those sensors.


I got what you mean now. When I looks through the config there is no mention about mqtt_state_topic. But in I search word battery and found that there are 2 @property mention about battery that why it show automatically on frontend/ but nothing is about battery at all. So that mean I cannot stop battery alert to display right?

def device_state_attributes(self):
    """Return the state attributes."""
    return {ATTR_CURRENT_HUMIDITY: self.current_humidity,
            'battery': self.current_battery}

def current_battery(self):
    """Return the current battery voltage."""
    return self._measurements.get('batteryVoltage')

These 2 sensors are automatically created when I add sensibo A/C controller to home assistant.
To add is simple

  - platform: sensibo
    api_key: YOUR_API_KEY

Then switch (optional)

  - platform: template
        friendly_name: "AC"
        value_template: "{{ is_state('', 'cool') or is_state('', 'heat') or is_state('', 'dry') or is_state('', 'heat')}}"
          service: climate.turn_on
          service: climate.turn_off


Has anyone attempted a LoveLace card with this? I am just getting started with LoveLace and trying to understand how it all ties in. This may not even be a valid question for all I know.


I have it in lovelace. To keep it small I just added the groups to my lovelace config so I can bring everything up as a more-info type view.

  - id: battery_alerts
    type: entities
    title: Battery Alerts
    show_header_toggle: false
      - group.battery_alert
      - group.battery_status
      - group.battery_view


Can you post a screenshot of the entity on the states page? I need to see it’s state as well as the attributes.

I haven’t looked at Lovelace yet.



All of those look to be sensors. I thought the entity that was giving you trouble was climate? Can you tell me which entity in the screenshot is parent entity? Also, the attributes column isn’t visible. I need to see that column too.


I create 2 climates / one for livingroom and second for bedroom 1 / 2 sensors for battery automatically created by itslef. When I try to delete from integrations it create more and more.
example I delete sensor.livingroom_ac_battery, then it create sensor.livingroom_ac_battery_2 .

bedroom climate living


If cannot stop them from creating. Can we specific entity_id not to show or popup. Left it with unknown state.


I had to reinstall HA on my Rpi3 … i’m on 0.83.3 and am getting these entries which i think i tracked back to battery.yaml:

Error rendering data template: UndefinedError: ‘entity_id’ is undefined
21:20 helpers/ (ERROR)
Error rendering data template: UndefinedError: ‘entity_id’ is undefined
21:15 helpers/ (ERROR)
Error during template condition: UndefinedError: ‘None’ has no attribute ‘attributes’
21:15 helpers/ (ERROR)
Error during template condition: UndefinedError: ‘None’ has no attribute ‘attributes’
21:15 helpers/ (ERROR)
Error rendering data template: UndefinedError: ‘entity_id’ is undefined
21:13 helpers/ (ERROR)

In the battery.yaml code i saw a template checking for none … (4 times).

Any tips to resolve this? I don’t get the battery status reported anymore either…


You can disable creation of the sensors using customize like this:

      battery_sensor_creation_disabled: true
      battery_sensor_creation_disabled: true

I didn’t realize it was possible to get an event without an entity_id. I can add a condition to filter those events out.


Thank you. I will try.


I’ve just use your package with my Xiaomi gateway, but i’ve no sensor created… however sensors have attribute “battery_level” i dont know why… !BLA

Any idea ?
Thanks for your work !!


Really nice work, I just tried it and it works really great. Many thanks!