The ZWay text bot is small tool to control ZWay server via human text commands. It can act as telegram bot and as http server.
go get -u github.com/olegator77/zway-bot
zway-bot -zway-url=<zway API server url> \
-zway-user=<zway user name> \
-zway-password=<zway password> \
-tg-bot-token='<telegram bot token' \
-tg-bot-users=<comma separated list of authorized telegram users> \
-http-addr=<http server addr:port> \
-bind-locations=<Comma separated bindings of sender's default locations, e.g 'olegator77=cabinet,192.168.1.101=hall'>
Just send text phrases to the bot like:
turn on lamp in the lounge
red illumination in the cabinet
green illumination
turn off TV in the bedroom
heat floor in the bathroom and toilet
Bot will parse phrase, match it with commands, devices and locations titles obtained from ZWay server.
Supported comamnds are:
on
- turn on the deviceoff
- turn off the devicerun
- run scenered/green/yellow/white...
- set color to RGB lamp illuminationmaximum
- set maximum level to dimmerlighter
- increase dimmer leveldarker
- decrease dimmer level
Bot is remember last devices and locations, and uses them for next commands to last devices or last location. Contexts are binded to commands's sender: telegram nick or IP address of remote host.
E.g: after command turn on dimmer in the cabinet
, the next command can be in short form, like just off
or maximum
. The device dimmer
and location cabinet
will be used from last context.
Bot can use default location of command sender (telegram nick or IP address of remote host). This default location will be used, if command phrase is not contains location name.