WiCAN

Open source, ESP32-C3 CAN adapter with USB, Wi-Fi, and BLE support

Sep 27, 2022

Project update 5 of 10

Setting Up Battery Alerts in Home Assistant

by Ali Slim

In this update, I’d like to talk about low battery alerts and how to set them up. Battery alerts are particularly useful if you own multiple cars that you don’t often use. All modern cars have some "parasitic current draw" between 20 mA to 85 mA which will eventually discharge the battery if the car is not started; some cars can only last about 30 days before they need a jump start.

The WiCAN device can help you keep an eye on the battery voltage as the battery discharges and send you an alert when the preset value is reached. In this tutorial, you’ll create a simple MQTT sensor and automation in Home Assistant so, when a low battery is detected, a text-to-speech notification will be sent to Google Home speaker.

Battery alerts are easy to set up, assuming you have a Wi-Fi connection where you park your car and you have a Home Assistant running on your network. Here’s how to set it up:

  1. Install Home Assistant Mosquitto broker add-on

  2. Create Home Assistant new user account for WiCAN. These user credentials will be used to set up the MQTT setting for WiCAN.

  3. Connect to WiCAN access point WiCAN_xxxxxxxxxxxx then, using a web browser, go to http://192.168.80.1/

  4. Enable Sleep mode and Battery Alert.

  5. Fill in the Battery Alert configuration info. For the Alert URL use your Home Assistant IP address and the MQTT User/Password created in step two.

  6. To create a new MQTT sensor, you’ll need to edit the configuration.yaml file by adding the following lines:

    mqtt:
      sensor:
        - name: "Car Battery"
          state_topic: "CAR1/voltage"
          unit_of_measurement: "V"
          value_template: "{{ value_json.battery_voltage }}"
    
  7. Restart Home Assistant, then edit your dashboard to add a new card with the “Car Battery” entity.

  8. Lastly, create a new automation by setting the MQTT topic, entity name, and battery voltage value.


Sign up to receive future updates for WiCAN.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects