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) }}
@@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) }}"
@@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) }}"
@@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
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).
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!
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
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.
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!
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?
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!
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!
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 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) }}
@@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) }}"
Amazing - thank you for sharing this! I have almost all of the parts here already - just need the voltage sensor!
Hi can you post a link with the stl for the printer?
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) }}
Thanks!!
Can you post the template as its not possible to see clearly in the video and im getting syntax errors
Hi, Which template do you need?
The template sensor at 7:40 thanks
@@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) }}"
@@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) }}"
@@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
Works a treat, great idea. Thank you!
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).
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!
This is great, thank you! Could you share a link to your Tinkercad box design?
Could you share a link to your Tinkercad box design?
I'll try and get it uploaded yes!
@@Mr12v thanks
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
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.
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!
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?
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!
Future TODO use a digital out to turn on/off a trickle charger to compensate for monitor parasitic discharge.
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!
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.
Hi, do you need the code i used in the home assistant?
@@Mr12v yes
@@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) }}
@@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) }}"
Hi there. Where can i find the tasmota Bin file for this project
It just uses the standard tasmota bin for the esp8266 :)
Thank you very much for the good video. Please share the tinkercad-File or (better) the stl-file with us. Please.
great, thank you
im getting this error - Platform error tts.template - No module named 'homeassistant.components.template.tts', does anyone know why