Monitoring Smart Home Device Battery Levels with Home Assistant

Поділитися
Вставка
  • Опубліковано 17 бер 2023
  • In this video, I cover how to download and install the custom battery card, two required sensors for monitoring, as well as an automation to alert you when a device has a low battery.
    If you'd like to support the channel, you can do so by becoming a Patron at / fasthowto
    This episode's t-shirt: amzn.to/3JrZy9t
    HACS: • Home Assistant startin...
    Mushroom cards: • How to create a Home A...
    IMPORTANT! UA-cam does not allow the use of '<' or '>' in descriptions. The characters below LOOK like those, but they are NOT THE SAME. Wherever you see one of those characters below, delete them and replace them with the same character (above the period or the comma). Thank you!
    battery card configuration code:
    ---
    type: custom:battery-state-card
    color_gradient:
    - '#ff0000'
    - '#ffff00'
    - '#00ff00'
    entities:
    - entity: sensor.my_device_battery
    name: My Sensor
    ---
    Mushroom template card code:
    Icon:
    ---
    {% if is_state('binary_sensor.devices_with_low_battery', 'on') %}
    mdi:battery-10
    {% else %}
    mdi:battery
    {% endif %}
    ---
    Icon Color:
    ---
    {% if is_state('binary_sensor.devices_with_low_battery', 'on') %}
    red
    {% endif %}
    ---
    sensor:
    - platform: template
    sensors:
    devices_with_low_battery:
    friendly_name: 'Devices with low battery'
    unit_of_measurement: devices
    value_template: >-
    {% set ignore_entities = ['sensor.device1_battery_level','sensor.device2_battery_level'] %}
    {{ states.sensor
    | selectattr('attributes.device_class', 'eq', 'battery')
    | rejectattr('entity_id', 'in', ignore_entities)
    | map(attribute='state')
    | map('int', -1) | select('le', 10)
    | list | count
    }}
    icon_template: >-
    {% if is_state('sensor.devices_with_low_battery', '0') %}
    mdi:check-circle
    {% else %}
    mdi:battery-alert
    {% endif %}
    binary_sensor:
    - platform: threshold
    entity_id: sensor.devices_with_low_battery
    name: Devices with low battery
    upper: 0.5
    Some of my favorite home automation things:
    Aqara temperature and humidity sensor (zigbee): amzn.to/3X2ubr3
    Aqara water leak sensor (zigbee): amzn.to/3JkWH3P
    Aqara door & window sensor (zigbee): amzn.to/3Ril7N7
    Aqara mini switch (zigbee): amzn.to/3HlmmGK
    Aqara motion sensor (zigbee): amzn.to/3kV2eDS
    Zigbee and Zwave coordinator: amzn.to/3yuqPTG
    USB extension for Zigbee/Zwave sticks: amzn.to/3ySQGVL
    Intel Nuc: amzn.to/3JcVivA
    KASA outdoor outlet (wifi): amzn.to/3XOLoFl
    KASA indoor outlet HS103 (wifi): amzn.to/3XOLVai
    KASA single pole dimmer HS220 (wifi): amzn.to/3HgOaft
    KASA single pole switch HS200 (wifi): amzn.to/3HHNEsC
    KASA three way switch HS210(wifi): amzn.to/3kSZ0ks
    KASA three way dimmer KS230 (wifi)" amzn.to/3kQm2s8
    Shelly 2.5 relay switch (wifi): amzn.to/40drGon
    Honeywell T9 thermostat (wifi, homekit): amzn.to/3WOVvsD
    Honeywell T9 remote zone sensor: amzn.to/3jfr5Sw
    Sonoff S31 Lite smart plug (zigbee): amzn.to/3HDsb3U
    Sonoff S31 smart plug with power monitoring (zigbee): amzn.to/40fkvMk
    Sengled bulbs (zigbee): amzn.to/3JH95vl
    MyQ Homebridge for Chamberlain/Liftmaster MyQ garage door openers (wifi, homekit): amzn.to/3DrfxSW
    MyQ Chamberlain/Liftmaster garage door controller for non-MyQ openers (wifi): amzn.to/3HIctVm
    August 4th generation WiFi smart lock: amzn.to/3ksXZj3
    Motorola MoCA Adapters: amzn.to/41h9LxI
    My studio gear:
    Canon 90D: amzn.to/3WOvmKz
    Canon EF 28mm f/1.8 USM: amzn.to/3DkPvAH
    Canon EF 50mm f/1.4 USM: amzn.to/3jinlQk
    Canon EF-S 17-55 f/2.8 IS USM: amzn.to/3kRZgQK
    Canon AC adapter: amzn.to/3RgogNC
    Canon DC coupler: amzn.to/3HcmTuK
    Lexar Pro 128GB SDXC cards: amzn.to/3Drg7jA
    ProGrade SD card reader: amzn.to/3HmPRYQ
    Lowepro ProTactic 450 camera bag: amzn.to/3DoJras
    Manfrotto 055 CX Pro tripod: amzn.to/3XOaMei
    Manfrotto 055LC leveling center column: amzn.to/40aYm1R
    Manfrotto MVH502AH fluid head: amzn.to/40eyOkw
    Rode NTG-3B mic: amzn.to/3kGEbIL
    Rode SM4-R shockmount: amzn.to/3Y8zo1m
    Shure SM7B mic: amzn.to/3wEnX5H
    Zoom H4n pro 4-track digital recorder: amzn.to/3Y365x6
    Zoom F6 digital field recorder: amzn.to/3ZWxjHa
    Cloudlifter: amzn.to/3Z31tqO
    GLS balanced XLR cables: amzn.to/3kXb97K
    TASCAM DR-10 lav mic: amzn.to/3kRvGLb
    windjammer for lav mics: amzn.to/3HFPDNM
    Neewer boom arm mic stand: amzn.to/3WH8YCI
    Samson MD5 mic stand: amzn.to/3HHP46q
    Aputure Amaran 100x lights: amzn.to/40dJqQp
    Aputure Light Dome SE: amzn.to/40dJBex
    Light stands: amzn.to/3Rethq2
    Green screen: amzn.to/3jcOjJ3
    Rim light: amzn.to/3RkyzQW
  • Наука та технологія

