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:

1 Like

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?
livingroom_1_ac/battery
livingroom_1_ac/battery_2
bedroom_1_ac/battery

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 sensibo.py 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?

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

@property
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

climate:
  - platform: sensibo
    api_key: YOUR_API_KEY

Then switch (optional)

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

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
    entities:
      - group.battery_alert
      - group.battery_status
      - group.battery_view
2 Likes

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/service.py (ERROR)
Error rendering data template: UndefinedError: ā€˜entity_idā€™ is undefined
21:15 helpers/service.py (ERROR)
Error during template condition: UndefinedError: ā€˜Noneā€™ has no attribute ā€˜attributesā€™
21:15 helpers/condition.py (ERROR)
Error during template condition: UndefinedError: ā€˜Noneā€™ has no attribute ā€˜attributesā€™
21:15 helpers/condition.py (ERROR)
Error rendering data template: UndefinedError: ā€˜entity_idā€™ is undefined
21:13 helpers/service.py (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:

homeassistant:
  customize:
    climate.bedroom_1_ac:
      battery_sensor_creation_disabled: true
    climate.bedroom_ac:
      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!