Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SHT30/DS18B20 errors and warnings in the logs
#17
I have tested KC868-A2 board with GPIO33 for DS18B20
   
   
here is webpage:
   
here is my ESPHome config file:
   
you can test with my yaml file (just replace DS18B20 sensor ID by yourself):
Code:
esphome:
  name: a2

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "YnmQggQsfd7jvFefoMqNCpBtb63RXtotS+mSBQVIhY8="

# Example configuration entry
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

switch:
  - platform: gpio
    name: "a2-light1"
    pin: 15
    inverted: False
    id: relay_1  # Assign ID to relay 1

  - platform: gpio
    name: "a2-light2"
    pin: 2
    inverted: False

binary_sensor:
  - platform: gpio
    name: "a2-input1"
    pin:
      number: 36
      inverted: true

  - platform: gpio
    name: "a2-input2"
    pin:
      number: 39
      inverted: true

external_components:
  - source:
      type: git
      url: https://github.com/ssieb/esphome
      ref: onewire
    components: [ gpio ]
    refresh: 1min

#dallas:
one_wire:
- platform: gpio
   pin: GPIO33
   id: sensor_1

sensor:
  - platform: dallas_temp
    one_wire_id: sensor_1
    address: 0xc1012263977a9928
    filters:
    - lambda: return x * (9.00/5.00) + 32.00;
    name: "Temperature #1"
    unit_of_measurement: "°F"
    icon: "mdi:temperature-fahrenheit"
    device_class: "temperature"
    accuracy_decimals: 2

web_server:
  port: 80

# UART configuration for SIM7600E
uart:
  id: uart_2
  tx_pin: GPIO5
  rx_pin: GPIO13
  baud_rate: 115200

interval:
  - interval: 200ms  # Shorten the interval to reduce blocking time
    then:
      - lambda: |-
          static std::string uart_buffer;
          uint8_t c;
          int count = 0;
          const int max_reads = 10;  // Limit the number of bytes read per interval

          while (id(uart_2).available() && count < max_reads) {
            if (id(uart_2).read_byte(&c)) {
              uart_buffer += (char)c;
              count++;

              // Log each received character (optional for debugging)
              ESP_LOGD("UART", "Received: %c", (char)c);

              // Check if we have received the "RING" signal
              if (uart_buffer.find("RING") != std::string::npos) {
                ESP_LOGI("SIM7600", "Incoming call detected, turning on relay 1.");
                id(relay_1).turn_on();  // Turn on relay 1
                uart_buffer.clear();  // Clear the buffer after processing
              }

              // Clear the buffer if it gets too large
              if (uart_buffer.length() > 100) {
                uart_buffer.clear();
              }
            }
          }
yaml file download: 
.txt   A2-DS18B20-HA.txt (Size: 2.57 KB / Downloads: 29)
Reply


Messages In This Thread
RE: SHT30/DS18B20 errors and warnings in the logs - by admin - 10-12-2024, 12:44 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)