Building a 12v Car Battery monitor for Home Assistant with MQTT, NodeMCU, Tasmota, ESP8266, Arduino

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 32

  • @TheTox1cant
    @TheTox1cant 2 года назад +2

    anybody ending up here and looking at the posted template above here is some modified code to work with current HA as of 10/18/22 for both legacy code and modern. This code is using an ESP32C3 so you may or may not have to add back the 5v conversion
    Modern
    template:
    - sensor:
    - name: "Battery Monitor"
    unit_of_measurement: "VDC"
    state: >
    {{ ((states('sensor.voltage_monitor_1_analog_a1')|float(0) - 45 ) / 918 * 3.3)|round (2) }}
    Legacy
    sensor:
    platform: template
    sensors:
    battery:
    friendly_name: 'Voltage Monitor 1'
    unit_of_measurement: 'VDC'
    value_template: "{{ ((states('sensor.tasmota_analog_a1')|float(0) - 45 ) / 918 * 3.3)|round (2) }}

  • @thedmr8886
    @thedmr8886 2 года назад

    Amazing - thank you for sharing this! I have almost all of the parts here already - just need the voltage sensor!

  • @timmulhall2121
    @timmulhall2121 3 года назад

    Works a treat, great idea. Thank you!

  • @nuukemm
    @nuukemm 2 года назад

    This is great, thank you! Could you share a link to your Tinkercad box design?

  • @matisok
    @matisok Год назад

    Hi there. Excellent tutorial. Building this myself now for my houseboat, though with node-red instead of Home Assistant. I am curious: why did you change to ESP Home? (as I read on the home assistant forum).

    • @Mr12v
      @Mr12v  10 месяцев назад

      It was really only because I had moved most of my other stuff over to esphome, it doesn't really add any functionality as such but I could tie in the deep sleep to my system better!

  • @manfredschuhmacher5260
    @manfredschuhmacher5260 2 года назад

    great, thank you

  • @Edmorbus
    @Edmorbus Год назад

    Could you share a link to your Tinkercad box design?

    • @Mr12v
      @Mr12v  Год назад

      I'll try and get it uploaded yes!

    • @Edmorbus
      @Edmorbus Год назад

      @@Mr12v thanks

  • @grommet20002000
    @grommet20002000 3 года назад +1

    Can you post the template as its not possible to see clearly in the video and im getting syntax errors

    • @Mr12v
      @Mr12v  3 года назад

      Hi, Which template do you need?

    • @grommet20002000
      @grommet20002000 3 года назад

      The template sensor at 7:40 thanks

    • @Mr12v
      @Mr12v  3 года назад +2

      @@grommet20002000 here is the one I have setup in home assistant in the configuration.yaml
      - platform: template
      sensors:
      battery_v1:
      friendly_name: "Voltage Monitor 1"
      unit_of_measurement: 'volts'
      value_template: "{{ ((states('sensor.voltagesensor1_analog_a0')|float - 45 ) / 1024 * 3.3 * 5)|round (2) }}"

    • @grommet20002000
      @grommet20002000 3 года назад

      @@Mr12v Thanks for your video and help, i now have this in my template.yaml
      - sensor:
      - name: "Solar battery"
      unit_of_measurement: "Volts"
      state: "{{ (((states('sensor.green_house_analog_a0') | float -22) / 1024 * 3.3) * 5) | round(2) }}"

    • @sygad1
      @sygad1 3 года назад

      @@Mr12v I just pasted this directly into my configuration.yaml and it's giving me errors "end of stream" is there meant to be something before -platform: template? - thanks

  • @christophsuess7646
    @christophsuess7646 2 года назад

    Thank you very much for the good video. Please share the tinkercad-File or (better) the stl-file with us. Please.

  • @bruceshowalter6046
    @bruceshowalter6046 3 года назад

    Future TODO use a digital out to turn on/off a trickle charger to compensate for monitor parasitic discharge.

    • @Mr12v
      @Mr12v  3 года назад

      I use it through home assistant to turn the chargers on and off whe the battery drains. I have since moved to esphome and sleep the monitor as much as I can to save on the discharge factor!

  • @colincoleman7358
    @colincoleman7358 3 года назад

    Could you use the circuit board part of a mobile phone charger to provide the 5 Volt supply rail?. I ask this because I have several of these module that are no longer used, They all have different plugs on the end for when each phone had an alternate style power socket

  • @marcuslibby6918
    @marcuslibby6918 Год назад

    im getting this error - Platform error tts.template - No module named 'homeassistant.components.template.tts', does anyone know why

  • @ljadf
    @ljadf 3 года назад +1

    Looks "real good" "up in here" y'all.. Was this designed for an American audience by any chance? :) On a more serious note, it'd also be "real good" if you could post the code you used for the template, as I'm also not able to see it clearly. Great work though, the closest I could get was a bluetooth module, which doesn't work with Homeassistant.

    • @Mr12v
      @Mr12v  3 года назад

      Hi, do you need the code i used in the home assistant?

    • @MrDallaskincaid
      @MrDallaskincaid 3 года назад

      @@Mr12v yes

    • @ljadf
      @ljadf 3 года назад

      @@Mr12v I did manage to find some code online which I modified to below, I found that by tweaking the '3.139' figure up or down, it tuned it to within 2dp of the measured figures:
      {{ ((states('sensor.mysensorname')|float -10) /1024 * 3.139 * 5) | round (2) }}

    • @Mr12v
      @Mr12v  3 года назад +1

      @@ljadf you have it there :) This is my Home Assistant sensor using the template.
      - platform: template
      sensors:
      battery_v1:
      friendly_name: "Voltage Monitor 1"
      unit_of_measurement: 'volts'
      value_template: "{{ ((states('sensor.voltagesensor1_analog_a0')|float - 45 ) / 1024 * 3.3 * 5)|round (2) }}"

  • @reg2590
    @reg2590 3 года назад

    Thanks for documenting this.
    My hybrid car's 12v battery has been flat a few times due to little use during lockdown such that it could not power the electrics for the car to start using the big drive battery.
    A Wi-Fi battery status sensor is a good solution either as an ESP8266 acting as a web server one can log into or as you suggest an ESP8266 sending MQTT messages to Home assistant or in my case NodeRed.
    I would like to keep the battery drain to a minimum so I intend to use tasmota's DeepSleep mode.
    My question is simple - Did you investigate the Tasmota DeepSleep command and if so was it successful?

    • @Mr12v
      @Mr12v  3 года назад

      Hi, I've converted one of then to use deep sleep through esphome although its the same thing. It works really well to be honest and keeps the last reported value in home assistant so you don't lose the value. I'm sure it could be done with tasmots just as easy yes!

  • @CodeWithCal
    @CodeWithCal 3 года назад

    How accurate do you find your readings?
    I have a similar setup stepping rough a 12v supply to 3.3v using the same 5:1 ratio voltage divider.
    Results are ball park how ever I would like to get it more precise.

    • @Mr12v
      @Mr12v  3 года назад +2

      Hi. I just used a volt meter to check the values and then changed the calibration values to give me the most accurate voltage to actual. I calibrated at about 12.5v which is somewhere at the mid point. They seem accurate enough!

  • @brucerawiri7170
    @brucerawiri7170 3 года назад +1

    Hi there. Where can i find the tasmota Bin file for this project

    • @Mr12v
      @Mr12v  3 года назад

      It just uses the standard tasmota bin for the esp8266 :)