Skip to content

Latest commit

 

History

History
191 lines (150 loc) · 6.28 KB

README.md

File metadata and controls

191 lines (150 loc) · 6.28 KB

This component creates a bluetooth bridge for an Ikea Idasen desk that uses a Linak controller with ESPHome and an ESP32 device.

Cover integration Linak Desk Card
Home Assistant Desk Controller

The desk is controlled using the cover integration or Linak Desk Card which is available in HACS in Home assistant.

Dependencies

Installation

You can install this component with ESPHome external components feature like this:

external_components:
  - source: github://j5lien/esphome-idasen-desk-controller@v4.0.0

For the first connection you will need to press the pairing button on the desk.

Configuration

BLE Client

You need first to configure ESPHome BLE Client (check the documentation for more information):

esp32_ble_tracker:

ble_client:
  - mac_address: "00:00:00:00:00:00" # Replace with the desk bluetooth mac address
    id: idasen_desk

On OSX, you can find the mac address of the desk by first connecting to it using a supported app (like Idasen Controller or Desk Remote Control), and then running this command in terminal: system_profiler SPBluetoothDataType

Idasen Desk Controller

Then you need to enable this component with the id of the ble_client component:

idasen_desk_controller:
    # Reference to the ble client component id
    # -----------
    # Required
    ble_client_id: idasen_desk
    # Fallback to use only up and down commands (less precise)
    # -----------
    # Optional
    only_up_down_command: false

Cover

Now you can add the cover component that will allow you to control your desk:

cover:
  - platform: idasen_desk_controller
    name: "Desk"

Extra Desk informations

Using ESPHome BLE Client Sensor, you can expose more informations that doesn't require this custom component.

This is an example that generates sensors that were available in previous versions:

esp32_ble_tracker:

globals:
  # To store the Desk Connection Status
  - id: ble_client_connected
    type: bool
    initial_value: 'false'

ble_client:
  - mac_address: "00:00:00:00:00:00"
    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
    type: characteristic
    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: never
    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
    type: characteristic
    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: never
    notify: true
    lambda: |-
      uint16_t raw_speed = ((uint16_t)x[3] << 8) | x[2];
      return raw_speed / 100;

binary_sensor:
  # Desk Bluetooth Connection Status
  - platform: template
    name: 'Desk Connection'
    id: desk_connection
    lambda: 'return id(ble_client_connected);'

  # Desk Moving Status
  - platform: template
    name: 'Desk Moving'
    id: desk_moving
    lambda: 'return id(desk_speed).state > 0;'

Troubleshooting

ESPHome lower than 1.19.0

Check the version v1.2.4 of this component

Not moving using cover component

If the desk is not moving using the cover component you can try to activate a fallback option only_up_down_command. It will only use up and down commands to control the desk height, it is less precise when you specify a target position.

idasen_desk_controller:
    ble_client_id: idasen_desk
    only_up_down_command: true

Wifi deconnexion

If you experience Wifi deconnexion, try to activate the wifi fast connect option.

wifi:
  ssid: ...
  password: ...
  fast_connect: true

You can also try to set the power save mode option to none.

wifi:
  ssid: ...
  password: ...
  fast_connect: true
  power_save_mode: none

References