LEGO DUPLO train control with esphome

@JWL98, @anthonyangel, @vrutkovs, @arehsan, @Lumpusz

Very cool that you guys figured this out, amazing.
I am trying to wrap my head around this, but still a bit puzzled:
How do you guys know what values to enter for:

  • ble_clients mac_address and id
  • service_uuid
  • characteristic_uuid
  • the value of the bytes to write

thanks up front for the help,

Br,

Raymond

service_uuid and characteristic_uuid are hardcoded values LEGO uses in the train to identify data. These will not change. Same for bytes to write - this is the protocol we should follow.
MAC address and ID can be detected using ESP32 Bluetooth Low Energy Scanner ā€” ESPHome

Thank you very much for your response.
Makes things a lot clearer.
Do you know any esphome yaml files to use to get that data?
Do I need to push any buttons on the Lego hub to activate communication?
Can the values to send be found in the official Lego api docks?
Sorry for all the questions :grin:
Trying to fully understand.
I have never used BLE with HA or esphome.
Best regards,
Thanks upfront,
Raymond

Do you know any esphome yaml files to use to get that data?

You may want to start with ESPHome Tutorial at Getting Started with ESPHome and Home Assistant ā€” ESPHome first

Do I need to push any buttons on the Lego hub to activate communication?

I donā€™t think Lego hub is needed, at least I donā€™t have one

Can the values to send be found in the official Lego api docks?

I donā€™t know tbf, quite possibly these are extracted from the docs indeed

I am a bit puzzled :slight_smile:
How are you connecting this all to Lego if you donā€™t have a hub?
With a hub I mean: Lego part 88009
thanks again
br
Raymond

ESPHome runs on a microcontroller which has BT, so it can connect to the train directly

Thanks I got that part :smiley:
I was talking about the ā€˜Lego-sideā€™
You still need a hub as linked above in the Lego train, or am i misunderstanding things?
Br