I have a ntc sensor working on an esp8266. As a comparison of accuracy want to add a dallas DS 18b20 sensor to the same esp.
Ths is the configuration file uploaded to the esp8266 by OTA
The sensor is not connected and the log gives an error that sensor not found. Was expecting a series of addresses for the sensors.
Here is a part of the relevant log
[23:48:03][C][dallas.sensor:073]: Pin: GPIO5 (Mode: INPUT)
[23:48:03][C][dallas.sensor:074]: Update Interval: 60.0s
[23:48:03][W][dallas.sensor:077]: Found no sensors!
[23:48:04][C][captive_portal:169]: Captive Portal:
[23:48:04][C][ota:029]: Over-The-Air Updates:
[23:48:04][C][ota:030]: Address: playground.local:8266
[23:48:04][C][api:095]: API Server:
[23:48:04][C][api:096]: Address: playground.local:6053
[23:48:39][E][dallas.sensor:126]: Requesting conversion failed
[23:48:43][D][switch:025]: 'VCC For NTC from PinD7' Turning OFF.
[23:48:43][D][switch:045]: 'VCC For NTC from PinD7': Sending state OFF
[23:48:43][D][adc:056]: 'source_sensor': Got voltage=0.49V
[23:48:43][D][sensor:092]: 'source_sensor': Sending state 1.44617 V with 4 decimals of accuracy
[23:48:43][D][resistance:037]: 'Resistance Sensor' - Resistance 7723.0Ω
[23:48:43][D][sensor:092]: 'Resistance Sensor': Sending state 7723.00830 Ω with 2 decimals of accuracy
[23:48:43][D][ntc:026]: 'NTC Temperature Sensor' - Temperature: 30.9°C
[23:48:43][D][sensor:092]: 'NTC Temperature Sensor': Sending state 30.93044 °C with 0 decimals of accuracy
[23:48:43][D][switch:021]: 'VCC For NTC from PinD7' Turning ON.
[23:48:43][D][switch:045]: 'VCC For NTC from PinD7': Sending state ON
[23:49:39][E][dallas.sensor:126]: Requesting conversion failed
I used the GPIO05 as you suggested @nickrout, I did not get the result I was seeking. Even created a dallas hub on a esp8266 on pins GPIO05 and GPIO04 in turn, but same result.
What am I missing…
I have not connected the sensor yet to the defined pin(As stated in the documentation). Yes I have the pullup of 4.7kOhms as defined in the esphome documentation.
BTW I am using ESPHOME(dev) to compile and upload.
I was merely following this from the documentation @ Esphome
Getting Sensor IDs
It is highly recommended to use the address attribute for creating dallas sensors, because if you have multiple sensors on a bus and the automatic sensor discovery fails, all sensors indices will be shifted by one. In order to get the address, simply start the firmware on your device with a configured dallas hub and observe the log output (the log level must be set to at least debug!). Note that you don’t need to define the individual sensors just yet, as the scanning will happen even with no sensors connected. For example with this configuration:
# Example configuration entry
dallas:
- pin: GPIO23
# Note you don't have to add any sensors at this point
I am pretty sure that means you do not need to create a sensor in your yaml file - the sensor clearly needs to be physically connected to get the address.
You are right @nickrout!
Esphome takes pin number as an int for the dallas sensor I think, so used 5 to get the sensor working. This is the final yaml file uploaded.