Controlling BLE ceiling light with HA

Hello @HVPereira,

I was not able to find the App ‘ZhiMeiDengKong’ in the Play store, may I ask you to provide a link to this app such as this one?

It would also help if you could capture the messages when some buttons are pressed in the app (or the remote), as detailed here for the dev branch.

Thanks in advance :slightly_smiling_face:

1 Like

@Yacko, I corrected this while pulling all my changes and recent fixes from my dev branch to main branch, it should work OK now.

I have the same light with ZhiMeiDengKong app.
Here the link to ZhiMeiDengKong app
I am trying to use zhijia coding, but still not luck…
Any ideas?

Try with encoding: zhiguang :slightly_smiling_face:
Ref doc

You can also listen the traffic generated by your phone app to shadow the config and avoid pairing.

Have issues with the compiling firmware from your fork. So I cant try encoding: zhiguang
But I have captured the packages from APP compiled from repo and can success send it by inject service.

Light ON
Work for me!!!!----->>>[13:44:43][D][ble_adv_handler:300]: raw - 02.01.1A.1B.03.48.46.4B.4A.E4.62.28.85.E6.EF.19.AE.CB.63.FA.C5.3A.96.44.2A.10.11.12.13.14.15 (31)
Not work for me----->>>[13:44:43][D][ble_adv_handler:300]: raw - 02.01.1A.1B.03.F9.08.49.B2.CE.2C.4C.61.31.CA.53.B4.78.67.B7.58.10.11.12.13.14.15.16.17.18.19 (31)
[13:44:43][D][zhijia - v1:189]: Decoded KO (CRC)

Light OFF
Work for me!!!!----->>>[13:45:04][D][ble_adv_handler:300]: raw - 02.01.1A.1B.03.48.46.4B.4A.FF.8E.82.6C.0B.D4.FE.58.B2.65.FD.35.3A.04.C2.CB.10.11.12.13.14.15 (31)
Not work for me----->>>[13:45:04][D][ble_adv_handler:300]: raw - 02.01.1A.1B.03.F9.08.49.B2.CE.2C.4D.60.30.CB.53.B5.78.66.E7.02.10.11.12.13.14.15.16.17.18.19 (31)
[13:45:04][D][zhijia - v1:189]: Decoded KO (CRC)

Looks like raw …10.11.12.13.14.15 (31) is unknow coder ?

Indeed, It does not correspond to any of our supported apps (even zhiguang btw).
You can open a request to have it supported, but that’s a lot of work for a fully unknown app, with no guarantee of success. Moreover the fact it is not available on the Play Store is not a very good point… I would rather not install it on my phone…

EDIT: opened request here

That’s exactly the one, I’ve managed to turn it off and on by sending raw data… but changing the brightness and so on is really hard.

I’ve managed to rtrieve the following information, maybe it could help to “build something”:

turn off

02.01.01.1B.03.48.46.4B.4A.9E.36.9B.BA.1C.35.5F.F9.11.4C.54.6C.51.3D.B0.A5.10.11.12.13.14.15

turn on

02.01.01.1B.03.48.46.4B.4A.FF.17.13.59.BB.D4.FE.59.B2.A7.12.D3.F8.D2.92.49.10.11.12.13.14.15

colder(only has 3 levels, but i need to make request 1 and then request 2. If I make 1 followed by 1 it stays in the same status)

1E.FF.58.55.18.48.46.4B.4A.E1.4B.0F.BF.C1.F2.1C.AF.42.EA.6D.BD.B1.EF.ED.C7.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.0A.B0.76.FA.68.C9.F3.68.6B.B1.20.CA.EF.B4.69.8E.10.11.12.13.14.15

Warmer (3 levels, same as before for colder)

1E.FF.58.55.18.48.46.4B.4A.51.D5.99.2F.31.82.AC.1F.B2.E0.61.48.BB.65.A5.D8.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.FF.8E.82.2D.53.D4.FE.5D.60.65.FD.43.39.EC.08.E0.10.11.12.13.14.15

Brightness down

1E.FF.58.55.18.48.46.4B.4A.51.D5.99.2F.31.82.AC.21.B2.E0.61.48.BE.35.42.0D.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.99.1A.E2.87.F9.3A.64.F9.FA.70.D2.28.2E.C1.B2.44.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.9E.18.DE.8E.F4.35.5F.FA.FF.CB.26.EF.D3.F2.6C.BA.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.1C.9C.62.0C.76.B7.E1.7C.7D.26.B1.8C.72.4F.05.98.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.E4.62.28.C4.BE.EF.19.B4.45.63.FA.CB.3F.8A.11.24.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.FF.8E.82.2D.53.D4.FE.5B.60.65.FD.43.E8.8C.58.73.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.B2.5C.22.D2.90.21.4B.7E.13.6D.F0.09.3E.F8.F9.E1.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.16.BB.7D.F6.6C.BD.E7.62.77.6A.F0.60.35.97.29.CE.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.0A.C1.83.FA.68.C9.F3.66.6B.CD.09.E9.0E.54.EA.89.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.23.A9.6D.01.7F.B0.DA.6F.84.AF.40.F5.EA.1E.17.D6.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.9E.27.F9.8E.F4.35.5F.FA.FF.45.A3.59.5E.8C.79.A7.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.99.2D.F1.87.F9.3A.64.F9.FA.C5.20.F3.D8.F8.93.C1.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.51.02.CA.2F.31.82.AC.21.B2.F0.62.B8.AD.B1.39.42.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.69.1B.DF.97.C9.6A.94.C9.CA.60.F3.18.3D.0D.45.AA.10.11.12.13.14.15

