-
Notifications
You must be signed in to change notification settings - Fork 218
TestAgent
Jereme Haack edited this page Apr 6, 2014
·
7 revisions
Full code of agent detailed in AgentDevelopment.
import sys
from volttron.lite.agent import BaseAgent, PublishMixin
from volttron.lite.agent import utils, matching
from volttron.lite.messaging import headers as headers_mod
class TestAgent(PublishMixin, BaseAgent):
@matching.match_start('heartbeat/listeneragent')
def on_heartbeat_topic(self, topic, headers, message, match):
print "TestAgent got\nTopic: {topic}, {headers}, Message: {message}".format(topic=topic, headers=headers, message=message)
def main(argv=sys.argv):
'''Main method called by the eggsecutable.'''
utils.default_main(TestAgent,
description='Test Agent',
argv=argv)
if <u>name</u> == '<u>main</u>':
# Entry point for script
try:
sys.exit(main())
except KeyboardInterrupt:
pass
Contents of setup.py for TestAgent:
from setuptools import setup, find_packages
setup(
name = "testagent",
version = ".1",
#Automatically find required packages
packages = find_packages(),
#specify the method to call when this egg is executed
entry_points = {
'setuptools.installation': [
'eggsecutable = tester.testagent:main',
]
}
)
Contents of testeragent.launch.json
{
"agent": {
"exec": "testeragent-0.1-py2.7.egg --config \"%c\" --sub \"%s\" --pub \"%p\""
},
"agentid": "Test1",
"message": "hello"
}
Arguments for testeragent:
--config_path Agents/TestAgent/testeragent.launch.json --pub ipc:///tmp/volttron-lite-agent-publish --sub ipc:///tmp/volttron-lite-agent-subscribe
- 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