From 70ed602814205a73bf0576f6ce38eeb13d6d1469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20M=C3=BCller=20=28ChaoticByte=29?= Date: Fri, 21 Jul 2023 22:46:13 +0200 Subject: [PATCH] Added an example to the README --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index abf0d97..6c373c4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # YaHue Lib -Yet Another Philips Hue API Library for Python. This project only implements a subset of the API. +Yet Another Philips Hue API Library for Python. This project only implements home subset of the API. ## Getting Started @@ -29,3 +29,23 @@ See https://developers.meethue.com/develop/get-started-2/ ## Documentation see [DOCUMENTATION.md](DOCUMENTATION.md) + +## Example + +```python +#!/usr/bin/env python3 + +from yahuelib.controller import LightController, GroupController +from yahuelib.utils import rgb_to_hsv + +if __name__ == "__main__": + home = GroupController.from_name("Home", "192.168.0.120", "XXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXX") + if not home.all_on: + home.all_on = True + color = rgb_to_hsv(255, 220, 100) + home.hue = color[0] + home.saturation = color[1] + home.brightness = 1.0 + home.alert() + +```