syssi / esphome-atorch-dl24

ESPHome component to monitor and control some Atorch meters via bluetooth
Apache License 2.0
56 stars 13 forks source link

DT24PW _BLE cant connect #61

Closed 1mwbandy closed 9 months ago

1mwbandy commented 1 year ago

Hello Guys, I need a help. The Bluetooth can not connect to DT24PW. The board what I use is: ESP-WROOM-32 image The MAC - DT24PW image

Can you help me? tnx Here is the yaml:

substitutions:
  name: atorch-dc-meter
  external_components_source: github://syssi/esphome-atorch-dl24@main
  dl24_mac_address: 38:3B:26:55:76:92
  project_version: 2.0.0
  device_description: "Monitor and control a Atorch meter via bluetooth"

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-atorch-dl24"
    version: ${project_version}

esp32:
  board: nodemcu-32s
  framework:
    type: arduino

external_components:
  - source: ${external_components_source}
    refresh: 0s

wifi:
  ssid: Muhely
  password: cirmanska

ota:

logger:
  level: DEBUG

# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt

api:

esp32_ble_tracker:

ble_client:
  - mac_address: ${dl24_mac_address}
    id: ble_client0

atorch_dl24:
  - id: atorch0
    ble_client_id: ble_client0
    check_crc: false
    # The meter publishes a status report per second via BLE notification. If you don't like this update interval
    # you can use this setting to throttle the sensor updates by skipping some status reports.
    throttle: 1s

binary_sensor:
  - platform: atorch_dl24
    atorch_dl24_id: atorch0
    running:
      name: "${name} running"

sensor:
  - platform: atorch_dl24
    atorch_dl24_id: atorch0
    voltage:
      name: "${name} voltage"
    current:
      name: "${name} current"
    power:
      name: "${name} power"
    capacity:
      name: "${name} capacity"
    energy:
      name: "${name} energy"
    temperature:
      name: "${name} temperature"
    dim_backlight:
      name: "${name} dim backlight"
    runtime:
      name: "${name} runtime"

text_sensor:
  - platform: atorch_dl24
    atorch_dl24_id: atorch0
    runtime_formatted:
      name: "${name} runtime formatted"

# If you use `mqtt` you can control a button if you publish the message "PRESS". The topic depends on
# the name of your ESPHome node and the name of the button entity:
#
# mosquitto_pub -t 'atorch-dc-meter/button/atorch-dc-meter_reset_energy/command' -m 'PRESS'
# mosquitto_pub -t 'atorch-dc-meter/button/atorch-dc-meter_reset_capacity/command' -m 'PRESS'
# mosquitto_pub -t 'atorch-dc-meter/button/atorch-dc-meter_reset_runtime/command' -m 'PRESS'
# mosquitto_pub -t 'atorch-dc-meter/button/atorch-dc-meter_reset_all/command' -m 'PRESS'
# ...
button:
  - platform: atorch_dl24
    atorch_dl24_id: atorch0
    reset_energy:
      name: "${name} reset energy"
    reset_capacity:
      name: "${name} reset capacity"
    reset_runtime:
      name: "${name} reset runtime"
    reset_all:
      name: "${name} reset all"
    plus:
      name: "${name} plus"
    minus:
      name: "${name} minus"
    setup:
      name: "${name} setup"
    enter:
      name: "${name} enter"

And log:

