- 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:
"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
"""
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}))
"""
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}))