Closed pasolobo2 closed 3 years ago
Thanks, I'll take a look tomorrow.
@pasolobo2 unfortunately, the dump you posted does not contain a single package with useful data. Please make sure that the sensor is added to the official application (MiHome), and that this application is closed while receiving the log (there is no active connection to the sensor), and try again to capture data.
@pasolobo2 thank you. We are dealing with another encryptor. In order to continue working on its support, you need to get the encryption key anyway. This can be done using one of the methods described in our FAQ. The simplest is the MiHome mod by vevs. Consider the fact that after re-adding the sensor to the application, you will need to get the HA log again. There are two options here:
The first option is safer and faster. You can then change the key (by deleting and adding the sensor to MiHome again), if this is important to you.
Received. I'll take a look a little later.
@Magalex2x14 Can you explain how you decrypt the advertisement. I can add this device, but I don’t understand how to decrypt the messages.
@pasolobo2 There is no bind key
in your key.txt file. The token
mentioned in key.txt is not the key we need. Please follow the instructions here to find the bind key
. It should have 32 characters.
@Ernst79 I had an idea to change the parser code so that, in the case of an unknown device, logging would occur after decryption (if the packet is encrypted), but my hands have not yet reached... Also, I think, we can add a warning about the need to configure the key in case the data is encrypted and the key is not in the configuration.
In general, I just took the actual parser code and constants and added them to a small program that parses the text file with dump. Unfortunately, I am now out of place, and I do not have it at hand. I will return to this in early January.
Yes, that's the correct bind_key. I'll look into it.
I have created the SJWS01LM branch, which adds support for your sensor.
I used the Moisture type Binary Sensor, so it should show wet/dry as state.
Please copy the code from __init__.py
, const.py
and binary_sensor.py
to your config/custom_components/ble_monitor
folder to test. You will need to set the encryption_key in your configuration as well.
I haven't found a battery reading but I assumed it does send battery info, given your screenshot above.
@Magalex2x14 I managed to do the decryption, so no need to send your script. However, I have two questions.
data = bytes.fromhex(data_string)
, but I don't find the correct sensor_type byte (I find b'c\x08'
with sensor_type = data[xiaomi_index + 5:xiaomi_index + 7])
. Luckily if I check sensor_type
== b'\x63\x08'
I find TRUE. MMTS_DICT
of battery at the measuring sensors as well as binary sensors, should I enable them both?@pasolobo2 Did you had a change to try it?
Hi. I made the change in ble monitor, added the encryption_key in the config.yaml I restarted my HA but I don't see the changes. What should i see?
ble_monitor:
hci_interface: 0
discovery: True
active_scan: False
report_unknown: False
batt_entities: False
rounding: True
decimals: 1
period: 60
log_spikes: False
use_median: False
restore_state: False
devices:
- mac: '54:EF:44:E0:27:BC'
name: 'Agua'
encryption_key: '255e6cabb39b2eddd0de992b9fee2bf2'
I dont see anything on the logs
logger:
default: info
logs:
custom_componets.ble_monitor: debug
Aren't there any lines in the logs about ble_monitor? Please show all log output (not only errors, but all lines), by clicking on this button at the bottom of the log.
Isn't there a device visible under integrations --> ble_monitor --> devices? If it works, a device should be shown which is named with your MAC address. The sensor should show up as binary_sensor.ble_moisture_54EF44E027BC
Hi.
I made the change.
b'c\x08': ("SJWS01LM", True),
I send b c x08.txt b x63 x08.txt
you the logs with the two options.
It looks like something is wrong on this line.
Line 512: File "/config/custom_components/ble_monitor/binary_sensor.py", line 113, in async_run
Do you have the previous and/or next line in the log. I think something is missing around these lines, which indicates what is wrong.
Here is ...
Traceback (most recent call last): File "/config/custom_components/ble_monitor/binary_sensor.py", line 113, in async_run sw_i, op_i, l_i, b_i = MMTS_DICT[sensortype][1] ValueError: too many values to unpack (expected 4)
I send you a zip of my component... ble_monitor.zip
You also had to copy __init__.py
and binary_sensor.py
, You now still have the old files (at least binary_sensors.py
seems to be the old version in your zip file (and explains the error). Could you try again?
Great, thanks. I will prepare a beta release a.s.a.p.
Released as 0.9.5-beta.
Can you check one thing. Does it report battery state? (and at what interval).
Sorry, yesterday my HA installation stopped working. I must reinstall it. Also, my PC started doing weird things. I have to check. I will take a few days.
Follow
Hello and happy new year !!!....
I hope it is correct now.
How do you find the bindkey for xiaomi Flood Detector?
Hi.
I need support for the new Xiaomi Flood Detector - SJWS01LM
log.txt
Detect water leaks.
Thanks!!!