volttron CSV Agent onstart add in time delay

24 views Asked by At

On the CSV driver agent script how could I add in a 300 second delay to the onstart function? I was hoping to delay the self.actuate_point method/function only one time on startup by 300 seconds when the agent is installed.

#csv driver start
@Core.receiver("onstart")
def onstart(self, sender, **kwargs):
    """
    This is method is called once the Agent has successfully connected to the platform.
    This is a good place to setup subscriptions if they are not dynamic or
    do any other startup activities that require a connection to the message bus.
    Called after any configurations methods that are called at startup.

    Usually not needed if using the configuration store.
    """
    # ADD time.sleep?
    time.sleep(300)

    # Every time_delay_normal seconds, ask the core agent loop to run the actuate point method with no parameters
    self.core.periodic(self.time_delay_normal, self.actuate_point)
1

There are 1 answers

0
Craig On BEST ANSWER

@HenryHub you shouldn't use the main time library in most of volttron. Instead you should use gevent.sleep(0.3)

import gevent

gevent.sleep(seconds)