Bluetooth ble sensor for esphome diy

Good day!

the idea is simple, to make a universal ble sensor that can be used in the future as;

-street meteorological station

  • water leakage sensor
    -control of the state of various devices and systems.

the main advantage is the work from battery for a long time.

based on the esp32_ble examples, I was able to make a beacon (label) that sends 12 bytes of data once every 5 minutes.

I divided all sensor values ​​into two parts.
t = 25.12, h = 60.13%
1 byte = 25
2 bytes = 12
3 bytes = 60
4 bytes = 13

and so on for all values

using the examples in esphome I was able to accept these bytes.

there is only one problem left to solve and I need your help.

how to combine two values ​​into one using esphome code ??? x[0] + “.” + x[1] = 25.12

esphome code snippet

    - mac_address: '30:AE:A4:9C:B5:EE'
      service_uuid: 'AAAA'
        - lambda: |-
  - platform: template
    name: "t"
    id: ble_sensor
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"

  - platform: template
    name: "h"
    id: ble_sensor2
    unit_of_measurement: "%"
    icon: "mdi:water-percent"

1 Like