КОМЕНТАРІ • 41

  • @arthurkazanis4283
    @arthurkazanis4283 6 місяців тому +2

    Great video. Accurate and to the point. I also learnt some stuff on template cards. Love your work Jeff.

    • @fasthowto
      @fasthowto  6 місяців тому

      Thank you for the kind words, and thanks for watching!

  • @Hupihovi
    @Hupihovi Рік тому +1

    Good job man! Man of your word ;)

    • @fasthowto
      @fasthowto  Рік тому +1

      Thank you! It actually shipped this morning. Been a bear of a week at my day job.
      Do you have any creative ideas for giving away these two Fire 10 tablets I've still got? Doesn't look like those guys are going to come forward any time soon... LOL

  • @DanBrown1010
    @DanBrown1010 5 місяців тому +1

    Excellent work! Earned my sub!!

    • @fasthowto
      @fasthowto  5 місяців тому

      Thank you so much for the kind words, and thank you for watching - and for the sub! :)

  • @KozakPlus
    @KozakPlus 10 місяців тому +2

    Really usefull, concise and exciting videos from Mr. Jeff. Thank you a lot and greetings from Ukraine

    • @fasthowto
      @fasthowto  10 місяців тому +1

      Many thanks, glad you are enjoying the videos! Thank you for watching!

  • @OutdoorDreamsHunt
    @OutdoorDreamsHunt Рік тому +1

    Love watching this content just for the shirt messages 😂

  • @killerx4307
    @killerx4307 2 місяці тому

    Nice video.. You are the reason that make me to convert my home to a Smart Home.. and you are a true smart home solver!

    • @fasthowto
      @fasthowto  2 місяці тому +1

      Thank you so much for the kind words! I'm so happy to hear that my videos are helpful. :) thanks for watching!

  • @RandomTorok
    @RandomTorok 3 місяці тому

    I am working on a couple of devices that are basically thermometers. One will be a weather station that I will put outside and it will record temperature, humidity and barometric pressure. I've got it running on an TTGO T-Dislplay and powered by 2 18650 batterys. I have a 4056 charger connect to the battery and the device with a small solar panel connect to the charger. I'm not sure that the small solar panel is sufficient to power the device as well as charge the battery. My dashboard card currently shows the temperature, humidity, pressure as well as battery voltage and battery level. What I'd really like is a battery state that shows charging or discharging. The dashboard card for my phone has this field. Would you know how I can add battery state for my weather station?

  • @frankraym
    @frankraym Рік тому

    My other question as well is if I have another device that goes low battery will I get notified ? Since the automation from the beginning of the video has when it goes from off to on. But if you have already a low battery it stays on and when another device would get low battery it won't switch from off to on....unless I don't fully understand

    • @fasthowto
      @fasthowto  Рік тому

      Great question! Your understanding ia correct. If you want multiple notifications, you'd need to add additional sensors and rewrite the automation, or you'd need to notify based on each device individually. I have WAY too many devices for that. (In fact, you'll see the same logic in my upcoming video on environment change notifications). Since I keep batteries for everything on hand, when I get a notification, I look at the batteries view and see what device needs batteries. Then I go replace them, and I'm back to green and the red light on the card on the dashboard turns off. No idea why you would let one device sit there long enough with a near-dead battery that a second would also go into that state - but regardless, if it happens it should easily be seen on the batteries view by the red battery icon in a sea of otherwise green/yellow.
      Thanks for watching!

  • @MadMike78
    @MadMike78 9 місяців тому

    I don't have the same settings as you do for the alert trigger to send a notification. Do i need to install something?

    • @fasthowto
      @fasthowto  6 місяців тому

      Do you have the companion app installed on your phone?

  • @akhosha2
    @akhosha2 Рік тому

    My configuration.yaml file already contains a sensor: key and it will not let me add the code per your instructions. What am i missing here?

    • @fasthowto
      @fasthowto  Рік тому

      If you already have a sensor key, just add the rest of the code below that. The sensor key in the video is to tell you what section to add it to, you cannot have multiple keys of the same type.

  • @travismailsa1
    @travismailsa1 Рік тому

    Thanks, once configured how do you set a homeassistant notification to notify you when a battery is at or below a certain level?

    • @fasthowto
      @fasthowto  Рік тому

      Did you watch the video?

    • @travismailsa1
      @travismailsa1 Рік тому +1

      @@fasthowto shot for the reply, I did watch the entire video yes. And setup exactly as shown just modified the sensors/batteries I want monitored.

    • @fasthowto
      @fasthowto  Рік тому

      @@travismailsa1 OK, cool. Perhaps I didn't understand what you were asking then? Could you try to explain what you'd like to do in a little greater detail?

    • @travismailsa1
      @travismailsa1 Рік тому

      I have the exact same setup now as per the video, what i am wanting is Homeassistant to push a notification to my Wifes mobile phone when her cell battery hits below 50% for example to put it on charge. She is famous for not charging her phone and this has caused majour issues when emergencies have occured. So i am wandering now how i could possibly create a trigger for the setup provided in the current video. Currently we receive no notifications when either our batteries are low. Both our phones are currently low now on the Battery dash i created like your. configuration.yaml is setup exactly like yours excluding the ignore entities

    • @travismailsa1
      @travismailsa1 Рік тому +1

      @@fasthowto Hi There, just an update, i managed to create automations to do what i wanted via the battery entity and a blueprint to notify me when a battery reaches 50% then 40% and finally 30%. Thank your for your responses though.

  • @JeffAycan
    @JeffAycan 7 місяців тому

    I may have missed the obvious, but what percentage dictates a "low battery"?

    • @fasthowto
      @fasthowto  7 місяців тому

      Sorry about that! Line 103 in config yaml. Great question, and thanks for watching!

    • @JeffAycan
      @JeffAycan 7 місяців тому

      @@fasthowto Thanks, I was thinking that but figured I'd ask first. The absolutely crazy part is, my line 103 coincidently happens to be the same as your line 103. Who'd have thought they'd line up with completely separate systems.

  • @frankraym
    @frankraym Рік тому

    Update : so I got the template in I got the yaml file in but when I go to make an automation it shows the sensor as off. Now it's my understanding that it will only show the checkmark once a device becomes low battery. So I went into developer tools and change the state of a battery to see if it would turn the binary all batteries sensor to on......nothing happened 😢.... So is there something I'm missing ?!

    • @fasthowto
      @fasthowto  Рік тому

      Hard for me to say if you're missing something without being able to see what you've done, so... My first question though would be did you reload the config and/or reboot?

    • @frankraym
      @frankraym Рік тому +1

      ​@@fasthowto ok it was my fault I had an extra spacing in yaml config. Now my next question would be why is it always showing as 1 device with low battery ?

    • @fasthowto
      @fasthowto  Рік тому

      It automatically checks everything with a battery in your system. Go to your entities, and type "battery" in the search bar. There you'll find what the device is, and if you don't want to track that device, you can add it to the exclusions in the config. As mentioned in the video, I ignore phones and tablets and stuff like that. I don't need an alert every time my wife's phone dies. 😂

    • @frankraym
      @frankraym Рік тому

      @@fasthowto ok thank you for that quick response. Is it normal to always show 1 low battery even though in the dashboard all my batteries are higher than 30 %?

    • @frankraym
      @frankraym Рік тому

      @@fasthowto is the binary sensor always supposed to go on ,off on off since as you mentioned it checks the batteries automatically?