Lyr3x / Roode

A reliable smart home people counter based on VL53L1X and ESPHome
The Unlicense
149 stars 41 forks source link

Failed config platform not found 'sensor.vl53l1x' ESPHome V2022.1.2 and ESP8266 #116

Closed JannickBlmndl closed 2 years ago

JannickBlmndl commented 2 years ago

Describe the bug Compiling fails on ESPHome V2022.1.2 and Roode 1.5.1.

To Reproduce Steps to reproduce the behavior:

substitutions:
  devicename: roode8266
  friendly_name: $devicename

external_components:
  refresh: always
  source:
    type: git
    url: https://github.com/Lyr3x/Roode
    ref: master

esphome:
  name: $devicename
  platform: ESP8266
  board: nodemcuv2

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
  use_address: $devicename
  fast_connect: True
  power_save_mode: none
  domain: .local

captive_portal:

api:
  reboot_timeout: 60min
  services:
    - service: recalibrate
      then:
        - lambda: "id(roode_platform)->recalibration();"

ota:
  password: !secret http_password

web_server:
  port: 80
  auth:
    username: admin
    password: !secret http_password

# Enable logging
logger:
  level: INFO

i2c:
# ESP8266
  sda: 4
  scl: 5
# ESP32
#   sda: 21
#   scl: 22

# VL53L1X sensor configuration is separate from Roode people counting algorithm
vl53l1x:
  calibration:
    # The ranging mode is different based on how long the distance is that the sensor need to measure.
    # The longer the distance, the more time the sensor needs to take a measurement.
    # Available options are: auto, shortest, short, medium, long, longer, longest
    ranging: auto

roode:
  id: roode_platform
  # Smooth out measurements by using the minimum distance from this number of readings
  sampling: 2
  # This controls the size of the Region of Interest the sensor should take readings in.
  roi: { height: 16, width: 6 }
  # The detection thresholds for determining whether a measurement should count as a person crossing.
  # A reading must be greater than the minimum and less than the maximum to count as a crossing.
  # These can be given as absolute distances or as percentages.
  # Percentages are based on the automatically determined idle or resting distance.
  detection_thresholds: # defaults for both zones. These also default to 0% & 85% as previously done.
    min: 100mm # absolute distance
    max: 80% # percent based on idle distance
  # The people counting algorithm works by splitting the sensor's capability reading area into two zones.
  # This allows for detecting whether a crossing is an entry or exit based on which zones was crossed first.
  zones:
    invert: true

button:
  - platform: restart
    name: $friendly_name Restart
    entity_category: config
  - platform: template
    name: $friendly_name Recalibrate
    on_press:
      - lambda: id(roode_platform)->recalibration();
    entity_category: config

number:
  - platform: roode
    people_counter:
      name: $friendly_name people counter

binary_sensor:
  - platform: status
    name: $friendly_name API Status
  - platform: roode
    presence_sensor:
      name: "$friendly_name presence"

sensor:
  - platform: roode
    name: Roode
    zones:
      entry:
        distance:
          name: $friendly_name Entry Distance
          filters:
            - delta: 100
      exit:
        distance:
          name: $friendly_name Exit Distance
          filters:
            - delta: 100
    max_threshold_entry:
      name: $friendly_name max zone 0
    max_threshold_exit:
      name: $friendly_name max zone 1
    min_threshold_entry:
      name: $friendly_name min zone 0
    min_threshold_exit:
      name: $friendly_name min zone 1
    roi_height_entry:
      name: $friendly_name ROI height zone 0
    roi_width_entry:
      name: $friendly_name ROI width zone 0
    roi_height_exit:
      name: $friendly_name ROI height zone 1
    roi_width_exit:
      name: $friendly_name ROI width zone 1
  - platform: vl53l1x
    error:
      name: Sensor Error
  - platform: wifi_signal
    name: $friendly_name RSSI
    update_interval: 60s

  - platform: uptime
    name: Uptime Sensor
    id: uptime_sensor
    update_interval: 60s
    internal: true
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_human
            state: !lambda |-
              int seconds = round(id(uptime_sensor).raw_state);
              int days = seconds / (24 * 3600);
              seconds = seconds % (24 * 3600);
              int hours = seconds / 3600;
              seconds = seconds % 3600;
              int minutes = seconds /  60;
              seconds = seconds % 60;
              return (
                (days ? String(days) + "d " : "") +
                (hours ? String(hours) + "h " : "") +
                (minutes ? String(minutes) + "m " : "") +
                (String(seconds) + "s")
              ).c_str();

text_sensor:
  - platform: roode
    version:
      name: $friendly_name version
  - platform: roode
    entry_exit_event:
      name: $friendly_name last direction
  - platform: template
    name: $friendly_name Uptime Human Readable
    id: uptime_human
    icon: mdi:clock-start

Logs:

INFO Updating https://github.com/Lyr3x/Roode@master
Failed config

sensor.roode: [source /config/esphome/esphome-pplcounter.yaml:105]
  platform: roode
  name: Roode

  [zones] is an invalid option for [sensor.roode]. Please check the indentation.
  zones:  [source /config/esphome/esphome-pplcounter.yaml:108]
    entry: 
      distance: 
        name: roode8266 Entry Distance
        filters: 
          - delta: 100
    exit: 
      distance: 
        name: roode8266 Exit Distance
        filters: 
          - delta: 100
  max_threshold_entry: 
    name: roode8266 max zone 0
  max_threshold_exit: 
    name: roode8266 max zone 1
  min_threshold_entry: 
    name: roode8266 min zone 0
  min_threshold_exit: 
    name: roode8266 min zone 1
  roi_height_entry: 
    name: roode8266 ROI height zone 0
  roi_width_entry: 
    name: roode8266 ROI width zone 0
  roi_height_exit: 
    name: roode8266 ROI height zone 1
  roi_width_exit: 
    name: roode8266 ROI width zone 1
sensor.vl53l1x: [source /config/esphome/esphome-pplcounter.yaml:134]

  Platform not found: 'sensor.vl53l1x'.
  platform: vl53l1x
  error: 
    name: Sensor Error
JannickBlmndl commented 2 years ago

Closing this issue because I copied the configuration from the dev branch. So I think these features were introduced at a version later than 1.5.1. After changing the sensor config to this, compiling went without errors!

...

sensor:
  - platform: roode
    name: Roode
    distance_entry:
      name: $friendly_name Entry Distance
      filters:
        - delta: 100
    distance_exit:
      name: $friendly_name Exit Distance
      filters:
        - delta: 100

...

Thanks for the awesome development work!!