Small CLI (command line interface) for Waveshare PoE HAT B with OLED Display.
10K+
Small command line interface for Waveshare PoE HAT B with OLED Display.

Find this project on GitHub https://github.com/pietmacom/waveshare-poe-hat-b-cli and on DockerHub https://hub.docker.com/r/pietmacom/waveshare-poe-hat-b-cli
Run command
foo@bar:~$ docker run --privileged -it pietmacom/waveshare-poe-hat-b-cli /root/waveshare-poe-hat-b-cli oled "Hello World!"
foo@bar:~$ docker run --privileged -it pietmacom/waveshare-poe-hat-b-cli /root/waveshare-poe-hat-b-cli fan on
Run simple script simple.sh
foo@bar:~$ docker run --privileged -it pietmacom/waveshare-poe-hat-b-cli
#!/bin/sh -e
_fanState="off"
_fanOnTemperature="40000"
_fanOffTemperature="35000"
while true; do
_temperature="$(cat /sys/class/thermal/thermal_zone0/temp)"
_temperatureViewAwk="BEGIN { printf \"%.2f C\", (${_temperature}/1000) }"
_temperatureView=$(awk "${_temperatureViewAwk}";)
if [[ "${_temperature}" -gt "${_fanOnTemperature}" ]]; then
_fanState="on"
elif [[ "${_temperature}" -lt "${_fanOffTemperature}" ]]; then
_fanState="off"
fi
./waveshare-poe-hat-b-cli fan ${_fanState}
./waveshare-poe-hat-b-cli oled "T: ${_temperatureView}" "F: ${_fanState}"
sleep 3
done

Run your own script
Copy simple.sh, make your changes and mount it into your new container.
foo@bar:~$ docker run --privileged -it -v yourscript.sh:/root/script.sh pietmacom/waveshare-poe-hat-b-cli
Docker Compose
version: '3'
services:
waveshare-poe-hat-b-cli:
image: pietmacom/waveshare-poe-hat-b-cli:latest
privileged: true
restart: "unless-stopped"
foo@bar:~$ sudo ./waveshare-poe-hat-b-cli fan on
Fan turned on!
foo@bar:~$ sudo ./waveshare-poe-hat-b-cli fan off
Fan turned off!
foo@bar:~$ sudo ./waveshare-poe-hat-b-cli oled "row1"
row 1: row1

foo@bar:~$ sudo ./waveshare-poe-hat-b-cli oled "row1" "row2"
row 1: row1
row 2: row2

foo@bar:~$ sudo ./waveshare-poe-hat-b-cli oled "row1" "row2" "row3"
row 1: row1
row 2: row2
row 3: row3

foo@bar:~$ sudo ./waveshare-poe-hat-b-cli oled "row1" "row2" "row3" "row4"
row 1: row1
row 2: row2
row 3: row3
row 4: row4

I2C interface is required for the OLED display, you need to first enable the i2c interface for properly work. Open a terminal of Raspberry Pi and configure:
foo@bar:~$ sudo raspi-config
Interfacing Options -> I2C -> Yes

And then reboot the system.
foo@bar:~$ sudo reboot
foo@bar:~$ ./make clean
foo@bar:~$ ./make
Documentation https://www.waveshare.com/wiki/PoE_HAT_(B)
Content type
Image
Digest
sha256:5839ecd67…
Size
3 MB
Last updated
over 3 years ago
docker pull pietmacom/waveshare-poe-hat-b-cli