Skip to content

kegnet client

Paul Cowan edited this page Jul 9, 2013 · 6 revisions

kegnet-client

kegnet-client is the KegNet client temperature and pour transmitter daemon.

Versions

There are 2 versions, in separate branches in GitHub:

  • master branch is the current, which uses REST and PKI and send data directly to KegNet servers
  • xively branch is older/alternate, which uses Xively a 3rd party service provider

Function

  • Reads temperature from W1 device
  • Transmits signed temperature at regular intervals (pings)
  • Monitors /usr/share/kegnet-client/spool for new .pour files
  • Transmits signed our data
  • Deletes .pour file upon successful transmission

Code

  • Written in Python, code at client.py
  • Uses ConfigParser to read configuration
  • Uses Pyinotify to monitor directory for new files
  • Uses M2Crypto to load private key and sign data
  • Uses base64 to convert signature bytes to ascii
  • Uses Requests to communicate over HTTPS to KegNet servers
  • Uses syslog library to write logs

Operation

  • Executable located at /usr/share/kegnet-client/lib/client.py
  • Started and managed as a daemon by systemd
  • Service configuration file is /usr/share/kegnet-client/service/kegnet-client.service
  • .service file is linked into /etc/systemd/system/multi-user.target.wants to start up on multi-user run level
  • To manually start kegnet-client execute /usr/share/kegnet-client/start-kegnet-client or systemctl start kegnet-client.service
  • To manually stop kegnet-client execute /usr/share/kegnet/stop-kegnet-client or systemctl stop kegnet-client.service

Configuration

  • /usr/share/kegnet-client/conf/privkey.pem is the client's private key file
  • Reads configuration from /usr/share/kegnet-client/conf/client.conf
  • /usr/share/kegnet-client/conf/client.conf contains 2 parameters: uuid and serviceBaseURL
  • uuid is the KegNet client's unique UUID, which identifies it to the KegNet servers
  • serviceBaseURL is the URL to the KegNet REST API

Output

  • Logs using syslog to /var/log/user.log
Clone this wiki locally