class documentation
Layout Power Agent
This manages the power subscription and publication.
There is only one of these, but singularity is not enforced.
| Method | __init__ |
Initialise the power manager |
| Method | handle |
Handle a publication |
| Constant | ON |
On Off decode for power and decoder function commands |
| Method | _create |
Overrides version in base class |
| Async Method | _pub |
Check for publication. |
| Instance Variable | _dcc |
Undocumented |
| Instance Variable | _publish |
Undocumented |
Initialise the power manager
This initialises the power manager with the topic filter and QoS for the subscription and the topic for publishing the power state.
This will publish the power state when the power state changes or on the first call to check_power. It will also publish the power state if a retained message is received.
| Parameters | |
| topic | the topic filter to match against received topics |
| qos | the Quality of Service for the subscription. Must be either MQTTClient.QOS0 or MQTTClient.QOS1 |
| pub | the topic used for publishing the power state |
Handle a publication
This method is called by the MQTT client when a publication is received. It will turn the DCC power on or off according to the payload.
| Parameters | |
| topic | the topic of the publication |
| dup | True if this is a duplicate publication |
| ret | True if this is a retained publication |
| payload | the payload of the publication as a string |
ON_OFF =
¶
On Off decode for power and decoder function commands
| Value |
|