Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Enttoi Raspberry Pi client

Branch Travis
master Build Status
dev Build Status

This is a client application that runs on RPi and streams sensors data to gateway.

The client will read each sensor's state every X ms. After reading, it will report on each change of state immediately or at least once every Y seconds (even if the state wasn't changed) to the gateway. This will provide an efficient way of getting real-time state of sensors and track of online/offline clients (due to network or other issues).

For each sensor a separated thread is spinned, so the IO operations won't block reporting of different sensors.

Board schematic

The following parts required:

  • Raspberry Pi board
  • WiFi dongle (optional if there is LAN socket)
  • If the WiFi dongle used at least 2A power adapter is required.
  • Breadboard (optional)
  • One LED connected to wPi=0 or BCM=17 pin. The LED has 4 states:
    • On - client launched, but no request is sent to gateway
    • Slow blinking - latest request were successfull
    • Fast blinking - latest request wasn't sent due error (timeout, network errors, etc)
    • Off - client terminated
  • 2 reed switches connected to wPi=5,7 or BCM=4,24.

All parts should be connected in the following way: Schematic

Application Configurations

The only prerequisite is to have environment variables which defines the endpoint of API and a security token.

Those can be defined either simply in /etc/environment:

ENTTOI_ENDPOINT="[gateway endpoint URI]"
ENTTOI_CLIENT_TOKEN="[client's token]"

Running as shell application

Since GPIO requires elevations, environment variables needs to be added for sudo

sudo visudo

then add:

Defaults	env_keep +="ENTTOI_ENDPOINT"
Defaults	env_keep +="ENTTOI_CLIENT_TOKEN"

Deploy the / folder into Raspberry Pi and start client from terminal:

sudo python

Running as daemon service

The client daemonized using Stephen's fairly painless trick.

Assuming that the project cloned into /home/pi/enttoi-client (this can me changed in, copy init script to /etc/init.d:

sudo cp /etc/init.d

Make sure that both and are executable:

sudo chmod 755 /etc/init.d/
chmod 755

At this stage you can start and stop service:

sudo /etc/init.d/ start
sudo /etc/init.d/ status
sudo /etc/init.d/ stop

See log file at /tmp/entoi-client.log for info or errors.

Now, add it to boot sequence:

sudo update-rc.d defaults


Enttoi Raspberry Pi Python client





No releases published


No packages published