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

Update Time standalone #2

Open
3DJupp opened this issue Mar 26, 2017 · 4 comments
Open

Update Time standalone #2

3DJupp opened this issue Mar 26, 2017 · 4 comments

Comments

@3DJupp
Copy link
Owner

3DJupp commented Mar 26, 2017

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

@3DJupp
Copy link
Owner Author

3DJupp commented Mar 26, 2017

@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
Copy link

shawaj commented Mar 26, 2017

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
Copy link
Owner Author

3DJupp commented Mar 27, 2017

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
Copy link

shawaj commented Mar 27, 2017 via email

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

No branches or pull requests

2 participants