blue-assistant 4.194.1__py3-none-any.whl → 4.226.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function blue_assistant_hue_create_user() {
4
+ local options=$1
5
+ local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
+
7
+ abcli_eval dryrun=$do_dryrun \
8
+ python3 -m blue_assistant.script.repository.hue \
9
+ create_user \
10
+ "${@:2}"
11
+ }
@@ -0,0 +1,11 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function blue_assistant_hue_list() {
4
+ local options=$1
5
+ local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
+
7
+ abcli_eval dryrun=$do_dryrun \
8
+ python3 -m blue_assistant.script.repository.hue \
9
+ list \
10
+ "${@:2}"
11
+ }
@@ -9,7 +9,7 @@ function blue_assistant_hue() {
9
9
  return
10
10
  fi
11
11
 
12
- python3 -m blue_assistant.hue "$@"
12
+ python3 -m blue_assistant.script.repository.hue "$@"
13
13
  }
14
14
 
15
15
  abcli_source_caller_suffix_path /hue
@@ -27,7 +27,10 @@ function test_blue_assistant_help() {
27
27
  "@assistant web crawl" \
28
28
  \
29
29
  "@hue" \
30
+ "@hue create_user" \
31
+ "@hue list" \
30
32
  "@hue set" \
33
+ "@hue test" \
31
34
  \
32
35
  "blue_assistant"; do
33
36
  abcli_eval ,$options \
blue_assistant/README.py CHANGED
@@ -10,8 +10,8 @@ items = README.Items(
10
10
  {
11
11
  "name": "hue",
12
12
  "url": "./blue_assistant/script/repository/hue",
13
- "marquee": "https://github.com/kamangir/assets/blob/main/blue-assistant/hue.jpg?raw=true",
14
- "description": '"send a color command to the Hue LED lights in my apartment." 🔥',
13
+ "marquee": "https://github.com/kamangir/assets/raw/main/blue-assistant/20250314_143702.jpg?raw=true",
14
+ "description": '"send a color command to the Hue LED lights in my apartment."',
15
15
  },
16
16
  {
17
17
  "name": "blue-amo",
@@ -4,7 +4,7 @@ ICON = "🧠"
4
4
 
5
5
  DESCRIPTION = f"{ICON} An AI Assistant."
6
6
 
7
- VERSION = "4.194.1"
7
+ VERSION = "4.226.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
blue_assistant/config.env CHANGED
@@ -5,4 +5,6 @@ BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL=dall-e-3
5
5
  BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY=standard
6
6
  BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE=1024x1024
7
7
 
8
- HUE_BRIDGE_IP_ADDRESS=192.168.1.95
8
+ HUE_BRIDGE_IP_ADDRESS=192.168.1.95
9
+ HUE_TEST_DEFAULT_INTERVAL=0.01
10
+ HUE_MAX_SATURATION=254
blue_assistant/env.py CHANGED
@@ -15,3 +15,7 @@ BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY = get_env("BLUE_ASSISTANT_IMAGE_DEFAULT_QUA
15
15
  BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE = get_env("BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE")
16
16
 
17
17
  HUE_BRIDGE_IP_ADDRESS = get_env("HUE_BRIDGE_IP_ADDRESS")
18
+
19
+ HUE_BRIDGE_USERNAME = get_env("HUE_BRIDGE_USERNAME")
20
+ HUE_TEST_DEFAULT_INTERVAL = get_env("HUE_TEST_DEFAULT_INTERVAL", 0.01)
21
+ HUE_MAX_SATURATION = get_env("HUE_MAX_SATURATION", 254)
@@ -1,10 +1,57 @@
1
1
  from typing import List
2
+ import cv2
2
3
 
3
4
  from blue_options.terminal import show_usage, xtra
4
5
 
5
6
  from blue_assistant import env
6
7
 
7
8
 
9
+ def help_create_user(
10
+ tokens: List[str],
11
+ mono: bool,
12
+ ) -> str:
13
+ options = xtra("dryrun", mono=mono)
14
+
15
+ args = [
16
+ f"[--bridge_ip <{env.HUE_BRIDGE_IP_ADDRESS}>]",
17
+ ]
18
+
19
+ return show_usage(
20
+ [
21
+ "@hue",
22
+ "create_user",
23
+ f"[{options}]",
24
+ ]
25
+ + args,
26
+ "create a hue user.",
27
+ mono=mono,
28
+ )
29
+
30
+
31
+ def help_list(
32
+ tokens: List[str],
33
+ mono: bool,
34
+ ) -> str:
35
+ options = xtra("dryrun", mono=mono)
36
+
37
+ args = [
38
+ f"[--bridge_ip <{env.HUE_BRIDGE_IP_ADDRESS}>]",
39
+ f"[--username <{env.HUE_BRIDGE_USERNAME}>]",
40
+ "[--verbose 1]",
41
+ ]
42
+
43
+ return show_usage(
44
+ [
45
+ "@hue",
46
+ "list",
47
+ f"[{options}]",
48
+ ]
49
+ + args,
50
+ "list hue lights.",
51
+ mono=mono,
52
+ )
53
+
54
+
8
55
  def help_set(
9
56
  tokens: List[str],
10
57
  mono: bool,
@@ -13,12 +60,13 @@ def help_set(
13
60
 
14
61
  args = [
15
62
  f"[--bridge_ip <{env.HUE_BRIDGE_IP_ADDRESS}>]",
16
- "[--username <username>]",
63
+ f"[--username <{env.HUE_BRIDGE_USERNAME}>]",
17
64
  "[--light_id <light_id>]",
18
65
  "[--hue <65535>]",
19
- "[--saturation <254>]",
66
+ f"[--saturation <{env.HUE_MAX_SATURATION}>]",
20
67
  "[--verbose 1]",
21
68
  ]
69
+
22
70
  return show_usage(
23
71
  [
24
72
  "@hue",
@@ -31,6 +79,39 @@ def help_set(
31
79
  )
32
80
 
33
81
 
82
+ def help_test(
83
+ tokens: List[str],
84
+ mono: bool,
85
+ ) -> str:
86
+ options = xtra("dryrun", mono=mono)
87
+
88
+ args = [
89
+ f"[--bridge_ip <{env.HUE_BRIDGE_IP_ADDRESS}>]",
90
+ f"[--username <{env.HUE_BRIDGE_USERNAME}>]",
91
+ "[--light_id all | <light_id>]",
92
+ f"[--interval <{env.HUE_TEST_DEFAULT_INTERVAL:.2f}>]",
93
+ f"[--colormap <{cv2.COLORMAP_HOT}>]",
94
+ "[--verbose 1]",
95
+ ]
96
+
97
+ return show_usage(
98
+ [
99
+ "@hue",
100
+ "test",
101
+ f"[{options}]",
102
+ ]
103
+ + args,
104
+ "test hue.",
105
+ {
106
+ "colormap: https://docs.opencv.org/4.x/d3/d50/group__imgproc__colormap.html": [],
107
+ },
108
+ mono=mono,
109
+ )
110
+
111
+
34
112
  help_functions = {
113
+ "create_user": help_create_user,
114
+ "list": help_list,
35
115
  "set": help_set,
116
+ "test": help_test,
36
117
  }
blue_assistant/sample.env CHANGED
@@ -0,0 +1 @@
1
+ HUE_BRIDGE_USERNAME=
@@ -1,11 +1,17 @@
1
1
  import argparse
2
+ import cv2
2
3
 
3
4
  from blueness import module
4
5
  from blueness.argparse.generic import sys_exit
5
6
 
6
7
  from blue_assistant import NAME
7
8
  from blue_assistant import env
8
- from blue_assistant.script.repository.hue.functions import set_light_color
9
+ from blue_assistant.script.repository.hue.api import (
10
+ create_user,
11
+ list_lights,
12
+ set_light_color,
13
+ test,
14
+ )
9
15
  from blue_assistant.logger import logger
10
16
 
11
17
  NAME = module.name(__file__, NAME)
@@ -14,7 +20,7 @@ parser = argparse.ArgumentParser(NAME)
14
20
  parser.add_argument(
15
21
  "task",
16
22
  type=str,
17
- help="set",
23
+ help="create_user | list | set | test",
18
24
  )
19
25
  parser.add_argument(
20
26
  "--bridge_ip",
@@ -24,11 +30,14 @@ parser.add_argument(
24
30
  parser.add_argument(
25
31
  "--username",
26
32
  type=str,
33
+ default=env.HUE_BRIDGE_USERNAME,
27
34
  help="aka API key",
28
35
  )
29
36
  parser.add_argument(
30
37
  "--light_id",
31
38
  type=str,
39
+ default="",
40
+ help="all | <light_id>",
32
41
  )
33
42
  parser.add_argument(
34
43
  "--hue",
@@ -39,8 +48,8 @@ parser.add_argument(
39
48
  parser.add_argument(
40
49
  "--saturation",
41
50
  type=int,
42
- default=254,
43
- help="0 to 254",
51
+ default=env.HUE_MAX_SATURATION,
52
+ help=f"0 to {env.HUE_MAX_SATURATION}",
44
53
  )
45
54
  parser.add_argument(
46
55
  "--verbose",
@@ -48,10 +57,34 @@ parser.add_argument(
48
57
  default=0,
49
58
  help="0 | 1",
50
59
  )
60
+ parser.add_argument(
61
+ "--interval",
62
+ type=float,
63
+ default=env.HUE_TEST_DEFAULT_INTERVAL,
64
+ help="in seconds",
65
+ )
66
+ parser.add_argument(
67
+ "--colormap",
68
+ type=int,
69
+ default=cv2.COLORMAP_HOT,
70
+ help="//docs.opencv.org/4.x/d3/d50/group__imgproc__colormap.html",
71
+ )
51
72
  args = parser.parse_args()
52
73
 
53
74
  success = False
54
- if args.task == "set":
75
+ if args.task == "create_user":
76
+ username = create_user(
77
+ bridge_ip=args.bridge_ip,
78
+ )
79
+ if username:
80
+ success = True
81
+ elif args.task == "list":
82
+ success, _ = list_lights(
83
+ bridge_ip=args.bridge_ip,
84
+ username=args.username,
85
+ verbose=args.verbose == 1,
86
+ )
87
+ elif args.task == "set":
55
88
  success = set_light_color(
56
89
  bridge_ip=args.bridge_ip,
57
90
  username=args.username,
@@ -60,6 +93,15 @@ if args.task == "set":
60
93
  saturation=args.saturation,
61
94
  verbose=args.verbose == 1,
62
95
  )
96
+ elif args.task == "test":
97
+ success = test(
98
+ bridge_ip=args.bridge_ip,
99
+ username=args.username,
100
+ light_id=args.light_id,
101
+ interval=args.interval,
102
+ colormap=args.colormap,
103
+ verbose=args.verbose == 1,
104
+ )
63
105
  else:
64
106
  success = None
65
107
 
@@ -0,0 +1,186 @@
1
+ from typing import Tuple, Dict, List
2
+ import requests
3
+ from time import sleep
4
+ from tqdm import tqdm
5
+ import cv2
6
+ import random
7
+
8
+ from blueness import module
9
+
10
+ from blue_assistant import NAME
11
+ from blue_assistant import env
12
+ from blue_assistant.script.repository.hue.colors import get_hue_values
13
+ from blue_assistant.logger import logger
14
+
15
+ NAME = module.name(__file__, NAME)
16
+
17
+
18
+ # hue-2025-03-14-1l8tv6
19
+ def create_user(
20
+ bridge_ip: str = env.HUE_BRIDGE_IP_ADDRESS,
21
+ wait_for_link_press: bool = True,
22
+ ) -> str:
23
+ URL = f"http://{bridge_ip}/api"
24
+
25
+ payload = {
26
+ "devicetype": "my_hue_app#python_script",
27
+ }
28
+
29
+ if wait_for_link_press:
30
+ input("Press the link button on the Hue Bridge ...")
31
+
32
+ try:
33
+ response = requests.post(URL, json=payload)
34
+
35
+ if response.status_code == 200:
36
+ result = response.json()
37
+ if "success" in result[0]:
38
+ username = result[0]["success"]["username"]
39
+ logger.info(f"created {username}")
40
+ return username
41
+
42
+ logger.error(result)
43
+ return ""
44
+
45
+ logger.error(response)
46
+ return ""
47
+ except Exception as e:
48
+ logger.error(e)
49
+ return ""
50
+
51
+
52
+ # hue-2025-03-14-4r9mgh
53
+ def list_lights(
54
+ bridge_ip: str = env.HUE_BRIDGE_IP_ADDRESS,
55
+ username: str = env.HUE_BRIDGE_USERNAME,
56
+ verbose: bool = False,
57
+ ) -> Tuple[bool, Dict]:
58
+ URL = f"http://{bridge_ip}/api/{username}"
59
+
60
+ response = requests.get(URL)
61
+
62
+ if response.status_code != 200:
63
+ logger.error(response)
64
+ return False, {}
65
+
66
+ list_of_lights = response.json()["lights"]
67
+ logger.info(
68
+ "found {} light(s): {}".format(
69
+ len(list_of_lights),
70
+ ", ".join(list_of_lights.keys()),
71
+ )
72
+ )
73
+ if verbose:
74
+ for light_id, light_info in list_of_lights.items():
75
+ logger.info(f"#{light_id}: {light_info}")
76
+
77
+ return True, list_of_lights
78
+
79
+
80
+ # hue-2025-03-13-1xjr1z
81
+ def set_light_color(
82
+ light_id: str,
83
+ hue: int, # 0 to 65535
84
+ saturation: int, # 0 to 254
85
+ bridge_ip: str = env.HUE_BRIDGE_IP_ADDRESS,
86
+ username: str = env.HUE_BRIDGE_USERNAME,
87
+ verbose: bool = False,
88
+ ) -> bool:
89
+ logger.info(
90
+ "{}.set_light_color({}@{}:{}) -> hue=0x{:x}, saturation=0x{:x}".format(
91
+ NAME,
92
+ username,
93
+ bridge_ip,
94
+ light_id,
95
+ hue,
96
+ saturation,
97
+ )
98
+ )
99
+
100
+ # Construct the API endpoint URL
101
+ url = f"http://{bridge_ip}/api/{username}/lights/{light_id}/state"
102
+
103
+ # Prepare the payload with the desired hue and saturation
104
+ payload = {
105
+ "hue": hue,
106
+ "sat": saturation,
107
+ }
108
+
109
+ response = requests.put(url, json=payload)
110
+
111
+ # https://chat.openai.com/c/6deb94d0-826a-48de-b5ef-f7d8da416c82
112
+ # response.raise_for_status()
113
+ if response.status_code // 100 != 2:
114
+ logger.error(response)
115
+ return False
116
+
117
+ if verbose:
118
+ logger.info(response.json())
119
+
120
+ return True
121
+
122
+
123
+ def test(
124
+ colormap: int = cv2.COLORMAP_HOT,
125
+ light_id: str = "all",
126
+ interval: float = env.HUE_TEST_DEFAULT_INTERVAL,
127
+ bridge_ip: str = env.HUE_BRIDGE_IP_ADDRESS,
128
+ username: str = env.HUE_BRIDGE_USERNAME,
129
+ verbose: bool = False,
130
+ ) -> bool:
131
+ if not light_id:
132
+ light_id = "all"
133
+
134
+ logger.info(
135
+ "{}.test({}@{}:{}) @ colormap #{}, interval={} s".format(
136
+ NAME,
137
+ username,
138
+ bridge_ip,
139
+ light_id,
140
+ colormap,
141
+ interval,
142
+ )
143
+ )
144
+
145
+ list_of_lights: List[str]
146
+ if light_id == "all":
147
+ success, dict_of_lights = list_lights(
148
+ bridge_ip=bridge_ip,
149
+ username=username,
150
+ verbose=verbose,
151
+ )
152
+ if not success:
153
+ return success
154
+ list_of_lights = list(dict_of_lights.keys())
155
+ else:
156
+ list_of_lights = [light_id]
157
+
158
+ list_of_hue_values = get_hue_values(
159
+ colormap=colormap,
160
+ length=len(list_of_lights),
161
+ )
162
+ list_of_hue_values = list_of_hue_values + list_of_hue_values
163
+
164
+ hue_offset: int = 0
165
+ try:
166
+ while True:
167
+ logger.info(f"hue_offset={hue_offset}")
168
+
169
+ for light_index in tqdm(range(len(list_of_lights))):
170
+ set_light_color(
171
+ light_id=list_of_lights[light_index],
172
+ hue=list_of_hue_values[hue_offset + light_index],
173
+ saturation=random.randint(1, env.HUE_MAX_SATURATION),
174
+ bridge_ip=bridge_ip,
175
+ username=username,
176
+ verbose=verbose,
177
+ )
178
+
179
+ sleep(interval)
180
+
181
+ hue_offset = (hue_offset + 1) % len(list_of_lights)
182
+
183
+ except KeyboardInterrupt:
184
+ logger.info("Ctrl+C detected.")
185
+
186
+ return True
@@ -0,0 +1,21 @@
1
+ from typing import List
2
+ import numpy as np
3
+ import cv2
4
+
5
+
6
+ # https://chatgpt.com/c/67d4c06c-2168-8005-9d8b-4b6c9848957e
7
+ def get_hue_values(
8
+ colormap: int = cv2.COLORMAP_HOT,
9
+ length: int = 255,
10
+ ) -> List[int]:
11
+ # Create a gradient from 0 to 255
12
+ gradient = np.linspace(0, 255, length).astype("uint8")
13
+ gradient = np.repeat(gradient[np.newaxis, :], 1, axis=0)
14
+
15
+ # Apply the colormap
16
+ color_mapped_image = cv2.applyColorMap(gradient, colormap)
17
+
18
+ # Convert BGR to HSV
19
+ hsv_image = cv2.cvtColor(color_mapped_image, cv2.COLOR_BGR2HSV)
20
+
21
+ return (hsv_image[0, :, 0] * (65535 / 179)).astype(int).tolist()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.194.1
3
+ Version: 4.226.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -62,6 +62,7 @@ graph LR
62
62
  url["🔗 url"]:::folder
63
63
  object["📂 object"]:::folder
64
64
 
65
+
65
66
  script --> assistant_script_list
66
67
 
67
68
  script --> assistant_script_run
@@ -71,12 +72,39 @@ graph LR
71
72
  url --> assistant_web_crawl
72
73
  assistant_web_crawl --> object
73
74
 
75
+
76
+ bridge_ip["🔗 bridge_ip"]:::folder
77
+ hue_username["🔗 hue_username"]:::folder
78
+ list_of_lights["💡 light IDs"]:::folder
79
+
80
+ hue_create_user["@hue<br>create_user"]
81
+ hue_list["@hue<br>list"]
82
+ hue_set["@hue<br>set"]
83
+ hue_test["@hue<br>test"]
84
+
85
+ bridge_ip --> hue_create_user
86
+ hue_create_user --> hue_username
87
+
88
+ bridge_ip --> hue_list
89
+ hue_username --> hue_list
90
+ hue_list --> list_of_lights
91
+
92
+ bridge_ip --> hue_set
93
+ hue_username --> hue_set
94
+ list_of_lights --> hue_set
95
+
96
+ bridge_ip --> hue_test
97
+ hue_username --> hue_test
98
+ list_of_lights --> hue_test
99
+
100
+
101
+
74
102
  classDef folder fill:#999,stroke:#333,stroke-width:2px;
75
103
  ```
76
104
 
77
105
  | | |
78
106
  | --- | --- |
79
- | [`hue`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/hue) [![image](https://github.com/kamangir/assets/blob/main/blue-assistant/hue.jpg?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/hue) "send a color command to the Hue LED lights in my apartment." 🔥 | [`blue-amo`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) [![image](https://github.com/kamangir/assets/raw/main/blue-amo-2025-02-03-nswnx6/stitching_the_frames-2.png?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) A story developed and visualized, by AI. |
107
+ | [`hue`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/hue) [![image](https://github.com/kamangir/assets/raw/main/blue-assistant/20250314_143702.jpg?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/hue) "send a color command to the Hue LED lights in my apartment." | [`blue-amo`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) [![image](https://github.com/kamangir/assets/raw/main/blue-amo-2025-02-03-nswnx6/stitching_the_frames-2.png?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) A story developed and visualized, by AI. |
80
108
  | [`orbital-data-explorer`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/orbital_data_explorer/README.md) [![image](https://github.com/kamangir/assets/blob/main/blue-assistant/orbital-data-explorer.png?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/orbital_data_explorer/README.md) Access to the [Orbital Data Explorer](https://ode.rsl.wustl.edu/), through AI. ⏸️ | |
81
109
 
82
110
  ---
@@ -84,4 +112,4 @@ graph LR
84
112
 
85
113
  [![pylint](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-assistant.svg)](https://pypi.org/project/blue-assistant/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-assistant)](https://pypistats.org/packages/blue-assistant)
86
114
 
87
- built by 🌀 [`blue_options-4.234.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.194.1`](https://github.com/kamangir/blue-assistant).
115
+ built by 🌀 [`blue_options-4.234.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.226.1`](https://github.com/kamangir/blue-assistant).
@@ -1,26 +1,28 @@
1
- blue_assistant/README.py,sha256=CfWGCgzrRjJYsTzb54xEN8wMcd4i07uiXMexPXNIZPM,1892
2
- blue_assistant/__init__.py,sha256=pguwP78L_PIpppm8r4yKoUl5NaCDWsugNTfBiFi4U0Y,311
1
+ blue_assistant/README.py,sha256=GEtSZDyrctYxvOWNkRRMbfuJiX6U-ttM8FU3kWFhZkI,1898
2
+ blue_assistant/__init__.py,sha256=Lt2arNXWEfflfdNSOZGrMdkTpnM0a46MOG9WPns80Ko,311
3
3
  blue_assistant/__main__.py,sha256=URtal70XZc0--3FDTYWcLtnGOqBYjMX9gt-L1k8hDXI,361
4
- blue_assistant/config.env,sha256=hH4mWFF8fQaBscocDiHLsJ3tstoLSq0MvNRqTTCscww,247
5
- blue_assistant/env.py,sha256=ruMvPEthUs1rS7RtoKcSO6WY8u8UqVkItkgZaU8yMGU,579
4
+ blue_assistant/config.env,sha256=npodyuuhkZUHUv9FnEiQQZkKxFbg8nQb1YpOCURqV3Y,301
5
+ blue_assistant/env.py,sha256=FTSdJ8-J4jAyI0-h3MBgOweQBWd3YEFIibBHSXpClrY,760
6
6
  blue_assistant/functions.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
7
7
  blue_assistant/host.py,sha256=SapEe4s9J-7gV3F9JuWEmSfslCeWuJ5f7a-nFObFBrI,208
8
8
  blue_assistant/logger.py,sha256=3MfsXwivdRfVPjAjqdQld3iOg9JB6olbACL8t8gIRgI,105
9
- blue_assistant/sample.env,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ blue_assistant/sample.env,sha256=rFfaN3lwiVm1CW28Pi0ZPwJPuu7_r3QWL54jIgHK_fY,20
10
10
  blue_assistant/urls.py,sha256=59Op4CwgZeo1ZtFouisZxMk07zJNBOqlVAi8tXpsidM,20
11
11
  blue_assistant/.abcli/abcli.sh,sha256=56ZicaXpbZ4zuaGPZJTEgfajokNUWTklzl38vENGzz0,198
12
12
  blue_assistant/.abcli/actions.sh,sha256=vW1hNMuhjghvqib0775kDzDwqGnqPo3mqLTUkPCd8z4,236
13
13
  blue_assistant/.abcli/alias.sh,sha256=UOAS8mrAr-kKx0QQpfPf-nYBKL7lkR8tSF6bWviA09Y,85
14
14
  blue_assistant/.abcli/blue_assistant.sh,sha256=plLTQQerVmfb_SNlOkv0MEaQCF7YdsOHzCq0M3FWT4c,239
15
15
  blue_assistant/.abcli/browse.sh,sha256=qZ_RK_WnsjmF-hfWKiMEOnnv22QtZh9HQ0VFJUbP6aI,294
16
- blue_assistant/.abcli/hue.sh,sha256=Sgph5Wm-Gm9ajfXF19jft-Wr04vB2oPN-KcO1sn3M4Y,344
16
+ blue_assistant/.abcli/hue.sh,sha256=avQT49SlA2ZPDvSdme1vWqDAYtAOHJQI8-3LdqXvBZc,362
17
17
  blue_assistant/.abcli/script.sh,sha256=XIkY4eZyFPKLi_mLoPMbnq76E4K1GG3xxha8VYJC2zI,356
18
18
  blue_assistant/.abcli/web.sh,sha256=1HA3u6umxwZro_CnxD2H9_WABypeSfMU-X2ncFMnU8c,344
19
+ blue_assistant/.abcli/hue/create_user.sh,sha256=Nh8FhnGweB2JZB7SVh-6jp8ud5YHeJSaCe_0MdkgsxI,282
20
+ blue_assistant/.abcli/hue/list.sh,sha256=ynptjPo6jZnwm-7wAVgGx-mZvyPKZ9b5JaJoY0xidCg,268
19
21
  blue_assistant/.abcli/hue/set.sh,sha256=VcADsfbjjbrxIMX9cVVHeK0MH649ZRY29V8YDTgflms,266
20
22
  blue_assistant/.abcli/script/list.sh,sha256=2lcVfqDfZP50NszF8o5YCo3TrJKeDc_qo7MTAF3XTGw,131
21
23
  blue_assistant/.abcli/script/run.sh,sha256=kSXmyM9NUj2X2orSGyu5t_P5frG-gyumbRq-xqF692c,911
22
24
  blue_assistant/.abcli/tests/README.sh,sha256=Qs0YUxVB1OZZ70Nqw2kT1LKXeUnC5-XfQRMfqb8Cbwg,152
23
- blue_assistant/.abcli/tests/help.sh,sha256=VKcritMf2q4KxLDTACOV0CocwqNnUu-oprcnDeSLgvk,842
25
+ blue_assistant/.abcli/tests/help.sh,sha256=V9eOnJFClPumxX69TtZ8fR6HBdueRQOfqwRUQNPj27M,915
24
26
  blue_assistant/.abcli/tests/script_list.sh,sha256=OVOwWO9wR0eeDZTM6uub-eTKbz3eswU3vEUPWXcK-gQ,178
25
27
  blue_assistant/.abcli/tests/script_run.sh,sha256=vfmK8sjkMfSQPwCacQppiL6inMbvQP7nci7qLppFSL0,769
26
28
  blue_assistant/.abcli/tests/version.sh,sha256=oR2rvYR8zi-0VDPIdPJsmsmWwYaamT8dmNTqUh3-8Gw,154
@@ -29,7 +31,7 @@ blue_assistant/.abcli/web/crawl.sh,sha256=M9YoKKJBKZT2OtmFPvRCSSKpiAq0zyacRAVZ6s
29
31
  blue_assistant/help/__init__.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
30
32
  blue_assistant/help/__main__.py,sha256=cVejR7OpoWPg0qLbm-PZf5TuJS27x49jzfiyCLyzEns,241
31
33
  blue_assistant/help/functions.py,sha256=O85zVEMtnm32O7KB6W6uQRoFXnE_4dW5pwYZtMakYDg,865
32
- blue_assistant/help/hue.py,sha256=2c7yvUXQ5D15nVyKM8bGKxqlVoJjrZWdVOwFBFNqCTw,665
34
+ blue_assistant/help/hue.py,sha256=ZElPG24ekiS7eIGLVrP2gB_womlGUuwln2cded4Li-c,2319
33
35
  blue_assistant/help/script.py,sha256=tofv49tIBqoH8ed9hDCFHqzWaXmyyPofvqElk2n976w,1121
34
36
  blue_assistant/help/web.py,sha256=yOtA1IdQLBbhx_0Q1xLNwzdHozXdpALMYtwS5X3889o,575
35
37
  blue_assistant/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -50,9 +52,10 @@ blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py,sha256
50
52
  blue_assistant/script/repository/generic/__init__.py,sha256=kLffGsQMQAFJTw6IZBE5eBxvshP1x9wwHHR4hsDJblo,75
51
53
  blue_assistant/script/repository/generic/classes.py,sha256=LqxQGRbakikvGwdQB8jjqlpsjt-PGKC9BcHMSO9wN-E,2318
52
54
  blue_assistant/script/repository/hue/__init__.py,sha256=WjL9GIlN-DBnbUMJ8O_FxTp0rcVGlsIS3H9YtXEefTk,76
53
- blue_assistant/script/repository/hue/__main__.py,sha256=_OMa721WQ6Q3zCabrPfD9OEwktyzxy6Wi2sE22PqwqI,1280
55
+ blue_assistant/script/repository/hue/__main__.py,sha256=jaesrONQsrpVdg8A7NzzT8xpsdXs5gmrywOTE_TWD6c,2321
56
+ blue_assistant/script/repository/hue/api.py,sha256=C3KzT_MG868gsznUXpwEbUleBjnJObWzZgzvN6wi3uo,4774
54
57
  blue_assistant/script/repository/hue/classes.py,sha256=YhifmcuylnZuI0_BjBPmwrSbsO-BOHDHNJ0pSLIExiE,188
55
- blue_assistant/script/repository/hue/functions.py,sha256=lpOBqQ2udUy53u8x-M32Dvfvo7kNmpNbFhJ7BAeDPNU,1219
58
+ blue_assistant/script/repository/hue/colors.py,sha256=rUdtCroNAnzm1zUuVp8eVhvfIie1f7sd208ypsFAJ_w,625
56
59
  blue_assistant/script/repository/orbital_data_explorer/__init__.py,sha256=yy5FtCeHlr9dRfqxw4QYWr7_yRjnQpwVyuAY2vLrh4Q,110
57
60
  blue_assistant/script/repository/orbital_data_explorer/classes.py,sha256=NEJeud6UPXarnAIEvAX_ZKFoRnyK1tiEIORSsrixLxQ,1024
58
61
  blue_assistant/script/repository/orbital_data_explorer/actions/__init__.py,sha256=RcrFUAwnvhuwNh3gC65w9G26vd_cIa7LV1lFvGFcigk,370
@@ -60,8 +63,8 @@ blue_assistant/script/repository/orbital_data_explorer/actions/researching_the_q
60
63
  blue_assistant/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
64
  blue_assistant/web/__main__.py,sha256=wriAODGqb_WRaXxq5KF5ZJp1pOzuTMlVElDafgZo5f0,1258
62
65
  blue_assistant/web/crawl.py,sha256=Sxkxg9b0IsQxL0ecEAcb13JwPOmwkwUie8XUeDChf1c,2249
63
- blue_assistant-4.194.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
64
- blue_assistant-4.194.1.dist-info/METADATA,sha256=gSMvACrGOz8uFIx0nDjAbp2WBnKmh4qGtHeEUFw9-2A,4213
65
- blue_assistant-4.194.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
66
- blue_assistant-4.194.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
67
- blue_assistant-4.194.1.dist-info/RECORD,,
66
+ blue_assistant-4.226.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
67
+ blue_assistant-4.226.1.dist-info/METADATA,sha256=2i7iVIFWTHWYZA2LvFcjYFpWLi7XSkUvNMS7l51qx4w,4826
68
+ blue_assistant-4.226.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
69
+ blue_assistant-4.226.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
70
+ blue_assistant-4.226.1.dist-info/RECORD,,
@@ -1,53 +0,0 @@
1
- import requests
2
-
3
- from blueness import module
4
-
5
- from blue_assistant import NAME
6
- from blue_assistant import env
7
- from blue_assistant.logger import logger
8
-
9
- NAME = module.name(__file__, NAME)
10
-
11
-
12
- def set_light_color(
13
- username: str,
14
- light_id: str,
15
- hue: int, # 0 to 65535
16
- saturation: int, # 0 to 254
17
- bridge_ip: str = env.HUE_BRIDGE_IP_ADDRESS,
18
- verbose: bool = False,
19
- ) -> bool:
20
- logger.info(
21
- "{}.set_light_color({}@{}:{}) -> hue=0x{:x}, saturation=0x{:x}".format(
22
- NAME,
23
- username,
24
- bridge_ip,
25
- light_id,
26
- hue,
27
- saturation,
28
- )
29
- )
30
-
31
- # hue-2025-03-13-1xjr1z
32
-
33
- # Construct the API endpoint URL
34
- url = f"http://{bridge_ip}/api/{username}/lights/{light_id}/state"
35
-
36
- # Prepare the payload with the desired hue and saturation
37
- payload = {
38
- "hue": hue,
39
- "sat": saturation,
40
- }
41
-
42
- response = requests.put(url, json=payload)
43
-
44
- # https://chat.openai.com/c/6deb94d0-826a-48de-b5ef-f7d8da416c82
45
- # response.raise_for_status()
46
- if response.status_code // 100 != 2:
47
- logger.error(response)
48
- return False
49
-
50
- if verbose:
51
- logger.info(response.json())
52
-
53
- return True