myhomeiot / esphome-components

A collection of my ESPHome components
Other
257 stars 25 forks source link

ble_gateway: Raw packet to MQTT #17

Closed JacoBezuidenhout closed 2 years ago

JacoBezuidenhout commented 2 years ago

Hi everyone.

Wow this is really cool! I am fairly new to ESPHome and am struggling to publish the raw packet to mqtt (and not home-assistant). How will I go about it?

myhomeiot commented 2 years ago

I will give you example soon :smile:

myhomeiot commented 2 years ago
mqtt:
  id: mqtt_client
  broker: 192.168.1.10
  username: mqtt_username
  password: mqtt_password
  reboot_timeout: 1h

ble_gateway:
  id: blegateway
  on_ble_advertise:
    then:
      mqtt.publish:
        topic: ble_gateway
        payload: !lambda return packet;

More info about ESPHome MQTT you can find here:

JacoBezuidenhout commented 2 years ago

Thank you verrrrryyy much!! I overcomplicated it completely. I really appreciate the super quick response!

JacoBezuidenhout commented 2 years ago

Just a note to other noobs like myself:

I had to add discovery: true to ble_gateway for it to start steaming over MQTT.