Moin zusammen,
aus einem eigenen Plugin oder einer Logic würde ich gerne das MQTT Plugin/Module nutzen. Dazu habe ich schon einige Resourcen durchsucht, wie https://www.smarthomeng.de/user/plug...tt/README.html oder https://github.com/smarthomeNG/plugi...an/__init__.py
Jedoch bekomme ich nur eine Fehlermeldung im Log zu sehen
und
Meine plugin.yaml
Meine module.yaml
Und schliesslich die Zeilen in meinem Plugin
Meine Versionen:
- SmartHomeNG Version: 1.6.master
- SmartHomeNG Plugins Version: 1.6.1.master
Kann mir jemand einen Tipp geben wie ich MQTT aus einem anderen Plugin nutzen kann?
aus einem eigenen Plugin oder einer Logic würde ich gerne das MQTT Plugin/Module nutzen. Dazu habe ich schon einige Resourcen durchsucht, wie https://www.smarthomeng.de/user/plug...tt/README.html oder https://github.com/smarthomeNG/plugi...an/__init__.py
Jedoch bekomme ich nur eine Fehlermeldung im Log zu sehen
Code:
2019-12-28 22:41:06 INFO Main Modules: Loaded module 'http' (class 'Http') v1.6.0: Modul zur Implementierung von Backend-Webinterfaces für Plugins 2019-12-28 22:41:06 INFO Main Loading '/usr/local/smarthome/modules/mqtt/module.yaml' to 'OrderedDict' 2019-12-28 22:41:06 INFO Main module 'mqtt': has no item-struct definitions in metadata 2019-12-28 22:41:06 INFO Main Loading module 'mqtt': args = '{'module_name': "'mqtt'"}' 2019-12-28 22:41:06 ERROR Main Module mqtt exception: module 'modules.mqtt' has no attribute 'Mqtt' Traceback (most recent call last): File "/usr/local/smarthome/lib/module.py", line 101, in __init__ self._load_module(module, classname, classpath, args) File "/usr/local/smarthome/lib/module.py", line 226, in _load_module exec("self.loadedmodule = {0}.{1}.__new__({0}.{1})".format(classpath, classname)) File "<string>", line 1, in <module> AttributeError: module 'modules.mqtt' has no attribute 'Mqtt' 2019-12-28 22:41:06 INFO Main Loaded Modules: ['http']
Code:
AttributeError: 'NoneType' object has no attribute 'publish_topic'
Code:
MQTT: class_name: Mqtt class_path: plugins.mqtt host: 127.0.0.1 port: 1883
Code:
%YAML 1.1 --- # etc/module.yaml http: module_name: http starturl: backend # threads: 8 # showtraceback: False # showpluginlist: True # port: 8383 # user: admin # password: '' # hashed_password: 'xxx' # servicesport: 8384 # service_user: serviceuser # service_password: '' # service_hashed_password: 'xxx' mqtt: module_name: mqtt #dummy: # module_name: dummy
Code:
try: self.mod_mqtt = Modules.get_instance().get_module('mqtt') except: self.mod_mqtt = None if self.mod_mqtt == None: self.logger.error("Plugin '{}': Cannot load MQTT module".format(self.get_shortname())) return False ... self.mod_mqtt.publish_topic(self, topicOut, mqttValue)
- SmartHomeNG Version: 1.6.master
- SmartHomeNG Plugins Version: 1.6.1.master
Kann mir jemand einen Tipp geben wie ich MQTT aus einem anderen Plugin nutzen kann?
Kommentar