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
- Host: GitHub
- URL: https://github.com/gannonprudhomme/raspberrypi-backlight-server
- Owner: gannonprudhomme
- Created: 2021-05-27T20:40:35.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-03T21:20:33.000Z (about 5 years ago)
- Last Synced: 2025-02-02T01:13:51.248Z (over 1 year ago)
- Topics: python, raspberry-pi
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.