mirror of
https://github.com/naruxde/revpipyload.git
synced 2025-11-08 23:23:52 +01:00
Object scan in MQTT server uses wrong name source, ignoring export flag
The object scan to find IOs on core devices uses the `__slot__` attribute, which include very private objects. That objects are not accessible by `getattr` - Now we are using `dir()`. Missing objects from parent classes. Ignored the export flag from piCtory. closing #9
This commit is contained in:
@@ -167,9 +167,12 @@ class MqttServer(Thread):
|
|||||||
# CoreIOs prüfen und zu export hinzufügen
|
# CoreIOs prüfen und zu export hinzufügen
|
||||||
lst_coreio = []
|
lst_coreio = []
|
||||||
if self._rpi.core:
|
if self._rpi.core:
|
||||||
for obj_name in self._rpi.core.__slots__:
|
for obj_name in dir(self._rpi.core):
|
||||||
|
# Scan all non-private objects of the core device
|
||||||
|
if obj_name.find("_") == 0:
|
||||||
|
continue
|
||||||
obj = getattr(self._rpi.core, obj_name)
|
obj = getattr(self._rpi.core, obj_name)
|
||||||
if isinstance(obj, revpimodio2.io.IOBase):
|
if isinstance(obj, revpimodio2.io.IOBase) and obj.export:
|
||||||
lst_coreio.append(obj)
|
lst_coreio.append(obj)
|
||||||
|
|
||||||
# IOs exportieren und Events anmelden
|
# IOs exportieren und Events anmelden
|
||||||
|
|||||||
Reference in New Issue
Block a user