j5lien / esphome-idasen-desk-controller

ESPHome component for Ikea Idasen desk control
MIT License
188 stars 36 forks source link

v1.2.3 - Platform not found 'sensor.idasen_desk_controller' #45

Closed harrisonhjones closed 1 year ago

harrisonhjones commented 2 years ago

I am using the following config:

esphome:
  name: h-office-esphome-23dd9c
  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: "h-office-esphome-23dd9c"
    password: !secret captive_wifi_password

captive_portal:

# BEGIN BLUETOOTH DISCOVERY INTEGRATION
esp32_ble_tracker:
# 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: "REDACTED"
    # 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: "H Office Desk"

#sensor:
#  - platform: idasen_desk_controller
#    desk_height:
#      # Height in cm
#      name: "H Office Desk Height"
#      # Millimeter precision
#      accuracy_decimals: 1

binary_sensor:
  # Desk bluetooth connection
  - platform: idasen_desk_controller
    name: "H Office Desk Connection"
    type: CONNECTION
  # Desk moving status
  - platform: idasen_desk_controller
    name: "H Office Desk Moving"
    type: MOVING
# END IDASEN DESK CONTROLLER INTEGRATION

It works as expected however as soon as I comment in the sensor I get an error saying that the sensor.idasen_desk_controller isn't found. Any idea what's going on?

If I try to compile I get:

INFO Reading configuration /config/esphome/h-office-esphome-23dd9c.yaml...
ERROR Unable to load component idasen_desk_controller.sensor:
Traceback (most recent call last):
  File "/esphome/esphome/loader.py", line 162, in _lookup_module
    module = importlib.import_module(f"esphome.components.{domain}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/esphome/.esphome/external_components/c787d8e2/components/idasen_desk_controller/sensor.py", line 20, in <module>
    sensor.sensor_schema(UNIT_HEIGHT, ICON_HEIGHT, 0),
TypeError: sensor_schema() takes from 0 to 1 positional arguments but 3 were given
Failed config

sensor.idasen_desk_controller: [source /config/esphome/h-office-esphome-23dd9c.yaml:53]

  Platform not found: 'sensor.idasen_desk_controller'.
  platform: idasen_desk_controller
  desk_height: 
    name: H Office Desk Height
    accuracy_decimals: 1
arevaclier commented 2 years ago

I had the same issue and provided a small fix that makes it work (see #46)

j5lien commented 1 year ago

The fix has been merged. Sorry for the delay...