As said before, HTCPCP is fundamentally flawed. In two ways: (1) there is no way the amount of coffee can be controlled, (2) it assumes a teapot cannot brew cofee.
It's time for a new HTPCP-like protocol that solves both of these problems. Things that need to be supported:
- Brewing coffee
- Small talk while deciding if one wants coffee
- Making sure nobody ever believes tea pots cannot make coffee
- At least some control over who is allowed to brew coffee.
As data carrier, pigeons were considered. However, no quality trained pigeons were available, so Telegram was picked. Telegram has a nice bot api. Further, some nice people wrote a Python library for communicating. This solves requirement 4, and eases the development of code for 1-3.
The core telegram bot communication code can be found in telegram.py and may be a useful example to others. The code for implementing requirements 2-3 is also in this file.
The koffiezetter.py has been updated to react to telegram, and to be a little more verbose over telegram, too.
As for the protocol, current computers and even the Raspberry Pi have enough processing power to do some amount of written language recognition. Supported commands:
- 'hi' or 'hello': start smalltalk
- some sentence containing 'tea': tell that shamefully we cannot provide tea
- some sentence containing 'one cup of coffee': brew 1 cup
- some sentence containing 'two cups of coffee': brew 2 cups
- shortcut: if it's really early in the morning and coffee is urgently required with lack of proper verbalisation skills, the word 'coffee' provides for 1 cup of coffee
Brewing more than 3 cups over telegram is not allowed (yet) since no phyisical checks are being made before brewing starts. Read: it can get a big mess, and for <=2 cups this is considered an acceptable risk.
Video is updated, as well as the source on Github.