Howto create battery alert without creating a template for every device


#513

Ok, never mind then


#514

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.


#515

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.


#516

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.


#517

thank you :smiley:


#518

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


#519

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.


#520

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

#521

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.


#522

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

#523

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.


#524


#525

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.


#526

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


#527

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


#528

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…


#529

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.


#530

Thank you. I will try.


#531

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 !!


#532

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