[Custom component] Chroma integration - control your RGB

GitHub Release Installations
HACS Default License

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.

Buy Me A Coffee

2 Likes

Some users are reporting random problems with connection to Chroma SDK, which is related to the Razer Synapse software rather than integration itself. What is happening - Rest API stops responding to any requests, including local ones.

This might happen if the same PC is used with different user accounts - Synapse is known to have problems when users are logging in/out or just switching.

In this case, here is a what-to-do:

  • Exit Synapse (or all the Razer apps);
  • Open Windows Services (just type services in the Start menu);
  • Find and restart Razer Central Service - this will also restart Razer Synapse Service (on this step Rest API will start responding again);
  • Start Synapse software (this is needed to maintain the connection between integration and ChromaSDK).

Or just reboot the PC, if you don’t care.

P.S. You can always check whether the problem is because of the ChromaSDK or integration. Just open http://localhost:54235/razer/chromasdk (from the PC with Chroma you want to control) - if it does not open - the API is dead. If it does open - please report a bug (open a new issue on GitHub - link in the first post)

:bug: Since Chroma SDK is not perfect software, some bugs on its side are happening.

:open_book: Now Chroma integration GitHub (link in the first post) has a section dedicated to their troubleshooting.

P.S. The integration is already confirmed to work with at least 12 different models of devices, as well as with 1 3rd party service :bulb: If you have Razer devices which are not in the list yet, let me know :mag:

:christmas_tree: A season of lights is back

Hello, guys.

It has been a while since the last release of the Chroma integration was published. Unfortunately, I had no time for it, but now with a bit of spare time, I would like to make sure it works well for those 30 people using it. And, maybe, for some new users.

Have happy holidays :christmas_tree:


0.3.0💡Auto-reconnect & better error handling

:octopus: GitHub release ←

:rocket: Features

  • Handle SDK disconnects
  • Reconnect automatically when SDK becomes available

:bug: Bug fixes

  • Fix integration reload block on errors

:package: Dependencies

  • Bumped aiochroma to 0.2.0

:coffee: Support Chroma

Monetary support:

Non-monetary support:

This integration no longer seems to work for me, Thought it might have been my antivirus/firewall but i have added in all the exceptions previously and checked that it’s not blocking anything. Fails within seconds.

Not sure if it’s because my HA server is hosted at another location and site to site VPN’d into my home network but this wasn’t an issue before.