2023-07-21 22:35:31 +02:00
# Table of Contents
* [yahuelib ](#yahuelib )
* [yahuelib.controller ](#yahuelib.controller )
* [LightController ](#yahuelib.controller.LightController )
2023-07-25 20:27:35 +02:00
* [check\_reachable ](#yahuelib.controller.LightController.check_reachable )
* [check\_on ](#yahuelib.controller.LightController.check_on )
* [set\_on ](#yahuelib.controller.LightController.set_on )
* [get\_brightness ](#yahuelib.controller.LightController.get_brightness )
* [set\_brightness ](#yahuelib.controller.LightController.set_brightness )
* [get\_hue ](#yahuelib.controller.LightController.get_hue )
* [set\_hue ](#yahuelib.controller.LightController.set_hue )
* [get\_saturation ](#yahuelib.controller.LightController.get_saturation )
* [set\_saturation ](#yahuelib.controller.LightController.set_saturation )
* [get\_color\_temperature ](#yahuelib.controller.LightController.get_color_temperature )
* [set\_color\_temperature ](#yahuelib.controller.LightController.set_color_temperature )
2023-07-21 22:35:31 +02:00
* [alert ](#yahuelib.controller.LightController.alert )
* [alert\_long ](#yahuelib.controller.LightController.alert_long )
* [GroupController ](#yahuelib.controller.GroupController )
2023-07-25 20:27:35 +02:00
* [check\_any\_on ](#yahuelib.controller.GroupController.check_any_on )
* [check\_all\_on ](#yahuelib.controller.GroupController.check_all_on )
* [set\_all\_on ](#yahuelib.controller.GroupController.set_all_on )
* [get\_brightness ](#yahuelib.controller.GroupController.get_brightness )
* [set\_brightness ](#yahuelib.controller.GroupController.set_brightness )
* [get\_hue ](#yahuelib.controller.GroupController.get_hue )
* [set\_hue ](#yahuelib.controller.GroupController.set_hue )
* [get\_saturation ](#yahuelib.controller.GroupController.get_saturation )
* [set\_saturation ](#yahuelib.controller.GroupController.set_saturation )
* [get\_color\_temperature ](#yahuelib.controller.GroupController.get_color_temperature )
* [set\_color\_temperature ](#yahuelib.controller.GroupController.set_color_temperature )
2023-07-21 22:35:31 +02:00
* [alert ](#yahuelib.controller.GroupController.alert )
* [alert\_long ](#yahuelib.controller.GroupController.alert_long )
2023-08-04 19:36:09 +02:00
* [MotionSensor ](#yahuelib.controller.MotionSensor )
* [check\_on ](#yahuelib.controller.MotionSensor.check_on )
* [set\_on ](#yahuelib.controller.MotionSensor.set_on )
* [check\_reachable ](#yahuelib.controller.MotionSensor.check_reachable )
* [get\_battery ](#yahuelib.controller.MotionSensor.get_battery )
* [get\_sensitivity ](#yahuelib.controller.MotionSensor.get_sensitivity )
* [set\_sensitivity ](#yahuelib.controller.MotionSensor.set_sensitivity )
* [get\_sensitivitymax ](#yahuelib.controller.MotionSensor.get_sensitivitymax )
2023-08-04 19:46:55 +02:00
* [check\_ledindication ](#yahuelib.controller.MotionSensor.check_ledindication )
2023-08-04 19:36:09 +02:00
* [set\_ledindication ](#yahuelib.controller.MotionSensor.set_ledindication )
* [get\_presence ](#yahuelib.controller.MotionSensor.get_presence )
2023-07-25 20:27:35 +02:00
* [yahuelib.utils ](#yahuelib.utils )
* [rgb\_to\_hsv ](#yahuelib.utils.rgb_to_hsv )
* [kelvin\_to\_mired ](#yahuelib.utils.kelvin_to_mired )
2023-07-21 22:35:31 +02:00
* [yahuelib.exceptions ](#yahuelib.exceptions )
2023-08-04 19:36:09 +02:00
* [DeviceNotFound ](#yahuelib.exceptions.DeviceNotFound )
2023-07-21 22:35:31 +02:00
* [APIError ](#yahuelib.exceptions.APIError )
< a id = "yahuelib" > < / a >
# yahuelib
< a id = "yahuelib.controller" > < / a >
# yahuelib.controller
< a id = "yahuelib.controller.LightController" > < / a >
## LightController Objects
```python
class LightController(_BaseController)
```
Control a Philips Hue Light using the API of your Hue Bridge.
**Arguments**:
- `number: int` - The number of your light
- `bridge_ip_address: str` - The IP address of your Hue Bridge
- `bridge_api_user: str` - The user used to authenticate to the API
Use the class method `.from_name(name:str, ...)` to use the name of a light instead of the number.
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.check_reachable" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### check\_reachable
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def check_reachable() -> bool
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Check if the light is reachable
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.check_on" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### check\_on
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def check_on() -> bool
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Check if the light is on
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.set_on" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### set\_on
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def set_on(on: bool)
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Turn the light on/off
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.get_brightness" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### get\_brightness
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def get_brightness() -> int
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Get the brightness
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.set_brightness" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### set\_brightness
2023-07-21 22:35:31 +02:00
```python
2023-08-04 19:36:09 +02:00
def set_brightness(brightness: int)
2023-07-21 22:35:31 +02:00
```
2023-08-04 19:36:09 +02:00
Set the brightness (`0` - `254` )
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.get_hue" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### get\_hue
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def get_hue() -> int
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Get the hue
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.set_hue" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### set\_hue
2023-07-21 22:35:31 +02:00
```python
2023-08-04 19:36:09 +02:00
def set_hue(hue: int)
2023-07-21 22:35:31 +02:00
```
2023-08-04 19:36:09 +02:00
Set the hue (0 - 65535)
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.get_saturation" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### get\_saturation
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def get_saturation() -> int
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Get the saturation
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.set_saturation" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### set\_saturation
2023-07-21 22:35:31 +02:00
```python
2023-08-04 19:36:09 +02:00
def set_saturation(saturation: int)
2023-07-21 22:35:31 +02:00
```
2023-08-04 19:36:09 +02:00
Set the saturation (`0` - `254` )
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.get_color_temperature" > < / a >
2023-07-23 10:32:00 +02:00
2023-07-25 20:27:35 +02:00
#### get\_color\_temperature
2023-07-23 10:32:00 +02:00
```python
2023-08-04 19:36:09 +02:00
def get_color_temperature() -> int
2023-07-23 10:32:00 +02:00
```
2023-07-25 20:27:35 +02:00
Get the white color temperature in Mired
2023-07-23 10:32:00 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.LightController.set_color_temperature" > < / a >
2023-07-23 10:32:00 +02:00
2023-07-25 20:27:35 +02:00
#### set\_color\_temperature
2023-07-23 10:32:00 +02:00
```python
2023-07-25 20:27:35 +02:00
def set_color_temperature(mired: int)
2023-07-23 10:32:00 +02:00
```
2023-07-25 20:27:35 +02:00
Set the white color temperature in Mired (`154` - `500` )
2023-07-23 10:32:00 +02:00
2023-07-21 22:35:31 +02:00
< a id = "yahuelib.controller.LightController.alert" > < / a >
#### alert
```python
def alert()
```
Flash the light once.
< a id = "yahuelib.controller.LightController.alert_long" > < / a >
#### alert\_long
```python
def alert_long()
```
Flash the light for 10 seconds.
< a id = "yahuelib.controller.GroupController" > < / a >
## GroupController Objects
```python
class GroupController(_BaseController)
```
Control a Philips Hue Light Group (Room/Zone) using the API of your Hue Bridge.
**Arguments**:
- `number: int` - The number of your light group
- `bridge_ip_address: str` - The IP address of your Hue Bridge
- `bridge_api_user: str` - The user used to authenticate to the API
Use the class method `.from_name(name:str, ...)` to use the name of a group instead of the number.
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.check_any_on" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### check\_any\_on
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def check_any_on() -> bool
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Check if any light in this group is on
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.check_all_on" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### check\_all\_on
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def check_all_on() -> bool
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Check if all lights in this group are on
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.set_all_on" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### set\_all\_on
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def set_all_on(on: bool)
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Turn on/off all lights in this group
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.get_brightness" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### get\_brightness
2023-07-21 22:35:31 +02:00
```python
2023-08-04 19:36:09 +02:00
def get_brightness()
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Get the last set brightness in this group
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.set_brightness" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### set\_brightness
2023-07-21 22:35:31 +02:00
```python
2023-08-04 19:36:09 +02:00
def set_brightness(brightness: int)
2023-07-21 22:35:31 +02:00
```
2023-08-04 19:36:09 +02:00
Set the brightness (`0` - `254` ) of all lights in this group
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.get_hue" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### get\_hue
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def get_hue() -> int
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Get the last set hue in this group
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.set_hue" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### set\_hue
2023-07-21 22:35:31 +02:00
```python
2023-08-04 19:36:09 +02:00
def set_hue(hue: int)
2023-07-21 22:35:31 +02:00
```
2023-08-04 19:36:09 +02:00
Set the hue (`0` - `65535` ) of all lights in this group
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.get_saturation" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### get\_saturation
2023-07-21 22:35:31 +02:00
```python
2023-07-25 20:27:35 +02:00
def get_saturation() -> int
2023-07-21 22:35:31 +02:00
```
2023-07-25 20:27:35 +02:00
Get the last set saturation in this group
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.set_saturation" > < / a >
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
#### set\_saturation
2023-07-21 22:35:31 +02:00
```python
2023-08-04 19:36:09 +02:00
def set_saturation(saturation: int)
2023-07-21 22:35:31 +02:00
```
2023-08-04 19:36:09 +02:00
Set the saturation (`0` - `254` ) of all lights in this group
2023-07-21 22:35:31 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.get_color_temperature" > < / a >
2023-07-23 10:32:00 +02:00
2023-07-25 20:27:35 +02:00
#### get\_color\_temperature
2023-07-23 10:32:00 +02:00
```python
2023-08-04 19:36:09 +02:00
def get_color_temperature() -> int
2023-07-23 10:32:00 +02:00
```
2023-07-25 20:27:35 +02:00
Get the last set white color temperature in Mired
2023-07-23 10:32:00 +02:00
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.controller.GroupController.set_color_temperature" > < / a >
2023-07-23 10:32:00 +02:00
2023-07-25 20:27:35 +02:00
#### set\_color\_temperature
2023-07-23 10:32:00 +02:00
```python
2023-07-25 20:27:35 +02:00
def set_color_temperature(mired: int)
2023-07-23 10:32:00 +02:00
```
2023-07-25 20:27:35 +02:00
Set the white color temperature in Mired (`154` - `500` ) for all lights in this group
2023-07-23 10:32:00 +02:00
2023-07-21 22:35:31 +02:00
< a id = "yahuelib.controller.GroupController.alert" > < / a >
#### alert
```python
def alert()
```
Flash all lights in the group once.
< a id = "yahuelib.controller.GroupController.alert_long" > < / a >
#### alert\_long
```python
def alert_long()
```
Flash all lights in the group for 10 seconds.
2023-08-04 19:36:09 +02:00
< a id = "yahuelib.controller.MotionSensor" > < / a >
## MotionSensor Objects
```python
class MotionSensor(_BaseController)
```
< a id = "yahuelib.controller.MotionSensor.check_on" > < / a >
#### check\_on
```python
def check_on() -> bool
```
Check if the sensor is on
< a id = "yahuelib.controller.MotionSensor.set_on" > < / a >
#### set\_on
```python
def set_on(on: bool)
```
Turn the sensor on/off
< a id = "yahuelib.controller.MotionSensor.check_reachable" > < / a >
#### check\_reachable
```python
def check_reachable() -> bool
```
Check if the sensor is reachable
< a id = "yahuelib.controller.MotionSensor.get_battery" > < / a >
#### get\_battery
```python
def get_battery() -> int
```
Get the current charge of the battery in percent
< a id = "yahuelib.controller.MotionSensor.get_sensitivity" > < / a >
#### get\_sensitivity
```python
def get_sensitivity() -> int
```
Get the sensitivity of the sensor
< a id = "yahuelib.controller.MotionSensor.set_sensitivity" > < / a >
#### set\_sensitivity
```python
def set_sensitivity(sensitivity: int)
```
Set the sensitivity of the sensor
< a id = "yahuelib.controller.MotionSensor.get_sensitivitymax" > < / a >
#### get\_sensitivitymax
```python
def get_sensitivitymax() -> int
```
Get the maximum sensititvity of the sensor
2023-08-04 19:46:55 +02:00
< a id = "yahuelib.controller.MotionSensor.check_ledindication" > < / a >
2023-08-04 19:36:09 +02:00
2023-08-04 19:46:55 +02:00
#### check\_ledindication
2023-08-04 19:36:09 +02:00
```python
2023-08-04 19:46:55 +02:00
def check_ledindication() -> bool
2023-08-04 19:36:09 +02:00
```
2023-08-04 19:46:55 +02:00
Check if the LED indication is turned on or off
2023-08-04 19:36:09 +02:00
< a id = "yahuelib.controller.MotionSensor.set_ledindication" > < / a >
#### set\_ledindication
```python
def set_ledindication(on: bool)
```
Turn the LED indicator on/off
< a id = "yahuelib.controller.MotionSensor.get_presence" > < / a >
#### get\_presence
```python
def get_presence() -> bool
```
Check if the motion sensor detected the presence of someone in it's reach
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.utils" > < / a >
# yahuelib.utils
< a id = "yahuelib.utils.rgb_to_hsv" > < / a >
#### rgb\_to\_hsv
```python
def rgb_to_hsv(r: int, g: int, b: int) -> tuple
```
2023-08-04 19:36:09 +02:00
Convert RGB colors `(255, 220, 100)` to Philips Hue's hue, saturation and brightness values `(8456, 149, 245)` imprecisely
2023-07-25 20:27:35 +02:00
< a id = "yahuelib.utils.kelvin_to_mired" > < / a >
#### kelvin\_to\_mired
```python
def kelvin_to_mired(kelvin: int)
```
Convert the color temperature from Kelvin to Mired
2023-07-21 22:35:31 +02:00
< a id = "yahuelib.exceptions" > < / a >
# yahuelib.exceptions
2023-08-04 19:36:09 +02:00
< a id = "yahuelib.exceptions.DeviceNotFound" > < / a >
2023-07-21 22:35:31 +02:00
2023-08-04 19:36:09 +02:00
## DeviceNotFound Objects
2023-07-21 22:35:31 +02:00
```python
2023-08-04 19:36:09 +02:00
class DeviceNotFound(Exception)
2023-07-21 22:35:31 +02:00
```
2023-08-04 19:36:09 +02:00
`DeviceNotFound` Exception
2023-07-21 22:35:31 +02:00
< a id = "yahuelib.exceptions.APIError" > < / a >
## APIError Objects
```python
class APIError(Exception)
```
Generic `APIError` Exception