Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ESPHome yaml for DS18B20 and ADC 1 ~ 4
#1
Could you let me get a sample ESPHome yaml file to obtain sensor data from DS18B20 and ADC 1 ~ 4?

My board is KC868-A4 Rev. is 1.2.4
Reply
#2
you can check at here: https://www.kincony.com/forum/forumdisplay.php?fid=54
Reply
#3
My question was solved. And, it is working well.
I hope to share my yaml file for other people

--
esphome:
name: kc868a4
friendly_name: KC868A4

esp32:
board: esp32dev
framework:
type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:
- platform: esphome
password: "xxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
ssid: "XXXXXXXXXXXXXXXXXX"
password: "XXXXXXXXXXXXXXXX"

# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "XXXXXXXXXXXXX"
password: "XXXXXXXXXX"

captive_portal:

web_server:
port: 80

one_wire:
- platform: gpio
pin: GPIO13



remote_receiver:
pin:
number: 23
inverted: True
dump: nec
tolerance: 25%
filter: 50us
idle: 10ms
buffer_size: 2kb

remote_transmitter:
pin:
number: 22
carrier_duty_percent: 50%

switch:
- platform: gpio
name: “DO1”
pin: 2
inverted: false

- platform: gpio
name: “DO2”
pin: 15
inverted: false

- platform: gpio
name: “DO3”
pin: 5
inverted: false

- platform: gpio
name: “DO4”
pin: 4
inverted: false

- platform: template
name: “HZ Power”
turn_on_action:
- remote_transmitter.transmit_nec:
address: 0x719E
command: 0xFF00
command_repeats: 1
repeat:
times: 1
wait_time: 50ms

turn_off_action:
- remote_transmitter.transmit_nec:
address: 0x719E
command: 0xFF00
command_repeats: 1
repeat:
times: 1
wait_time: 50ms

binary_sensor:
- platform: gpio
name: “DI1”
pin:
number: 36
inverted: true

- platform: gpio
name: “DI2”
pin:
number: 39
inverted: true

- platform: gpio
name: “DI3”
pin:
number: 27
inverted: true

- platform: gpio
name: “DI4”
pin:
number: 14
inverted: true


sensor:
- platform: adc
pin: 32 # or 34
name: "Humidity [A3]"
unit_of_measurement: "%"
update_interval: 5s
attenuation: 12db
# 0 ~ 4096
# filters:
# - lambda:
# if (x >= 3.11) {
# return x * 1.60256;
# } else if (x <= 0.15) {
# return 0;
# } else {
# return x * 1.51;
# }
filters:
- lambda:
if (x >= 3.11) {
return x * 30.83751;
} else if (x <= 0.15) {
return 0;
} else {
return x * 29.24;
}
- platform: adc
pin: 33 # or 35
name: "Temperature [A4]"
unit_of_measurement: "°C"
update_interval: 5s
attenuation: 12db
filters:
# - multiply: 1.51515
# Sensor 0~5V > 0~50'C
- lambda:
if (x >= 3.11) {
return x * 15.41876;
} else if (x <= 0.15) {
return 0;
} else {
return x * 14.62;
}

- platform: dallas_temp
address: 0x7c0000003497e528
name: "Temperature DS18B20"
update_interval: 10s
Reply
#4
thanks share your code.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)