Pfew, thats it… it’s back…
Any idea where to get the correct string in the app then?
Maybe here?
Did you get this in ESPhome or nRF?
That string in the example is in ESPHome.
Is the string you get a notification or is it if you press one of the arrows, in my case this string comes from one of the notify characteristics.
I just got back home, i will have a quick look what happens with the string you provided, but i noticed its totally different format in nRF and Esphome, with only the one in esphome giving right results. (nRF is hex format, and esphome uft-8 i think)
What you might try, find all the notify characteristics in nRF and make a sensor out of all of them with this (this is all notify characteristics i see in your screenshots):
text_sensor:
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service dump 1"
service_uuid: 'f000ffc0-0451-4000-b000-000000000000'
characteristic_uuid: 'f000ffc1-0451-4000-b000-000000000000'
notify: true
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service dump 2"
service_uuid: 'f000ffc0-0451-4000-b000-000000000000'
characteristic_uuid: 'f000ffc2-0451-4000-b000-000000000000'
notify: true
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service dump 3"
service_uuid: 'FFE0'
characteristic_uuid: 'FFE4'
notify: true
so without the internal part unlike in my full example, so you can see it in home assistant.
I am not sure if your battery has the button on it with lights for the current state of charge, when i connect to my battery and have the notify services enabled pressing the button triggers the message on the notify service as well.
Where do I press what? The button in esphome?
No i mean in the nRF app, so did you get this value when pressing on one of the arrows, or was it a notify update after subscribing to it in the nRF app, i think to subscribe to a notify service its the 3 arrows down button.
But i would try what i posted in my earlyer post with the 3 text_sensors.
Will do this.
But what arrows do you mean? On the battery? I dont have that… only a “power” button, which is not a power button
So only the "BLE Service dump 3"
gives an output… and a lot! - so much it keeps crashing the connection with HA. Can only get logging from esp directly.
see below:
https://dpaste.org/ZXbjh
Not sure if it helps, but these are only the values of "BLE Service dump 3"
it gives:
'^2134000000000000'
'3075000001005600'
'650B00800C94'
'040D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0335'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'040D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^2134000000000000'
'3075000001005600'
'650B00800C9l'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000p00000'
'0000000000000000'
'0336'
'^2134000`00000000'
'3075000001005600'
'650\x8200800C94'
'050D090D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0335'
'^2p34000000000000'
'3075000001005600'
'650B008`0C94'
'050D090D0C0D060D'
'00000000000000`0'
'0000000000000000'
'0000000000000000'
'0334'
'^2134000000000000'
'3075000001`05600'
'650B00800C94'
'050D0A0D0C0D060D'
'000000000`000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2134000000000000'
'307500000100560`'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000`00000000'
'0336'
'^2134000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^20340000`0000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D090D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0333'
'^1F3400000000000`'
'3075000001005600'
'650B00800C94'
'050D090D0B0D06`D'
'00000000000p0000'
'0000000000000000'
'0000000000000000'
'0332'
'^1D34000000000000'
'3075000001005600'
'650B00800C94'
'040D09pD0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'p32E'
'^1D34000000000000'
'30o5000001005600'
'650B00800C94'
'020D050D070D030D'
'0000000000000000'
'0000`00000000000'
'0000000000000000'
'0322'
'^113l000000000000'
'3075000001005600'
'650B00800C94'
'020D050D070D030D'
'0000000000`00000'
'0000000000000000'
'0000000000000000'
'03q6'
'^1234000000000000'
'3075000001005600'
'6e0B00800C94'
'020D060D070D030D'
'00000000000`0000'
'0000000000000000'
'0000000000000000'
'0318'
'^1234000000000000'
'3075000001005600'
'650B00800C94'
'020D060D070D0s0D'
'0000000000000000'
'0000000000000000'
'000000000`000000'
'0318'
'^1234000000000000'
'3075000001005600'
'650B00800C94'
'020D060D070D030D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0318'
'^1234000000000000'
'3075000001005600'
'650B00800C94'
'020D060D07`D030D'
'0000000000000000'
'0000000000000000'
'00000p0000000000'
'0318'
'^123400`000000000'
'3075000001005600'
'650B00800C94'
'020D060D070D030D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0318'
'^1234000`00000000'
'3075000001005600'
'650B00800C94'
'020D060D070D030D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0318'
'^1234000000000000'
'3075000001005600'
'650B00800C94'
'020D060D070D030D'
'0000000000000000'
'00000000000000p0'
'0000`00000000000'
'0318'
'^1234000000000`0`'
'3075000001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0322'
'^1C34000000000000'
'3075000001005600'
'650B00800C94'
'040D0r0D0A0D050D'
'0000000000000000'
'00`0000000000000'
'0000000000000000'
'032C'
'^2434000000000000'
'3075000001005600'
'650B00800C94'
'060D0B0D0C0D070D'
'0000000000000`00'
'0000000000000000'
'0000000000000000'
'033C'
'^2434000000000000'
'3075000001005600'
'650B0`800C94'
'05pD0B0D0C0D070D'
'00000`0000000000'
'0000000000000000'
'0000000000000000'
'033B'
'^2334000000000000'
'3075000001`05600'
'650B00800C94'
'050D0B0D0C0D070D'
'000000000`000000'
'0000000000000000'
'0000000000000000'
'033A'
'^2234000000000000'
'30o5000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2b34000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'000000p000000000'
'0000000000000000'
'0336'
'^2134000000000000'
'3075`00001005600'
'650B00800C94'
'05`D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'000000000000`000'
'0000000000000000'
'0338'
'^2234000000000000'
'3075000001005600'
'650B0`800C94'
'050D0A0D0C0D070D'
'000000000000000`'
'0000p00000000000'
'0000000000000000'
'0338'
'^223t000000000000'
'3075000001005600'
'650B00800C94'
'`50D0A0D0C0D070D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2534000000000000'
'3075000001005600'
'650B00800C94'
'060D0B0D0D0D070D'
'00000000000`0000'
'0000000000000000'
'0000000000000000'
'033E'
'^2734000000000000'
'3075`00001005600'
'650B00800C94'
'060D0B0D0D0D090D'
'0000000000000000'
'0000000000000000'
'000000000`000000'
'0342'
'^2734000000000000'
'3075000001005600'
'650B00800C94'
'060D0B0D0D0D090D'
'00000000p0000000'
'0000000000000000'
'0000000000000000'
'0342'
'^2734000000000000'
'g075000001005600'
'650B00800C94'
'060D0B0D0D0D090D'
'0000000000000000'
'000000000000000p'
'0000000000000000'
'0342'
'^2834000000000000'
'3075000001005600'
'650B00800C94'
'06`D0C0D0D0D090D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0344'
'^2834000`00000000'
'3075000001005600'
'650B00800C94'
'060D0\x830D0D0D090D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0344'
'\xbe2834000000000000'
'3075000001005600'
'650B00800C94'
'060D0B0D0E0D090D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0344'
'^2834000000000000'
'3075000001005600'
'650B00800C94'
'060D0C0D0E0D0A0D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0346'
'^2A34000000000000'
'30750000010056`0'
'650B00800C94'
'060D0C0D0E0D`A0D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0348'
'^2834000000000000'
'3075000001005600'
'650B00800C94'
'070D0B0D0D0D090D'
'0000000000000`00'
'0000000000000000'
'0000000000000000'
'0344'
'48s'
'^2834000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000`00000000'
'0000000000000000'
'0000000000000000'
'03sE'
'^2234000000000000'
'6j0B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'00000000000000`0'
'0000000000000000'
'0338'
'^23340000000000`0'
'3075000001005600'
'650B00800C94'
'060D0A0D0C0D070D'
'0000000000000000'
'0000000000000000'
'`33A'
'\x9e2334000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0\x880C0D070D'
'0000000000000000'
'0000000000000000'
'0339'
'^2234000000000000'
'3`75000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2434000000000000'
'0000000000000000'
'0336'
'^2134000000000000'
'3075000001005600'
'650B00800C94'
'050D090D0B0D060D'
'00000000000000p0'
'0000000000000000'
'0000000000000000'
'0334'
'^1F34000000000000'
'3075000001005600'
'650B00800C84'
'050D090D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'03c2'
'^1F34000000000000'
'3075000001005600'
'650B00800C94'
'050D090D0B0D060D'
'00000000000`0000'
'0000000000000000'
'000000000p000000'
'0332'
'^1F34000000000000'
'30w5000001005600'
'650B00800C94'
'050D0A0D0B0D0n0D'
'000`000000000000'
'0000000000000000'
'00000000p0000000'
'0333'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'00000000000000p0'
'0000000000000000'
'0000000000000000'
'0334'
'^1D34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0B0D050D'
'000000000`000000'
'0000000000000000'
'000000000000000`'
'032E'
'^1D34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000`00000000'
'032D'
'^1C34000000000000'
'307500`001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'000000000000`000'
'032C'
'^1B340000p0000000'
'3075000001005600'
'650B00800C94'
'030D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'030A'
'^1B34`00000000000'
'3075000001005600'
'650B00800C94'
'040D090D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'032C'
'^1D340`0000000000'
'3075000001005600'
'650B00800C94'
'040D`90D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000`00'
'032E'
'^1C34000000000000'
'3075000001005600'
'650\x8200800C94'
'040D090D0A0D050D'
'0000000000000000'
'00p0000000000000'
'0000000000000000'
'0f2C'
'^1C34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0A0D040D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'032B'
'^1B34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0A0D040D'
'0000000000000000'
'0000000000000000'
'0000
'032A'
'^1C34000000000000'
'307m000001005600'
'650B00800C94'
'030D090D0B0D050D'
'0000000000000000'
'0000000000000000'
'00000000p0000000'
'032C'
'^bC34000000000000'
'3075000001005600'
'650B00800C94'
'030D090D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'`32C'
'^1D34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0B0D050D'
'0000000000`00000'
'`000000000000000'
'0000000000000000'
'032E'
'^1834000000000000'
'3p75000001005600'
'650B00800C94'
'030D070D0A0\x84040D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0324'
'^1834000000000000'
'3075000001005600'
'650\x8600800C94'
'030D070D0A0D040D'
'0000000000000000'
'000000000`000000'
'0000000000000000'
'0324'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'000000000000000`'
'0000000000000000'
'0336'
'^b134000000000000'
'3075000001005600'
'650B00800C94'
'`50D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2134000000000000'
'30750`0001005600'
'650B00800C94'
'0e0D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'00000000000`0000'
'0000000000000000'
'0334'
'^2134000000000000'
'30750`0001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000`00000'
'0336'
'^2134000000000000'
'3075000003005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'^2134000000000000'
'3`75000001005600'
'650B00800C94'
'0000000000000000'
'0000000000000000'
'0336'
'^2134000000000`00'
'3075000001005600'
'650B00800C94'
'040D090D0B0D0g0D'
'000`000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^1F34000000000000'
'c075000001005600'
'650B00800C94'
'040D090D0B0D070D'
'0000`00000000000'
'0000000000000000'
'0000000000000000'
'0332'
'^2334000000`00000'
'3075000001005600'
'650B00800C94'
'060D0A0D0\x830D070D'
'0000000000000000'
'0000000000000000'
'0330'
'^1E34000000000000'
'3075000001005600650B'
'`0800C94'
'050D090D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0330'
'^1E3400000`000000'
'3075000001005600'
'650B00800C94'
'050D090D0B0D050D'
'0000000`00000000'
'0000000000000000'
'0`00000000000000'
'0330'
'^2`34000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^20340`0000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'3075000001005600'
'650\x8200800C94'
'00000000000000`0'
'0000`00000000000'
'0000000000000000'
'0334'
'^2234000000000000'
'307500`001005600'
'650B00800C94'
'050D0A0D0C0D070\xc4'
'00000`0000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2234000000000`00'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'0000000000000`00'
'000`000000000000'
'0338'
'^203400000000`000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'00000`0000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'000000000`000000'
'0335'
'^2134000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060\x8c'
'0000000000000000'
'0000000000000000'
'0336'
'^2E34000000000000'
'3075000001005600'
'650B00800C94'
'090D0D0D0E0D0A0D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0350'
'^2434000000000000'
'3075000001005600'
'650B00800B94'
'060D0B0D0C0D070D'
'0000000000000000'
'00000000`0000000'
'0000000000000000'
'033C'
'^2434000000000000'
'307500`001005600'
'650B00800C94'
'060D0\x820D0C0D070D'
'0000000000000000'
'`000000000000000'
'0000000000000000'
'033C'
'^2334000000000000'
'3075000001005600'
'650B0`800C94'
'050D0B0D0C0D070D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'033A'
'^2334000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0D0B0D070D'
'0000000`00000000'
'0000000000000000'
'0000000000000000'
'0339'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0D0B0D070D'
'0000000000000000'
'0000000000000000'
'000000p000000000'
'0338'
'^2334000000000000'
'3075000001005600'
'650B00800C94'
'060D0A0D0C0D070\x84'
'0000000000000000'
'0000000000000000'
'0000000000`00000'
'033A'
'^2334000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0\x840C0D060D'
'0000000000000000'
'0000000000000`00'
'0000000000000000'
'0339'
'^223400000000`000'
'3075000001005600'
'l50B00800C94'
'050D0B0D0C0\x88060D'
'0000000000000000'
'00000000000000`0'
'0000000000000000'
'0338'
'^22340000000000p0'
'3075000001005600'
'650B00800C94'
'050D0B0D0C0D060D'
'000p000000000000'
'0000000000000000'
'0000000000`00000'
'`338'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'040D09`D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0332'
'^1C34000000000000'
'g075000001005600'
'650B00800\x8794'
'040D090D0A0\xc4050D'
'0000000`00000000'
'0000000000000000'
'0000000000000000'
'032C'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'05`D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^20340`00000000p0'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000`00000'
'0000000000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'307500000100560p'
'650B00800C94'
'050D0A0\x840B0D060D'
'0000000000000000'
'0p00000000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'3075000p01005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'000000000000`000'
'0334'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000`00000000000'
'0335'
'^2134000000000000'
'307m000001005600'
'650B00800C94'
'050D0A0D0C0Dp60D'
'0000`00000000000'
'0000000000000000'
'000000000`000000'
'0336'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0@0D0C0D060D'
'0000000000000000'
'0000000000000000'
'p000000000000000'
'0338'
'^2d3400000p000000'
'30o5000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0337'
'^213400000000`000'
'3075000001005600'
'650B00800C94'
'050D`A0D0C0D`60D'
'00p0000000000000'
'0000000000000000'
'0000`00000000000'
'0336'
'^1D34`00000000000'
'3075000001005600'
'650B00800C94'
'0000000000000000'
'0332'
'^1F34000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0332'
'^1F34000000000000'
'3075000001005600'
'650B00800C94'
'050D0@0D0B0D050D'
'0000000000000000'
'0000000000000000'
'000000000000000`'
'0332'
'\xbc1F34000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D050D'
'0000000000000000'
'0000`00000000000'
'0000000000000000'
'0332'
'^1F34000000000000'
'2075000001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'000000000000`000'
'03dF'
'^1C34000000000000'
'30750000010p5600'
'650B00800C94'
'040D090D0A0D0u0D'
'0000000000000000'
'0000000000000000'
'000`000000000000'
'032C'
'^1C34000000000000'
'307i000001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'00000000`0000000'
'032C'
'^1C34000000000000'
'3075000001005600'
'650B00800Cy4'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'032C'
'^1C34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'000000`000000000'
'0000`00000000000'
'032C'
'^1C34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'032C'
'^1C34000000000000'
'3075000001005600'
'650B00800\x8b94'
'040D090D0A0D050D'
'000000000p000000'
'0000000000000000'
'000000000000000p'
'032E'
'^1C34000000000000'
'3075000001005600'
'650B00800E94'
'040D090D0A0D050D'
'650B00800C94'
'^2134000000000000'
'050D0A0D0C0D060D'
'^2134000000000000'
'3075000001005600'
'650B00800C94'
'040D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0335'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'040D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^2134000000000000'
'3075000001005600'
'650B00800C9l'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000p00000'
'0000000000000000'
'0336'
'^2134000`00000000'
'3075000001005600'
'650\x8200800C94'
'050D090D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0335'
'^2p34000000000000'
'3075000001005600'
'650B008`0C94'
'050D090D0C0D060D'
'00000000000000`0'
'0000000000000000'
'0000000000000000'
'0334'
'^2134000000000000'
'3075000001`05600'
'650B00800C94'
'050D0A0D0C0D060D'
'000000000`000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2134000000000000'
'307500000100560`'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000`00000000'
'0336'
'^2134000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^20340000`0000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D090D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0333'
'^1F3400000000000`'
'3075000001005600'
'650B00800C94'
'050D090D0B0D06`D'
'00000000000p0000'
'0000000000000000'
'0000000000000000'
'0332'
'^1D34000000000000'
'3075000001005600'
'650B00800C94'
'040D09pD0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'p32E'
'^1D34000000000000'
'30o5000001005600'
'650B00800C94'
'020D050D070D030D'
'0000000000000000'
'0000`00000000000'
'0000000000000000'
'0322'
'^113l000000000000'
'3075000001005600'
'650B00800C94'
'020D050D070D030D'
'0000000000`00000'
'0000000000000000'
'0000000000000000'
'03q6'
'^1234000000000000'
'3075000001005600'
'6e0B00800C94'
'020D060D070D030D'
'00000000000`0000'
'0000000000000000'
'0000000000000000'
'0318'
'^1234000000000000'
'3075000001005600'
'650B00800C94'
'020D060D070D0s0D'
'0000000000000000'
'0000000000000000'
'000000000`000000'
'0318'
'^1234000000000000'
'3075000001005600'
'650B00800C94'
'020D060D070D030D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0318'
'^1234000000000000'
'3075000001005600'
'650B00800C94'
'020D060D07`D030D'
'0000000000000000'
'0000000000000000'
'00000p0000000000'
'0318'
'^123400`000000000'
'3075000001005600'
'650B00800C94'
'020D060D070D030D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0318'
'^1234000`00000000'
'3075000001005600'
'650B00800C94'
'020D060D070D030D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0318'
'^1234000000000000'
'3075000001005600'
'650B00800C94'
'020D060D070D030D'
'0000000000000000'
'00000000000000p0'
'0000`00000000000'
'0318'
'^1234000000000`0`'
'3075000001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0322'
'^1C34000000000000'
'3075000001005600'
'650B00800C94'
'040D0r0D0A0D050D'
'0000000000000000'
'00`0000000000000'
'0000000000000000'
'032C'
'^2434000000000000'
'3075000001005600'
'650B00800C94'
'060D0B0D0C0D070D'
'0000000000000`00'
'0000000000000000'
'0000000000000000'
'033C'
'^2434000000000000'
'3075000001005600'
'650B0`800C94'
'05pD0B0D0C0D070D'
'00000`0000000000'
'0000000000000000'
'0000000000000000'
'033B'
'^2334000000000000'
'3075000001`05600'
'650B00800C94'
'050D0B0D0C0D070D'
'000000000`000000'
'0000000000000000'
'0000000000000000'
'033A'
'^2234000000000000'
'30o5000001005600'
'050D0A0D0C0D070D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2b34000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'000000p000000000'
'0000000000000000'
'0336'
'^2134000000000000'
'3075`00001005600'
'650B00800C94'
'05`D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'000000000000`000'
'0000000000000000'
'0338'
'^2234000000000000'
'3075000001005600'
'650B0`800C94'
'050D0A0D0C0D070D'
'000000000000000`'
'0000p00000000000'
'0000000000000000'
'0338'
'^223t000000000000'
'3075000001005600'
'650B00800C94'
'`50D0A0D0C0D070D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2534000000000000'
'3075000001005600'
'650B00800C94'
'060D0B0D0D0D070D'
'00000000000`0000'
'0000000000000000'
'0000000000000000'
'033E'
'^2734000000000000'
'3075`00001005600'
'650B00800C94'
'060D0B0D0D0D090D'
'0000000000000000'
'0000000000000000'
'000000000`000000'
'0342'
'^2734000000000000'
'3075000001005600'
'650B00800C94'
'060D0B0D0D0D090D'
'00000000p0000000'
'0000000000000000'
'0000000000000000'
'0342'
'^2734000000000000'
'g075000001005600'
'650B00800C94'
'060D0B0D0D0D090D'
'0000000000000000'
'000000000000000p'
'0000000000000000'
'0342'
'^2834000000000000'
'3075000001005600'
'650B00800C94'
'06`D0C0D0D0D090D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0344'
'^2834000`00000000'
'3075000001005600'
'650B00800C94'
'060D0\x830D0D0D090D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0344'
'\xbe2834000000000000'
'3075000001005600'
'650B00800C94'
'060D0B0D0E0D090D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0344'
'^2834000000000000'
'3075000001005600'
'650B00800C94'
'060D0C0D0E0D0A0D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0346'
'^2A34000000000000'
'30750000010056`0'
'650B00800C94'
'060D0C0D0E0D`A0D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0348'
'^2834000000000000'
'3075000001005600'
'650B00800C94'
'070D0B0D0D0D090D'
'0000000000000`00'
'0000000000000000'
'0000000000000000'
'0344'
'^2834000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000`00000000'
'0000000000000000'
'0000000000000000'
'03sE'
'^2234000000000000'
'6j0B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'00000000000000`0'
'0000000000000000'
'0338'
'^23340000000000`0'
'3075000001005600'
'650B00800C94'
'060D0A0D0C0D070D'
'0000000000000000'
'0000000000000000'
'`33A'
'650B00800C94'
'050D0A0\x880C0D070D'
'0000000000000000'
'0000000000000000'
'0339'
'^2234000000000000'
'3`75000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2434000000000000'
'0000000000000000'
'0336'
'^2134000000000000'
'3075000001005600'
'650B00800C94'
'050D090D0B0D060D'
'00000000000000p0'
'0000000000000000'
'0000000000000000'
'0334'
'^1F34000000000000'
'3075000001005600'
'650B00800C84'
'050D090D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'03c2'
'^1F34000000000000'
'3075000001005600'
'650B00800C94'
'050D090D0B0D060D'
'00000000000`0000'
'0000000000000000'
'000000000p000000'
'0332'
'^1F34000000000000'
'30w5000001005600'
'650B00800C94'
'050D0A0D0B0D0n0D'
'000`000000000000'
'0000000000000000'
'00000000p0000000'
'0333'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'00000000000000p0'
'0000000000000000'
'0000000000000000'
'0334'
'^1D34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0B0D050D'
'000000000`000000'
'0000000000000000'
'000000000000000`'
'032E'
'^1D34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000`00000000'
'032D'
'^1C34000000000000'
'307500`001005600'
'650B00800C94'
'040D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'000000000000`000'
'032C'
'^1B340000p0000000'
'3075000001005600'
'650B00800C94'
'030D090D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'030A'
'^1B34`00000000000'
'3075000001005600'
'650B00800C94'
'040D090D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'032C'
'^1D340`0000000000'
'3075000001005600'
'650B00800C94'
'040D`90D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000`00'
'032E'
'^1C34000000000000'
'3075000001005600'
'650\x8200800C94'
'040D090D0A0D050D'
'0000000000000000'
'00p0000000000000'
'0000000000000000'
'0f2C'
'^1C34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0A0D040D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'032B'
'^1B34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0A0D040D'
'0000000000000000'
'0000000000000000'
'0000
'032A'
'^1C34000000000000'
'307m000001005600'
'650B00800C94'
'030D090D0B0D050D'
'0000000000000000'
'0000000000000000'
'00000000p0000000'
'032C'
'^bC34000000000000'
'3075000001005600'
'650B00800C94'
'030D090D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'`32C'
'^1D34000000000000'
'3075000001005600'
'650B00800C94'
'040D090D0B0D050D'
'0000000000`00000'
'`000000000000000'
'0000000000000000'
'032E'
'^1834000000000000'
'3p75000001005600'
'650B00800C94'
'030D070D0A0\x84040D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0324'
'^1834000000000000'
'3075000001005600'
'650\x8600800C94'
'030D070D0A0D040D'
'0000000000000000'
'000000000`000000'
'0000000000000000'
'0324'
'^21340000`0000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'000000000000000`'
'0000000000000000'
'0336'
'^b134000000000000'
'3075000001005600'
'650B00800C94'
'`50D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2134000000000000'
'30750`0001005600'
'650B00800C94'
'0e0D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'00000000000`0000'
'0000000000000000'
'0334'
'^2134000000000000'
'30750`0001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000`00000'
'0336'
'^2134000000000000'
'3075000003005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'^2134000000000000'
'3`75000001005600'
'650B00800C94'
'0000000000000000'
'0000000000000000'
'0336'
'^2134000000000`00'
'3075000001005600'
'650B00800C94'
'040D090D0B0D0g0D'
'000`000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^1F34000000000000'
'c075000001005600'
'650B00800C94'
'040D090D0B0D070D'
'0000`00000000000'
'0000000000000000'
'0000000000000000'
'0332'
'^2334000000`00000'
'3075000001005600'
'650B00800C94'
'060D0A0D0\x830D070D'
'0000000000000000'
'0000000000000000'
'0330'
'^1E34000000000000'
'3075000001005600650B'
'`0800C94'
'050D090D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0330'
'^1E3400000`000000'
'3075000001005600'
'650B00800C94'
'050D090D0B0D050D'
'0000000`00000000'
'0000000000000000'
'0`00000000000000'
'0330'
'^2`34000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^20340`0000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'3075000001005600'
'650\x8200800C94'
'050D0A0D0B0D060D'
'00000000000000`0'
'0000`00000000000'
'0000000000000000'
'0334'
'^2234000000000000'
'307500`001005600'
'650B00800C94'
'050D0A0D0C0D070\xc4'
'00000`0000000000'
'0000000000000000'
'0000000000000000'
'0338'
'^2234000000000`00'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D070D'
'0000000000000000'
'0000000000000`00'
'000`000000000000'
'0338'
'^203400000000`000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'00000`0000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'000000000`000000'
'0335'
'^2134000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060\x8c'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0336'
'^2E34000000000000'
'3075000001005600'
'650B00800C94'
'090D0D0D0E0D0A0D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0350'
'^2434000000000000'
'3075000001005600'
'650B00800B94'
'060D0B0D0C0D070D'
'0000000000000000'
'00000000`0000000'
'0000000000000000'
'033C'
'^2434000000000000'
'307500`001005600'
'650B00800C94'
'060D0\x820D0C0D070D'
'0000000000000000'
'`000000000000000'
'0000000000000000'
'033C'
'^2334000000000000'
'3075000001005600'
'650B0`800C94'
'050D0B0D0C0D070D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'033A'
'^2334000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0D0B0D070D'
'0000000`00000000'
'0000000000000000'
'0000000000000000'
'0339'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0D0B0D070D'
'0000000000000000'
'0000000000000000'
'000000p000000000'
'0338'
'^2334000000000000'
'3075000001005600'
'650B00800C94'
'060D0A0D0C0D070\x84'
'0000000000000000'
'0000000000000000'
'0000000000`00000'
'033A'
'^2334000000000000'
'3075000001005600'
'650B00800C94'
'050D0B0\x840C0D060D'
'0000000000000000'
'0000000000000`00'
'0000000000000000'
'0339'
'^223400000000`000'
'3075000001005600'
'l50B00800C94'
'050D0B0D0C0\x88060D'
'0000000000000000'
'00000000000000`0'
'0000000000000000'
'0338'
'^22340000000000p0'
'3075000001005600'
'650B00800C94'
'050D0B0D0C0D060D'
'000p000000000000'
'0000000000000000'
'0000000000`00000'
'`338'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'040D09`D0A0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0332'
'^1C34000000000000'
'g075000001005600'
'650B00800\x8794'
'040D090D0A0\xc4050D'
'0000000`00000000'
'0000000000000000'
'0000000000000000'
'032C'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'05`D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0334'
'^20340`00000000p0'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000`00000'
'0000000000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'307500000100560p'
'650B00800C94'
'050D0A0\x840B0D060D'
'0000000000000000'
'0p00000000000000'
'0000000000000000'
'0334'
'^2034000000000000'
'3075000p01005600'
'650B00800C94'
'050D0A0D0B0D060D'
'0000000000000000'
'0000000000000000'
'000000000000`000'
'0334'
'^2034000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000`00000000000'
'0335'
'^2134000000000000'
'307m000001005600'
'650B00800C94'
'050D0A0D0C0Dp60D'
'0000`00000000000'
'0000000000000000'
'000000000`000000'
'0336'
'^2234000000000000'
'3075000001005600'
'650B00800C94'
'050D0@0D0C0D060D'
'0000000000000000'
'0000000000000000'
'p000000000000000'
'0338'
'^2d3400000p000000'
'30o5000001005600'
'650B00800C94'
'050D0A0D0C0D060D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0337'
'^213400000000`000'
'3075000001005600'
'650B00800C94'
'050D`A0D0C0D`60D'
'00p0000000000000'
'0000000000000000'
'0000`00000000000'
'0336'
'^1D34`00000000000'
'3075000001005600'
'650B00800C94'
'0000000000000000'
'0332'
'^1F34000000000000'
'3075000001005600'
'650B00800C94'
'050D0A0D0B0D050D'
'0000000000000000'
'0000000000000000'
'0000000000000000'
'0332'
'^1F34000000000000'
'3075000001005600'
'650B00800C94'
'050D0@0D0B0D050D'
'0000000000000000'
'0000000000000000'
'000000000000000`'
'0332'
'\xbc1F34000000000000'
'3075000001005600'
@sender That looks quite promising, i put one of the outputs in my python script:
Decoded values:
voltage: 13345
current: 0
capacity: 30000
cycles: 1
soc: 86
temperature: 2917
status: 0
afe_status: 12
transformed:
temperature_celsius: 18.6
voltage_display: 13.345
current_display: 0.0
cycles_display: 1
so i think the value you are looking for is the BLE service dump 3
I would remove the other two in that case, and set it like this:
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service dump 3"
service_uuid: 'FFE0'
characteristic_uuid: 'FFE4'
notify: true
internal: true
So the complete script would look like this i think in your case, note the last comment in it at the bottom, possibly you dont need the two lower things. Also put in the mac adres again :
esp32_ble_tracker:
scan_parameters:
duration: 90s
# Define the BLE client
ble_client:
- mac_address: "" # Replace with the MAC address of your BLE device
id: my_ble_client
on_connect:
then:
- lambda: |-
id(ble_connected) = true;
id(ble_state) = "connected";
on_disconnect:
then:
- lambda: |-
id(ble_connected) = false;
id(ble_state) = "reconnecting";
- script.execute: reconnect_ble
## To find the mac adress, most easy way is to enable the part down below saying:
## - platform: ble_scanner
## name: "BLE Devices Scanner"
## This will show all found BLE devices in the area with their mac adres and name if they have one in the esphome log.
## In case of a X210 battery the macs start consistently with: DC:0D:30:
text_sensor:
- platform: template
name: "Battery BLE connection"
id: ble_state_sensor
lambda: |-
return id(ble_state);
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service FFE0 Characteristic FFE4"
service_uuid: 'FFE0'
characteristic_uuid: 'FFE4'
notify: true
internal: true
id: ble_raw_data
on_value:
then:
- lambda: |-
std::string raw_data = id(ble_raw_data).state;
if (raw_data.length() >= 38) {
// Strip the first character '^'
raw_data = raw_data.substr(1);
auto char_to_int = [](char c) -> int {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('A' <= c && c <= 'F') {
return (c - 'A') + 10;
} else {
return 0;
}
};
auto asciitochar = [&](char b, char b2) -> int {
return ((char_to_int(b) << 4) & 0xF0) + (char_to_int(b2) & 0x0F);
};
int voltage = (((((asciitochar(raw_data[6], raw_data[7]) << 8) + asciitochar(raw_data[4], raw_data[5])) << 8) + asciitochar(raw_data[2], raw_data[3])) << 8) + asciitochar(raw_data[0], raw_data[1]);
int current = (((((asciitochar(raw_data[14], raw_data[15]) << 8) + asciitochar(raw_data[12], raw_data[13])) << 8) + asciitochar(raw_data[10], raw_data[11])) << 8) + asciitochar(raw_data[8], raw_data[9]);
int soc = (asciitochar(raw_data[30], raw_data[31]) << 8) + asciitochar(raw_data[28], raw_data[29]);
int temperature = (asciitochar(raw_data[34], raw_data[35]) << 8) + asciitochar(raw_data[32], raw_data[33]);
int status = asciitochar(raw_data[36], raw_data[37]);
int afe_status = asciitochar(raw_data[40], raw_data[41]);
float temperature_celsius = (temperature - 0xAAB) / 10.0;
float voltage_display = voltage / 1000.0;
float current_display = current / 10.0;
id(global_voltage) = voltage_display;
id(global_current) = current_display;
id(global_soc) = soc;
id(global_temperature) = temperature_celsius;
id(global_status) = status;
id(global_afe_status) = afe_status;
} else {
ESP_LOGE("main", "Received raw data is too short.");
}
- platform: ble_scanner
name: "BLE Devices Scanner"
script:
- id: reconnect_ble
then:
- delay: 5s
- ble_client.connect: my_ble_client
- delay: 30s
- if:
condition:
lambda: |-
return !id(ble_connected);
then:
- script.execute: reconnect_ble
sensor:
- platform: template
name: "Battery voltage"
unit_of_measurement: "V"
update_interval: 30s
accuracy_decimals: 2
lambda: |-
return id(global_voltage);
- platform: template
name: "Battery Current"
update_interval: 30s
unit_of_measurement: "A"
accuracy_decimals: 1
lambda: |-
return id(global_current);
- platform: template
name: "Battery SOC"
update_interval: 30s
unit_of_measurement: "%"
accuracy_decimals: 0
lambda: |-
return id(global_soc);
- platform: template
name: "Battery Temperature"
update_interval: 30s
unit_of_measurement: "°C"
accuracy_decimals: 1
lambda: |-
return id(global_temperature);
#Unsure about these two yet if they actually work and what they mean
- platform: template
name: "Battery Status"
update_interval: 30s
accuracy_decimals: 0
lambda: |-
return id(global_status);
- platform: template
name: "Battery AFE Status"
update_interval: 30s
accuracy_decimals: 0
lambda: |-
return id(global_afe_status);
globals:
- id: global_voltage
type: float
restore_value: no
initial_value: '0.0'
- id: global_current
type: float
restore_value: no
initial_value: '0.0'
- id: global_soc
type: int
restore_value: no
initial_value: '0'
- id: global_temperature
type: float
restore_value: no
initial_value: '0.0'
- id: global_status
type: int
restore_value: no
initial_value: '0'
- id: global_afe_status
type: int
restore_value: no
initial_value: '0'
- id: ble_connected
type: bool
restore_value: no
initial_value: 'false'
- id: ble_state
type: std::string
restore_value: no
initial_value: '"disconnected"'
# this fetches data every minute by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
# Not sure if you actually need these two one, if it keeps dumping so mucht data it might do it itself anyway.
# You could try removing these
interval:
- interval: 1min
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
#this button manually fetches the data by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
button:
- platform: template
name: "Force update values"
on_press:
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
I will try to also add the Cycle count and capacity later this week if i find the time
Hm… no luck yet… I have this in the yaml now:
esphome:
name: "esp32-12"
platform: ESP32
board: wemos_d1_mini32
substitutions:
esp_name: esp32_12
wifi:
ssid: "wifi"
password: !secret wifi_key
use_address: 192.168.6.95
domain: !secret domain
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${esp_name} Fallback Hotspot"
password: !secret Fallback_Hotspot
captive_portal:
# Enable logging
logger:
# level: VERBOSE
# baud_rate: 9600
# Enable Home Assistant API
api:
ota:
time:
- platform: homeassistant
id: homeassistant_time
web_server:
port: 80
esp32_ble_tracker:
scan_parameters:
duration: 90s
# Define the BLE client
ble_client:
- mac_address: "30:55:44:36:66:7D" # Replace with the MAC address of your BLE device
id: my_ble_client
on_connect:
then:
- lambda: |-
id(ble_connected) = true;
id(ble_state) = "connected";
on_disconnect:
then:
- lambda: |-
id(ble_connected) = false;
id(ble_state) = "reconnecting";
- script.execute: reconnect_ble
## To find the mac adress, most easy way is to enable the part down below saying:
## - platform: ble_scanner
## name: "BLE Devices Scanner"
## This will show all found BLE devices in the area with their mac adres and name if they have one in the esphome log.
## In case of a X210 battery the macs start consistently with: DC:0D:30:
sensor:
- <<: !include includes/include-wifi-signal.yaml
- <<: !include includes/include-uptime-config.yaml
- platform: template
name: "Battery voltage"
unit_of_measurement: "V"
update_interval: 30s
accuracy_decimals: 2
lambda: |-
return id(global_voltage);
- platform: template
name: "Battery Current"
update_interval: 30s
unit_of_measurement: "A"
accuracy_decimals: 1
lambda: |-
return id(global_current);
- platform: template
name: "Battery SOC"
update_interval: 30s
unit_of_measurement: "%"
accuracy_decimals: 0
lambda: |-
return id(global_soc);
- platform: template
name: "Battery Temperature"
update_interval: 30s
unit_of_measurement: "°C"
accuracy_decimals: 1
lambda: |-
return id(global_temperature);
#Unsure about these two yet if they actually work and what they mean
- platform: template
name: "Battery Status"
update_interval: 30s
accuracy_decimals: 0
lambda: |-
return id(global_status);
- platform: template
name: "Battery AFE Status"
update_interval: 30s
accuracy_decimals: 0
lambda: |-
return id(global_afe_status);
globals:
- id: global_voltage
type: float
restore_value: no
initial_value: '0.0'
- id: global_current
type: float
restore_value: no
initial_value: '0.0'
- id: global_soc
type: int
restore_value: no
initial_value: '0'
- id: global_temperature
type: float
restore_value: no
initial_value: '0.0'
- id: global_status
type: int
restore_value: no
initial_value: '0'
- id: global_afe_status
type: int
restore_value: no
initial_value: '0'
- id: ble_connected
type: bool
restore_value: no
initial_value: 'false'
- id: ble_state
type: std::string
restore_value: no
initial_value: '"disconnected"'
# this fetches data every minute by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
# Not sure if you actually need these two one, if it keeps dumping so mucht data it might do it itself anyway.
# You could try removing these
interval:
- interval: 1min
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
#this button manually fetches the data by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
button:
- platform: template
name: "Force update values"
on_press:
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
text_sensor:
- <<: !include includes/include-uptime-human.yaml
- <<: !include includes/include-esphome-version.yaml
- <<: !include includes/include-wifi-info.yaml
- platform: template
name: "Battery BLE connection"
id: ble_state_sensor
lambda: |-
return id(ble_state);
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service FFE0 Characteristic FFE4"
service_uuid: 'FFE0'
characteristic_uuid: 'FFE4'
notify: true
internal: true
id: ble_raw_data
on_value:
then:
- lambda: |-
std::string raw_data = id(ble_raw_data).state;
if (raw_data.length() >= 38) {
// Strip the first character '^'
raw_data = raw_data.substr(1);
auto char_to_int = [](char c) -> int {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('A' <= c && c <= 'F') {
return (c - 'A') + 10;
} else {
return 0;
}
};
auto asciitochar = [&](char b, char b2) -> int {
return ((char_to_int(b) << 4) & 0xF0) + (char_to_int(b2) & 0x0F);
};
int voltage = (((((asciitochar(raw_data[6], raw_data[7]) << 8) + asciitochar(raw_data[4], raw_data[5])) << 8) + asciitochar(raw_data[2], raw_data[3])) << 8) + asciitochar(raw_data[0], raw_data[1]);
int current = (((((asciitochar(raw_data[14], raw_data[15]) << 8) + asciitochar(raw_data[12], raw_data[13])) << 8) + asciitochar(raw_data[10], raw_data[11])) << 8) + asciitochar(raw_data[8], raw_data[9]);
int soc = (asciitochar(raw_data[30], raw_data[31]) << 8) + asciitochar(raw_data[28], raw_data[29]);
int temperature = (asciitochar(raw_data[34], raw_data[35]) << 8) + asciitochar(raw_data[32], raw_data[33]);
int status = asciitochar(raw_data[36], raw_data[37]);
int afe_status = asciitochar(raw_data[40], raw_data[41]);
float temperature_celsius = (temperature - 0xAAB) / 10.0;
float voltage_display = voltage / 1000.0;
float current_display = current / 10.0;
id(global_voltage) = voltage_display;
id(global_current) = current_display;
id(global_soc) = soc;
id(global_temperature) = temperature_celsius;
id(global_status) = status;
id(global_afe_status) = afe_status;
} else {
ESP_LOGE("main", "Received raw data is too short.");
}
- platform: ble_scanner
name: "BLE Devices Scanner"
switch:
- <<: !include includes/include-generic-restart-switch.yaml
script:
- id: reconnect_ble
then:
- delay: 5s
- ble_client.connect: my_ble_client
- delay: 30s
- if:
condition:
lambda: |-
return !id(ble_connected);
then:
- script.execute: reconnect_ble
#https://community.home-assistant.io/t/powerxtreme-emergoplus-ble-battery
EDIT: Think I did needed to add:
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service dump 3"
service_uuid: 'FFE0'
characteristic_uuid: 'FFE4'
notify: true
internal: true
And I commented out:
# - platform: ble_scanner
# name: "BLE Devices Scanner"
Because I thought that might fill the logs…
But still no readings. Other errors:
08:41:50][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '07D2'
[08:41:50][E][main:229]: Received raw data is too short.
[08:41:50][D][text_sensor:064]: 'BLE Service dump 3': Sending state '07D2'
[08:41:50][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:41:51][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^EF33000000000000'
[08:41:51][E][main:229]: Received raw data is too short.
[08:41:51][D][text_sensor:064]: 'BLE Service dump 3': Sending state '^EF33000000000000'
[08:41:51][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:41:51][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:41:51][E][main:229]: Received raw data is too short.
[08:41:51][D][text_sensor:064]: 'BLE Service dump 3': Sending state '3075000001005600'
[08:41:51][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:41:51][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '660B00800C94'
[08:41:51][E][main:229]: Received raw data is too short.
[08:41:51][D][text_sensor:064]: 'BLE Service dump 3': Sending state '660B00800C94'
[08:41:51][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:41:51][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'F80CFE0CFF0\xc3FA0C'
[08:41:51][E][main:229]: Received raw data is too short.
[08:41:51][D][text_sensor:064]: 'BLE Service dump 3': Sending state 'F80CFE0CFF0\xc3FA0C'
[08:41:51][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:41:51][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0`00000000000000'
[08:41:51][E][main:229]: Received raw data is too short.
[08:41:51][D][text_sensor:064]: 'BLE Service dump 3': Sending state '0`00000000000000'
[08:41:51][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:41:51][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:41:51][E][main:229]: Received raw data is too short.
[08:41:51][D][text_sensor:064]: 'BLE Service dump 3': Sending state '0000000000000000'
[08:41:51][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:41:51][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '00000`0000000000'
[08:41:51][E][main:229]: Received raw data is too short.
[08:41:51][D][text_sensor:064]: 'BLE Service dump 3': Sending state '00000`0000000000'
[08:41:51][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
Flooded with a red error:
[08:41:50][E][main:229]: Received raw data is too short.
I really hope this will start working
ha interesting, i thought the ‘’ around the data you provided were some weird artifact of copy pasting or the console.
(so i removed all of them leaving me with for example this: ^2134000000000000307500000105600650B00800C94050D0A0D0C0D060D000000000
000000000000000000000000000000000000000336)
Looks like its in the actual data.
So i think only thing needed is to remove those pesky quotation marks and newlines.
(Note the two new lines in the lambda of the ble_client).
I can not really test this myself, this is a suggestion from ChatGPT. Let me know if it works or not
If it works you might want to try reducing the amount of data its processing, for example by setting a global counter initially zero, then on every ble receive in the lambda increase the counter till for example 10, if it hits ten do the rest of the code and reset the counter to 0, so it skips 0 - 9 and does processing only for the 10th receive.
esphome:
name: "esp32-12"
platform: ESP32
board: wemos_d1_mini32
substitutions:
esp_name: esp32_12
wifi:
ssid: "wifi"
password: !secret wifi_key
use_address: 192.168.6.95
domain: !secret domain
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${esp_name} Fallback Hotspot"
password: !secret Fallback_Hotspot
captive_portal:
# Enable logging
logger:
# level: VERBOSE
# baud_rate: 9600
# Enable Home Assistant API
api:
ota:
time:
- platform: homeassistant
id: homeassistant_time
web_server:
port: 80
esp32_ble_tracker:
scan_parameters:
duration: 90s
# Define the BLE client
ble_client:
- mac_address: "30:55:44:36:66:7D" # Replace with the MAC address of your BLE device
id: my_ble_client
on_connect:
then:
- lambda: |-
id(ble_connected) = true;
id(ble_state) = "connected";
on_disconnect:
then:
- lambda: |-
id(ble_connected) = false;
id(ble_state) = "reconnecting";
- script.execute: reconnect_ble
## To find the mac adress, most easy way is to enable the part down below saying:
## - platform: ble_scanner
## name: "BLE Devices Scanner"
## This will show all found BLE devices in the area with their mac adres and name if they have one in the esphome log.
## In case of a X210 battery the macs start consistently with: DC:0D:30:
sensor:
- <<: !include includes/include-wifi-signal.yaml
- <<: !include includes/include-uptime-config.yaml
- platform: template
name: "Battery voltage"
unit_of_measurement: "V"
update_interval: 30s
accuracy_decimals: 2
lambda: |-
return id(global_voltage);
- platform: template
name: "Battery Current"
update_interval: 30s
unit_of_measurement: "A"
accuracy_decimals: 1
lambda: |-
return id(global_current);
- platform: template
name: "Battery SOC"
update_interval: 30s
unit_of_measurement: "%"
accuracy_decimals: 0
lambda: |-
return id(global_soc);
- platform: template
name: "Battery Temperature"
update_interval: 30s
unit_of_measurement: "°C"
accuracy_decimals: 1
lambda: |-
return id(global_temperature);
#Unsure about these two yet if they actually work and what they mean
- platform: template
name: "Battery Status"
update_interval: 30s
accuracy_decimals: 0
lambda: |-
return id(global_status);
- platform: template
name: "Battery AFE Status"
update_interval: 30s
accuracy_decimals: 0
lambda: |-
return id(global_afe_status);
globals:
- id: global_voltage
type: float
restore_value: no
initial_value: '0.0'
- id: global_current
type: float
restore_value: no
initial_value: '0.0'
- id: global_soc
type: int
restore_value: no
initial_value: '0'
- id: global_temperature
type: float
restore_value: no
initial_value: '0.0'
- id: global_status
type: int
restore_value: no
initial_value: '0'
- id: global_afe_status
type: int
restore_value: no
initial_value: '0'
- id: ble_connected
type: bool
restore_value: no
initial_value: 'false'
- id: ble_state
type: std::string
restore_value: no
initial_value: '"disconnected"'
# this fetches data every minute by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
# Not sure if you actually need these two one, if it keeps dumping so mucht data it might do it itself anyway.
# You could try removing these
interval:
- interval: 1min
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
#this button manually fetches the data by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
button:
- platform: template
name: "Force update values"
on_press:
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
text_sensor:
- <<: !include includes/include-uptime-human.yaml
- <<: !include includes/include-esphome-version.yaml
- <<: !include includes/include-wifi-info.yaml
- platform: template
name: "Battery BLE connection"
id: ble_state_sensor
lambda: |-
return id(ble_state);
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service FFE0 Characteristic FFE4"
service_uuid: 'FFE0'
characteristic_uuid: 'FFE4'
notify: true
internal: true
id: ble_raw_data
on_value:
then:
- lambda: |-
std::string raw_data = id(ble_raw_data).state;
// Remove newlines and single quotes
raw_data.erase(std::remove(raw_data.begin(), raw_data.end(), '\n'), raw_data.end());
raw_data.erase(std::remove(raw_data.begin(), raw_data.end(), '\''), raw_data.end());
if (raw_data.length() >= 38) {
// Strip the first character '^'
raw_data = raw_data.substr(1);
auto char_to_int = [](char c) -> int {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('A' <= c && c <= 'F') {
return (c - 'A') + 10;
} else {
return 0;
}
};
auto asciitochar = [&](char b, char b2) -> int {
return ((char_to_int(b) << 4) & 0xF0) + (char_to_int(b2) & 0x0F);
};
int voltage = (((((asciitochar(raw_data[6], raw_data[7]) << 8) + asciitochar(raw_data[4], raw_data[5])) << 8) + asciitochar(raw_data[2], raw_data[3])) << 8) + asciitochar(raw_data[0], raw_data[1]);
int current = (((((asciitochar(raw_data[14], raw_data[15]) << 8) + asciitochar(raw_data[12], raw_data[13])) << 8) + asciitochar(raw_data[10], raw_data[11])) << 8) + asciitochar(raw_data[8], raw_data[9]);
int soc = (asciitochar(raw_data[30], raw_data[31]) << 8) + asciitochar(raw_data[28], raw_data[29]);
int temperature = (asciitochar(raw_data[34], raw_data[35]) << 8) + asciitochar(raw_data[32], raw_data[33]);
int status = asciitochar(raw_data[36], raw_data[37]);
int afe_status = asciitochar(raw_data[40], raw_data[41]);
float temperature_celsius = (temperature - 0xAAB) / 10.0;
float voltage_display = voltage / 1000.0;
float current_display = current / 10.0;
id(global_voltage) = voltage_display;
id(global_current) = current_display;
id(global_soc) = soc;
id(global_temperature) = temperature_celsius;
id(global_status) = status;
id(global_afe_status) = afe_status;
} else {
ESP_LOGE("main", "Received raw data is too short.");
}
- platform: ble_scanner
name: "BLE Devices Scanner"
switch:
- <<: !include includes/include-generic-restart-switch.yaml
script:
- id: reconnect_ble
then:
- delay: 5s
- ble_client.connect: my_ble_client
- delay: 30s
- if:
condition:
lambda: |-
return !id(ble_connected);
then:
- script.execute: reconnect_ble
#https://community.home-assistant.io/t/powerxtreme-emergoplus-ble-battery
Actually, looking at the log part you posted again, looks like its submitting it to the notify in segments?
Then my previous post wont work.
Can you try posting a bit longer result from the logs (like the one you posted with the Other errors, where it says Received data too short) so i can try figuring out if it has a repeating pattern ?
Basicly what needs to happen is identify how many segments it posts and putting them together, then process them. Challange in this is going to determine the start of each set of segments
Its a bit of a guess since i can not properly test, but something like might work, it does compile but since i do not have the same battery its a bit hard to test. As a last resort i could program a second esp to act as the battery.
Note the new global which is a buffer for the incoming strings, every ^ basicly starts the string by looking for it as the first character, then if the character is not found it will add it to the rest, once its found again it will process the data first and reset the string to the new found first segment. This should also solve the issue of flooding the processor for the processing of the strings as its actually quite a few less then assumed but broken up.
If it is still too much data then implementing the counter is still an option.
esphome:
name: "esp32-12"
platform: ESP32
board: wemos_d1_mini32
substitutions:
esp_name: esp32_12
wifi:
ssid: "wifi"
password: !secret wifi_key
use_address: 192.168.6.95
domain: !secret domain
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${esp_name} Fallback Hotspot"
password: !secret Fallback_Hotspot
captive_portal:
# Enable logging
logger:
# level: VERBOSE
# baud_rate: 9600
# Enable Home Assistant API
api:
ota:
time:
- platform: homeassistant
id: homeassistant_time
web_server:
port: 80
esp32_ble_tracker:
scan_parameters:
duration: 90s
# Define the BLE client
ble_client:
- mac_address: "30:55:44:36:66:7D" # Replace with the MAC address of your BLE device
id: my_ble_client
on_connect:
then:
- lambda: |-
id(ble_connected) = true;
id(ble_state) = "connected";
on_disconnect:
then:
- lambda: |-
id(ble_connected) = false;
id(ble_state) = "reconnecting";
- script.execute: reconnect_ble
## To find the mac adress, most easy way is to enable the part down below saying:
## - platform: ble_scanner
## name: "BLE Devices Scanner"
## This will show all found BLE devices in the area with their mac adres and name if they have one in the esphome log.
## In case of a X210 battery the macs start consistently with: DC:0D:30:
sensor:
- <<: !include includes/include-wifi-signal.yaml
- <<: !include includes/include-uptime-config.yaml
- platform: template
name: "Battery voltage"
unit_of_measurement: "V"
update_interval: 30s
accuracy_decimals: 2
lambda: |-
return id(global_voltage);
- platform: template
name: "Battery Current"
update_interval: 30s
unit_of_measurement: "A"
accuracy_decimals: 1
lambda: |-
return id(global_current);
- platform: template
name: "Battery SOC"
update_interval: 30s
unit_of_measurement: "%"
accuracy_decimals: 0
lambda: |-
return id(global_soc);
- platform: template
name: "Battery Temperature"
update_interval: 30s
unit_of_measurement: "°C"
accuracy_decimals: 1
lambda: |-
return id(global_temperature);
#Unsure about these two yet if they actually work and what they mean
- platform: template
name: "Battery Status"
update_interval: 30s
accuracy_decimals: 0
lambda: |-
return id(global_status);
- platform: template
name: "Battery AFE Status"
update_interval: 30s
accuracy_decimals: 0
lambda: |-
return id(global_afe_status);
globals:
- id: global_voltage
type: float
restore_value: no
initial_value: '0.0'
- id: global_current
type: float
restore_value: no
initial_value: '0.0'
- id: global_soc
type: int
restore_value: no
initial_value: '0'
- id: global_temperature
type: float
restore_value: no
initial_value: '0.0'
- id: global_status
type: int
restore_value: no
initial_value: '0'
- id: global_afe_status
type: int
restore_value: no
initial_value: '0'
- id: ble_connected
type: bool
restore_value: no
initial_value: 'false'
- id: ble_state
type: std::string
restore_value: no
initial_value: '"disconnected"'
- id: completed_string
type: std::string
restore_value: no
initial_value: '""'
# this fetches data every minute by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
# Not sure if you actually need these two one, if it keeps dumping so mucht data it might do it itself anyway.
# You could try removing these
interval:
- interval: 1min
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
#this button manually fetches the data by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
button:
- platform: template
name: "Force update values"
on_press:
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
text_sensor:
- <<: !include includes/include-uptime-human.yaml
- <<: !include includes/include-esphome-version.yaml
- <<: !include includes/include-wifi-info.yaml
- platform: template
name: "Battery BLE connection"
id: ble_state_sensor
lambda: |-
return id(ble_state);
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service FFE0 Characteristic FFE4"
service_uuid: 'FFE0'
characteristic_uuid: 'FFE4'
notify: true
internal: true
id: ble_raw_data
on_value:
then:
- lambda: |-
std::string raw_data = id(ble_raw_data).state;
if (raw_data[0] == '^') {
if (!id(completed_string).empty()) {
// Process the completed string
std::string processed_data = id(completed_string);
// Parse the processed_data
auto char_to_int = [](char c) -> int {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('A' <= c && c <= 'F') {
return (c - 'A') + 10;
} else {
return 0;
}
};
auto asciitochar = [&](char b, char b2) -> int {
return ((char_to_int(b) << 4) & 0xF0) + (char_to_int(b2) & 0x0F);
};
if (processed_data.length() >= 38) { // Adjust the length based on your data structure
int voltage = (((((asciitochar(processed_data[6], processed_data[7]) << 8) + asciitochar(processed_data[4], processed_data[5])) << 8) + asciitochar(processed_data[2], processed_data[3])) << 8) + asciitochar(processed_data[0], processed_data[1]);
int current = (((((asciitochar(processed_data[14], processed_data[15]) << 8) + asciitochar(processed_data[12], processed_data[13])) << 8) + asciitochar(processed_data[10], processed_data[11])) << 8) + asciitochar(processed_data[8], processed_data[9]);
int soc = (asciitochar(processed_data[30], processed_data[31]) << 8) + asciitochar(processed_data[28], processed_data[29]);
int temperature = (asciitochar(processed_data[34], processed_data[35]) << 8) + asciitochar(processed_data[32], processed_data[33]);
int status = asciitochar(processed_data[36], processed_data[37]);
int afe_status = asciitochar(processed_data[40], processed_data[41]);
float temperature_celsius = (temperature - 0xAAB) / 10.0;
float voltage_display = voltage / 1000.0;
float current_display = current / 10.0;
id(global_voltage) = voltage_display;
id(global_current) = current_display;
id(global_soc) = soc;
id(global_temperature) = temperature_celsius;
id(global_status) = status;
id(global_afe_status) = afe_status;
} else {
ESP_LOGE("main", "Received raw data is too short.");
}
}
// Reset the completed_string with the new segment starting with ^
id(completed_string) = raw_data;
} else {
// Append to the existing string
id(completed_string) += raw_data;
}
- platform: ble_scanner
name: "BLE Devices Scanner"
switch:
- <<: !include includes/include-generic-restart-switch.yaml
script:
- id: reconnect_ble
then:
- delay: 5s
- ble_client.connect: my_ble_client
- delay: 30s
- if:
condition:
lambda: |-
return !id(ble_connected);
then:
- script.execute: reconnect_ble
#https://community.home-assistant.io/t/powerxtreme-emergoplus-ble-battery
Did you see this?
It’s a bit hard for me to follow you here
i must have missed it, anyhow, just try the last code version i posted
I think it should already have a repeating pattern since every new batch of data starts with the ^, so it might already be solved.
If it does not work ill code up a fake battery later today that acts in the way yours seems to do so i can figure out how to fix it.
I Used the code from post PowerXtreme / Emergoplus BLE Battery - #23 by devilmastah
It’s doing something now, but not totally correct:
One more set of output if it helps:
[08:29:14][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:14][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0`00000000000000'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06EC'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F733000000000000'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'g075000001005600'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0CFF0C010DFD0C'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '00000p0000000000'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06EE'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F733000000000000'
[08:29:15][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:15][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3p75000001005600'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA`C010D010DFC0C'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '05F0'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F833000`00000000'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:16][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":1719210555,"address":"A4:C1:38:31:9C:E1","rssi":-85,"name":"ATC_319CE1"}'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0C010D010DFC0\x87'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:16][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:16][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '000000000`000000'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '05F1'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '\xbeF833000000000000'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '307500000100560`'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0CFF0C020DFD0C'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000`00000000000'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F0'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F833000000000000'
[08:29:17][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:17][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00p00C94'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FB0CFF0C020DF\x840C'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '000000`000000000'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F1'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F9330`0000000000'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C9h'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FB0C\x8cF0C020DFD0C'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:18][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:18][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000`00'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F2'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F933000000000000'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005v00'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750\x8600800C94'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0C010D010DFD0C'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:19][D][sensor:094]: 'Battery Temperature': Sending state 1775.59998 °C with 1 decimals of accuracy
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '00p0000000000000'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '05F3'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F933000000000000'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '30o5000001005600'
[08:29:19][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:19][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B`0800C94'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FB0CFF0C020DFD0C'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '000000`000000000'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0vF2'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F933000000000000'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'w50B00800C94'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FB0CFF0C020DFD0C'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:20][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:20][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F2'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F833000000000000'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0CFF0C020DFD0C'
[08:29:21][D][sensor:094]: 'Battery Status': Sending state 176.00000 with 0 decimals of accuracy
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F0'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^D833000000000000'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:21][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:21][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FB0CFF0C030DFD0C'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F2'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^FA33000000000000'
[08:29:22][D][sensor:094]: 'esp32_12 - WiFi Signal': Sending state -60.00000 dBm with 0 decimals of accuracy
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FB0CFF0C0c0DFD0C'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:22][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:22][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '00`0000000000000'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F4'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F9f3000000000000'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:23][W][ble_client.automation:141]: Cannot write to BLE characteristic - not connected
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'F\x820CFF0C020DFD0C'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000`00000000'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F2'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '\xbcF933000000000000'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_READ_CHAR_EVT
[08:29:23][W][ble_text_sensor:081]: Error reading char at handle 22, status=2
[08:29:23][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:23][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750Bp0800C94'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FB0CFF0C020DFD0C'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F2'
[08:29:24][D][sensor:094]: 'Battery Current': Sending state 0.00000 A with 1 decimals of accuracy
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F833000000000000'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0CFF0C020DFD0C'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '00000000000000`0'
[08:29:24][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:24][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '000000000000`000'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F0'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F833000000000000'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0CFF0C020DFD0C'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000p00000000'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F0'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^F83300p000000000'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '30750`0001005600'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:25][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750\x8200800C94'
[08:29:25][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0BFF0C020DFD0C'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '06F0'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^FC33000000000000'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FB0C010D030DFD0C'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '000`000000000000'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:26][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:26][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '05F9'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^FC33000000000000'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B00800C94'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'FA0C010D030DFD0C'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:27][D][sensor:094]: 'Battery voltage': Sending state 3195.66309 V with 2 decimals of accuracy
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0uF8'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^FB33000000000000'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '307u000001005600'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '750B`0800C94'
[08:29:27][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:27][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state 'F\x810C010D030DFD0C'
[08:29:28][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:28][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:28][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:28][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '00000000000000`0'
[08:29:28][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:28][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '0000000000000000'
[08:29:28][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:28][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '05F7'
[08:29:28][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:28][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '^FD33000000000000'
[08:29:28][D][esp32_ble_client:110]: [0] [30:55:44:36:66:7D] ESP_GATTC_NOTIFY_EVT
[08:29:28][D][text_sensor:064]: 'BLE Service FFE0 Characteristic FFE4': Sending state '3075000001005600'
One annoying thing is as soon if the ESP is in the range of the battery I cannot flash it. It always fails at 4-5%. It must be too busy. Anything doable to that? Filter? Or is it the internals too busy with parsing the messages?
I have a powerextreme x125. I guess this must also work for this device?
Try it? Then you’ll know…
I will try it. But I was wondering if someone else already tried.
@sender Unfortunately, it did not work. I have a similar as you. These weird numbers do not make sense. I have also the problem that I cannot flash it anymore if it is connected to the battery.
So I would like to start on the beginning to make sure I got the right string.
@devilmastah Which OS app are you using (Do you have a link to the app-store?) and what steps do I need to do to get this long string in the App? Are able to provide this. Can you make your decode script available? Or when I have the string can I sent it to you to see if it is similar?
And lastly, do you see something in the decompile code of the app that different version of the battery are treaded differently?
Sorry for all the questions. Hopefully we can get this to work and when I do I will post also a fully working script.
I had it running partially… it works well, but I cannot “access” the esp anymore (update) if ble is connected. Tried to work it out with the expert (@devilmastah) but he’s not responding anymore… Hope someone else is able to help out because I really like this concept!
My latest running config:
esphome:
name: "esp32-12"
platform: ESP32
board: wemos_d1_mini32
substitutions:
esp_name: esp32_12
wifi:
ssid: "wifi"
password: !secret Iwifi_key
use_address: 192.168.1.1
domain: !secret domain
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${esp_name} FH"
password: !secret FH
captive_portal:
# Enable logging
logger:
# level: VERBOSE
# baud_rate: 9600
# Enable Home Assistant API
api:
ota:
platform: esphome
time:
- platform: homeassistant
id: homeassistant_time
web_server:
port: 80
esp32_ble_tracker:
scan_parameters:
duration: 90s
# Define the BLE client
ble_client:
- mac_address: "30:55:44:36:77:7D" # Replace with the MAC address of your BLE device
id: my_ble_client
on_connect:
then:
- lambda: |-
id(ble_connected) = true;
id(ble_state) = "connected";
on_disconnect:
then:
- lambda: |-
id(ble_connected) = false;
id(ble_state) = "reconnecting";
- script.execute: reconnect_ble
## To find the mac adress, most easy way is to enable the part down below saying:
## - platform: ble_scanner
## name: "BLE Devices Scanner"
## This will show all found BLE devices in the area with their mac adres and name if they have one in the esphome log.
## In case of a X210 battery the macs start consistently with: DC:0D:30:
sensor:
- <<: !include includes/include-wifi-signal.yaml
- <<: !include includes/include-uptime-config.yaml
- platform: template
name: "Battery voltage"
unit_of_measurement: "V"
update_interval: 30s
filters:
- lambda: |
if (x < 0) return {};
else return x;
accuracy_decimals: 2
lambda: |-
return id(global_voltage);
- platform: template
name: "Battery Current"
update_interval: 30s
filters:
- lambda: |
if (x < 0) return {};
else return x;
unit_of_measurement: "A"
accuracy_decimals: 1
lambda: |-
return id(global_current);
- platform: template
name: "Battery SOC"
update_interval: 30s
filters:
- lambda: |
if (x < 0) return {};
else return x;
unit_of_measurement: "%"
accuracy_decimals: 0
lambda: |-
return id(global_soc);
- platform: template
name: "Battery Temperature"
update_interval: 30s
filters:
- lambda: |
if (x < 0) return {};
else return x;
unit_of_measurement: "°C"
accuracy_decimals: 1
lambda: |-
return id(global_temperature);
globals:
- id: global_voltage
type: float
restore_value: no
initial_value: '0.0'
- id: global_current
type: float
restore_value: no
initial_value: '0.0'
- id: global_soc
type: int
restore_value: no
initial_value: '0'
- id: global_temperature
type: float
restore_value: no
initial_value: '0.0'
- id: ble_connected
type: bool
restore_value: no
initial_value: 'false'
- id: ble_state
type: std::string
restore_value: no
initial_value: '"disconnected"'
- id: completed_string
type: std::string
restore_value: no
initial_value: '""'
# this fetches data every minute by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
# Not sure if you actually need these two one, if it keeps dumping so mucht data it might do it itself anyway.
# You could try removing these
interval:
- interval: 1min
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
#this button manually fetches the data by pushing a Number 1 to the FFF2 characteristic, causing an update on the Notify FFF1
button:
- platform: template
name: "Force update values"
on_press:
then:
- ble_client.ble_write:
id: my_ble_client
service_uuid: 'FFF0'
characteristic_uuid: 'FFF2'
value: [0x31]
text_sensor:
- <<: !include includes/include-uptime-human.yaml
- <<: !include includes/include-esphome-version.yaml
- <<: !include includes/include-wifi-info.yaml
- platform: template
name: "Battery BLE connection"
id: ble_state_sensor
lambda: |-
return id(ble_state);
- platform: ble_client
ble_client_id: my_ble_client
name: "BLE Service FFE0 Characteristic FFE4"
service_uuid: 'FFE0'
characteristic_uuid: 'FFE4'
notify: true
internal: true
id: ble_raw_data
on_value:
then:
- lambda: |-
std::string raw_data = id(ble_raw_data).state;
if (raw_data[0] == '^') {
if (!id(completed_string).empty()) {
// Process the completed string
std::string processed_data = id(completed_string);
processed_data = processed_data.substr(1);
// Parse the processed_data
auto char_to_int = [](char c) -> int {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('A' <= c && c <= 'F') {
return (c - 'A') + 10;
} else {
return 0;
}
};
auto asciitochar = [&](char b, char b2) -> int {
return ((char_to_int(b) << 4) & 0xF0) + (char_to_int(b2) & 0x0F);
};
if (processed_data.length() >= 38) { // Adjust the length based on your data structure
int voltage = (((((asciitochar(processed_data[6], processed_data[7]) << 8) + asciitochar(processed_data[4], processed_data[5])) << 8) + asciitochar(processed_data[2], processed_data[3])) << 8) + asciitochar(processed_data[0], processed_data[1]);
int current = (((((asciitochar(processed_data[14], processed_data[15]) << 8) + asciitochar(processed_data[12], processed_data[13])) << 8) + asciitochar(processed_data[10], processed_data[11])) << 8) + asciitochar(processed_data[8], processed_data[9]);
int soc = (asciitochar(processed_data[30], processed_data[31]) << 8) + asciitochar(processed_data[28], processed_data[29]);
int temperature = (asciitochar(processed_data[34], processed_data[35]) << 8) + asciitochar(processed_data[32], processed_data[33]);
float temperature_celsius = (temperature - 0xAAB) / 10.0;
float voltage_display = voltage / 1000.0;
float current_display = current / 10.0;
id(global_voltage) = voltage_display;
id(global_current) = current_display;
id(global_soc) = soc;
id(global_temperature) = temperature_celsius;
} else {
ESP_LOGE("main", "Received raw data is too short.");
}
}
// Reset the completed_string with the new segment starting with ^
id(completed_string) = raw_data;
} else {
// Append to the existing string
id(completed_string) += raw_data;
}
# - platform: ble_scanner
# name: "BLE Devices Scanner"
switch:
- <<: !include includes/include-generic-restart-switch.yaml
script:
- id: reconnect_ble
then:
- delay: 5s
- ble_client.connect: my_ble_client
- delay: 30s
- if:
condition:
lambda: |-
return !id(ble_connected);
then:
- script.execute: reconnect_ble