I made an agent with the creation wizard. How can I publish data from this agent to the message bus?
Ultimately I am hoping to use this agent to calculate some "events" similar to the air_cx_agent
and use the forward agent to send it onto the VOLTTRON central instance.
This is the just code snip from the periodic that runs every 300 seconds:
fdd_check
is a boolean True False type calculation from the BACnet data on the BAS.
I have an issue in the self.vip.pubsub.publish
:
from volttron.platform.agent import utils
from volttron.platform.vip.agent import Agent, Core, RPC
from volttron.platform.messaging import topics, headers
'''
code snip below from method
ran by the periodic every 300 seconds
'''
fdd_check = self.fault_condition_one(df_lastrow)
_log.debug(f'[FC 1 Agent INFO] - fault_condition_one {fdd_check}')
self.vip.pubsub.publish(
peer="pubsub",
topic=f"{topics.FAULTS_FC1}/{self.ahu_instance_id}",
headers={
headers.TIMESTAMP: utils.format_timestamp(utils.get_aware_utc_now())
},
message=int(fdd_check),
)
Full Trace back:
Traceback (most recent call last):
File "/var/lib/volttron/volttron/platform/vip/agent/core.py", line 117, in _loop
method(*self.args, **self.kwargs)
File "/home/volttron/.volttron/agents/4bddb163-3d1c-403e-8ce0-70a82f58ea1c/fconeagent-0.1/fcone/agent.py", line 277, in get_stuff_done
topic=f"{topics.FAULTS_FC1}/{self.ahu_instance_id}",
AttributeError: module 'volttron.platform.messaging.topics' has no attribute 'FAULTS_FC1'
In my thinking I would like to relate this topic or data on the message bus to the HVAC equipment it is monitoring via BACnet self.ahu_instance_id
, as well as that is FAULTS, and fault condition #1. Can the topics just be made up? Thanks for any tips.