Fix documentation in state.py.
authorBenjamin Braatz <bb@bbraatz.eu>
Sun, 21 Mar 2021 15:12:00 +0000 (16:12 +0100)
committerBenjamin Braatz <bb@bbraatz.eu>
Sun, 21 Mar 2021 15:12:00 +0000 (16:12 +0100)
controlpi_plugins/state.py

index bd9d1286c8202a612f54437bbe140df0c2900735..a60233dc4da9679da96de6759a21a3850e92f1f3 100644 (file)
@@ -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": <state to be set> 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}))