class documentation

class Sensor(MQTTAgent):

Constructor: Sensor(sensor)

View In Hierarchy

Sensor Agent

This agent is used to handle publications to the sensor topic and any publications it makes.

Method __init__ Construct the Sensor agent
Method handle_publication Handle a publication This method is called by the MQTT client when a publication is received.
Constant SENSOR_PAYLOAD Sensor payload look up
Constant SENSOR_TOPIC_PREFIX Undocumented
Method _create_pub_check Overrides version in base class
Async Method _pub_check Publication check
Instance Variable _name Undocumented
Instance Variable _sensor Undocumented
def __init__(self, sensor):

Construct the Sensor agent

Create object variables and initialise the base Agent class topic and QoS

def handle_publication(self, topic, dup_flag, ret_flag, payload):

Handle a publication This method is called by the MQTT client when a publication is received.

Parameters
topicthe topic of the publication
dup_flagTrue if this is a duplicate publication
ret_flagTrue if this is a retained publication
payloadthe payload of the publication as a string
SENSOR_PAYLOAD =

Sensor payload look up

Dictionary to translate internal status to reported status

Value
{DCCBlkDet.BLK_EMPTY: 'INACTIVE',
 DCCBlkDet.BLK_OCC: 'ACTIVE',
 DCCBlkDet.BLK_NPOW: 'INACTIVE'}
SENSOR_TOPIC_PREFIX: str =

Undocumented

Value
'track/sensor'
def _create_pub_check(self):

Overrides version in base class

async def _pub_check(self):

Publication check

Check to see if block state has changed and publish it.

This coroutine runs forever.

_name =

Undocumented

_sensor =

Undocumented