benleb / ad-automoli

💡 Fully automatic light management based on conditions like motion, illuminance, humidity, and other clever features
https://github.com/benleb/ad-automoli
MIT License
110 stars 29 forks source link

ImportError: cannot import name 'Room' from 'adutils' #110

Closed Gibby closed 1 year ago

Gibby commented 1 year ago

😩 Describe the issue/bug Error initializing app.

😒 Expected behavior No errors when starting up.

🎛️ Configuration


kitchen:
  module: automoli
  class: AutoMoLi
  room: Kitchen
  delay: 900
  motion_state_on: "on"
  motion_state_off: "off"
  disable_switch_entities: input_boolean.downstairs_lights_motion
  debug_log: false
  daytimes:
    - {'light': 100, 'starttime': '00:00'}
    - {'light': 100, 'starttime': '12:00'}
  illuminance:
    - sensor.average_home_solar_lux
  illuminance_threshold: 7000
  lights:
    - light.kitchen_lights
  motion:
    - binary_sensor.first_floor_motion
    - binary_sensor.blueiris_kitchen_motion
    - binary_sensor.downstairs_multi_sensor_motion

livingroom:
  module: automoli
  class: AutoMoLi
  room: Living Room
  delay: 1800
  motion_state_on: "on"
  motion_state_off: "off"
  disable_switch_entities: input_boolean.downstairs_lights_motion
  debug_log: false
  daytimes:
    - {'light': 100, 'starttime': '00:00'}
    - {'light': 100, 'starttime': '12:00'}
  illuminance:
    - sensor.average_home_solar_lux
  illuminance_threshold: 7000
  lights:
    - switch.living_room_light
  motion:
    - binary_sensor.first_floor_motion
    - binary_sensor.blueiris_kitchen_motion
    - binary_sensor.downstairs_multi_sensor_motion

garage:
  module: automoli
  class: AutoMoLi
  room: Garage
  delay: 300
  motion_state_on: "on"
  motion_state_off: "off"
  debug_log: false
  daytimes:
    - {'light': 100, 'starttime': '00:00'}
    - {'light': 100, 'starttime': '12:00'}
  illuminance:
    - sensor.average_home_solar_lux
  illuminance_threshold: 7000
  lights:
    - light.garage_lights
  motion:
    - binary_sensor.garage_double_door
    - binary_sensor.garage_house_door
    - binary_sensor.garage_single_door

upstairs_hallway:
  module: automoli
  class: AutoMoLi
  room: Upstairs Hallway
  delay: 190
  motion_state_on: "on"
  motion_state_off: "off"
  disable_switch_entities: input_boolean.upstairs_hallway_lights_motion
  debug_log: false
  daytimes:
    - {'light': 100, 'starttime': '00:00'}
    - {'light': 100, 'starttime': '12:00'}
  illuminance:
    - sensor.average_home_solar_lux
  illuminance_threshold: 7000
  lights:
    - switch.hallway_light
  motion:
    - binary_sensor.hallway_motion

🧠 System

🗒️ Logs

fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
OK: 921 MiB in 69 packages
Collecting bs4
  Downloading bs4-0.0.1.tar.gz (1.1 kB)
Collecting adutils>=0.5.0
  Downloading adutils-0.6.2-py3-none-any.whl (6.8 kB)
Collecting beautifulsoup4
  Downloading beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Collecting soupsieve>1.2
  Downloading soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Building wheels for collected packages: bs4
  Building wheel for bs4 (setup.py): started
  Building wheel for bs4 (setup.py): finished with status 'done'
  Created wheel for bs4: filename=bs4-0.0.1-py3-none-any.whl size=1272 sha256=aff036245b10aacfa4e045c11be193553d8c87683423b597c3253ae952ef86b9
  Stored in directory: /root/.cache/pip/wheels/73/2b/cb/099980278a0c9a3e57ff1a89875ec07bfa0b6fcbebb9a8cad3
Successfully built bs4
Installing collected packages: soupsieve, beautifulsoup4, bs4, adutils
Successfully installed adutils-0.6.2 beautifulsoup4-4.11.1 bs4-0.0.1 soupsieve-2.3.2.post1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Collecting adutils~=0.4.1
  Downloading adutils-0.4.12-py3-none-any.whl (7.8 kB)
Installing collected packages: adutils
  Attempting uninstall: adutils
    Found existing installation: adutils 0.6.2
    Uninstalling adutils-0.6.2:
      Successfully uninstalled adutils-0.6.2
