blue-assistant 4.221.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.
- blue_assistant/__init__.py +1 -1
- blue_assistant/config.env +3 -1
- blue_assistant/env.py +2 -0
- blue_assistant/help/hue.py +7 -3
- blue_assistant/script/repository/hue/__main__.py +12 -5
- blue_assistant/script/repository/hue/{functions.py → api.py} +34 -19
- blue_assistant/script/repository/hue/colors.py +21 -0
- {blue_assistant-4.221.1.dist-info → blue_assistant-4.226.1.dist-info}/METADATA +2 -2
- {blue_assistant-4.221.1.dist-info → blue_assistant-4.226.1.dist-info}/RECORD +12 -11
- {blue_assistant-4.221.1.dist-info → blue_assistant-4.226.1.dist-info}/LICENSE +0 -0
- {blue_assistant-4.221.1.dist-info → blue_assistant-4.226.1.dist-info}/WHEEL +0 -0
- {blue_assistant-4.221.1.dist-info → blue_assistant-4.226.1.dist-info}/top_level.txt +0 -0
blue_assistant/__init__.py
CHANGED
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
@@ -17,3 +17,5 @@ BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE = get_env("BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE")
|
|
17
17
|
HUE_BRIDGE_IP_ADDRESS = get_env("HUE_BRIDGE_IP_ADDRESS")
|
18
18
|
|
19
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)
|
blue_assistant/help/hue.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
from typing import List
|
2
|
+
import cv2
|
2
3
|
|
3
4
|
from blue_options.terminal import show_usage, xtra
|
4
5
|
|
@@ -62,7 +63,7 @@ def help_set(
|
|
62
63
|
f"[--username <{env.HUE_BRIDGE_USERNAME}>]",
|
63
64
|
"[--light_id <light_id>]",
|
64
65
|
"[--hue <65535>]",
|
65
|
-
"[--saturation <
|
66
|
+
f"[--saturation <{env.HUE_MAX_SATURATION}>]",
|
66
67
|
"[--verbose 1]",
|
67
68
|
]
|
68
69
|
|
@@ -88,8 +89,8 @@ def help_test(
|
|
88
89
|
f"[--bridge_ip <{env.HUE_BRIDGE_IP_ADDRESS}>]",
|
89
90
|
f"[--username <{env.HUE_BRIDGE_USERNAME}>]",
|
90
91
|
"[--light_id all | <light_id>]",
|
91
|
-
"[--interval <
|
92
|
-
"[--
|
92
|
+
f"[--interval <{env.HUE_TEST_DEFAULT_INTERVAL:.2f}>]",
|
93
|
+
f"[--colormap <{cv2.COLORMAP_HOT}>]",
|
93
94
|
"[--verbose 1]",
|
94
95
|
]
|
95
96
|
|
@@ -101,6 +102,9 @@ def help_test(
|
|
101
102
|
]
|
102
103
|
+ args,
|
103
104
|
"test hue.",
|
105
|
+
{
|
106
|
+
"colormap: https://docs.opencv.org/4.x/d3/d50/group__imgproc__colormap.html": [],
|
107
|
+
},
|
104
108
|
mono=mono,
|
105
109
|
)
|
106
110
|
|
@@ -1,11 +1,12 @@
|
|
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.
|
9
|
+
from blue_assistant.script.repository.hue.api import (
|
9
10
|
create_user,
|
10
11
|
list_lights,
|
11
12
|
set_light_color,
|
@@ -47,8 +48,8 @@ parser.add_argument(
|
|
47
48
|
parser.add_argument(
|
48
49
|
"--saturation",
|
49
50
|
type=int,
|
50
|
-
default=
|
51
|
-
help="0 to
|
51
|
+
default=env.HUE_MAX_SATURATION,
|
52
|
+
help=f"0 to {env.HUE_MAX_SATURATION}",
|
52
53
|
)
|
53
54
|
parser.add_argument(
|
54
55
|
"--verbose",
|
@@ -59,9 +60,15 @@ parser.add_argument(
|
|
59
60
|
parser.add_argument(
|
60
61
|
"--interval",
|
61
62
|
type=float,
|
62
|
-
default=
|
63
|
+
default=env.HUE_TEST_DEFAULT_INTERVAL,
|
63
64
|
help="in seconds",
|
64
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
|
+
)
|
65
72
|
args = parser.parse_args()
|
66
73
|
|
67
74
|
success = False
|
@@ -92,7 +99,7 @@ elif args.task == "test":
|
|
92
99
|
username=args.username,
|
93
100
|
light_id=args.light_id,
|
94
101
|
interval=args.interval,
|
95
|
-
|
102
|
+
colormap=args.colormap,
|
96
103
|
verbose=args.verbose == 1,
|
97
104
|
)
|
98
105
|
else:
|
@@ -2,11 +2,14 @@ from typing import Tuple, Dict, List
|
|
2
2
|
import requests
|
3
3
|
from time import sleep
|
4
4
|
from tqdm import tqdm
|
5
|
+
import cv2
|
6
|
+
import random
|
5
7
|
|
6
8
|
from blueness import module
|
7
9
|
|
8
10
|
from blue_assistant import NAME
|
9
11
|
from blue_assistant import env
|
12
|
+
from blue_assistant.script.repository.hue.colors import get_hue_values
|
10
13
|
from blue_assistant.logger import logger
|
11
14
|
|
12
15
|
NAME = module.name(__file__, NAME)
|
@@ -118,9 +121,9 @@ def set_light_color(
|
|
118
121
|
|
119
122
|
|
120
123
|
def test(
|
121
|
-
|
124
|
+
colormap: int = cv2.COLORMAP_HOT,
|
122
125
|
light_id: str = "all",
|
123
|
-
interval: float =
|
126
|
+
interval: float = env.HUE_TEST_DEFAULT_INTERVAL,
|
124
127
|
bridge_ip: str = env.HUE_BRIDGE_IP_ADDRESS,
|
125
128
|
username: str = env.HUE_BRIDGE_USERNAME,
|
126
129
|
verbose: bool = False,
|
@@ -129,12 +132,12 @@ def test(
|
|
129
132
|
light_id = "all"
|
130
133
|
|
131
134
|
logger.info(
|
132
|
-
"{}.test({}@{}:{}) @
|
135
|
+
"{}.test({}@{}:{}) @ colormap #{}, interval={} s".format(
|
133
136
|
NAME,
|
134
137
|
username,
|
135
138
|
bridge_ip,
|
136
139
|
light_id,
|
137
|
-
|
140
|
+
colormap,
|
138
141
|
interval,
|
139
142
|
)
|
140
143
|
)
|
@@ -152,20 +155,32 @@ def test(
|
|
152
155
|
else:
|
153
156
|
list_of_lights = [light_id]
|
154
157
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
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.")
|
170
185
|
|
171
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.
|
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)
|
@@ -112,4 +112,4 @@ graph LR
|
|
112
112
|
|
113
113
|
[](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [](https://pypi.org/project/blue-assistant/) [](https://pypistats.org/packages/blue-assistant)
|
114
114
|
|
115
|
-
built by 🌀 [`blue_options-4.234.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.
|
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,8 +1,8 @@
|
|
1
1
|
blue_assistant/README.py,sha256=GEtSZDyrctYxvOWNkRRMbfuJiX6U-ttM8FU3kWFhZkI,1898
|
2
|
-
blue_assistant/__init__.py,sha256=
|
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=
|
5
|
-
blue_assistant/env.py,sha256=
|
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
|
@@ -31,7 +31,7 @@ blue_assistant/.abcli/web/crawl.sh,sha256=M9YoKKJBKZT2OtmFPvRCSSKpiAq0zyacRAVZ6s
|
|
31
31
|
blue_assistant/help/__init__.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
|
32
32
|
blue_assistant/help/__main__.py,sha256=cVejR7OpoWPg0qLbm-PZf5TuJS27x49jzfiyCLyzEns,241
|
33
33
|
blue_assistant/help/functions.py,sha256=O85zVEMtnm32O7KB6W6uQRoFXnE_4dW5pwYZtMakYDg,865
|
34
|
-
blue_assistant/help/hue.py,sha256=
|
34
|
+
blue_assistant/help/hue.py,sha256=ZElPG24ekiS7eIGLVrP2gB_womlGUuwln2cded4Li-c,2319
|
35
35
|
blue_assistant/help/script.py,sha256=tofv49tIBqoH8ed9hDCFHqzWaXmyyPofvqElk2n976w,1121
|
36
36
|
blue_assistant/help/web.py,sha256=yOtA1IdQLBbhx_0Q1xLNwzdHozXdpALMYtwS5X3889o,575
|
37
37
|
blue_assistant/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -52,9 +52,10 @@ blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py,sha256
|
|
52
52
|
blue_assistant/script/repository/generic/__init__.py,sha256=kLffGsQMQAFJTw6IZBE5eBxvshP1x9wwHHR4hsDJblo,75
|
53
53
|
blue_assistant/script/repository/generic/classes.py,sha256=LqxQGRbakikvGwdQB8jjqlpsjt-PGKC9BcHMSO9wN-E,2318
|
54
54
|
blue_assistant/script/repository/hue/__init__.py,sha256=WjL9GIlN-DBnbUMJ8O_FxTp0rcVGlsIS3H9YtXEefTk,76
|
55
|
-
blue_assistant/script/repository/hue/__main__.py,sha256=
|
55
|
+
blue_assistant/script/repository/hue/__main__.py,sha256=jaesrONQsrpVdg8A7NzzT8xpsdXs5gmrywOTE_TWD6c,2321
|
56
|
+
blue_assistant/script/repository/hue/api.py,sha256=C3KzT_MG868gsznUXpwEbUleBjnJObWzZgzvN6wi3uo,4774
|
56
57
|
blue_assistant/script/repository/hue/classes.py,sha256=YhifmcuylnZuI0_BjBPmwrSbsO-BOHDHNJ0pSLIExiE,188
|
57
|
-
blue_assistant/script/repository/hue/
|
58
|
+
blue_assistant/script/repository/hue/colors.py,sha256=rUdtCroNAnzm1zUuVp8eVhvfIie1f7sd208ypsFAJ_w,625
|
58
59
|
blue_assistant/script/repository/orbital_data_explorer/__init__.py,sha256=yy5FtCeHlr9dRfqxw4QYWr7_yRjnQpwVyuAY2vLrh4Q,110
|
59
60
|
blue_assistant/script/repository/orbital_data_explorer/classes.py,sha256=NEJeud6UPXarnAIEvAX_ZKFoRnyK1tiEIORSsrixLxQ,1024
|
60
61
|
blue_assistant/script/repository/orbital_data_explorer/actions/__init__.py,sha256=RcrFUAwnvhuwNh3gC65w9G26vd_cIa7LV1lFvGFcigk,370
|
@@ -62,8 +63,8 @@ blue_assistant/script/repository/orbital_data_explorer/actions/researching_the_q
|
|
62
63
|
blue_assistant/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
63
64
|
blue_assistant/web/__main__.py,sha256=wriAODGqb_WRaXxq5KF5ZJp1pOzuTMlVElDafgZo5f0,1258
|
64
65
|
blue_assistant/web/crawl.py,sha256=Sxkxg9b0IsQxL0ecEAcb13JwPOmwkwUie8XUeDChf1c,2249
|
65
|
-
blue_assistant-4.
|
66
|
-
blue_assistant-4.
|
67
|
-
blue_assistant-4.
|
68
|
-
blue_assistant-4.
|
69
|
-
blue_assistant-4.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|