Brightness up:

1E.FF.58.55.18.48.46.4B.4A.E4.75.33.C4.BE.EF.19.B4.45.55.DF.DA.4A.74.EE.C3.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.7B.07.CB.A9.D7.58.82.D7.DC.E1.94.B8.64.5C.95.57.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.1C.AB.71.0C.76.B7.E1.7C.7D.2B.83.8C.78.96.55.7E.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.78.06.CC.A8.DA.5B.85.D8.D9.26.DB.53.79.7F.5D.32.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.E1.7C.34.BF.C1.F2.1C.B1.42.63.47.C6.3E.1E.18.16.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.B2.4D.0F.D2.90.21.4B.7E.13.FD.8D.8E.AE.9C.7B.41.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.07.9A.5E.25.5B.CC.F6.53.68.18.D4.53.89.11.1B.DF.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.16.AA.70.F6.6C.BD.E7.62.77.C1.2E.EA.02.7C.51.D8.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.23.B8.7C.01.7F.B0.DA.6F.84.C3.31.E6.E6.96.EA.F3.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.0A.B0.76.FA.68.C9.F3.66.6B.B1.20.CA.E9.AC.EF.67.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.99.3C.04.87.F9.3A.64.F9.FA.39.B5.80.63.68.A9.AE.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.9E.36.FC.8E.F4.35.5F.FA.FF.CB.48.F0.D3.EA.FE.CB.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.69.0A.D2.97.C9.6A.94.C9.CA.95.3F.E4.07.14.41.27.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.51.F3.B7.2F.31.82.AC.21.B2.E0.C3.47.BE.DD.87.22.10.11.12.13.14.15
1E.FF.58.55.18.48.46.4B.4A.7B.16.E2.A9.D7.58.82.D7.DC.4E.12.05.50.A3.8B.63.10.11.12.13.14.15

RAW data are coded by special algorithm by china application. APP need to be reverse engineered to understand the encoder algorithm… Should wait if someone interested to do that…

I see… thought it might be of help :frowning:

Hi @NicoIIT,

You were right! It’s zhijia / v2, I was able to parse commands from Zhi Guang app! Interesting, but remote commands were not parsed…

In any case, it works — I paired each lantern to the app (as separate groups) and created controllers for them:

ble_adv_controller:
  - id: lights_3d
    encoding: zhijia
    variant: v2
    forced_id: 0xE59BCE
    index: 1
  - id: lights_kitchen
    encoding: zhijia
    variant: v2
    forced_id: 0xE59BCE
    index: 3
  - id: lights_tv
    encoding: zhijia
    variant: v2
    forced_id: 0xE59BCE
    index: 2

light:
  - platform: ble_adv_controller
    ble_adv_controller_id: lights_3d
    name: 3D Printer Light
  - platform: ble_adv_controller
    ble_adv_controller_id: lights_kitchen
    name: Kitchen
  - platform: ble_adv_controller
    ble_adv_controller_id: lights_tv
    name: Main
1 Like

@spherebread: great!

You were right! It’s zhijia / v2, I was able to parse commands from Zhi Guang app! Interesting, but remote commands were not parsed…

Well provide me one of those raw commands, probably a new variant to be added for this type of remote.

Here you go:
02.01.1A.14.FF.F0.FF.CF.58.EC.CF.CD.CF.30.EF.CE.6D.CC.CD.67.C8.EC.2F.C9 (24)

Well I think I decoded it, it was a Pairing command :slightly_smiling_face: .
May you provide a few more commands in this issue so that I can confirm and implement a decoder ? Thanks!

1 Like

@ All, new version pushed to main branch:

  • Support for physical remote sync with HA: the ble_adv_remote component allows you to listen to your physical remote (or phone) commands and publish them to HA (promoted from dev branch)
  • Support for native config listening and Shadow: No more pairing needed! (promoted from dev branch)
  • Support for RGB light type (beta), using type: rgb at light level
  • Support for ZhiMeiDengKong App (beta), encoding: zhimei
  • Possibility to increase the bluetooth range with option use_max_tx_power
  • More Actions and Automation Triggers available

Please note that:

  • The native buttons are deprecated (including pair button), they can be replaced by standard template button with corresponding action
  • The native scanner it includes to listen to config and remote commands makes it incompatible with the ESP32 BLE Tracker or the components that would include it, such as Bluetooth Proxy.
  • 3 components are now used: ble_adv_handler, ble_adv_remote, ble_adv_controller

Do not hesitate to open issues in case you are facing problems.

Enjoy :slightly_smiling_face:

3 Likes

I came here in search of a solution to integrate my new fan that works with the FanLampPro app. I just ordered one of the recommended ESP-32 boards off AliExpress and will report back in a couple of weeks :slight_smile:
Can’t wait to try @NicoIIT’s integration :slight_smile:

New version pushed to main, probably one of my last refactoring as the software looks quite clean now!

Features:

  • Adding support for Smart Light App, encoding: agarce
  • Change log and Developer’s Guide added
  • Bug fixes on RGB lights and Fan Speed speed_count handling
  • Many features for Developers or experienced users to be able to add new codecs or translators by configuration (see wiki)

As always it comes with a bit of migrations that you can find in the change log.
Hope I have not break everything :slight_smile:

3 Likes

Splendid – works great with my “FanLampPro” fan :slight_smile: Thank you @NicoIIT !

1 Like