-
Notifications
You must be signed in to change notification settings - Fork 218
SchedulerExampleAgent
jhaack edited this page Oct 28, 2015
·
3 revisions
The SchedulerExampleAgent demonstrates how to use the scheduling feature of the ActuatorAgent as well as how to send a command. This agent publishes a request for a reservation on a (fake) device then takes an action when it's scheduled time appears. The ActuatorAgent must be running to exercise this example.
Note: Since there is no actual device, an error is produced when the agent attempts to take its action.
def publish_schedule(self):
'''Periodically publish a schedule request'''
headers = {
'AgentID': agent_id,
'type': 'NEW_SCHEDULE',
'requesterID': agent_id, #The name of the requesting agent.
'taskID': agent_id + "-ExampleTask", #The desired task ID for this task. It must be unique among all other scheduled tasks.
'priority': 'LOW', #The desired task priority, must be 'HIGH', 'LOW', or 'LOW_PREEMPT'
}
start = str(datetime.datetime.now())
end = str(datetime.datetime.now() + datetime.timedelta(minutes=1))
msg = [
['campus/building/unit',start,end]
]
self.vip.pubsub.publish(
'pubsub', topics.ACTUATOR_SCHEDULE_REQUEST, headers, msg)
The agent listens to schedule announcements from the actuator and then issues a command
@PubSub.subscribe('pubsub', topics.ACTUATOR_SCHEDULE_ANNOUNCE(campus='campus',
building='building',unit='unit'))
def actuate(self, peer, sender, bus, topic, headers, message):
print ("response:",topic,headers,message)
if headers[headers_mod.REQUESTER_ID] != agent_id:
return
'''Match the announce for our fake device with our ID
Then take an action. Note, this command will fail since there is no
actual device'''
headers = {
'requesterID': agent_id,
}
self.vip.pubsub.publish(
'pubsub', topics.ACTUATOR_SET(campus='campus',
building='building',unit='unit',
point='point'),
- Platform Agent
- VOLTTRON Central Agent
- Platform Commands
- Platform Configuration
- [Platform Hardening Security Recommendations] (Linux-Platform-Hardening-Recommendations-for-VOLTTRON-users)
- ...
- [Building VOLTTRON] (Building-VOLTTRON)
- Example Agents
- Agent Development
- [Shortcut Scripts] (Scripts)
- [VOLTTRON Conventions] (Conventions)
- [sMAP Test Server] (sMAP-Test-Instance)
- [Design Discussions] (Design Discussions)
- VIP
- VIP - VOLTTRON Interconnect Protocol
- RPC by example
- VIP - Known Identities
- VIP - Authentication
- VIP - Authorization
- Protecting Pub/Sub Topics
- Setup Eclipse for VOLTTRON
- Deployment Walkthrough
- Forward Historian Walkthrough
- [Create New Historian Agent] (Developing-Historian-Agents)
- [Create New Driver Agent] (Develop-Driver-Agent)
- [Developing With Eclipse] (Eclipse)
- Migrations
- [2.x to 3.x Migration](2.x-to 3.x-Migration)
- 1.2 to 2.0 Migration
- [Deployment Recommendations](Recommendations for Deployments)
VOLTTRON Versions and Features
Transactional Network Platform Overview
- Established Topics
- Working with the Actuator Agent
- Logging
- [Multi-Node Communication] (MultiBuildingMessaging)
Information Exchange Standards