Skip to content

Commit

Permalink
duration string to mopp pip
Browse files Browse the repository at this point in the history
  • Loading branch information
8cH9azbsFifZ committed Nov 16, 2023
1 parent c7c028a commit dc76ad9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 73 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
0.0.8 - move json duration string to mopp module (pip)
0.0.7 - topic for durations array
0.0.6 - topic changed
0.0.5 - name of chatserver for connection
Expand Down
64 changes: 0 additions & 64 deletions beep.py

This file was deleted.

14 changes: 5 additions & 9 deletions udp2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import socket
import time
import sys
from beep import *

logging.basicConfig(level=logging.DEBUG, format='%(message)s', )

Expand Down Expand Up @@ -66,7 +65,7 @@ def on_log(mqttc, obj, level, string):

# Main loop
while KeyboardInterrupt:
time.sleep(0.2) # anti flood
time.sleep(0.2) # anti flood

# FIXME: ADD KEEPALIVE SIGNAL

Expand All @@ -77,20 +76,17 @@ def on_log(mqttc, obj, level, string):
print (r)
sys.stdout.flush() # TODO: use logging

# Beep if message received
# If message received send the duration json over mqtt
if not "Keepalive" in r:
b = Beep(speed=r["Speed"])
b = Mopp(speed=r["Speed"])
if not last_r == r:
#b.beep_message(r["Message"])
last_r = r

# decode the message
print (r["Speed"])
print (r["Message"])
# decode the mopp message to a json string containing the durations
mydecoded = b.return_duration_json(r["Message"])

# And send mqtt
#infot = mqttc.publish(config.TOPIC, data_bytes, qos=2)
#infot = mqttc.publish(config.TOPIC, data_bytes, qos=2) // publish raw mopp data to another topic?
infot = mqttc.publish(config.TOPICDURATIONS, mydecoded, qos=2)
infot.wait_for_publish()

Expand Down

0 comments on commit dc76ad9

Please sign in to comment.