Hey there!
Today I would like to share with you my latest work - Chroma
custom integration for HA (already available via HACS). For now, it has two main parts – the possibility to control your devices as usual HA light
entities and separate control over keyboards with per-key RGB via a service
(check the video linked below).
More features are planned as well for future releases.
External links
Chroma
integration GitHub: GitHub - Vaskivskyi/ha-chroma: Control your Chroma-enabled devices from Home Assistant
aiochroma
library GitHub: GitHub - Vaskivskyi/aiochroma: API wrapper for communication with Razer Chroma devices
Presentation of effects on YouTube: Control your Razer Chroma RGB devices from Home Assistant [custom integration] - YouTube
How it works and what is needed
The integration connects to the ChromaSDK API on your PC (or another device with Razer peripherals connected and Synapse software installed) via the network (yes, any network device can be reached, just make sure the connection is allowed by the target firewall).
Firewall settings on the target device
In order to connect, your target device has to allow connection on port 54236
(the default port, which cannot be changed). Please, make sure this port is opened, otherwise, the integration will not configure.
Keep in mind! If you are trying to communicate outside your local network and have opened the ports, ChromaSDK has direct open access for any connection. There is no password or any other protection. In case, there are any vulnerabilities, you are the only responsible person.
Lights
The integration has control over 6 types of Chroma-enabled devices: chromalink
, headset
, keyboard
, keypad
, mouse
and mousepad
. You can select devices you wish to control during the integration setup.
Currently, I can guarantee the correct work with the 4 types but headset
and keypad
- I do not have any device of this type.
Each of the light
entities supports RGB colour and brightness settings in a usual HA way.
Sending message service (per-key RGB keyboards)
Using the send_message
service you can send any sequence of the symbols to be shown on the keyboard. The library behind the integration currently supports all the keys for BlackWidow V3 Pro in the EN_US layout (more layouts are coming soon, but you can just swap some letters in your text for now).
Except for the message
itself, the service accepts the following parameters: color
, background
(colour of the key in the off state), brightness
, spacing
(time delay between symbols), tail
(refer to the video for an example), repeats
(of the full message) and sleep
(delay between repeats).
Simple string
Any simple text message can be sent directly as a string:
A Lazy Fox came here and left this note for the Rabbit #3.
In this case, all the small letters, 3
and spaces will be shown as a single key. For displaying A
, L
, F
, R
and #
a double-key will be used: {Shift}
(the left one) and a corresponding small letter or 3
.
Other buttons
Other keys can be activated by adding their names to the message
string. Known key names include:
-
{Esc}
,{Tab}
,{CapsLock}
,{Shift}
,{Ctrl}
,{Win}
,{Alt}
,{Space}
,{RAlt}
,{Fn}
,{Menu}
,{RCtrl}
,{RShift}
,{Enter}
,{Backspace}
-
{PrtSc}
,{ScrLk}
,{Pause}
,{Ins}
,{Home}
,{PgUp}
,{Del}
,{End}
,{PgDn}
-
{Up}
,{Left}
,{Down}
,{Right}
-
{Multi}
(multimedia keys),{Volume}
, -
{NumLock}
,{Num/}
,{Num*}
,{Num-}
,{Num+}
,{NumEnter}
,{Num.}
-
{Num0}
,{Num1}
,{Num2}
,{Num3}
,{Num4}
,{Num5}
,{Num6}
,{Num7}
,{Num8}
,{Num9}
-
{F1}
-{F12}
Strings to test
If you have watched the video with the examples mentioned in the beginning, you might want to check how to repeat them. Here are the corresponding strings
-
Hello, Home Assistant! - just written directly
-
Right arrow -
sdfghj6yn{Space}
(<-- here space is written with name, so you won’t lose it when copying the string) -
Left arrow -
lkjhgf6tv{Space}
-
Status (load animation) -
{Num8}{Num9}{Num6}{Num3}{Num2}{Num1}{Num4}{Num7}
-
Snake -
`123edfgt67yhnm,.l;/{Fn}{Menu}{RCtrl}{RShift}{Enter}\{Backspace}{Ins}{Home}{PgUp}{NumLock}{Num/}{Num*}{Num-}{Num+}{Num6}{Num5}{Num2}{Num0}{Right}{Down}{Left}{RCtrl}{RShift}/.loiujhy6789{F7}{F6}{F5}65rfcxzaqw21`{Esc}
This integration is a free-time project. If you like it, you can support me by buying a coffee.