I think that you are trying to read the sensor from the node on EspHome. In this case, since you are using deep sleep, you need to read the mqtt sensor on HA.
- platform: mqtt
name: Battery Voltage
state_topic: "battery_voltage/sensor/voltage/state"
unit_of_measurement: 'V'
device_class: voltage
qos: 2
payload_available: "online"
payload_not_available: "offline"
thanks for being so helpful, yes I have been getting the senor data from Esp Home.
I have added the text to my config.yaml and get this error
bad indentation of a mapping entry at line 152, column 9:
name: Battery Voltage
^
This is one of my favorite integrations and with the situation with the cars not being driven alot at the moment a very practical one.
I would love to have the gauges working for display on my wall mounted tablet.
Thanks once again If you are able to help.
Thank you so much for you help. It was a combination of the indentation and the fact I also had a sensor field higher up for the badnest, i placed the code under that and it was fine, I am still learning this yaml coding and with the help of people like yourself I am getting to understand it little by little. I presume, I just change the line to state_topic: “what i called the other sensors/sensor/voltage/state”
Thanks for this! Just waiting for my power shields and then I’ll build them!
Anyone tried adding a ds18b20 temp sensor to it? Just for the fun of it to get the interior car temp during winter to see if the heater is working
I had thought about that myself, but decided not to as I mounted all my units at within the engine bay to get a direct reading from the battery. My alarm keyfob also shows the internal temperature anyway, so I know its nice and warm/cold before getting in after a remote start.
I think I have some with 1.5m cables around here somewhere, will add one just for the fun of it. Should be fine to push through some grommet between the engine bay and the car. Will report back when it’s done!
Thanks for your code and advice.
Am I right that this is so the wemos d1 can wake up from deep sleep? (indeed mine with your ESPHome code goes to deep sleep but does not wake up)
Am I also right that it’s no longer possible to program the wemos d1 after that connection, at least not via USB?
Just want to double check before I solder the pins
Yes, that is so that the D1 Mini can wake up from deep sleep. I have two devices that use deep sleep and they have been working without any problem for at least 5 months. The D1 mini should wake up.
In order to upload any code OTA, you can stop deep sleep on the D1 Mini. See the deep_sleep.prevent and deep_sleep.enter below under the MQTT section.
I have an input boolean in HA. When I turn it off, it executes an automation and script to send an mqtt message to turn off deep sleep on my devices. The next time the D1 mini wakes up or if I reset it manually, it will not go to deep sleep.
These are the automations:
##############################################################
# DEEP SLEEP FOR ESPHOME DEVICES
##############################################################
- id: TurnOffDeepSleepForOTA
alias: Turn Off Deep Sleep For OTA
trigger:
platform: state
entity_id: input_boolean.deep_sleep
to: 'off'
action:
- service: script.turn_on
entity_id: script.stop_deep_sleep_on_esphome_devices
##############################################################
- id: TurnOnDeepSleepForOTA
alias: Turn On Deep Sleep For OTA
trigger:
platform: state
entity_id: input_boolean.deep_sleep
to: 'on'
action:
- service: script.turn_on
entity_id: script.resume_deep_sleep_on_esphomedevices
These are the scripts:
####################################################################
stop_deep_sleep_on_esphome_devices:
alias: Stop Deep Sleep
sequence:
- service: mqtt.publish
data:
topic: deep_sleep/ota_mode
payload: 'ON'
qos: 2
retain: true
- service: notify.mobile_app_my_iphone
data:
title: Deep Sleep
message: Deep sleep turned off for OTA updates
####################################################################
resume_deep_sleep_on_esphomedevices:
alias: Resume Deep Sleep
sequence:
- service: mqtt.publish
data:
topic: deep_sleep/ota_mode
payload: 'OFF'
qos: 2
retain: true
- service: notify.mobile_app_my_iphone
data:
title: Deep Sleep
message: Deep sleep turned on
####################################################################
Of course, you could have them combined instead of separated in automations/scripts.
I would not solder anything until you have tested that everything is working.
The D1 mini has a built in 220k , so in total you’ll get 1M + 220k + 220k = 1.44M
I can’t see why it would not work, the idea of the 1.44 was that it would handle up to 16V input without burning the A0.
Thx did order som resistors whit 1m ohm and 220k ohm did not have so hi resitors home. Have 3 sensors 2 in cars and one in the caravan and it works perfect
Does anyone with better knowledge than me , know why after changing from my isp wifi and changing to unifi equipment (yet another rabbit hole) the D1s dont always connect to report the voltage. They worked 98% of the time before. I have created a 2.4 access point just from my Home automation, and used a new SSID, and re-flashed the D1s with the new details. When they do connect they have very good signal strength. One of my cars has not reported back now in 2 days? I am thinking it must be down to the unifi setup, but I have no issues with anything else (The D1s have static ip in the programming).
I’m struggling here. I can’t get the voltage multiplier to work correctly.
I am using a ESP32 based D1 Mini as I need a more powerful ESP for a GPS sensor. I created a resistor for 1.46M ohm (as that’s the closest I could get to 1.22M with the resistors I have. I have the resistors connected to the Voltage input from the DC power shield to the A0 pin (on the ESP32 that’s GPIO36).
The issue I am having is that the voltage is always 12v. I’ve got the ESP connected to my bench power supply and if I up the voltage to say, 14v, the sensor still shows 12v.
I tried adding attenuation to the config, as on the ESPHome docs it mentions there is a limit on the ESP32 but this didn’t make a difference other than increasing the voltage to 24v and 42.55v on the sensor.
ESP32 Attenuation
On the ESP32, the voltage measured with the ADC caps out at 1.1V by default as the sensing range or the attenuation of the ADC is set to 0db by default.
To measure voltages higher than 1.1V, set attenuation to one of the following values:
0db for a full-scale voltage of 1.1V (default)
2.5db for a full-scale voltage of 1.5V
6db for a full-scale voltage of 2.2V
11db for a full-scale voltage of 3.9V
I took a quick look at the esp32 d1 mini datasheet and it doesn’t look like it has a voltage divider.
If I remember corretly, the ESP32 ADC can read up to 3.3v so anything above 3.3v will always give the max value ( 12v in your case). Try to feed it something between 0 and 3.3 volts and see if you the readings go up and down with it.