Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedusim committed Dec 1, 2023
1 parent f213d28 commit b4b917b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A Python Lighthouse Adapter

(README WIP; please consult pyghthouse/ph.py for usage information.)
(README WIP; please consult pyghthouse/ph.py or examples/README.md for usage information.)

Example scripts can be found [here](examples)

Expand All @@ -13,3 +13,17 @@ Example scripts can be found [here](examples)
If you are experiencing errors regarding SSL certificates,
instantiate Pyghthouse using the `ignore_ssl_cert=True`
keyword argument.

## Requiered packages
- websocket-client
- msgpack

##### Optional packages used in examples
- numpy
- Pillow

## Guide to install packages
To install packages in python, you can use `pip install <package name>` in a command line. For example `pip install numpy`.
If you have problems with installing, we recommend to use this guide: https://packaging.python.org/en/latest/tutorials/installing-packages/

In Thonny, you can use a Package Manager. You can find it in `Tools > Manage packages...`
39 changes: 36 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,41 @@ This is a loose collection of example scripts for pyghthouse.

Run any script by entering `python <filename>`.

Some scripts have additional dependencies; you can install them by running `pip install -r requirements.txt` from the
repository root directory.
Some scripts have additional dependencies; Check `README.md` in the repository root directory for an installation guide

If you set up config.py with your username and API token, you won't have to enter them every time you run a script.
Be aware that API tokens are only valid for a few days.
Be aware that API tokens are only valid for a few days.

##### Beware:
Python imports search for the modules in the current folder and in installed packages. So, if you haven't installed
pyghthouse as a package, you need to change the imports of the files in this folder to work.

In the repository root directory should be a file called `example.py`. This file shows the usage of imports of
pyghthouse without having it installed as a package.
Note: To use the imports the same way as `example.py`, your skript has to be in the same folder.

### Available functions
Here you can find a list of functions containing in this package.

`from_html(html_color)`
Converts an HTML color string like FF7F00 or #c0ffee to RGB

`from_hsv(h: float, s: float, v: float)`
Converts HSV (float values between 0 and 1) colors to RGB.

###### The class `Pyghthouse` with
`Pyghthouse(username: str, token: str, ...)`
Set up the `Pyghthouse` object. Needed arguments are `username` and `token`. Optional arguments and further explanation
can be found in the class definition (see `pyghthouse\ph.py`)

`Pyghthouse.empty_image()`
Creates a black image.
This function can also be called with an instance of the `Pyghthouse` object (*`<instance name>.empty_image()`*)

`<instance name>.set_image(image)`
Sends the given `image`.

`<instance name>.close()`
Closes the connection.

*More functions can be found in `pyghthouse\ph.py`*

0 comments on commit b4b917b

Please sign in to comment.