mikecoder96 / happylighting-py Goto Github PK
View Code? Open in Web Editor NEWHappyLight BLE communication using Bleak (QHM Led Controller)
License: GNU Affero General Public License v3.0
HappyLight BLE communication using Bleak (QHM Led Controller)
License: GNU Affero General Public License v3.0
there seems to be like windows version but could not found it. Also, what's the c++ / hex equivalent of controlling the led. I tried converting bytearray to hex equivalent but failed. I am trying to control the lighting via Bluetoothctl and gatt write? any help will really be appreciated.
I figured i'd just start a new thread for this that way we're not piggy backing off the other user's thread
What i've hacked together for my own purposes uses a 24x7 pixel bitmap as a color source for the lights, it then lerps the color based off the current minute - it's a pretty specific usecase, but using images as a way to encode color sequences might be a pretty intuitive way to do it.
I'll add what I've done to implement the logic mostly to clarify the idea - but my approach to it could be considered an act of violence, I do apologize for what I've done to your code lol
I then call it from powershell and do the image handling there because i'm much more comfortable there.
add-type -AssemblyName System.Drawing
write-output "Loading File"
$bmp = (new-object System.Drawing.Bitmap -ArgumentList @("PathToImage"))
$now = (get-date)
$color1 = $bmp.GetPixel($now.hour%$bmp.width,[int]($now.DayOfWeek));
$color2 = $bmp.GetPixel(($now.hour+1)%$bmp.width,[int]($now.DayOfWeek));
#close
write-output ("Closing File - picking for "+([int]($now.DayOfWeek))+" : "+($now.hour%$bmp.width)+" : "+$now.minute)
$bmp.Dispose()
#quicklerp
[int]$red = (($color2.r)*($now.minute / 60.0)) +(($color1.r)*(1-($now.minute / 60.0)))
[int]$green = (($color2.g)*($now.minute / 60.0)) +(($color1.g)*(1-($now.minute / 60.0)))
[int]$blue = (($color2.b)*($now.minute / 60.0)) +(($color1.b)*(1-($now.minute / 60.0)))
write-output ("R $red G $green B $blue")
for($i = 0; $i -lt 10; $i++){
if ((iex ("python $PSScriptRoot\pyhl.py FF:FF:FF:FF:FF:FF on "+$red+" "+$green+" "+$blue+" 2>&1") | % -begin {$result=$false }{ $result = $result -or $_.ToString().contains("was not found!");} -End {-not $result})){
break;
}
write-output "Looping $i of 10"
sleep 5
}
write-output ("Done")
$global:ErrorActionPreference = "Continue"
Then I call that from a scheduled task that runs ever half hour throughout the day
it says it is in releases, but I don't see anything lol
Hello im very interest about the app but idk how to install it can u do a tutorial please ?
Can you make a version for Linux?
im struggling with this program, my device shows up in like 1/15 scans. How do I get the UUID? Tried to get it from android but thats broken too. Any help would be apreceated. Chis#8122
Can i use ur app? or do u offer service for brands?
hey is it possible to use the functions without the gui?
if not, could you maybe find a way to do it?
(I want to link my led strips to google assistant but I don't know how to use the functions without the gui and i don't know much about bluethooth ble devices)
use >>
scan()
output>
names
QHM_d51
Connect(name) #QHM_d51
Change_color(RGB value)# 255,255,255
Change_mode(MODE)
LEDS_on()
LEDS_off()
and is it possible to turn on and off the led strips with the app?
Hi,
I would like to create a new preset (pulsating green/purple) as a training but i do not find where the presets are defined. I am not used to python and this kind of coding.
Thank you
For the moment, there is no intention to implement a player inside the application
after using this program for a while, i wanted to share some bugs that i want to report
from ctypes import windll
and all its references (line 359 and 360) from pyhl.py
Traceback (most recent call last):
File "/home/golden/Desktop/HappyLighting-py-master/LEDStripController/pyhl.py", line 18, in <module>
from ctypes import windll
ImportError: cannot import name 'windll' from 'ctypes' (/usr/lib/python3.11/ctypes/__init__.py)
Traceback (most recent call last):
File "/home/golden/Desktop/HappyLighting-py-master/LEDStripController/pyhl.py", line 242, in changeSpeed
if isModeUsed:
^^^^^^^^^^
NameError: name 'isModeUsed' is not defined
I just discovered your wonderful repository and I saw that it's a little hard to use
since it doesn't have requirements file and it's built with visual studio.
So I created new program with similar functionality
refactored the code
With very lightweight app that can work on Windows
/ Linux
/ Mac
There's already release for windows
https://github.com/thewh1teagle/happy
I would love to be able to create my own sequences of pulsing and jumping with custom colors.
I could even help with the code, but would need a walk through of how the actual commands to the device work.
The connect button does nothing when pressed, I tried restarting, uninstalling the official app, and updating bleak,
Is there anything that I'm missing?
How can i use this?
Hello, i'm having trouble when scanning, got this error :
libpng warning: iCCP: known incorrect sRGB profile
Traceback (most recent call last):
File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\qasync\__init__.py", line 780, in _error_handler
task.result()
File "C:\Users\Tatane\Downloads\HappyLighting-py-master\LEDStripController\pyhl.py", line 284, in handle_scan
devices = await BLEClass.BleakScanner.discover(timeout=8.0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\bleak\__init__.py", line 320, in discover
async with cls(**kwargs) as scanner:
File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\bleak\__init__.py", line 158, in __aenter__
await self._backend.start()
File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\bleak\backends\winrt\scanner.py", line 222, in start
assert_mta()
File "C:\Users\Tatane\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\bleak\backends\winrt\util.py", line 78, in assert_mta
raise BleakError(
bleak.exc.BleakError: The current thread apartment type is not MTA: STA. Beware of packages like pywin32 that may change the apartment type implicitly.
Need to be tested with multiple device. At the moment i have only one controller so I cannot try it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.