IPWorks IoT 2020 Python Edition

Questions / Feedback?

start_sleep Method

Enter sleep state for the specified duration.


def start_sleep(duration: int) -> None: ...


When this method is called, the gateway will buffer all incoming messages for the client until the next time it awakes. To receive all currently buffered messages, call stop_sleep or fetch_messages.

While in the sleep state, the client no longer must abide by the keep_alive_interval, but must awake before the end of the sleep duration. If it does not send the gateway any messages in this interval, it will be considered lost and will disconnect.

If fetch_messages is called, the client will return to sleep after receiving the messages and the sleep timer will restart. If stop_sleep is called, the client will enter the active state.

Sleep Examples

mqttsn1.StartSleep(8); // sleep for 8 seconds
// ... wait for 5 seconds
mqttsn1.FetchMessages(); // MessageIn will fire for each message buffered during that time
// ... wait for 5 more seconds (ok because <8 seconds since last packet sent)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 Python Edition - Version 20.0 [Build 8265]