I’m using Habapp for a while. No I want to use it with rollershutter.
But I can not import the rollershutter part.
Everytime I receive the following Error-Message
2023-12-22 18:02:28.793 [ERROR] [HABApp.Rules ] - Could not load C:\Development\SmartHome\habapp\rules\schedule_rule.py!
2023-12-22 18:02:28.793 [ERROR] [HABApp.Rules ] - File "C:\Development\SmartHome\habapp\rules\schedule_rule.py", line 58 in schedule_rule.py
2023-12-22 18:02:28.793 [ERROR] [HABApp.Rules ] - --------------------------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 51 | act_time = datetime.datetime.now().replace(microsecond=0)
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 52 | log.info(f'=========run_sunrise: {act_time} ')
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 53 | # subject = f'run_sunset: {act_time}'
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 54 | # body = f'run_sunset: {act_time}'
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 55 | # send_starttls(subject, body)
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 56 | # log.info(f'sent email with subject = {subject}')
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - --> 58 | schedule_rule()
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - ------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - log = <Logger ScheduleRule (DEBUG)>
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - ------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] -
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - File "C:\Development\SmartHome\habapp\rules\schedule_rule.py", line 22 in __init__
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - --------------------------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 18 | def __init__(self):
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 19 | super().__init__()
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 20 | log.info(f'ScheduleRule init....')
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - --> 22 | self.roller_shutter_az = RollershutterItem.get_item("AZBL")
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 24 | #
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - ------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - self = <schedule_rule>
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - self.run = <HABApp.rule.scheduler.habappschedulerview.HABAppSchedulerView object at 0x0000015201A873A0>
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - log = <Logger ScheduleRule (DEBUG)>
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - ------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] -
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - File "C:\Development\SmartHome\habapp\lib\site-packages\HABApp\core\items\base_item.py", line 39 in get_item
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - --------------------------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 31 | @classmethod
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 32 | def get_item(cls, name: str):
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 33 | """Returns an already existing item. If it does not exist or has a different item type an exception will occur.
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 34 |
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 35 | :param name: Name of the item
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 36 | """
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 37 | assert isinstance(name, str), type(name)
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 38 | item = get_item(name)
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - --> 39 | assert isinstance(item, cls), f'{cls} != {type(item)}'
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - 40 | return item
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - ------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - cls = <class 'HABApp.openhab.items.rollershutter_item.RollershutterItem'>
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - type(item) = <class 'HABApp.openhab.items.group_item.GroupItem'>
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - item = <GroupItem name: AZBL, value: None, last_change: 2023-12-22T17:15:40.242044, last_update: 2023-12-22T17:15:40.242044>
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - name = 'AZBL'
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - ------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] -
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - --------------------------------------------------------------------------------
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - Traceback (most recent call last):
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - File "C:\Development\SmartHome\habapp\lib\site-packages\HABApp\rule_manager\rule_file.py", line 78, in load
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - self.create_rules(created_rules)
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - File "C:\Development\SmartHome\habapp\lib\site-packages\HABApp\rule_manager\rule_file.py", line 68, in create_rules
2023-12-22 18:02:28.794 [ERROR] [HABApp.Rules ] - runpy.run_path(str(self.path), run_name=str(self.path), init_globals=rule_hook.in_dict())
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - File "C:\Development\python\python3.10\lib\runpy.py", line 289, in run_path
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - return _run_module_code(code, init_globals, run_name,
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - File "C:\Development\python\python3.10\lib\runpy.py", line 96, in _run_module_code
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - _run_code(code, mod_globals, init_globals,
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - File "C:\Development\python\python3.10\lib\runpy.py", line 86, in _run_code
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - exec(code, run_globals)
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - File "C:\Development\SmartHome\habapp\rules\schedule_rule.py", line 58, in schedule_rule.py
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - schedule_rule()
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - File "C:\Development\SmartHome\habapp\rules\schedule_rule.py", line 22, in __init__
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - self.roller_shutter_az = RollershutterItem.get_item("AZBL")
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - File "C:\Development\SmartHome\habapp\lib\site-packages\HABApp\core\items\base_item.py", line 39, in get_item
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - assert isinstance(item, cls), f'{cls} != {type(item)}'
2023-12-22 18:02:28.795 [ERROR] [HABApp.Rules ] - AssertionError: <class 'HABApp.openhab.items.rollershutter_item.RollershutterItem'> != <class 'HABApp.openhab.items.group_item.GroupItem'>
2023-12-22 18:02:28.797 [WARN ] [HABApp.Rules ] - Failed to load C:\Development\SmartHome\habapp\rules\schedule_rule.py!
Used code is:
import HABApp
#from HABApp.core.events import ValueUpdateEventFilter, ValueChangeEventFilter, EventFilter
from HABApp.openhab.events import ItemStateChangedEventFilter, ItemCommandEventFilter
from HABApp.openhab.items import RollershutterItem
log = logging.getLogger('ScheduleRule')
class schedule_rule(HABApp.Rule):
def __init__(self):
super().__init__()
log.info(f'ScheduleRule init....')
self.roller_shutter_az = RollershutterItem.get_item("AZBL")
But in VsCode i can dig into the RollershutterItem an can see that everything is there.
I used habapp 23.11.0.
Happens on both installations ( Development on Win, and runtime on raspi )
Has someone an idee what’s wrong