New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mqtt für openwb 2.0 #1570
mqtt für openwb 2.0 #1570
Conversation
Neu können auch Temp. übergeben werden. Brauchte noch ein Anpasung in setdata da sonst topics grad wieder gelöscht. Nur für Openwb 2.0 Guid kommt noch separat. Siehe auch: https://forum.openwb.de/viewtopic.php?t=8415
pub_single(msg.topic.replace('openWB/set/', 'openWB/', 1), msg.payload.decode("utf-8"), | ||
retain=True, no_json=True, port=1886) | ||
pub_single(msg.topic, "", no_json=True, port=1886) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub_single(msg.topic.replace('openWB/set/', 'openWB/', 1), msg.payload.decode("utf-8"), | |
retain=True, no_json=True, port=1886) | |
pub_single(msg.topic, "", no_json=True, port=1886) | |
self._validate_value(msg, None) |
Wenn das Topic nicht validiert werden soll als Datentyp None
angeben, dann wird das Topic von openWB/set/
an openWB/
gepublished und das openWB/set/
-Topic gelöscht.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
der self._validate_value(msg, None) ersetzt leider nicht die beiden pub_single..Wenn ich diese beiden durch den self._validate_value(msg, None) ersetzte, stimmt dann der Payload nicht mehr,
update 18:18: Ich glaube das liegt daran:
self._validate_value verwendet in Zeile 151
Pub().pub(msg.topic.replace('set/', '', 1), value, retain=retain)
Pub().pub(msg.topic, "")
in pub.py
def pub(self, topic: str, payload) -> None:
try:
if payload == "":
self.client.publish(topic, payload, qos=0, retain=True)
else:
self.client.publish(topic, payload=json.dumps(payload), qos=0, retain=True)
except Exception:
log.exception("Fehler im pub-Modul")
Der payload wird mit json.dumps(payload) gepublished. Im orginal coding wird durch den no_json=True der payload ohne json. gepublished
if no_json:
publish.single(topic, payload, hostname=hostname, retain=True)
Und das beeinflusst strings Stiebelx wird zu "Stiebelx"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
packages/helpermodules/setdata.py
Outdated
pass | ||
# diese topics werden im Smarthomemodul mqtt bearbeitet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass | |
# diese topics werden im Smarthomemodul mqtt bearbeitet | |
self._validate_value(msg, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ist geändert
Neu können auch Temp. übergeben werden.
Brauchte noch ein Anpasung in setdata da sonst topics grad wieder gelöscht. Nur für Openwb 2.0
Gui kommt noch separat.
Siehe auch:
https://forum.openwb.de/viewtopic.php?t=8415