Updated README

This commit is contained in:
Dominik Moritz Roth 2024-10-02 16:51:57 +02:00
parent 7f92a323c7
commit da871655e6

View File

@ -55,14 +55,52 @@ The `Nucon` enum contains all available parameters. Each parameter is defined wi
- A type (float, int, bool, str, or a custom Enum)
- A boolean indicating whether it's writable
Key methods:
- `Nucon.set_base_url(url)`: Set the base URL for the game's API
- `Nucon.set_dummy_mode(bool)`: Enable or disable dummy mode for testing
- `Nucon.get_all()`: Get all parameter values
- `Nucon.get_multiple(params)`: Get values for multiple specified parameters
Parameter properties:
- `Nucon.<PARAMETER>.value`: Get or set the current value of the parameter. Assigning a new value will write it to the game.
- `Nucon.<PARAMETER>.param_type`: Get the type of the parameter
- `Nucon.<PARAMETER>.is_writable`: Check if the parameter is writable
- `Nucon.<PARAMETER>.enum_type`: Get the enum type of the parameter if it's an enum, otherwise None
For a full list of parameters and their details, refer to the `Nucon` enum in the source code.
Parameter methods:
- `Nucon.<PARAMETER>.read()`: Get the current value of the parameter (alias for `value`)
- `Nucon.<PARAMETER>.write(new_value, force=False)`: Write a new value to the parameter. `force` will try to write even if the parameter is known as non-writable.
Class methods:
- `Nucon.get(parameter)`: Get the value of a specific parameter
- `Nucon.set(parameter, value, force=False)`: Set the value of a specific parameter
- `Nucon.get_all_readable()`: Get a list of all readable parameters (which is all parameters)
- `Nucon.get_all_writable()`: Get a list of all writable parameters
- `Nucon.get_all()`: Get all parameter values as a dictionary
- `Nucon.get_multiple(params)`: Get values for multiple specified parameters
- `Nucon.set_base_url(url)`: Set the base URL for the game's API
- `Nucon.set_dummy_mode(dummy_mode)`: Enable or disable dummy mode for testing
Custom Enum Types:
- `PumpStatus`: Enum for pump status (INACTIVE, ACTIVE_NO_SPEED_REACHED, ACTIVE_SPEED_REACHED, REQUIRES_MAINTENANCE, NOT_INSTALLED, INSUFFICIENT_ENERGY)
- `PumpDryStatus`: Enum for pump dry status (ACTIVE_WITHOUT_FLUID, INACTIVE_OR_ACTIVE_WITH_FLUID)
- `PumpOverloadStatus`: Enum for pump overload status (ACTIVE_AND_OVERLOAD, INACTIVE_OR_ACTIVE_NO_OVERLOAD)
- `BreakerStatus`: Enum for breaker status (OPEN, CLOSED)
## Testing
NuCon includes a test suite to verify its functionality and compatibility with the Nucleares game.
### Running Tests
To run the tests:
1. Ensure the Nucleares game is running and accessible at http://localhost:8080/ (or update the URL in the test setup).
2. Install pytest: `pip install pytest`
3. Run the tests: `pytest test/test.py`
### Test Coverage
The tests verify:
- Parameter types match their definitions in NuCon
- Writable parameters can be written to
- Non-writable parameters cannot be written to, even when force-writing
- Enum parameters and their custom truthy values behave correctly
## Disclaimer
NuCon is an unofficial tool and is not affiliated with or endorsed by the creators of Nucleares.