Skip to content

Instantly share code, notes, and snippets.

@peyanski
Last active October 17, 2022 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peyanski/260e5ee2744ff080e6ac80cba46b5751 to your computer and use it in GitHub Desktop.
Save peyanski/260e5ee2744ff080e6ac80cba46b5751 to your computer and use it in GitHub Desktop.
esphome:
name: idasen
platform: esp32
board: esp32dev # Replace with your board
# Starting with ESPHome 2021.10, libraries need to be included manually
libraries:
- "ESP32 BLE Arduino"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Idasen Fallback Hotspot"
password: aaaaaaaa
captive_portal:
# BEGIN BLUETOOTH DISCOVERY INTEGRATION
esp32_ble_tracker:
# globals:
# # To store the Desk Connection Status
# - id: ble_client_connected
# type: bool
# initial_value: 'false'
#ble_client:
# - mac_address: "D1:88:9C:81:3F:05"
# id: idasen_desk
# on_connect:
# then:
# # Update the Desk Connection Status
# - lambda: |-
# id(ble_client_connected) = true;
# - delay: 5s
# # Update desk height and speed sensors after bluetooth is connected
# - lambda: |-
# id(desk_height).update();
# id(desk_speed).update();
# on_disconnect:
# then:
# # Update the Desk Connection Status
# - lambda: |-
# id(ble_client_connected) = false;
#sensor:
# # Desk Height Sensor
# - platform: ble_client
# ble_client_id: idasen_desk
# id: desk_height
# name: 'Desk Height'
# service_uuid: '99fa0020-338a-1024-8a49-009c0215f78a'
# characteristic_uuid: '99fa0021-338a-1024-8a49-009c0215f78a'
# icon: 'mdi:arrow-up-down'
# unit_of_measurement: 'cm'
# accuracy_decimals: 1
# update_interval: 10s
# notify: true
# lambda: |-
# uint16_t raw_height = ((uint16_t)x[1] << 8) | x[0];
# unsigned short height_mm = raw_height / 10;
# return (float) height_mm / 10;
# # Desk Speed Sensor
# - platform: ble_client
# ble_client_id: idasen_desk
# id: desk_speed
# name: 'Desk Speed'
# service_uuid: '99fa0020-338a-1024-8a49-009c0215f78a'
# characteristic_uuid: '99fa0021-338a-1024-8a49-009c0215f78a'
# icon: 'mdi:speedometer'
# unit_of_measurement: 'cm/min' # I'm not sure this unit is correct
# accuracy_decimals: 0
# update_interval: 10s
# notify: true
# lambda: |-
# uint16_t raw_speed = ((uint16_t)x[3] << 8) | x[2];
# return raw_speed / 100;
#button:
# - platform: template
# name: Update Desk Information
# id: update_desk_data
# on_press:
# # Update desk height and speed sensors on button press
# - lambda: |-
# id(desk_height).update();
# id(desk_speed).update();
# END BLUETOOTH DISCOVERY INTEGRATION
# BEGIN IDASEN DESK CONTROLLER INTEGRATION
# https://github.com/j5lien/esphome-idasen-desk-controller/tree/v1.2.3
external_components:
- source: github://j5lien/esphome-idasen-desk-controller@v1.2.3
idasen_desk_controller:
# Desk controller bluetooth mac address
# -----------
# Required
mac_address: "D1:88:9C:81:3F:05"
# Use bluetooth callback to update sensors and cover entities
# Deactivate this option when data are not correctly updated when using the cover entity
# -----------
# Optionnal (default true)
bluetooth_callback: false
cover:
- platform: idasen_desk_controller
name: "IDASEN Desk"
binary_sensor:
# Desk bluetooth connection
- platform: idasen_desk_controller
name: "IDASEN Desk Connection"
type: CONNECTION
# Desk moving status
- platform: idasen_desk_controller
name: "IDASEN Desk Moving"
type: MOVING
# END IDASEN DESK CONTROLLER INTEGRATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment