3DJupp / PaPiRus-MQTT

MQTT Dashboard utilizing an ePaper / eInk Display
https://ci8.de/papirus-mqtt
11 stars 2 forks source link

Update Time standalone #2

Open 3DJupp opened 7 years ago

3DJupp commented 7 years ago

Like in https://github.com/PiSupply/PaPiRus/blob/master/bin/papirus-clock

3DJupp commented 7 years ago

@shawaj Do you think it might be possible to seperate the clock from the Mosquitto client? Then it would be possible to have the clock, in case the Broker is offline, or no updates are beeing sent in more than one minute.

shawaj commented 7 years ago

You mean have the clock come from elsewhere and just have partial updates for the time? Could the client not update the screen when the clock changes?

3DJupp commented 7 years ago

Hey, this is the part that listens for MQTT Topics, previously defined.

client = mqtt.Client()
client.username_pw_set(username="epaper", password="epaper")
client.on_connect = on_connect
client.on_message = on_message
client.connect("10.0.2.0", 1883, 60)

# Blocking call that processes network traffic, dispatches callbacks
# and handles reconnecting
# Other loop*() fucntions are available that give a threaded interface
# and a manual interface

try:
    client.loop_forever()

I hope that there is a way to check for a change in the time. Just like in the PaPiRus-Clock
https://github.com/PiSupply/PaPiRus/blob/master/bin/papirus-clock

    while True:
        while True:
            now = datetime.today()
            if now.second != previous_second:
                break
            time.sleep(0.1)
shawaj commented 7 years ago

Don't know enough about MQTT unfortunately but I'm sure there is a way.

Can you not just take that code from papirus-clock and implement something similar?

On 27 Mar 2017 6:02 pm, "Dominic Spatz" notifications@github.com wrote:

Hey, this is the part that listens for MQTT Topics, previously defined.

client = mqtt.Client() client.username_pw_set(username="epaper", password="epaper") client.on_connect = on_connect client.on_message = on_message client.connect("10.0.2.0", 1883, 60)

Blocking call that processes network traffic, dispatches callbacks

and handles reconnecting

Other loop*() fucntions are available that give a threaded interface

and a manual interface

try: client.loop_forever()

I hope that there is a way to check for a change in the time. Just like in the PaPiRus-Clock https://github.com/PiSupply/PaPiRus/blob/master/bin/papirus-clock

while True:
    while True:
        now = datetime.today()
        if now.second != previous_second:
            break
        time.sleep(0.1)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Dom1n1c/PaPiRus-MQTT/issues/2#issuecomment-289413400, or mute the thread https://github.com/notifications/unsubscribe-auth/ADNCuqi4ABKUDIsw1QMSB9etiYzA707Gks5rp425gaJpZM4MpnUm .