An open API service indexing awesome lists of open source software.

https://github.com/gannonprudhomme/raspberrypi-backlight-server

A Socket.io server for controlling the power & brightness of the official 7" RaspberryPi Touchscreen Display
https://github.com/gannonprudhomme/raspberrypi-backlight-server

python raspberry-pi

Last synced: about 2 months ago
JSON representation

A Socket.io server for controlling the power & brightness of the official 7" RaspberryPi Touchscreen Display

Awesome Lists containing this project

README

          

# RaspberryPi Backlight Server

A [Socket.io](https://python-socketio.readthedocs.io/en/latest/index.html) server for controlling an official 7" RaspberryPi Touchscreen Display,
using the [rpi_backlight](https://pypi.org/project/rpi-backlight/) library.

Currently used to control my Pi's touchscreen from HomeAssistant using
[ha-rpi-backlight](https://github.com/gannonprudhomme/ha-rpi-backlight).

## Installation

1. Install Python

2. Create a virtual environment: `python3 -m venv env` then `source env/Scripts/activate` (or `source env/bin/activate` on Unix)

3. Run `pip3 install -r requirements.txt`

4. Run `python3 main.py` to start the server!

## Configuration

The default port is [aiohttp](https://docs.aiohttp.org/en/stable/index.html)'s default port, which is 8080. To change it, create a `settings.json`
file in the root of the project, and provide a `port` key with the value of the port that is desired.

For example:

```json
{
"port": 3000
}
```

## Available Events

- `set_screen_power`: Takes boolean and sets the screen power accordingly

- `get_screen_power`: Returns a boolean indicating the screen power

- `set_brightness`: Takes an integer (or float, which is cast to an int) and sets the brightness accordingly

- `get_brightness`: Returns an integer of the current brightness

- `shutdown`: No arguments, calls `shutdown` on the Pi.