项目作者: j5lien

项目描述 :
ESPHome component for Ikea Idasen desk control
高级语言: C++
项目地址: git://github.com/j5lien/esphome-idasen-desk-controller.git
创建时间: 2021-01-30T09:40:41Z
项目社区:https://github.com/j5lien/esphome-idasen-desk-controller

开源协议:MIT License

下载


This project is archived as Idasen Desk is now compatbile with Home Assistant and ESPHome Bluetooth Proxy (https://www.home-assistant.io/integrations/idasen_desk/).

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:

  1. external_components:
  2. - 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):

  1. esp32_ble_tracker:
  2. ble_client:
  3. - mac_address: "00:00:00:00:00:00" # Replace with the desk bluetooth mac address
  4. 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:

  1. idasen_desk_controller:
  2. # Reference to the ble client component id
  3. # -----------
  4. # Required
  5. ble_client_id: idasen_desk
  6. # Fallback to use only up and down commands (less precise)
  7. # -----------
  8. # Optional
  9. only_up_down_command: false

Cover

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

  1. cover:
  2. - platform: idasen_desk_controller
  3. 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:

  1. esp32_ble_tracker:
  2. globals:
  3. # To store the Desk Connection Status
  4. - id: ble_client_connected
  5. type: bool
  6. initial_value: 'false'
  7. ble_client:
  8. - mac_address: "00:00:00:00:00:00"
  9. id: idasen_desk
  10. on_connect:
  11. then:
  12. # Update the Desk Connection Status
  13. - lambda: |-
  14. id(ble_client_connected) = true;
  15. - delay: 5s
  16. # Update desk height and speed sensors after bluetooth is connected
  17. - lambda: |-
  18. id(desk_height).update();
  19. id(desk_speed).update();
  20. on_disconnect:
  21. then:
  22. # Update the Desk Connection Status
  23. - lambda: |-
  24. id(ble_client_connected) = false;
  25. sensor:
  26. # Desk Height Sensor
  27. - platform: ble_client
  28. type: characteristic
  29. ble_client_id: idasen_desk
  30. id: desk_height
  31. name: 'Desk Height'
  32. service_uuid: '99fa0020-338a-1024-8a49-009c0215f78a'
  33. characteristic_uuid: '99fa0021-338a-1024-8a49-009c0215f78a'
  34. icon: 'mdi:arrow-up-down'
  35. unit_of_measurement: 'cm'
  36. accuracy_decimals: 1
  37. update_interval: never
  38. notify: true
  39. lambda: |-
  40. uint16_t raw_height = ((uint16_t)x[1] << 8) | x[0];
  41. unsigned short height_mm = raw_height / 10;
  42. return (float) height_mm / 10;
  43. # Desk Speed Sensor
  44. - platform: ble_client
  45. type: characteristic
  46. ble_client_id: idasen_desk
  47. id: desk_speed
  48. name: 'Desk Speed'
  49. service_uuid: '99fa0020-338a-1024-8a49-009c0215f78a'
  50. characteristic_uuid: '99fa0021-338a-1024-8a49-009c0215f78a'
  51. icon: 'mdi:speedometer'
  52. unit_of_measurement: 'cm/min' # I'm not sure this unit is correct
  53. accuracy_decimals: 0
  54. update_interval: never
  55. notify: true
  56. lambda: |-
  57. uint16_t raw_speed = ((uint16_t)x[3] << 8) | x[2];
  58. return raw_speed / 100;
  59. binary_sensor:
  60. # Desk Bluetooth Connection Status
  61. - platform: template
  62. name: 'Desk Connection'
  63. id: desk_connection
  64. lambda: 'return id(ble_client_connected);'
  65. # Desk Moving Status
  66. - platform: template
  67. name: 'Desk Moving'
  68. id: desk_moving
  69. 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.

  1. idasen_desk_controller:
  2. ble_client_id: idasen_desk
  3. only_up_down_command: true

Wifi deconnexion

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

  1. wifi:
  2. ssid: ...
  3. password: ...
  4. fast_connect: true

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

  1. wifi:
  2. ssid: ...
  3. password: ...
  4. fast_connect: true
  5. power_save_mode: none

References