bipsendk / OrasFaucet

Home Assistant custom component to intercept Bluetooth BLE announcements from Oras Faucet
GNU General Public License v3.0
3 stars 0 forks source link

ORAS data format not supported - HANSAFIT ECO+ #1

Open mihsu81 opened 4 months ago

mihsu81 commented 4 months ago

I'm getting the below error in HA and the integration doesn't see any device. I have x2 HANSAFIT ECO+ which are rebranded Oras faucets for some of the markets.

Această eroare originează într-o integrare non-standard.

Logger: custom_components.oras_faucet.models
Source: custom_components/oras_faucet/models.py:43
integration: oras_faucet (documentation)
First occurred: 10:51:41 (2 occurrences)
Last logged: 10:51:41

ORAS data format not supported: b'\x00d\x002212136284 '
ORAS data format not supported: b'\x00d\x002212136266 '
mihsu81 commented 4 months ago

Based on info from the HANSA Connect app, 2212136284 and 2212136284 are their serial numbers and IDs.

bipsendk commented 4 months ago

Do you have the complete announcement package logged in HomeAssistant ? That will make it easier to see what causes the devices not to be matched. In configuration.yaml make sure you have debug logging on bluetooth:

logger: 
  default: info
  logs: 
    homeassistant.components.bluetooth: debug

After enabling debug log, restart HA ...

The you should see something like this in the home assistant log (you probably need to download it from the system):

2024-07-06 20:12:11.307 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] bathroom-bluetooth-proxy (0C:8B:95:76:D2:AC) [connectable]: <BluetoothServiceInfoBleak name=18:DE:50:DC:5B:4C address=18:DE:50:DC:5B:4C rssi=-97 manufacturer_data={} service_data={'0000a201-0000-1000-8000-00805f9b34fb': b'\x00\r\xe5?\x1e\xb4\nq7\x83\xe2\xeeWe\x99:B'} service_uuids=['0000a201-0000-1000-8000-00805f9b34fb'] source=0C:8B:95:76:D2:AC connectable=True time=1473662.474518843 tx_power=None> match: set()

The mac address should match your device - and the serial number should hopefully also be visible...

mihsu81 commented 4 months ago

Hi @bipsendk,

These are the debug logs I get:

2024-07-08 11:56:32.110 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] ble-gateway-7 (94:B5:55:2D:73:44) [connectable]: <BluetoothServiceInfoBleak name=ORAS address=F6:92:88:5A:32:DF rssi=-82 manufacturer_data={305: b'\x00d\x002212136284     '} service_data={} service_uuids=[] source=94:B5:55:2D:73:44 connectable=True time=83019.226076343 tx_power=None> match: set()
2024-07-08 12:05:32.681 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] ble-gateway-7 (94:B5:55:2D:73:44) [connectable]: <BluetoothServiceInfoBleak name=ORAS address=F6:92:88:5A:32:DF rssi=-83 manufacturer_data={305: b'\x00d\x002212136284     '} service_data={} service_uuids=[] source=94:B5:55:2D:73:44 connectable=True time=83559.797546045 tx_power=None> match: set()
2024-07-08 12:46:31.153 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] ble-gateway-7 (94:B5:55:2D:73:44) [connectable]: <BluetoothServiceInfoBleak name=ORAS address=F6:92:88:5A:32:DF rssi=-83 manufacturer_data={305: b'\x00d\x002212136284     '} service_data={} service_uuids=[] source=94:B5:55:2D:73:44 connectable=True time=86018.269327725 tx_power=None> match: set()
bipsendk commented 4 months ago

Something apparently changed is the way the serial number is stored - need to figure out how to make sure, that the right device is detected... I am not using this add-on so much myself, as it only gives battery status. I have code in an ESPhome device, that once per hour via bluetooth queries the faucet for different parameters, but unfortunately the MAC address needs to be hard coded for this to work. That code tries to connect once per hour to get updated data like:

image

mihsu81 commented 4 months ago

If I use ble_monitor to record unknown packets i can see the advertisement is different to what the HA Bluetooth integration sees. It also seems to be slightly different to what you have in your logs.

2024-07-08 19:43:16.513 INFO (MainThread) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID ec6b41d16bf8: service data: []manufacturer specific data: [b'\x15\xff1\x01\x00d\x002212136266     ']local name: ORASUUID16: None,UUID128: None
2024-07-08 19:43:16.515 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Data binary sensor received: {'mac': 'EC6B41D16BF8', 'battery': 100, 'type': 'Electra Washbasin Faucet', 'packet': 'no packet id', 'firmware': 'Oras', 'data': True, 'rssi': -93, 'local_name': 'ORAS'}
2024-07-08 19:43:16.516 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {'mac': 'EC6B41D16BF8', 'battery': 100, 'type': 'Electra Washbasin Faucet', 'packet': 'no packet id', 'firmware': 'Oras', 'data': True, 'rssi': -93, 'local_name': 'ORAS'}
2024-07-08 19:43:28.128 INFO (MainThread) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID f692885a32df: service data: []manufacturer specific data: [b'\x15\xff1\x01\x00d\x002212136284     ']local name: ORASUUID16: None,UUID128: None
2024-07-08 19:43:28.129 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Data binary sensor received: {'mac': 'F692885A32DF', 'battery': 100, 'type': 'Electra Washbasin Faucet', 'packet': 'no packet id', 'firmware': 'Oras', 'data': True, 'rssi': -96, 'local_name': 'ORAS'}
2024-07-08 19:43:28.129 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {'mac': 'F692885A32DF', 'battery': 100, 'type': 'Electra Washbasin Faucet', 'packet': 'no packet id', 'firmware': 'Oras', 'data': True, 'rssi': -96, 'local_name': 'ORAS'}

I'll try your ESPHome code from https://github.com/bipsendk/OrasFaucet-ESPHome. Until now I used the code shared by myhomeiot in https://github.com/myhomeiot/esphome-components/issues/20 to get water consumption and total valve activations using myhomeiot_ble_client.

mihsu81 commented 4 months ago

Thanks for your suggestion. I used https://github.com/bipsendk/OrasFaucet-ESPHome to get the readings every 24 hours and store them in the MQTT broker to prevent the sensor state from going to "Unknown". It would be much neater to have everything running natively in HA without relying on an ESP32 to get the data. Unfortunately, I don't have the coding skills to help with that.