INFO ESPHome 2023.9.3
INFO Reading configuration /config/esphome/atorch.yaml...
INFO Updating https://github.com/syssi/esphome-atorch-dl24.git@main
INFO Starting log output from atorch-dc-meter.local using esphome API
INFO Successfully connected to atorch-dc-meter.local
[14:31:07][I][app:102]: ESPHome version 2023.9.3 compiled on Oct 13 2023, 14:17:37
[14:31:07][I][app:104]: Project syssi.esphome-atorch-dl24 version 2.0.0
[14:31:07][C][wifi:546]: WiFi:
[14:31:07][C][wifi:382]:   Local MAC: B0:A7:32:33:89:C8
[14:31:07][C][wifi:383]:   SSID: [redacted]
[14:31:07][C][wifi:384]:   IP Address: 192.168.1.108
[14:31:07][C][wifi:386]:   BSSID: [redacted]
[14:31:07][C][wifi:387]:   Hostname: 'atorch-dc-meter'
[14:31:07][C][wifi:389]:   Signal strength: -44 dB ▂▄▆█
[14:31:07][C][wifi:393]:   Channel: 11
[14:31:07][C][wifi:394]:   Subnet: 255.255.255.0
[14:31:07][C][wifi:395]:   Gateway: 192.168.1.1
[14:31:07][C][wifi:396]:   DNS1: 192.168.1.1
[14:31:07][C][wifi:397]:   DNS2: 0.0.0.0
[14:31:08][C][logger:357]: Logger:
[14:31:08][C][logger:358]:   Level: DEBUG
[14:31:08][C][logger:359]:   Log Baud Rate: 115200
[14:31:08][C][logger:361]:   Hardware UART: UART0
[14:31:08][C][atorch_dl24:065]: DL24
[14:31:08][C][atorch_dl24:066]:  Voltage 'atorch-dc-meter voltage'
[14:31:08][C][atorch_dl24:066]:    Device Class: 'voltage'
[14:31:08][C][atorch_dl24:066]:    State Class: 'measurement'
[14:31:08][C][atorch_dl24:066]:    Unit of Measurement: 'V'
[14:31:08][C][atorch_dl24:066]:    Accuracy Decimals: 2
[14:31:08][C][atorch_dl24:067]:  Current 'atorch-dc-meter current'
[14:31:08][C][atorch_dl24:067]:    Device Class: 'current'
[14:31:08][C][atorch_dl24:067]:    State Class: 'measurement'
[14:31:08][C][atorch_dl24:067]:    Unit of Measurement: 'A'
[14:31:08][C][atorch_dl24:067]:    Accuracy Decimals: 3
[14:31:08][C][atorch_dl24:068]:  Power 'atorch-dc-meter power'
[14:31:08][C][atorch_dl24:068]:    Device Class: 'power'
[14:31:08][C][atorch_dl24:068]:    State Class: 'measurement'
[14:31:08][C][atorch_dl24:068]:    Unit of Measurement: 'W'
[14:31:08][C][atorch_dl24:068]:    Accuracy Decimals: 4
[14:31:08][C][atorch_dl24:069]:  Capacity 'atorch-dc-meter capacity'
[14:31:08][C][atorch_dl24:069]:    Device Class: 'energy'
[14:31:08][C][atorch_dl24:069]:    State Class: 'total_increasing'
[14:31:08][C][atorch_dl24:069]:    Unit of Measurement: 'Ah'
[14:31:08][C][atorch_dl24:069]:    Accuracy Decimals: 3
[14:31:08][C][atorch_dl24:069]:    Icon: 'mdi:battery-medium'
[14:31:08][C][atorch_dl24:070]:  Energy 'atorch-dc-meter energy'
[14:31:08][C][atorch_dl24:070]:    Device Class: 'energy'
[14:31:08][C][atorch_dl24:070]:    State Class: 'total_increasing'
[14:31:08][C][atorch_dl24:070]:    Unit of Measurement: 'Wh'
[14:31:08][C][atorch_dl24:070]:    Accuracy Decimals: 0
[14:31:08][C][atorch_dl24:070]:    Icon: 'mdi:counter'
[14:31:08][C][atorch_dl24:071]:  Temperature 'atorch-dc-meter temperature'
[14:31:08][C][atorch_dl24:071]:    Device Class: 'temperature'
[14:31:08][C][atorch_dl24:071]:    State Class: 'measurement'
[14:31:08][C][atorch_dl24:071]:    Unit of Measurement: '°C'
[14:31:08][C][atorch_dl24:071]:    Accuracy Decimals: 0
[14:31:08][C][atorch_dl24:072]:  Dim Backlight 'atorch-dc-meter dim backlight'
[14:31:08][C][atorch_dl24:072]:    State Class: 'measurement'
[14:31:08][C][atorch_dl24:072]:    Unit of Measurement: 's'
[14:31:08][C][atorch_dl24:072]:    Accuracy Decimals: 0
[14:31:08][C][atorch_dl24:072]:    Icon: 'mdi:timer-outline'
[14:31:08][C][atorch_dl24:073]:  Running 'atorch-dc-meter running'
[14:31:08][C][atorch_dl24:079]:  Runtime 'atorch-dc-meter runtime'
[14:31:08][C][atorch_dl24:079]:    State Class: 'total_increasing'
[14:31:08][C][atorch_dl24:079]:    Unit of Measurement: 's'
[14:31:08][C][atorch_dl24:079]:    Accuracy Decimals: 0
[14:31:08][C][atorch_dl24:079]:    Icon: 'mdi:timelapse'
[14:31:08][C][atorch_dl24:080]:  Runtime Formatted 'atorch-dc-meter runtime formatted'
[14:31:08][C][atorch_dl24:080]:    Icon: 'mdi:timelapse'
[14:31:08][C][atorch_dl24.button:010]: AtorchDL24 Button 'atorch-dc-meter reset energy'
[14:31:08][C][atorch_dl24.button:010]:   Icon: 'mdi:history'
[14:31:08][C][atorch_dl24.button:010]: AtorchDL24 Button 'atorch-dc-meter reset capacity'
[14:31:08][C][atorch_dl24.button:010]:   Icon: 'mdi:history'
[14:31:08][C][atorch_dl24.button:010]: AtorchDL24 Button 'atorch-dc-meter reset runtime'
[14:31:08][C][atorch_dl24.button:010]:   Icon: 'mdi:history'
[14:31:08][C][atorch_dl24.button:010]: AtorchDL24 Button 'atorch-dc-meter reset all'
[14:31:08][C][atorch_dl24.button:010]:   Icon: 'mdi:history'
[14:31:08][C][atorch_dl24.button:010]: AtorchDL24 Button 'atorch-dc-meter plus'
[14:31:08][C][atorch_dl24.button:010]:   Icon: 'mdi:plus-circle-outline'
[14:31:08][C][atorch_dl24.button:010]: AtorchDL24 Button 'atorch-dc-meter minus'
[14:31:08][C][atorch_dl24.button:010]:   Icon: 'mdi:minus-circle-outline'
[14:31:08][C][atorch_dl24.button:010]: AtorchDL24 Button 'atorch-dc-meter setup'
[14:31:08][C][atorch_dl24.button:010]:   Icon: 'mdi:cog'
[14:31:08][C][atorch_dl24.button:010]: AtorchDL24 Button 'atorch-dc-meter enter'
[14:31:08][C][atorch_dl24.button:010]:   Icon: 'mdi:keyboard-return'
[14:31:08][C][esp32_ble:238]: ESP32 BLE:
[14:31:08][C][esp32_ble:240]:   MAC address: B0:A7:32:33:89:CA
[14:31:08][C][esp32_ble:241]:   IO Capability: none
[14:31:08][C][esp32_ble_tracker:617]: BLE Tracker:
[14:31:08][C][esp32_ble_tracker:618]:   Scan Duration: 300 s
[14:31:08][C][esp32_ble_tracker:619]:   Scan Interval: 320.0 ms
[14:31:08][C][esp32_ble_tracker:620]:   Scan Window: 30.0 ms
[14:31:08][C][esp32_ble_tracker:621]:   Scan Type: ACTIVE
[14:31:08][C][esp32_ble_tracker:622]:   Continuous Scanning: True
[14:31:08][C][ble_client:027]: BLE Client:
[14:31:08][C][ble_client:028]:   Address: 38:3B:26:55:76:92
[14:31:08][C][mdns:115]: mDNS:
[14:31:08][C][mdns:116]:   Hostname: atorch-dc-meter
[14:31:08][C][ota:097]: Over-The-Air Updates:
[14:31:08][C][ota:098]:   Address: atorch-dc-meter.local:3232
[14:31:08][C][api:138]: API Server:
[14:31:08][C][api:139]:   Address: atorch-dc-meter.local:6053
[14:31:08][C][api:143]:   Using noise encryption: NO
syssi commented 11 months ago

Could you try to use the ESP-IDF framework instead of Arduino. Did you change the MAC address to the one of your device?

1mwbandy commented 9 months ago

Hello, Right, thank you. With ESP-IDF work fine.