2022-02-20 11:16:35 -05:00
# Happy Cat 🐈🌞
2022-02-25 13:35:05 -05:00
A commandline utility to control your [Elgato Key Light ](https://www.elgato.com/en/key-light ) and [Key Light Air ](https://www.elgato.com/en/key-light-air ).
2022-02-20 11:16:35 -05:00
Change your light settings easily inside scripts or use configuration files to automatically apply your preferred setup over the course of the day, possibly even exploring the use as a [light therapy ](https://en.wikipedia.org/wiki/Light_therapy ) device.
2022-02-25 14:11:46 -05:00
Please report issues, bugs or feature requests [here ](https://codeberg.org/schrofi/happy-cat/issues ).
2022-02-26 17:10:55 -05:00
## Running
Download the newest release for your system from the [releases page ](https://codeberg.org/schrofi/happy-cat/releases ).
On Linux and Mac OS you can run the native binaries by simply executing `./hc` .
On all other systems you have to resort to java by running the jar like `java -jar ./hc.jar`
2022-02-20 11:16:35 -05:00
## Usage
2022-02-25 13:35:05 -05:00
Happy cat is split up into multiple subcommands, each of which have their own parameters.
2022-02-20 11:16:35 -05:00
To find out more about each command, check out the help pages by appending `--help` after the command.
2022-02-25 13:35:05 -05:00
*Important: Happy cat uses Kelvin to measure light temperature, while Elgato lamps use their own format internally. Conversion between the two is done on the fly*
2022-02-20 11:16:35 -05:00
#### Apply
2022-02-25 13:35:05 -05:00
Reads the provided configuration file, determines the currently active state based on time definitions and applies the state to the given light once.
2022-02-20 11:16:35 -05:00
It's basically a oneshot version of the `daemon` command. For examples of the configuration file, check the corresponding paragraph below.
*Example*
```shell
hc apply ./elgato.config elgato.local
```
#### Daemon
Reads the given configuration file, then determines and applies the currently valid configuration every minute.
*Example*
```shell
hc daemon ./elgato.config elgato.local
```
#### Get
2022-02-25 13:35:05 -05:00
Reads and prints the current status of the specified light.
2022-02-20 11:16:35 -05:00
*Example*
```shell
hc get elgato.local
```
#### Set
Sets the given values of powerstatus, brightness and temperature to the specified light.
```shell
hc set -p ON -b 70 -t 4200 elgato.local
```
## Configuration
To automatically apply settings, you can create your own configuration file which defines the settings for each timeframe.
All values inside `status` are optional, if they are not defined, those parameters will remain unchanged.
Timeframes can cross midnight, but *must not* overlap. If there are overlapping timeframes, the first valid timeframe will be chosen.
```json
{
"config": [
{
"start": "8:30",
"end": "11:00",
"status": {
"power": "ON",
"brightness": 100,
"temperature": 6500
}
},
{
"start": "11:00",
"end": "20:00",
"status": {
"brightness": 70,
"temperature": 4300
}
},
{
"start": "20:00",
"end": "8:30",
"status": {
"temperature": 3000
}
}
]
}
```
## Automation
2022-02-20 11:21:11 -05:00
Probably one could automate the setup using systemd and/or cronjobs, but so far I didn't get to that.
2022-02-25 13:35:05 -05:00
## Building
2022-02-26 17:10:55 -05:00
### Linux and Mac OS
To build native binaries run:
2022-02-25 13:35:05 -05:00
```bash
2022-02-26 16:14:46 -05:00
./gradlew nativeBinaries
2022-02-25 13:35:05 -05:00
```
2022-02-25 13:47:05 -05:00
You can then find the executable in `build/bin/native/hcReleaseExecutable` .
2022-02-25 13:35:05 -05:00
2022-02-26 17:10:55 -05:00
### Windows and others
To build the Java package run:
```bash
./gradlew shadowJar
```
You can then find the jar in `build/libs` .
2022-02-20 11:21:11 -05:00
## License
2022-02-25 13:35:05 -05:00
This software is licensed under the MPL 2.0, see the [LICENSE ](LICENSE ) file.