Die Suche ergab 10 Treffer
- Dienstag 17. September 2019, 21:26
- Forum: Allgemeine Fragen
- Thema: Auswertung von String Python2 vs Python3
- Antworten: 9
- Zugriffe: 1034
Re: Auswertung von String Python2 vs Python3
die Einrückung ist in Original alles auf 4 Zeichen, ist beim Kopieren passiert, sorry, das Programm läuft mit V2 gut, leider habe ich das mit V3 noch nicht ganz verstanden. Wo kann ich das denn nach lesen?
- Dienstag 17. September 2019, 20:42
- Forum: Allgemeine Fragen
- Thema: Auswertung von String Python2 vs Python3
- Antworten: 9
- Zugriffe: 1034
Re: Auswertung von String Python2 vs Python3
was heist das jetzt? mache ich doch oder?
- Dienstag 17. September 2019, 20:16
- Forum: Allgemeine Fragen
- Thema: Auswertung von String Python2 vs Python3
- Antworten: 9
- Zugriffe: 1034
Auswertung von String Python2 vs Python3
Hallo Forum,
ich habe ein Problem bei der Auswertung von Strings, hier mal ein Ausschnitt:
if msg.topic.decode() == "linux/off":
if msg.payload.decode() == "Hello world!":
print("Yes!")
mqtt.disconnect()
if msg.topic == "linux/smart":
print("Smart: "+msg.topic+" "+message)
if msg.payload ...
ich habe ein Problem bei der Auswertung von Strings, hier mal ein Ausschnitt:
if msg.topic.decode() == "linux/off":
if msg.payload.decode() == "Hello world!":
print("Yes!")
mqtt.disconnect()
if msg.topic == "linux/smart":
print("Smart: "+msg.topic+" "+message)
if msg.payload ...
- Donnerstag 5. September 2019, 23:02
- Forum: Allgemeine Fragen
- Thema: Python mqtt on_message und Publish
- Antworten: 18
- Zugriffe: 3471
Re: Python mqtt on_message und Publish
klar geht das auch ohne Linux PC aber ich wollt auch die Sprache etwas lernen, naja verstehen. Eines noch off Topic, kann Python auch als Service/Dienst laufen oder geht das nur über den Screen weg?
- Donnerstag 5. September 2019, 00:38
- Forum: Allgemeine Fragen
- Thema: Python mqtt on_message und Publish
- Antworten: 18
- Zugriffe: 3471
Re: Python mqtt on_message und Publish
Hallo,
erst mal danke an __blackjack__.
Es ist meine erstes Python Programm, ja ich habe da wohl ein paar Fehler gemacht. Das mit dem mqtt.publish war so eine Blitz Idee, warum auch immer. Sorry jetzt klar, wenn ich als client übergebe kann ich auf nix anders auch zugreifen.
Das mit dem Hostname ...
erst mal danke an __blackjack__.
Es ist meine erstes Python Programm, ja ich habe da wohl ein paar Fehler gemacht. Das mit dem mqtt.publish war so eine Blitz Idee, warum auch immer. Sorry jetzt klar, wenn ich als client übergebe kann ich auf nix anders auch zugreifen.
Das mit dem Hostname ...
- Mittwoch 4. September 2019, 22:34
- Forum: Allgemeine Fragen
- Thema: Python mqtt on_message und Publish
- Antworten: 18
- Zugriffe: 3471
Re: Python mqtt on_message und Publish
if msg == 'START':
print("STARTEN") # Erscheint auf der console
client.publish("/wassertonne/relay/", "0", hostname="mywatercli") # auch keine Meldung auf Server
print("STARTEN") # Erscheint NICHT auf der console
das hat ich doch auch getestet aber auch ohne erfolg...
- Mittwoch 4. September 2019, 22:21
- Forum: Allgemeine Fragen
- Thema: Python mqtt on_message und Publish
- Antworten: 18
- Zugriffe: 3471
Re: Python mqtt on_message und Publish
bitte um Beispiel, stehe jetzt ganz auf dem Schlauch.. sorry
- Mittwoch 4. September 2019, 22:03
- Forum: Allgemeine Fragen
- Thema: Python mqtt on_message und Publish
- Antworten: 18
- Zugriffe: 3471
Re: Python mqtt on_message und Publish
weil das nicht geht bei mir, da passiert nix...
if msg == 'STOP':
print("STOPen")
mqtt.publish("/wassertonne/relay/", "0")
print("fertig")
auf der console erscheint nur "STOPen" aber "fertig" nicht und es erfolgt kein Publish..
das war mein erster Ansatz...
if msg == 'STOP':
print("STOPen")
mqtt.publish("/wassertonne/relay/", "0")
print("fertig")
auf der console erscheint nur "STOPen" aber "fertig" nicht und es erfolgt kein Publish..
das war mein erster Ansatz...
- Mittwoch 4. September 2019, 20:53
- Forum: Allgemeine Fragen
- Thema: Python mqtt on_message und Publish
- Antworten: 18
- Zugriffe: 3471
Re: Python mqtt on_message und Publish
Hallo,
klar, habe jetzt mal so "gelöst"..
#!/usr/bin/python3.5
import paho.mqtt.client as mqtt
global runme
def on_connect( client, userdata, flags, rc):
print ("Connected with Code :" +str(rc))
# Subscribe Topic from here
client.subscribe("/abstand/#")
def on_message(client, userdata ...
klar, habe jetzt mal so "gelöst"..
#!/usr/bin/python3.5
import paho.mqtt.client as mqtt
global runme
def on_connect( client, userdata, flags, rc):
print ("Connected with Code :" +str(rc))
# Subscribe Topic from here
client.subscribe("/abstand/#")
def on_message(client, userdata ...
- Mittwoch 4. September 2019, 15:22
- Forum: Allgemeine Fragen
- Thema: Python mqtt on_message und Publish
- Antworten: 18
- Zugriffe: 3471
Python mqtt on_message und Publish
Hallo @all,
ich habe eine Verständnis Frage...
def on_message(client, userdata, message):
if topic == '/mach/was':
if msg == 'NIX':
print("ENDE")
... Publish eine Nachricht in ein topic ...
if msg == 'START':
... oder wie kann ich das tun ...
Wie kann ich ein PUBLISH in einen TOPIC ...
ich habe eine Verständnis Frage...
def on_message(client, userdata, message):
if topic == '/mach/was':
if msg == 'NIX':
print("ENDE")
... Publish eine Nachricht in ein topic ...
if msg == 'START':
... oder wie kann ich das tun ...
Wie kann ich ein PUBLISH in einen TOPIC ...