Skip to content
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

Merged
merged 3 commits into from Apr 19, 2024
Merged

mqtt für openwb 2.0 #1570

merged 3 commits into from Apr 19, 2024

Conversation

okaegi
Copy link
Contributor

@okaegi okaegi commented Apr 18, 2024

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

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
Comment on lines +1109 to +1111
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

@okaegi okaegi Apr 18, 2024

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"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Comment on lines 1127 to 1128
pass
# diese topics werden im Smarthomemodul mqtt bearbeitet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pass
# diese topics werden im Smarthomemodul mqtt bearbeitet
self._validate_value(msg, None)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ist geändert

@okaegi okaegi requested a review from LKuemmel April 18, 2024 14:57
@LKuemmel LKuemmel merged commit 6a27548 into openWB:master Apr 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants