esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

Xiaomi LYWSDCGQ BLE Sensor value update in hassio #1055

Closed ilmisu closed 4 years ago

ilmisu commented 4 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

Hass.io ESP (ESP32/ESP8266, Board/Sonoff):

ESP32 **Affected component:** https://esphome.io/components/sensor/xiaomi_lywsdcgq.html

Description of problem:

Problem-relevant YAML-configuration entries:

PASTE YAML FILE HERE
esphome:
  name: esp32
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: "Casa Misuriello"
  password: "xxx
# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "xxx"

ota:
  password: "xxx"

web_server:
  port: 80

esp32_ble_tracker:

sensor:
  - platform: xiaomi_lywsdcgq 
    mac_address: 58:2D:34:31:2B:03
    temperature:
      name: "Temperatura Soggiorno"
    humidity:
      name: "Umidità Soggiorno"
    battery_level:
      name: "Batteria TH soggiorno"

Logs (if applicable):

how Logs esp32.yaml
INFO Reading configuration /config/esphome/esp32.yaml...
INFO Starting log output from esp32.local using esphome API
INFO Connecting to esp32.local:6053 (192.168.1.122)
INFO Successfully connected to esp32.local
[12:29:30][I][app:100]: ESPHome version 1.14.3 compiled on Feb 18 2020, 21:20:46
[12:29:30][C][wifi:415]: WiFi:
[12:29:30][C][wifi:283]:   SSID: [redacted]
[12:29:30][C][wifi:284]:   IP Address: 192.168.1.122
[12:29:30][C][wifi:286]:   BSSID: [redacted]
[12:29:30][C][wifi:287]:   Hostname: 'esp32'
[12:29:30][C][wifi:291]:   Signal strength: -51 dB ▂▄▆█
[12:29:30][C][wifi:295]:   Channel: 1
[12:29:30][C][wifi:296]:   Subnet: 255.255.255.0
[12:29:30][C][wifi:297]:   Gateway: 192.168.1.1
[12:29:30][C][wifi:298]:   DNS1: 192.168.1.1
[12:29:30][C][wifi:299]:   DNS2: 0.0.0.0
[12:29:30][C][logger:175]: Logger:
[12:29:30][C][logger:176]:   Level: DEBUG
[12:29:30][C][logger:177]:   Log Baud Rate: 115200
[12:29:30][C][logger:178]:   Hardware UART: UART0
[12:29:31][C][esp32_ble_tracker:442]: BLE Tracker:
[12:29:31][C][esp32_ble_tracker:443]:   Scan Duration: 300 s
[12:29:31][C][esp32_ble_tracker:444]:   Scan Interval: 320.0 ms
[12:29:31][C][esp32_ble_tracker:445]:   Scan Window: 30.0 ms
[12:29:31][C][esp32_ble_tracker:446]:   Scan Type: ACTIVE
[12:29:31][C][xiaomi_lywsdcgq:012]: Xiaomi LYWSDCGQ
[12:29:31][C][xiaomi_lywsdcgq:013]:   Temperature 'Temperatura Soggiorno'
[12:29:31][C][xiaomi_lywsdcgq:013]:     Unit of Measurement: '°C'
[12:29:31][C][xiaomi_lywsdcgq:013]:     Accuracy Decimals: 1
[12:29:31][C][xiaomi_lywsdcgq:013]:     Icon: 'mdi:thermometer'
[12:29:31][C][xiaomi_lywsdcgq:014]:   Humidity 'Umidità Soggiorno'
[12:29:31][C][xiaomi_lywsdcgq:014]:     Unit of Measurement: '%'
[12:29:31][C][xiaomi_lywsdcgq:014]:     Accuracy Decimals: 1
[12:29:31][C][xiaomi_lywsdcgq:014]:     Icon: 'mdi:water-percent'
[12:29:31][C][xiaomi_lywsdcgq:015]:   Battery Level 'Batteria TH soggiorno'
[12:29:31][C][xiaomi_lywsdcgq:015]:     Unit of Measurement: '%'
[12:29:31][C][xiaomi_lywsdcgq:015]:     Accuracy Decimals: 0
[12:29:31][C][xiaomi_lywsdcgq:015]:     Icon: 'mdi:battery'
[12:29:31][C][web_server:122]: Web Server:
[12:29:31][C][web_server:123]:   Address: esp32.local:80
[12:29:31][C][ota:029]: Over-The-Air Updates:
[12:29:31][C][ota:030]:   Address: esp32.local:3232
[12:29:31][C][ota:032]:   Using Password.
[12:29:31][C][api:095]: API Server:
[12:29:31][C][api:096]:   Address: esp32.local:6053
[12:29:31][D][xiaomi_ble:158]: Got Xiaomi LYWSDCGQ (58:2D:34:31:2B:03):
[12:29:31][D][xiaomi_ble:161]:   Temperature: 20.4°C
[12:29:31][D][sensor:092]: 'Temperatura Soggiorno': Sending state 20.40000 °C with 1 decimals of accuracy
[12:30:01][D][xiaomi_ble:158]: Got Xiaomi LYWSDCGQ (58:2D:34:31:2B:03):
[12:30:01][D][xiaomi_ble:161]:   Temperature: 20.4°C
[12:30:01][D][xiaomi_ble:164]:   Humidity: 35.6%
[12:30:01][D][sensor:092]: 'Temperatura Soggiorno': Sending state 20.40000 °C with 1 decimals of accuracy
[12:30:01][D][sensor:092]: 'Umidità Soggiorno': Sending state 35.60000 % with 1 decimals of accuracy
[12:30:09][D][xiaomi_ble:158]: Got Xiaomi LYWSDCGQ (58:2D:34:31:2B:03):
[12:30:09][D][xiaomi_ble:161]:   Temperature: 20.4°C
[12:30:09][D][xiaomi_ble:164]:   Humidity: 35.6%
[12:30:09][D][sensor:092]: 'Temperatura Soggiorno': Sending state 20.40000 °C with 1 decimals of accuracy
[12:30:09][D][sensor:092]: 'Umidità Soggiorno': Sending state 35.60000 % with 1 decimals of accuracy
[12:30:31][D][xiaomi_ble:158]: Got Xiaomi LYWSDCGQ (58:2D:34:31:2B:03):
[12:30:31][D][xiaomi_ble:161]:   Temperature: 20.4°C
[12:30:31][D][xiaomi_ble:164]:   Humidity: 36.1%
[12:30:31][D][sensor:092]: 'Temperatura Soggiorno': Sending state 20.40000 °C with 1 decimals of accuracy
[12:30:31][D][sensor:092]: 'Umidità Soggiorno': Sending state 36.10000 % with 1 decimals of accuracy
[12:31:47][D][xiaomi_ble:158]: Got Xiaomi LYWSDCGQ (58:2D:34:31:2B:03):
[12:31:47][D][xiaomi_ble:161]:   Temperature: 20.4°C
[12:31:47][D][xiaomi_ble:164]:   Humidity: 36.0%
[12:31:47][D][sensor:092]: 'Temperatura Soggiorno': Sending state 20.40000 °C with 1 decimals of accuracy
[12:31:47][D][sensor:092]: 'Umidità Soggiorno': Sending state 36.00000 % with 1 decimals of accuracy
[12:32:25][D][xiaomi_ble:158]: Got Xiaomi LYWSDCGQ (58:2D:34:31:2B:03):
[12:32:26][D][xiaomi_ble:161]:   Temperature: 20.4°C
[12:32:26][D][xiaomi_ble:164]:   Humidity: 36.1%
[12:32:26][D][sensor:092]: 'Temperatura Soggiorno': Sending state 20.40000 °C with 1 decimals of accuracy
[12:32:26][D][sensor:092]: 'Umidità Soggiorno': Sending state 36.10000 % with 1 decimals of accuracy
[12:33:04][D][xiaomi_ble:158]: Got Xiaomi LYWSDCGQ (58:2D:34:31:2B:03):
[12:33:04][D][xiaomi_ble:167]:   Battery Level: 85%
[12:33:04][D][sensor:092]: 'Batteria TH soggiorno': Sending state 85.00000 % with 0 decimals of accuracy

Additional information and things you've tried:

ESP32 could read properly temperature, humidity and battery level values, hassio does not update them accordingly on the frontend, leaving the value got as soon as I've updated the entity trough the entity panel. this update is not done automatically.

Zixim commented 4 years ago

This works just fine for me. Very similar config.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.