Successfully installed adutils-0.4.12
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
2022-10-04 09:03:25.802319 INFO AppDaemon: AppDaemon Version 4.2.1 starting
2022-10-04 09:03:25.802569 INFO AppDaemon: Python version is 3.9.9
2022-10-04 09:03:25.802674 INFO AppDaemon: Configuration read from: /conf/appdaemon.yaml
2022-10-04 09:03:25.802775 INFO AppDaemon: Added log: AppDaemon
2022-10-04 09:03:25.802898 INFO AppDaemon: Added log: Error
2022-10-04 09:03:25.802997 INFO AppDaemon: Added log: Access
2022-10-04 09:03:25.803094 INFO AppDaemon: Added log: Diag
2022-10-04 09:03:25.816350 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2022-10-04 09:03:25.848713 INFO HASS: HASS Plugin Initializing
2022-10-04 09:03:25.848843 INFO HASS: HASS Plugin initialization complete
2022-10-04 09:03:25.849116 INFO AppDaemon: Initializing HTTP
2022-10-04 09:03:25.849355 INFO AppDaemon: Using 'ws' for event stream
2022-10-04 09:03:25.852045 WARNING AppDaemon: Creation of the Web directory /conf/www failed
2022-10-04 09:03:25.852223 INFO AppDaemon: Starting API
2022-10-04 09:03:25.854132 INFO AppDaemon: Starting Admin Interface
2022-10-04 09:03:25.854345 INFO AppDaemon: Starting Dashboards
2022-10-04 09:03:25.862712 INFO HASS: Connected to Home Assistant 2022.9.7
2022-10-04 09:03:25.889508 INFO AppDaemon: App 'kitchen' added
2022-10-04 09:03:25.890290 INFO AppDaemon: App 'livingroom' added
2022-10-04 09:03:25.891342 INFO AppDaemon: App 'garage' added
2022-10-04 09:03:25.891974 INFO AppDaemon: App 'upstairs_hallway' added
2022-10-04 09:03:25.892373 INFO AppDaemon: Found 4 total apps
2022-10-04 09:03:25.892635 INFO AppDaemon: Starting Apps with 4 workers and 4 pins
2022-10-04 09:03:25.893480 INFO AppDaemon: Running on port 5050
2022-10-04 09:03:25.930880 INFO HASS: Evaluating startup conditions
2022-10-04 09:03:25.933317 INFO HASS: Startup condition met: hass state=RUNNING
2022-10-04 09:03:25.933485 INFO HASS: All startup conditions met
2022-10-04 09:03:25.988043 INFO AppDaemon: Got initial state from namespace default
2022-10-04 09:03:27.897301 INFO AppDaemon: Scheduler running in realtime
2022-10-04 09:03:27.900405 INFO AppDaemon: Adding /conf/apps to module import path
2022-10-04 09:03:27.900836 INFO AppDaemon: Adding /conf/apps/healthcheck to module import path
2022-10-04 09:03:27.901241 INFO AppDaemon: Adding /conf/apps/ad_sunset_lights to module import path
2022-10-04 09:03:27.901698 INFO AppDaemon: Adding /conf/apps/ad-automoli to module import path
2022-10-04 09:03:27.902102 INFO AppDaemon: Adding /conf/apps/ad-ench to module import path
2022-10-04 09:03:27.902526 INFO AppDaemon: Adding /conf/apps/ad-alexadoorwindowannounce to module import path
2022-10-04 09:03:27.902939 INFO AppDaemon: Adding /conf/apps/ad-alexadoorwindowannounce/apps to module import path
2022-10-04 09:03:27.907563 WARNING AppDaemon: No app description found for: /conf/apps/hello.py - ignoring
2022-10-04 09:03:27.908150 WARNING AppDaemon: No app description found for: /conf/apps/healthcheck/healthcheck.py - ignoring
2022-10-04 09:03:27.908654 WARNING AppDaemon: No app description found for: /conf/apps/ad_sunset_lights/sunset_lights.py - ignoring
2022-10-04 09:03:27.909113 INFO AppDaemon: Loading App Module: /conf/apps/ad-automoli/automoli.py
2022-10-04 09:03:27.931232 WARNING Error: ------------------------------------------------------------
2022-10-04 09:03:27.931424 WARNING Error: Unexpected error loading module: /conf/apps/ad-automoli/automoli.py:
2022-10-04 09:03:27.931552 WARNING Error: ------------------------------------------------------------
2022-10-04 09:03:27.934753 WARNING Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/appdaemon/app_management.py", line 993, in check_app_updates
    await utils.run_in_executor(self, self.read_app, mod["name"], mod["reload"])
  File "/usr/local/lib/python3.9/site-packages/appdaemon/utils.py", line 337, in run_in_executor
    response = future.result()
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/appdaemon/app_management.py", line 784, in read_app
    self.modules[module_name] = importlib.import_module(module_name)
  File "/usr/local/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 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/conf/apps/ad-automoli/automoli.py", line 125, in <module>
    from adutils import Room, hl, natural_time, py38_or_higher, py39_or_higher  # noqa
ImportError: cannot import name 'Room' from 'adutils' (/usr/local/lib/python3.9/site-packages/adutils/__init__.py)

2022-10-04 09:03:27.934952 WARNING Error: ------------------------------------------------------------
2022-10-04 09:03:27.935087 WARNING AppDaemon: Removing associated apps:
2022-10-04 09:03:27.935241 WARNING AppDaemon: kitchen
2022-10-04 09:03:27.935528 WARNING AppDaemon: livingroom
2022-10-04 09:03:27.935774 WARNING AppDaemon: garage
2022-10-04 09:03:27.936015 WARNING AppDaemon: upstairs_hallway
2022-10-04 09:03:27.937697 WARNING AppDaemon: No app description found for: /conf/apps/ad-ench/ench.py - ignoring
2022-10-04 09:03:27.938242 WARNING AppDaemon: No app description found for: /conf/apps/ad-alexadoorwindowannounce/apps/alexa_door_window_announce.py - ignoring
2022-10-04 09:03:27.938857 INFO AppDaemon: App initialization complete

🧁 Additional context Add any other context about the problem here.

Gibby commented 1 year ago

I found the issue. Another app was forcing adutils to a lower version.