esphome / issues

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

MAC Address interpreted as integer by esphome.helpers #5796

Closed mrbubble62 closed 2 months ago

mrbubble62 commented 2 months ago

The problem

Hex MAC Addresses containing a letter (A,B,C,D,E ) have no issue If the MAC Address has no alpha characters E.G 49:42:07:00:25:59

INFO ESPHome 2024.4.1 INFO Reading configuration /config/esphome/bluetooth-proxy-3-7944b8.yaml... Failed config

sensor.inkbird_ibsth1_mini: [source /config/esphome/bluetooth-proxy-3-7944b8.yaml:65] platform: inkbird_ibsth1_mini

Must be string, got <class 'esphome.helpers.EInt'>. did you forget putting quotes around the value?. mac_address: 38648233559 temperature: name: Garage Freezer Temperature battery_level: name: Garage Freezer Battery Level

If I put the MAC address in quotes the device is ignored and never shows up in the Inkbird integration.

This MAC address works fine 49:42:08:00:25:3A, if I place quotes around it, the device is ignored. Is there some other way to markup the input stop the helper converting this to a number?

Which version of ESPHome has the issue?

2024.4.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2024.5.0

What platform are you using?

ESP32-IDF

Board

No response

Component causing the issue

esp32_ble_tracker/inkbird_ibsth1_mini

Example YAML snippet

esp32_ble_tracker:

sensor:
  - platform: inkbird_ibsth1_mini
    mac_address: 49:42:08:00:25:3A # this works
    temperature:
      name: "Garage Fridge Temperature"
    battery_level:
      name: "Garage Fridge Battery Level"
  - platform: inkbird_ibsth1_mini
    mac_address: 49:42:07:00:25:59 # this errors
    temperature:
      name: "Garage Freezer Temperature"
    battery_level:
      name: "Garage Freezer Battery Level"

Anything in the logs that might be useful for us?

INFO ESPHome 2024.4.1
INFO Reading configuration /config/esphome/bluetooth-proxy-3-7944b8.yaml...
Failed config

sensor.inkbird_ibsth1_mini: [source /config/esphome/bluetooth-proxy-3-7944b8.yaml:65]
  platform: inkbird_ibsth1_mini

  Must be string, got <class 'esphome.helpers.EInt'>. did you forget putting quotes around the value?.
  mac_address: 38648233559
  temperature: 
    name: Garage Freezer Temperature
  battery_level: 
    name: Garage Freezer Battery Level

Additional information

No response

mrbubble62 commented 2 months ago

Log output with MAC_Address: "49:42:08:00:25:59" (single or double quotes, same issue)

[15:58:43][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485377,"address":"49:42:08:00:25:59","rssi":-46,"name":"sps"}'
[15:58:44][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485377,"address":"49:42:08:00:25:59","rssi":-66,"name":"sps"}'
[15:58:44][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485378,"address":"49:42:08:00:25:59","rssi":-45,"name":"sps"}'
[15:58:47][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485381,"address":"49:42:08:00:25:3A","rssi":-58,"name":"sps"}'
[15:58:47][D][sensor:094]: 'Garage Fridge Battery Level': Sending state 58.00000 % with 0 decimals of accuracy
[15:58:48][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485381,"address":"49:42:08:00:25:3A","rssi":-60,"name":"sps"}'
[15:58:48][D][sensor:094]: 'Garage Fridge Battery Level': Sending state 58.00000 % with 0 decimals of accuracy
[15:58:48][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485382,"address":"49:42:08:00:25:3A","rssi":-58,"name":"sps"}'
[15:58:58][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485392,"address":"49:42:08:00:25:59","rssi":-65,"name":""}'
[15:58:58][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485392,"address":"49:42:08:00:25:59","rssi":-46,"name":"sps"}'
[15:59:03][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485397,"address":"49:42:08:00:25:3A","rssi":-58,"name":"sps"}'
[15:59:03][D][sensor:094]: 'Garage Fridge Battery Level': Sending state 58.00000 % with 0 decimals of accuracy
[15:59:04][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485398,"address":"49:42:08:00:25:3A","rssi":-57,"name":"sps"}'
[15:59:04][D][sensor:094]: 'Garage Fridge Battery Level': Sending state 58.00000 % with 0 decimals of accuracy
[15:59:05][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1485398,"address":"49:42:08:00:25:3A","rssi":-60,"name":"sps"}'
[15:59:05][D][sensor:094]: 'Garage Fridge Battery Level': Sending state 58.00000 % with 0 decimals of accuracy
mrbubble62 commented 2 months ago

VERY_VERBOSE output

[16:24:41][VV][api.service:345]: send_bluetooth_le_raw_advertisements_response: BluetoothLERawAdvertisementsResponse {
  advertisements: BluetoothLERawAdvertisement {
  address: 80547950896473
  rssi: -65
  address_type: 0
  data: '\xf0\xff sps
\xff\xe7\xfaV@'
}
}
[16:24:41][VV][esp32_ble_tracker:427]: Parse Result:
[16:24:41][VV][esp32_ble_tracker:444]:   Address: 49:42:08:00:25:59 (PUBLIC)
[16:24:41][VV][esp32_ble_tracker:446]:   RSSI: -65
[16:24:41][VV][esp32_ble_tracker:447]:   Name: 'sps'
[16:24:41][VV][esp32_ble_tracker:455]:   Ad Flag: 6
[16:24:41][VV][esp32_ble_tracker:458]:   Service UUID: 0xFFF0
[16:24:41][VV][esp32_ble_tracker:461]:   Manufacturer data: 56.1E.01.15.07.40.08 (7)
[16:24:41][VV][esp32_ble_tracker:477]: Adv data: 02.01.06.03.02.F0.FF.04.09.73.70.73.0A.FF.E7.FA.56.1E.01.15.07.40.08 (23)
[16:24:41][V][text_sensor:013]: 'BLE Devices Scanner': Received new state {"timestamp":1486935,"address":"49:42:08:00:25:59","rssi":-65,"name":"sps"}
[16:24:41][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1486935,"address":"49:42:08:00:25:59","rssi":-65,"name":"sps"}'
[16:24:41][VV][api.service:174]: send_text_sensor_state_response: TextSensorStateResponse {
  key: 2083332691
  state: '{"timestamp":1486935,"address":"49:42:08:00:25:59","rssi":-65,"name":"sps"}'
  missing_state: NO
}
[16:24:41][VV][inkbird_ibsth1_mini:033]: parse_device(): unknown MAC address.
[16:24:41][VV][inkbird_ibsth1_mini:033]: parse_device(): unknown MAC address.
[16:24:41][VV][inkbird_ibsth1_mini:033]: parse_device(): unknown MAC address.
[16:24:41][VV][inkbird_ibsth1_mini:033]: parse_device(): unknown MAC address.
[16:24:41][W][component:237]: Component esp32_ble_tracker took a long time for an operation (142 ms).
[16:24:41][W][component:238]: Components should block for at most 30 ms.
mrbubble62 commented 2 months ago

Even though it is not appearing in the logs the device has started showing up in the Inkbird integration.