From: Benjamin Braatz Date: Sun, 21 Mar 2021 15:12:00 +0000 (+0100) Subject: Fix documentation in state.py. X-Git-Tag: v0.3.0~46 X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=f6ae3521f2660b2b079848d07f5a5510cd3e257d;p=graphit%2Fcontrolpi.git Fix documentation in state.py. --- diff --git a/controlpi_plugins/state.py b/controlpi_plugins/state.py index bd9d128..a60233d 100644 --- a/controlpi_plugins/state.py +++ b/controlpi_plugins/state.py @@ -2,8 +2,8 @@ - State represents a Boolean state. - StateAlias translates to another state-like client. -- AndState combines several state clients by conjunction. -- OrState combines several state clients by disjunction. +- AndState combines several state-like clients by conjunction. +- OrState combines several state-like clients by disjunction. All these plugins use the following conventions: @@ -18,10 +18,12 @@ All these plugins use the following conventions: "new state": it changes the state accordingly. If this was really a change the corresponding event is sent. If it was already in this state a report message without "event": "changed" is sent. +- StateAlias can alias any message bus client using these conventions, not + just State instances. It translates all messages described here in both + directions. - AndState and OrState instances cannot be set. - AndState and OrState can combine any message bus clients using these - conventions, not just State instances. They only use the "get state" - command (to initialise their own internal state) and react to messages + conventions, not just State instances. They only react to messages containing "state" information. >>> import asyncio @@ -429,7 +431,7 @@ class AndState(BasePlugin): """ async def receive(self, message: Message) -> None: - """.""" + """Process "get state" command and messages of combined states.""" if ('target' in message and message['target'] == self.name and 'command' in message and message['command'] == 'get state'): await self.bus.send(Message(self.name, {'state': self.state})) @@ -544,7 +546,7 @@ class OrState(BasePlugin): """ async def receive(self, message: Message) -> None: - """.""" + """Process "get state" command and messages of combined states.""" if ('target' in message and message['target'] == self.name and 'command' in message and message['command'] == 'get state'): await self.bus.send(Message(self.name, {'state': self.state}))