smarthomeNG / plugins

Plugins for SmartHomeNG - The device integration platform for your smart home
https://www.smarthomeNG.de
45 stars 99 forks source link

AttributeError: 'UZSU' object has no attribute '_schedulers' / AttributeError: 'KNX' object has no attribute '_schedulers' #943

Closed bmxp closed 3 months ago

bmxp commented 3 months ago

Irgendwas ist mit der Adaption der Scheduler falsch gelaufen. Ich habe vorhin gepullt und seit dem Fehler:


2024-06-21  07:29:20 ERROR    lib.plugin        Plugin 'knx' exception in run() method: 'KNX' object has no attribute '_schedulers'
> Traceback (most recent call last):
>   File "/usr/local/smarthome/lib/plugin.py", line 756, in run
>     self.plugin.run()
>   File "/usr/local/smarthome/plugins/knx/__init__.py", line 553, in run
>     self.scheduler_add('KNX[{0}] time'.format(self.get_instance_name()), self._send_time, prio=5, cycle=int(self._send_time_do))
>   File "/usr/local/smarthome/lib/model/smartplugin.py", line 962, in scheduler_add
>     self._schedulers.append(name)
> AttributeError: 'KNX' object has no attribute '_schedulers'
2024-06-21  07:29:20 ERROR    lib.plugin        Plugin 'uzsu' exception in run() method: 'UZSU' object has no attribute '_schedulers'
> Traceback (most recent call last):
>   File "/usr/local/smarthome/lib/plugin.py", line 756, in run
>     self.plugin.run()
>   File "/usr/local/smarthome/plugins/uzsu/__init__.py", line 136, in run
>     self.scheduler_add('uzsu_sunupdate', self._update_all_suns,
>   File "/usr/local/smarthome/lib/model/smartplugin.py", line 962, in scheduler_add
>     self._schedulers.append(name)
> AttributeError: 'UZSU' object has no attribute '_schedulers'
Morg42 commented 3 months ago

Wahrscheinlich wird die init-Methode von smartplugin nicht eingebunden.

super().__init__() sollte helfen.

Das müssen wir ggf auch grundsätzlich mal prüfen, weil es bei Erweiterungen von SmartPlugin immer wieder zu Fehlern kommen könnte...

Alternativ in der init self._schedulers = [] einfügen.

bmxp commented 3 months ago

Mit dem super().init() ist zumindest beim KNX PLugin der Fehler weg.

Beim UZSU PLugin gibt es was neues:

2024-06-21  07:55:50 ERROR    lib.plugin        Plugin 'uzsu' exception in run() method: list.remove(x): x not in list
> Traceback (most recent call last):
>   File "/usr/local/smarthome/lib/plugin.py", line 756, in run
>     self.plugin.run()
>   File "/usr/local/smarthome/plugins/uzsu/__init__.py", line 174, in run
>     self._schedule(item, caller='run')
>   File "/usr/local/smarthome/plugins/uzsu/__init__.py", line 647, in _schedule
>     self.scheduler_remove(item.property.path)
>   File "/usr/local/smarthome/lib/model/smartplugin.py", line 996, in scheduler_remove
>     self._schedulers.remove(name)
> ValueError: list.remove(x): x not in list
bmxp commented 3 months ago

Also müsste man mal alle Plugins die auf SmartPlugin basieren nochmal mindestens auf das Vorhandensein von wenigstens super().__init__() prüfen?

Morg42 commented 3 months ago

Quickfix in develop.

Ja, das wäre wohl gut. Wenn wir entschieden haben, was wir am Smartplugin anpassen wollen, würde ich das sowieso noch alles prüfen.

Morg42 commented 3 months ago

Konkretes Problem gelöst.